diff --git a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs index 21071d2..4527add 100644 --- a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs +++ b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs @@ -4,9 +4,9 @@ using CliFx; using CliFx.Attributes; using CliFx.Exceptions; using CliFx.Utilities; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exporting; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exporting; namespace DiscordChatExporter.Cli.Commands.Base { @@ -36,11 +36,15 @@ namespace DiscordChatExporter.Cli.Commands.Base [CommandOption("dateformat", Description = "Format used when writing dates.")] public string DateFormat { get; init; } = "dd-MMM-yy hh:mm tt"; - protected ChannelExporter GetChannelExporter() => new(GetDiscordClient()); + private ChannelExporter? _channelExporter; + protected ChannelExporter Exporter => _channelExporter ??= new ChannelExporter(Discord); protected async ValueTask ExportAsync(IConsole console, Guild guild, Channel channel) { - console.Output.Write($"Exporting channel '{channel.Category} / {channel.Name}'... "); + await console.Output.WriteAsync( + $"Exporting channel '{channel.Category} / {channel.Name}'... " + ); + var progress = console.CreateProgressTicker(); var request = new ExportRequest( @@ -56,21 +60,21 @@ namespace DiscordChatExporter.Cli.Commands.Base DateFormat ); - await GetChannelExporter().ExportChannelAsync(request, progress); + await Exporter.ExportChannelAsync(request, progress); - console.Output.WriteLine(); - console.Output.WriteLine("Done."); + await console.Output.WriteLineAsync(); + await console.Output.WriteLineAsync("Done."); } protected async ValueTask ExportAsync(IConsole console, Channel channel) { - var guild = await GetDiscordClient().GetGuildAsync(channel.GuildId); + var guild = await Discord.GetGuildAsync(channel.GuildId); await ExportAsync(console, guild, channel); } protected async ValueTask ExportAsync(IConsole console, Snowflake channelId) { - var channel = await GetDiscordClient().GetChannelAsync(channelId); + var channel = await Discord.GetChannelAsync(channelId); await ExportAsync(console, channel); } diff --git a/DiscordChatExporter.Cli/Commands/Base/ExportMultipleCommandBase.cs b/DiscordChatExporter.Cli/Commands/Base/ExportMultipleCommandBase.cs index a1f4cda..cbd46d0 100644 --- a/DiscordChatExporter.Cli/Commands/Base/ExportMultipleCommandBase.cs +++ b/DiscordChatExporter.Cli/Commands/Base/ExportMultipleCommandBase.cs @@ -6,10 +6,10 @@ using System.Threading.Tasks; using CliFx; using CliFx.Attributes; using CliFx.Utilities; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exceptions; -using DiscordChatExporter.Domain.Exporting; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exceptions; +using DiscordChatExporter.Core.Exporting; +using DiscordChatExporter.Core.Utils.Extensions; using Gress; using Tyrrrz.Extensions; @@ -25,7 +25,10 @@ namespace DiscordChatExporter.Cli.Commands.Base // This uses a different route from ExportCommandBase.ExportAsync() because it runs // in parallel and needs another way to report progress to console. - console.Output.Write($"Exporting {channels.Count} channels... "); + await console.Output.WriteAsync( + $"Exporting {channels.Count} channels... " + ); + var progress = console.CreateProgressTicker(); var operations = progress.Wrap().CreateOperations(channels.Count); @@ -39,7 +42,7 @@ namespace DiscordChatExporter.Cli.Commands.Base try { - var guild = await GetDiscordClient().GetGuildAsync(channel.GuildId); + var guild = await Discord.GetGuildAsync(channel.GuildId); var request = new ExportRequest( guild, @@ -54,7 +57,7 @@ namespace DiscordChatExporter.Cli.Commands.Base DateFormat ); - await GetChannelExporter().ExportChannelAsync(request, operation); + await Exporter.ExportChannelAsync(request, operation); Interlocked.Increment(ref successfulExportCount); } @@ -68,12 +71,12 @@ namespace DiscordChatExporter.Cli.Commands.Base } }, ParallelLimit.ClampMin(1)); - console.Output.WriteLine(); + await console.Output.WriteLineAsync(); foreach (var (channel, error) in errors) - console.Error.WriteLine($"Channel '{channel}': {error}"); + await console.Error.WriteLineAsync($"Channel '{channel}': {error}"); - console.Output.WriteLine($"Successfully exported {successfulExportCount} channel(s)."); + await console.Output.WriteLineAsync($"Successfully exported {successfulExportCount} channel(s)."); } } } \ No newline at end of file diff --git a/DiscordChatExporter.Cli/Commands/Base/TokenCommandBase.cs b/DiscordChatExporter.Cli/Commands/Base/TokenCommandBase.cs index 1b49a31..615136d 100644 --- a/DiscordChatExporter.Cli/Commands/Base/TokenCommandBase.cs +++ b/DiscordChatExporter.Cli/Commands/Base/TokenCommandBase.cs @@ -1,26 +1,27 @@ using System.Threading.Tasks; using CliFx; using CliFx.Attributes; -using DiscordChatExporter.Domain.Discord; +using DiscordChatExporter.Core.Discord; namespace DiscordChatExporter.Cli.Commands.Base { public abstract class TokenCommandBase : ICommand { - [CommandOption("token", 't', IsRequired = true, EnvironmentVariableName = "DISCORD_TOKEN", Description = "Authorization token.")] + [CommandOption("token", 't', IsRequired = true, EnvironmentVariableName = "DISCORD_TOKEN", Description = "Authentication token.")] public string TokenValue { get; init; } = ""; - [CommandOption("bot", 'b', EnvironmentVariableName = "DISCORD_TOKEN_BOT", Description = "Authorize as a bot.")] + [CommandOption("bot", 'b', EnvironmentVariableName = "DISCORD_TOKEN_BOT", Description = "Authenticate as a bot.")] public bool IsBotToken { get; init; } - protected AuthToken GetAuthToken() => new( + private AuthToken GetAuthToken() => new( IsBotToken ? AuthTokenType.Bot : AuthTokenType.User, TokenValue ); - protected DiscordClient GetDiscordClient() => new(GetAuthToken()); + private DiscordClient? _discordClient; + protected DiscordClient Discord => _discordClient ??= new DiscordClient(GetAuthToken()); public abstract ValueTask ExecuteAsync(IConsole console); } diff --git a/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs b/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs index fe67b71..9628f1a 100644 --- a/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs +++ b/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using CliFx; using CliFx.Attributes; using DiscordChatExporter.Cli.Commands.Base; -using DiscordChatExporter.Domain.Discord.Models; +using DiscordChatExporter.Core.Discord.Data; namespace DiscordChatExporter.Cli.Commands { @@ -15,16 +15,18 @@ namespace DiscordChatExporter.Cli.Commands public override async ValueTask ExecuteAsync(IConsole console) { + await base.ExecuteAsync(console); + var channels = new List(); // Aggregate channels from all guilds - await foreach (var guild in GetDiscordClient().GetUserGuildsAsync()) + await foreach (var guild in Discord.GetUserGuildsAsync()) { // Skip DMs if instructed to if (!IncludeDirectMessages && guild.Id == Guild.DirectMessages.Id) continue; - await foreach (var channel in GetDiscordClient().GetGuildChannelsAsync(guild.Id)) + await foreach (var channel in Discord.GetGuildChannelsAsync(guild.Id)) { channels.Add(channel); } diff --git a/DiscordChatExporter.Cli/Commands/ExportChannelCommand.cs b/DiscordChatExporter.Cli/Commands/ExportChannelCommand.cs index 97ca90a..c14ea87 100644 --- a/DiscordChatExporter.Cli/Commands/ExportChannelCommand.cs +++ b/DiscordChatExporter.Cli/Commands/ExportChannelCommand.cs @@ -2,7 +2,7 @@ using CliFx; using CliFx.Attributes; using DiscordChatExporter.Cli.Commands.Base; -using DiscordChatExporter.Domain.Discord; +using DiscordChatExporter.Core.Discord; namespace DiscordChatExporter.Cli.Commands { diff --git a/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs b/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs index 92f4b81..c03c8e3 100644 --- a/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs +++ b/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs @@ -2,8 +2,8 @@ using CliFx; using CliFx.Attributes; using DiscordChatExporter.Cli.Commands.Base; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Utils.Extensions; namespace DiscordChatExporter.Cli.Commands { @@ -12,7 +12,9 @@ namespace DiscordChatExporter.Cli.Commands { public override async ValueTask ExecuteAsync(IConsole console) { - var channels = await GetDiscordClient().GetGuildChannelsAsync(Guild.DirectMessages.Id); + await base.ExecuteAsync(console); + + var channels = await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id); await ExportMultipleAsync(console, channels); } } diff --git a/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs b/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs index 0250a61..dbac7bc 100644 --- a/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs +++ b/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs @@ -2,8 +2,8 @@ using CliFx; using CliFx.Attributes; using DiscordChatExporter.Cli.Commands.Base; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Utils.Extensions; namespace DiscordChatExporter.Cli.Commands { @@ -15,7 +15,9 @@ namespace DiscordChatExporter.Cli.Commands public override async ValueTask ExecuteAsync(IConsole console) { - var channels = await GetDiscordClient().GetGuildChannelsAsync(GuildId); + await base.ExecuteAsync(console); + + var channels = await Discord.GetGuildChannelsAsync(GuildId); await ExportMultipleAsync(console, channels); } } diff --git a/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs b/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs index 0bd8f4a..cdd7244 100644 --- a/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs +++ b/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs @@ -3,9 +3,9 @@ using System.Threading.Tasks; using CliFx; using CliFx.Attributes; using DiscordChatExporter.Cli.Commands.Base; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Utils.Extensions; namespace DiscordChatExporter.Cli.Commands { @@ -17,10 +17,14 @@ namespace DiscordChatExporter.Cli.Commands public override async ValueTask ExecuteAsync(IConsole console) { - var channels = await GetDiscordClient().GetGuildChannelsAsync(GuildId); + var channels = await Discord.GetGuildChannelsAsync(GuildId); - foreach (var channel in channels.OrderBy(c => c.Category, PositionBasedComparer.Instance).ThenBy(c => c.Name)) - console.Output.WriteLine($"{channel.Id} | {channel.Category} / {channel.Name}"); + foreach (var channel in channels.OrderBy(c => c.Category.Position).ThenBy(c => c.Name)) + { + await console.Output.WriteLineAsync( + $"{channel.Id} | {channel.Category} / {channel.Name}" + ); + } } } } \ No newline at end of file diff --git a/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs b/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs index 118d2be..0840227 100644 --- a/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs +++ b/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs @@ -3,9 +3,8 @@ using System.Threading.Tasks; using CliFx; using CliFx.Attributes; using DiscordChatExporter.Cli.Commands.Base; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Utils.Extensions; namespace DiscordChatExporter.Cli.Commands { @@ -14,10 +13,14 @@ namespace DiscordChatExporter.Cli.Commands { public override async ValueTask ExecuteAsync(IConsole console) { - var channels = await GetDiscordClient().GetGuildChannelsAsync(Guild.DirectMessages.Id); + var channels = await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id); foreach (var channel in channels.OrderBy(c => c.Name)) - console.Output.WriteLine($"{channel.Id} | {channel.Category} / {channel.Name}"); + { + await console.Output.WriteLineAsync( + $"{channel.Id} | {channel.Category} / {channel.Name}" + ); + } } } } \ No newline at end of file diff --git a/DiscordChatExporter.Cli/Commands/GetGuildsCommand.cs b/DiscordChatExporter.Cli/Commands/GetGuildsCommand.cs index 8334f66..6a3abae 100644 --- a/DiscordChatExporter.Cli/Commands/GetGuildsCommand.cs +++ b/DiscordChatExporter.Cli/Commands/GetGuildsCommand.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using CliFx; using CliFx.Attributes; using DiscordChatExporter.Cli.Commands.Base; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Utils.Extensions; namespace DiscordChatExporter.Cli.Commands { @@ -12,10 +12,14 @@ namespace DiscordChatExporter.Cli.Commands { public override async ValueTask ExecuteAsync(IConsole console) { - var guilds = await GetDiscordClient().GetUserGuildsAsync(); + var guilds = await Discord.GetUserGuildsAsync(); foreach (var guild in guilds.OrderBy(g => g.Name)) - console.Output.WriteLine($"{guild.Id} | {guild.Name}"); + { + await console.Output.WriteLineAsync( + $"{guild.Id} | {guild.Name}" + ); + } } } } \ No newline at end of file diff --git a/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj b/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj index 48d858a..23be1bb 100644 --- a/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj +++ b/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj @@ -12,7 +12,7 @@ - + \ No newline at end of file diff --git a/DiscordChatExporter.Cli/Internal/Pollyfills.cs b/DiscordChatExporter.Cli/Utils/Pollyfills.cs similarity index 100% rename from DiscordChatExporter.Cli/Internal/Pollyfills.cs rename to DiscordChatExporter.Cli/Utils/Pollyfills.cs diff --git a/DiscordChatExporter.Domain/Discord/AuthToken.cs b/DiscordChatExporter.Core/Discord/AuthToken.cs similarity index 80% rename from DiscordChatExporter.Domain/Discord/AuthToken.cs rename to DiscordChatExporter.Core/Discord/AuthToken.cs index 22b62dc..6f7702a 100644 --- a/DiscordChatExporter.Domain/Discord/AuthToken.cs +++ b/DiscordChatExporter.Core/Discord/AuthToken.cs @@ -1,6 +1,6 @@ using System.Net.Http.Headers; -namespace DiscordChatExporter.Domain.Discord +namespace DiscordChatExporter.Core.Discord { public enum AuthTokenType { User, Bot } @@ -16,7 +16,7 @@ namespace DiscordChatExporter.Domain.Discord Value = value; } - public AuthenticationHeaderValue GetAuthorizationHeader() => Type switch + public AuthenticationHeaderValue GetAuthenticationHeader() => Type switch { AuthTokenType.Bot => new AuthenticationHeaderValue("Bot", Value), _ => new AuthenticationHeaderValue(Value) diff --git a/DiscordChatExporter.Domain/Discord/Models/Attachment.cs b/DiscordChatExporter.Core/Discord/Data/Attachment.cs similarity index 87% rename from DiscordChatExporter.Domain/Discord/Models/Attachment.cs rename to DiscordChatExporter.Core/Discord/Data/Attachment.cs index 1d59c64..799b344 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Attachment.cs +++ b/DiscordChatExporter.Core/Discord/Data/Attachment.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using System.IO; using System.Text.Json; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#attachment-object public partial class Attachment : IHasId @@ -32,7 +32,13 @@ namespace DiscordChatExporter.Domain.Discord.Models public FileSize FileSize { get; } - public Attachment(Snowflake id, string url, string fileName, int? width, int? height, FileSize fileSize) + public Attachment( + Snowflake id, + string url, + string fileName, + int? width, + int? height, + FileSize fileSize) { Id = id; Url = url; diff --git a/DiscordChatExporter.Domain/Discord/Models/Channel.cs b/DiscordChatExporter.Core/Discord/Data/Channel.cs similarity index 66% rename from DiscordChatExporter.Domain/Discord/Models/Channel.cs rename to DiscordChatExporter.Core/Discord/Data/Channel.cs index 78908fc..a252f4a 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Channel.cs +++ b/DiscordChatExporter.Core/Discord/Data/Channel.cs @@ -1,12 +1,11 @@ -using System; -using System.Linq; +using System.Linq; using System.Text.Json; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Reading; using Tyrrrz.Extensions; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#channel-object-channel-types // Order of enum fields needs to match the order in the docs. @@ -22,7 +21,7 @@ namespace DiscordChatExporter.Domain.Discord.Models } // https://discord.com/developers/docs/resources/channel#channel-object - public partial class Channel : IHasIdAndPosition + public partial class Channel : IHasId, IHasPosition { public Snowflake Id { get; } @@ -45,12 +44,19 @@ namespace DiscordChatExporter.Domain.Discord.Models public string? Topic { get; } - public Channel(Snowflake id, ChannelType type, Snowflake guildId, ChannelCategory? category, string name, int? position, string? topic) + public Channel( + Snowflake id, + ChannelType type, + Snowflake guildId, + ChannelCategory? category, + string name, + int? position, + string? topic) { Id = id; Type = type; GuildId = guildId; - Category = category ?? GetDefaultCategory(type); + Category = category ?? GetFallbackCategory(type); Name = name; Position = position; Topic = topic; @@ -62,19 +68,19 @@ namespace DiscordChatExporter.Domain.Discord.Models public partial class Channel { - private static ChannelCategory GetDefaultCategory(ChannelType channelType) => new( - Snowflake.Zero, - channelType switch - { - ChannelType.GuildTextChat => "Text", - ChannelType.DirectTextChat => "Private", - ChannelType.DirectGroupTextChat => "Group", - ChannelType.GuildNews => "News", - ChannelType.GuildStore => "Store", - _ => "Default" - }, - 0 - ); + private static ChannelCategory GetFallbackCategory(ChannelType channelType) => new( + Snowflake.Zero, + channelType switch + { + ChannelType.GuildTextChat => "Text", + ChannelType.DirectTextChat => "Private", + ChannelType.DirectGroupTextChat => "Group", + ChannelType.GuildNews => "News", + ChannelType.GuildStore => "Store", + _ => "Default" + }, + 0 + ); public static Channel Parse(JsonElement json, ChannelCategory? category = null, int? position = null) { @@ -82,7 +88,7 @@ namespace DiscordChatExporter.Domain.Discord.Models var guildId = json.GetPropertyOrNull("guild_id")?.GetString().Pipe(Snowflake.Parse); var topic = json.GetPropertyOrNull("topic")?.GetString(); - var type = (ChannelType)json.GetProperty("type").GetInt32(); + var type = (ChannelType) json.GetProperty("type").GetInt32(); var name = json.GetPropertyOrNull("name")?.GetString() ?? @@ -95,7 +101,7 @@ namespace DiscordChatExporter.Domain.Discord.Models id, type, guildId ?? Guild.DirectMessages.Id, - category ?? GetDefaultCategory(type), + category ?? GetFallbackCategory(type), name, position, topic diff --git a/DiscordChatExporter.Domain/Discord/Models/ChannelCategory.cs b/DiscordChatExporter.Core/Discord/Data/ChannelCategory.cs similarity index 80% rename from DiscordChatExporter.Domain/Discord/Models/ChannelCategory.cs rename to DiscordChatExporter.Core/Discord/Data/ChannelCategory.cs index 8a8dfaf..dc8180c 100644 --- a/DiscordChatExporter.Domain/Discord/Models/ChannelCategory.cs +++ b/DiscordChatExporter.Core/Discord/Data/ChannelCategory.cs @@ -1,14 +1,13 @@ -using System; -using System.Linq; +using System.Linq; using System.Text.Json; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Reading; using Tyrrrz.Extensions; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { - public partial class ChannelCategory : IHasIdAndPosition + public partial class ChannelCategory : IHasId, IHasPosition { public Snowflake Id { get; } @@ -45,6 +44,6 @@ namespace DiscordChatExporter.Domain.Discord.Models ); } - public static ChannelCategory Empty { get; } = new(Snowflake.Zero, "Missing", 0); + public static ChannelCategory Empty { get; } = new(Snowflake.Zero, "", 0); } } diff --git a/DiscordChatExporter.Domain/Discord/Models/Common/FileSize.cs b/DiscordChatExporter.Core/Discord/Data/Common/FileSize.cs similarity index 96% rename from DiscordChatExporter.Domain/Discord/Models/Common/FileSize.cs rename to DiscordChatExporter.Core/Discord/Data/Common/FileSize.cs index aa411db..c775424 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Common/FileSize.cs +++ b/DiscordChatExporter.Core/Discord/Data/Common/FileSize.cs @@ -1,6 +1,6 @@ using System; -namespace DiscordChatExporter.Domain.Discord.Models.Common +namespace DiscordChatExporter.Core.Discord.Data.Common { // Loosely based on https://github.com/omar/ByteSize (MIT license) public readonly partial struct FileSize diff --git a/DiscordChatExporter.Domain/Discord/Models/Common/IHasId.cs b/DiscordChatExporter.Core/Discord/Data/Common/IHasId.cs similarity index 53% rename from DiscordChatExporter.Domain/Discord/Models/Common/IHasId.cs rename to DiscordChatExporter.Core/Discord/Data/Common/IHasId.cs index 43ffff3..d32dab2 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Common/IHasId.cs +++ b/DiscordChatExporter.Core/Discord/Data/Common/IHasId.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Discord.Models.Common +namespace DiscordChatExporter.Core.Discord.Data.Common { public interface IHasId { diff --git a/DiscordChatExporter.Core/Discord/Data/Common/IHasPosition.cs b/DiscordChatExporter.Core/Discord/Data/Common/IHasPosition.cs new file mode 100644 index 0000000..7c6c77a --- /dev/null +++ b/DiscordChatExporter.Core/Discord/Data/Common/IHasPosition.cs @@ -0,0 +1,7 @@ +namespace DiscordChatExporter.Core.Discord.Data.Common +{ + public interface IHasPosition + { + int? Position { get; } + } +} \ No newline at end of file diff --git a/DiscordChatExporter.Domain/Discord/Models/Common/IdBasedEqualityComparer.cs b/DiscordChatExporter.Core/Discord/Data/Common/IdBasedEqualityComparer.cs similarity index 76% rename from DiscordChatExporter.Domain/Discord/Models/Common/IdBasedEqualityComparer.cs rename to DiscordChatExporter.Core/Discord/Data/Common/IdBasedEqualityComparer.cs index 69fa47d..d897baa 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Common/IdBasedEqualityComparer.cs +++ b/DiscordChatExporter.Core/Discord/Data/Common/IdBasedEqualityComparer.cs @@ -1,7 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; -namespace DiscordChatExporter.Domain.Discord.Models.Common +namespace DiscordChatExporter.Core.Discord.Data.Common { public partial class IdBasedEqualityComparer : IEqualityComparer { diff --git a/DiscordChatExporter.Domain/Discord/Models/Embed.cs b/DiscordChatExporter.Core/Discord/Data/Embed.cs similarity index 94% rename from DiscordChatExporter.Domain/Discord/Models/Embed.cs rename to DiscordChatExporter.Core/Discord/Data/Embed.cs index 1e6ec3a..1f6c4a6 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Embed.cs +++ b/DiscordChatExporter.Core/Discord/Data/Embed.cs @@ -3,11 +3,10 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text.Json; -using DiscordChatExporter.Domain.Internal.Extensions; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#embed-object public partial class Embed diff --git a/DiscordChatExporter.Domain/Discord/Models/EmbedAuthor.cs b/DiscordChatExporter.Core/Discord/Data/EmbedAuthor.cs similarity index 94% rename from DiscordChatExporter.Domain/Discord/Models/EmbedAuthor.cs rename to DiscordChatExporter.Core/Discord/Data/EmbedAuthor.cs index e18b031..7b73d00 100644 --- a/DiscordChatExporter.Domain/Discord/Models/EmbedAuthor.cs +++ b/DiscordChatExporter.Core/Discord/Data/EmbedAuthor.cs @@ -1,7 +1,7 @@ using System.Text.Json; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure public partial class EmbedAuthor diff --git a/DiscordChatExporter.Domain/Discord/Models/EmbedField.cs b/DiscordChatExporter.Core/Discord/Data/EmbedField.cs similarity index 94% rename from DiscordChatExporter.Domain/Discord/Models/EmbedField.cs rename to DiscordChatExporter.Core/Discord/Data/EmbedField.cs index bb07a1f..6fd2776 100644 --- a/DiscordChatExporter.Domain/Discord/Models/EmbedField.cs +++ b/DiscordChatExporter.Core/Discord/Data/EmbedField.cs @@ -1,7 +1,7 @@ using System.Text.Json; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure public partial class EmbedField diff --git a/DiscordChatExporter.Domain/Discord/Models/EmbedFooter.cs b/DiscordChatExporter.Core/Discord/Data/EmbedFooter.cs similarity index 93% rename from DiscordChatExporter.Domain/Discord/Models/EmbedFooter.cs rename to DiscordChatExporter.Core/Discord/Data/EmbedFooter.cs index 5a729d0..a8f0864 100644 --- a/DiscordChatExporter.Domain/Discord/Models/EmbedFooter.cs +++ b/DiscordChatExporter.Core/Discord/Data/EmbedFooter.cs @@ -1,7 +1,7 @@ using System.Text.Json; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure public partial class EmbedFooter diff --git a/DiscordChatExporter.Domain/Discord/Models/EmbedImage.cs b/DiscordChatExporter.Core/Discord/Data/EmbedImage.cs similarity index 94% rename from DiscordChatExporter.Domain/Discord/Models/EmbedImage.cs rename to DiscordChatExporter.Core/Discord/Data/EmbedImage.cs index b89e154..e8b31f6 100644 --- a/DiscordChatExporter.Domain/Discord/Models/EmbedImage.cs +++ b/DiscordChatExporter.Core/Discord/Data/EmbedImage.cs @@ -1,7 +1,7 @@ using System.Text.Json; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure public partial class EmbedImage diff --git a/DiscordChatExporter.Domain/Discord/Models/Emoji.cs b/DiscordChatExporter.Core/Discord/Data/Emoji.cs similarity index 97% rename from DiscordChatExporter.Domain/Discord/Models/Emoji.cs rename to DiscordChatExporter.Core/Discord/Data/Emoji.cs index 976ba36..a1ec9b4 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Emoji.cs +++ b/DiscordChatExporter.Core/Discord/Data/Emoji.cs @@ -5,7 +5,7 @@ using System.Text.Json; using JsonExtensions.Reading; using Tyrrrz.Extensions; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/emoji#emoji-object public partial class Emoji diff --git a/DiscordChatExporter.Domain/Discord/Models/Guild.cs b/DiscordChatExporter.Core/Discord/Data/Guild.cs similarity index 80% rename from DiscordChatExporter.Domain/Discord/Models/Guild.cs rename to DiscordChatExporter.Core/Discord/Data/Guild.cs index 702fa78..5a048f4 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Guild.cs +++ b/DiscordChatExporter.Core/Discord/Data/Guild.cs @@ -1,8 +1,8 @@ using System.Text.Json; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Utils.Extensions; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/guild#guild-object public partial class Guild : IHasId @@ -25,7 +25,11 @@ namespace DiscordChatExporter.Domain.Discord.Models public partial class Guild { - public static Guild DirectMessages { get; } = new(Snowflake.Zero, "Direct Messages", GetDefaultIconUrl()); + public static Guild DirectMessages { get; } = new( + Snowflake.Zero, + "Direct Messages", + GetDefaultIconUrl() + ); private static string GetDefaultIconUrl() => "https://cdn.discordapp.com/embed/avatars/0.png"; diff --git a/DiscordChatExporter.Domain/Discord/Models/Member.cs b/DiscordChatExporter.Core/Discord/Data/Member.cs similarity index 80% rename from DiscordChatExporter.Domain/Discord/Models/Member.cs rename to DiscordChatExporter.Core/Discord/Data/Member.cs index 636ac75..310a3fc 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Member.cs +++ b/DiscordChatExporter.Core/Discord/Data/Member.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/guild#guild-member-object public partial class Member : IHasId @@ -31,7 +31,11 @@ namespace DiscordChatExporter.Domain.Discord.Models public partial class Member { - public static Member CreateForUser(User user) => new(user, null, Array.Empty()); + public static Member CreateForUser(User user) => new( + user, + null, + Array.Empty() + ); public static Member Parse(JsonElement json) { diff --git a/DiscordChatExporter.Domain/Discord/Models/Message.cs b/DiscordChatExporter.Core/Discord/Data/Message.cs similarity index 97% rename from DiscordChatExporter.Domain/Discord/Models/Message.cs rename to DiscordChatExporter.Core/Discord/Data/Message.cs index 2fef3d1..6b774b2 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Message.cs +++ b/DiscordChatExporter.Core/Discord/Data/Message.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#message-object-message-types public enum MessageType diff --git a/DiscordChatExporter.Domain/Discord/Models/MessageReference.cs b/DiscordChatExporter.Core/Discord/Data/MessageReference.cs similarity index 92% rename from DiscordChatExporter.Domain/Discord/Models/MessageReference.cs rename to DiscordChatExporter.Core/Discord/Data/MessageReference.cs index 05f7f53..d504992 100644 --- a/DiscordChatExporter.Domain/Discord/Models/MessageReference.cs +++ b/DiscordChatExporter.Core/Discord/Data/MessageReference.cs @@ -1,8 +1,8 @@ using System.Text.Json; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure public partial class MessageReference diff --git a/DiscordChatExporter.Domain/Discord/Models/Reaction.cs b/DiscordChatExporter.Core/Discord/Data/Reaction.cs similarity index 87% rename from DiscordChatExporter.Domain/Discord/Models/Reaction.cs rename to DiscordChatExporter.Core/Discord/Data/Reaction.cs index c07ae5f..3696c12 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Reaction.cs +++ b/DiscordChatExporter.Core/Discord/Data/Reaction.cs @@ -1,7 +1,7 @@ using System.Text.Json; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Utils.Extensions; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/channel#reaction-object public partial class Reaction diff --git a/DiscordChatExporter.Domain/Discord/Models/Role.cs b/DiscordChatExporter.Core/Discord/Data/Role.cs similarity index 80% rename from DiscordChatExporter.Domain/Discord/Models/Role.cs rename to DiscordChatExporter.Core/Discord/Data/Role.cs index 1967d62..d7578f1 100644 --- a/DiscordChatExporter.Domain/Discord/Models/Role.cs +++ b/DiscordChatExporter.Core/Discord/Data/Role.cs @@ -1,11 +1,10 @@ using System.Drawing; using System.Text.Json; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Internal.Extensions; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/topics/permissions#role-object public partial class Role : IHasId @@ -18,7 +17,11 @@ namespace DiscordChatExporter.Domain.Discord.Models public Color? Color { get; } - public Role(Snowflake id, string name, int position, Color? color) + public Role( + Snowflake id, + string name, + int position, + Color? color) { Id = id; Name = name; diff --git a/DiscordChatExporter.Domain/Discord/Models/User.cs b/DiscordChatExporter.Core/Discord/Data/User.cs similarity index 86% rename from DiscordChatExporter.Domain/Discord/Models/User.cs rename to DiscordChatExporter.Core/Discord/Data/User.cs index 8c859e6..637f4b9 100644 --- a/DiscordChatExporter.Domain/Discord/Models/User.cs +++ b/DiscordChatExporter.Core/Discord/Data/User.cs @@ -1,10 +1,10 @@ using System; using System.Text.Json; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord.Models +namespace DiscordChatExporter.Core.Discord.Data { // https://discord.com/developers/docs/resources/user#user-object public partial class User : IHasId @@ -21,7 +21,12 @@ namespace DiscordChatExporter.Domain.Discord.Models public string AvatarUrl { get; } - public User(Snowflake id, bool isBot, int discriminator, string name, string avatarUrl) + public User( + Snowflake id, + bool isBot, + int discriminator, + string name, + string avatarUrl) { Id = id; IsBot = isBot; diff --git a/DiscordChatExporter.Domain/Discord/DiscordClient.cs b/DiscordChatExporter.Core/Discord/DiscordClient.cs similarity index 96% rename from DiscordChatExporter.Domain/Discord/DiscordClient.cs rename to DiscordChatExporter.Core/Discord/DiscordClient.cs index ba19e2a..27bf0e1 100644 --- a/DiscordChatExporter.Domain/Discord/DiscordClient.cs +++ b/DiscordChatExporter.Core/Discord/DiscordClient.cs @@ -5,14 +5,14 @@ using System.Net; using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exceptions; -using DiscordChatExporter.Domain.Internal; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exceptions; +using DiscordChatExporter.Core.Utils; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Http; using JsonExtensions.Reading; -namespace DiscordChatExporter.Domain.Discord +namespace DiscordChatExporter.Core.Discord { public class DiscordClient { @@ -34,7 +34,7 @@ namespace DiscordChatExporter.Domain.Discord await Http.ResponsePolicy.ExecuteAsync(async () => { using var request = new HttpRequestMessage(HttpMethod.Get, new Uri(_baseUri, url)); - request.Headers.Authorization = _token.GetAuthorizationHeader(); + request.Headers.Authorization = _token.GetAuthenticationHeader(); return await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); }); @@ -120,7 +120,8 @@ namespace DiscordChatExporter.Domain.Discord var orderedResponse = response .EnumerateArray() .OrderBy(j => j.GetProperty("position").GetInt32()) - .ThenBy(j => ulong.Parse(j.GetProperty("id").GetString())); + .ThenBy(j => ulong.Parse(j.GetProperty("id").GetString())) + .ToArray(); var categories = orderedResponse .Where(j => j.GetProperty("type").GetInt32() == (int)ChannelType.GuildCategory) @@ -135,7 +136,7 @@ namespace DiscordChatExporter.Domain.Discord var category = !string.IsNullOrWhiteSpace(parentId) ? categories.GetValueOrDefault(parentId) : null; - + var channel = Channel.Parse(channelJson, category, position); // Skip non-text channels diff --git a/DiscordChatExporter.Domain/Discord/Snowflake.cs b/DiscordChatExporter.Core/Discord/Snowflake.cs similarity index 95% rename from DiscordChatExporter.Domain/Discord/Snowflake.cs rename to DiscordChatExporter.Core/Discord/Snowflake.cs index 896d74c..34037b2 100644 --- a/DiscordChatExporter.Domain/Discord/Snowflake.cs +++ b/DiscordChatExporter.Core/Discord/Snowflake.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Text.RegularExpressions; -namespace DiscordChatExporter.Domain.Discord +namespace DiscordChatExporter.Core.Discord { public readonly partial struct Snowflake { @@ -32,7 +32,7 @@ namespace DiscordChatExporter.Domain.Discord return null; // As number - if (Regex.IsMatch(str, @"^\d{15,}$") && + if (Regex.IsMatch(str, @"^\d+$") && ulong.TryParse(str, NumberStyles.Number, formatProvider, out var value)) { return new Snowflake(value); diff --git a/DiscordChatExporter.Domain/DiscordChatExporter.Domain.csproj b/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj similarity index 100% rename from DiscordChatExporter.Domain/DiscordChatExporter.Domain.csproj rename to DiscordChatExporter.Core/DiscordChatExporter.Core.csproj diff --git a/DiscordChatExporter.Domain/Exceptions/DiscordChatExporterException.cs b/DiscordChatExporter.Core/Exceptions/DiscordChatExporterException.cs similarity index 96% rename from DiscordChatExporter.Domain/Exceptions/DiscordChatExporterException.cs rename to DiscordChatExporter.Core/Exceptions/DiscordChatExporterException.cs index 84ed863..de0434f 100644 --- a/DiscordChatExporter.Domain/Exceptions/DiscordChatExporterException.cs +++ b/DiscordChatExporter.Core/Exceptions/DiscordChatExporterException.cs @@ -1,7 +1,7 @@ using System; using System.Net.Http; -namespace DiscordChatExporter.Domain.Exceptions +namespace DiscordChatExporter.Core.Exceptions { public partial class DiscordChatExporterException : Exception { diff --git a/DiscordChatExporter.Domain/Exporting/ChannelExporter.cs b/DiscordChatExporter.Core/Exporting/ChannelExporter.cs similarity index 88% rename from DiscordChatExporter.Domain/Exporting/ChannelExporter.cs rename to DiscordChatExporter.Core/Exporting/ChannelExporter.cs index 64509b0..7e5944f 100644 --- a/DiscordChatExporter.Domain/Exporting/ChannelExporter.cs +++ b/DiscordChatExporter.Core/Exporting/ChannelExporter.cs @@ -2,13 +2,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Discord.Models.Common; -using DiscordChatExporter.Domain.Exceptions; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Discord.Data.Common; +using DiscordChatExporter.Core.Exceptions; +using DiscordChatExporter.Core.Utils.Extensions; -namespace DiscordChatExporter.Domain.Exporting +namespace DiscordChatExporter.Core.Exporting { public class ChannelExporter { diff --git a/DiscordChatExporter.Domain/Exporting/ExportContext.cs b/DiscordChatExporter.Core/Exporting/ExportContext.cs similarity index 95% rename from DiscordChatExporter.Domain/Exporting/ExportContext.cs rename to DiscordChatExporter.Core/Exporting/ExportContext.cs index ec29be0..929832c 100644 --- a/DiscordChatExporter.Domain/Exporting/ExportContext.cs +++ b/DiscordChatExporter.Core/Exporting/ExportContext.cs @@ -5,12 +5,12 @@ using System.IO; using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Internal.Extensions; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Utils.Extensions; using Tyrrrz.Extensions; -namespace DiscordChatExporter.Domain.Exporting +namespace DiscordChatExporter.Core.Exporting { internal class ExportContext { diff --git a/DiscordChatExporter.Domain/Exporting/ExportFormat.cs b/DiscordChatExporter.Core/Exporting/ExportFormat.cs similarity index 95% rename from DiscordChatExporter.Domain/Exporting/ExportFormat.cs rename to DiscordChatExporter.Core/Exporting/ExportFormat.cs index 692ed99..5119347 100644 --- a/DiscordChatExporter.Domain/Exporting/ExportFormat.cs +++ b/DiscordChatExporter.Core/Exporting/ExportFormat.cs @@ -1,6 +1,6 @@ using System; -namespace DiscordChatExporter.Domain.Exporting +namespace DiscordChatExporter.Core.Exporting { public enum ExportFormat { diff --git a/DiscordChatExporter.Domain/Exporting/ExportRequest.cs b/DiscordChatExporter.Core/Exporting/ExportRequest.cs similarity index 96% rename from DiscordChatExporter.Domain/Exporting/ExportRequest.cs rename to DiscordChatExporter.Core/Exporting/ExportRequest.cs index 1fa1b2c..c216fdb 100644 --- a/DiscordChatExporter.Domain/Exporting/ExportRequest.cs +++ b/DiscordChatExporter.Core/Exporting/ExportRequest.cs @@ -2,11 +2,11 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Internal; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Utils; -namespace DiscordChatExporter.Domain.Exporting +namespace DiscordChatExporter.Core.Exporting { public partial class ExportRequest { diff --git a/DiscordChatExporter.Domain/Exporting/MediaDownloader.cs b/DiscordChatExporter.Core/Exporting/MediaDownloader.cs similarity index 95% rename from DiscordChatExporter.Domain/Exporting/MediaDownloader.cs rename to DiscordChatExporter.Core/Exporting/MediaDownloader.cs index 6ef10c3..515b7cc 100644 --- a/DiscordChatExporter.Domain/Exporting/MediaDownloader.cs +++ b/DiscordChatExporter.Core/Exporting/MediaDownloader.cs @@ -7,11 +7,10 @@ using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Internal; -using DiscordChatExporter.Domain.Internal.Extensions; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Utils; +using DiscordChatExporter.Core.Utils.Extensions; -namespace DiscordChatExporter.Domain.Exporting +namespace DiscordChatExporter.Core.Exporting { internal partial class MediaDownloader { diff --git a/DiscordChatExporter.Domain/Exporting/MessageExporter.cs b/DiscordChatExporter.Core/Exporting/MessageExporter.cs similarity index 96% rename from DiscordChatExporter.Domain/Exporting/MessageExporter.cs rename to DiscordChatExporter.Core/Exporting/MessageExporter.cs index e632ec2..451006d 100644 --- a/DiscordChatExporter.Domain/Exporting/MessageExporter.cs +++ b/DiscordChatExporter.Core/Exporting/MessageExporter.cs @@ -1,10 +1,10 @@ using System; using System.IO; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exporting.Writers; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exporting.Writers; -namespace DiscordChatExporter.Domain.Exporting +namespace DiscordChatExporter.Core.Exporting { internal partial class MessageExporter : IAsyncDisposable { diff --git a/DiscordChatExporter.Domain/Exporting/Writers/CsvMessageWriter.cs b/DiscordChatExporter.Core/Exporting/Writers/CsvMessageWriter.cs similarity index 93% rename from DiscordChatExporter.Domain/Exporting/Writers/CsvMessageWriter.cs rename to DiscordChatExporter.Core/Exporting/Writers/CsvMessageWriter.cs index 5d8d9cf..7729ef6 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/CsvMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/CsvMessageWriter.cs @@ -2,11 +2,11 @@ using System.IO; using System.Text; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exporting.Writers.MarkdownVisitors; -using DiscordChatExporter.Domain.Internal.Extensions; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors; +using DiscordChatExporter.Core.Utils.Extensions; -namespace DiscordChatExporter.Domain.Exporting.Writers +namespace DiscordChatExporter.Core.Exporting.Writers { internal partial class CsvMessageWriter : MessageWriter { diff --git a/DiscordChatExporter.Domain/Exporting/Writers/Html/Core.css b/DiscordChatExporter.Core/Exporting/Writers/Html/Core.css similarity index 100% rename from DiscordChatExporter.Domain/Exporting/Writers/Html/Core.css rename to DiscordChatExporter.Core/Exporting/Writers/Html/Core.css diff --git a/DiscordChatExporter.Domain/Exporting/Writers/Html/Dark.css b/DiscordChatExporter.Core/Exporting/Writers/Html/Dark.css similarity index 100% rename from DiscordChatExporter.Domain/Exporting/Writers/Html/Dark.css rename to DiscordChatExporter.Core/Exporting/Writers/Html/Dark.css diff --git a/DiscordChatExporter.Domain/Exporting/Writers/Html/LayoutTemplateContext.cs b/DiscordChatExporter.Core/Exporting/Writers/Html/LayoutTemplateContext.cs similarity index 87% rename from DiscordChatExporter.Domain/Exporting/Writers/Html/LayoutTemplateContext.cs rename to DiscordChatExporter.Core/Exporting/Writers/Html/LayoutTemplateContext.cs index 8614889..4f5f59d 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/Html/LayoutTemplateContext.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/Html/LayoutTemplateContext.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Exporting.Writers.Html +namespace DiscordChatExporter.Core.Exporting.Writers.Html { internal class LayoutTemplateContext { diff --git a/DiscordChatExporter.Domain/Exporting/Writers/Html/Light.css b/DiscordChatExporter.Core/Exporting/Writers/Html/Light.css similarity index 100% rename from DiscordChatExporter.Domain/Exporting/Writers/Html/Light.css rename to DiscordChatExporter.Core/Exporting/Writers/Html/Light.css diff --git a/DiscordChatExporter.Domain/Exporting/Writers/Html/MessageGroup.cs b/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroup.cs similarity index 93% rename from DiscordChatExporter.Domain/Exporting/Writers/Html/MessageGroup.cs rename to DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroup.cs index f96e923..ad1fd8b 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/Html/MessageGroup.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroup.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using DiscordChatExporter.Domain.Discord.Models; +using DiscordChatExporter.Core.Discord.Data; -namespace DiscordChatExporter.Domain.Exporting.Writers.Html +namespace DiscordChatExporter.Core.Exporting.Writers.Html { // Used for grouping contiguous messages in HTML export internal partial class MessageGroup diff --git a/DiscordChatExporter.Domain/Exporting/Writers/Html/MessageGroupTemplate.cshtml b/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplate.cshtml similarity index 98% rename from DiscordChatExporter.Domain/Exporting/Writers/Html/MessageGroupTemplate.cshtml rename to DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplate.cshtml index 5516c15..18ca542 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/Html/MessageGroupTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplate.cshtml @@ -1,8 +1,8 @@ @using System @using System.Linq @using System.Threading.Tasks -@namespace DiscordChatExporter.Domain.Exporting.Writers.Html -@inherits MiniRazor.TemplateBase +@namespace DiscordChatExporter.Core.Exporting.Writers.Html +@inherits MiniRazor.TemplateBase @{ string FormatDate(DateTimeOffset date) => Model.ExportContext.FormatDate(date); diff --git a/DiscordChatExporter.Domain/Exporting/Writers/Html/MessageGroupTemplateContext.cs b/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplateContext.cs similarity index 80% rename from DiscordChatExporter.Domain/Exporting/Writers/Html/MessageGroupTemplateContext.cs rename to DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplateContext.cs index fa1d335..8049d8f 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/Html/MessageGroupTemplateContext.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplateContext.cs @@ -1,6 +1,6 @@ -using DiscordChatExporter.Domain.Exporting.Writers.MarkdownVisitors; +using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors; -namespace DiscordChatExporter.Domain.Exporting.Writers.Html +namespace DiscordChatExporter.Core.Exporting.Writers.Html { internal class MessageGroupTemplateContext { diff --git a/DiscordChatExporter.Core/Exporting/Writers/Html/PostambleTemplate.cshtml b/DiscordChatExporter.Core/Exporting/Writers/Html/PostambleTemplate.cshtml new file mode 100644 index 0000000..1a276a1 --- /dev/null +++ b/DiscordChatExporter.Core/Exporting/Writers/Html/PostambleTemplate.cshtml @@ -0,0 +1,12 @@ +@namespace DiscordChatExporter.Core.Exporting.Writers.Html +@inherits MiniRazor.TemplateBase + + + +
+
Exported @Model.MessageCount.ToString("N0") message(s)
+
+ + + + \ No newline at end of file diff --git a/DiscordChatExporter.Domain/Exporting/Writers/Html/PreambleTemplate.cshtml b/DiscordChatExporter.Core/Exporting/Writers/Html/PreambleTemplate.cshtml similarity index 92% rename from DiscordChatExporter.Domain/Exporting/Writers/Html/PreambleTemplate.cshtml rename to DiscordChatExporter.Core/Exporting/Writers/Html/PreambleTemplate.cshtml index 1e9026c..c4f9055 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/Html/PreambleTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/Writers/Html/PreambleTemplate.cshtml @@ -1,15 +1,15 @@ @using System @using System.Threading.Tasks @using Tyrrrz.Extensions -@namespace DiscordChatExporter.Domain.Exporting.Writers.Html -@inherits MiniRazor.TemplateBase +@namespace DiscordChatExporter.Core.Exporting.Writers.Html +@inherits MiniRazor.TemplateBase @{ string FormatDate(DateTimeOffset date) => Model.ExportContext.FormatDate(date); ValueTask ResolveUrlAsync(string url) => Model.ExportContext.ResolveMediaUrlAsync(url); - string GetStyleSheet(string name) => Model.GetType().Assembly.GetManifestResourceString($"DiscordChatExporter.Domain.Exporting.Writers.Html.{name}.css"); + string GetStyleSheet(string name) => Model.GetType().Assembly.GetManifestResourceString($"DiscordChatExporter.Core.Exporting.Writers.Html.{name}.css"); } diff --git a/DiscordChatExporter.Domain/Exporting/Writers/HtmlMessageWriter.cs b/DiscordChatExporter.Core/Exporting/Writers/HtmlMessageWriter.cs similarity index 94% rename from DiscordChatExporter.Domain/Exporting/Writers/HtmlMessageWriter.cs rename to DiscordChatExporter.Core/Exporting/Writers/HtmlMessageWriter.cs index 8c78f9b..cde055f 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/HtmlMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/HtmlMessageWriter.cs @@ -2,10 +2,10 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exporting.Writers.Html; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exporting.Writers.Html; -namespace DiscordChatExporter.Domain.Exporting.Writers +namespace DiscordChatExporter.Core.Exporting.Writers { internal class HtmlMessageWriter : MessageWriter { diff --git a/DiscordChatExporter.Domain/Exporting/Writers/JsonMessageWriter.cs b/DiscordChatExporter.Core/Exporting/Writers/JsonMessageWriter.cs similarity index 97% rename from DiscordChatExporter.Domain/Exporting/Writers/JsonMessageWriter.cs rename to DiscordChatExporter.Core/Exporting/Writers/JsonMessageWriter.cs index 5e478fb..e5647c1 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/JsonMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/JsonMessageWriter.cs @@ -1,13 +1,13 @@ using System.IO; +using System.Text.Encodings.Web; using System.Text.Json; using System.Threading.Tasks; -using System.Text.Encodings.Web; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exporting.Writers.MarkdownVisitors; -using DiscordChatExporter.Domain.Internal.Extensions; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors; +using DiscordChatExporter.Core.Utils.Extensions; using JsonExtensions.Writing; -namespace DiscordChatExporter.Domain.Exporting.Writers +namespace DiscordChatExporter.Core.Exporting.Writers { internal class JsonMessageWriter : MessageWriter { diff --git a/DiscordChatExporter.Domain/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs b/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs similarity index 95% rename from DiscordChatExporter.Domain/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs rename to DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs index 4c69299..58dab8f 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs @@ -3,13 +3,13 @@ using System.Linq; using System.Net; using System.Text; using System.Text.RegularExpressions; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Markdown; -using DiscordChatExporter.Domain.Markdown.Ast; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Markdown; +using DiscordChatExporter.Core.Markdown.Ast; +using DiscordChatExporter.Core.Utils.Extensions; -namespace DiscordChatExporter.Domain.Exporting.Writers.MarkdownVisitors +namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors { internal partial class HtmlMarkdownVisitor : MarkdownVisitor { diff --git a/DiscordChatExporter.Domain/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs b/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs similarity index 90% rename from DiscordChatExporter.Domain/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs rename to DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs index 13e05b5..5b9bcd2 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs @@ -1,10 +1,10 @@ using System.Text; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Markdown; -using DiscordChatExporter.Domain.Markdown.Ast; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Markdown; +using DiscordChatExporter.Core.Markdown.Ast; +using DiscordChatExporter.Core.Utils.Extensions; -namespace DiscordChatExporter.Domain.Exporting.Writers.MarkdownVisitors +namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors { internal partial class PlainTextMarkdownVisitor : MarkdownVisitor { diff --git a/DiscordChatExporter.Domain/Exporting/Writers/MessageWriter.cs b/DiscordChatExporter.Core/Exporting/Writers/MessageWriter.cs similarity index 86% rename from DiscordChatExporter.Domain/Exporting/Writers/MessageWriter.cs rename to DiscordChatExporter.Core/Exporting/Writers/MessageWriter.cs index c82789a..d0ab0bf 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/MessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/MessageWriter.cs @@ -1,9 +1,9 @@ using System; using System.IO; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Discord.Models; +using DiscordChatExporter.Core.Discord.Data; -namespace DiscordChatExporter.Domain.Exporting.Writers +namespace DiscordChatExporter.Core.Exporting.Writers { internal abstract class MessageWriter : IAsyncDisposable { diff --git a/DiscordChatExporter.Domain/Exporting/Writers/PlainTextMessageWriter.cs b/DiscordChatExporter.Core/Exporting/Writers/PlainTextMessageWriter.cs similarity index 97% rename from DiscordChatExporter.Domain/Exporting/Writers/PlainTextMessageWriter.cs rename to DiscordChatExporter.Core/Exporting/Writers/PlainTextMessageWriter.cs index 9e486e8..2ccadd3 100644 --- a/DiscordChatExporter.Domain/Exporting/Writers/PlainTextMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/PlainTextMessageWriter.cs @@ -2,11 +2,11 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exporting.Writers.MarkdownVisitors; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors; using Tyrrrz.Extensions; -namespace DiscordChatExporter.Domain.Exporting.Writers +namespace DiscordChatExporter.Core.Exporting.Writers { internal class PlainTextMessageWriter : MessageWriter { diff --git a/DiscordChatExporter.Domain/Markdown/Ast/EmojiNode.cs b/DiscordChatExporter.Core/Markdown/Ast/EmojiNode.cs similarity index 91% rename from DiscordChatExporter.Domain/Markdown/Ast/EmojiNode.cs rename to DiscordChatExporter.Core/Markdown/Ast/EmojiNode.cs index 647a502..e04972a 100644 --- a/DiscordChatExporter.Domain/Markdown/Ast/EmojiNode.cs +++ b/DiscordChatExporter.Core/Markdown/Ast/EmojiNode.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Markdown.Ast +namespace DiscordChatExporter.Core.Markdown.Ast { internal class EmojiNode : MarkdownNode { diff --git a/DiscordChatExporter.Domain/Markdown/Ast/FormattedNode.cs b/DiscordChatExporter.Core/Markdown/Ast/FormattedNode.cs similarity index 92% rename from DiscordChatExporter.Domain/Markdown/Ast/FormattedNode.cs rename to DiscordChatExporter.Core/Markdown/Ast/FormattedNode.cs index dbeee1e..dd3204c 100644 --- a/DiscordChatExporter.Domain/Markdown/Ast/FormattedNode.cs +++ b/DiscordChatExporter.Core/Markdown/Ast/FormattedNode.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace DiscordChatExporter.Domain.Markdown.Ast +namespace DiscordChatExporter.Core.Markdown.Ast { internal enum TextFormatting { diff --git a/DiscordChatExporter.Domain/Markdown/Ast/InlineCodeBlockNode.cs b/DiscordChatExporter.Core/Markdown/Ast/InlineCodeBlockNode.cs similarity index 82% rename from DiscordChatExporter.Domain/Markdown/Ast/InlineCodeBlockNode.cs rename to DiscordChatExporter.Core/Markdown/Ast/InlineCodeBlockNode.cs index 8530e03..ebea177 100644 --- a/DiscordChatExporter.Domain/Markdown/Ast/InlineCodeBlockNode.cs +++ b/DiscordChatExporter.Core/Markdown/Ast/InlineCodeBlockNode.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Markdown.Ast +namespace DiscordChatExporter.Core.Markdown.Ast { internal class InlineCodeBlockNode : MarkdownNode { diff --git a/DiscordChatExporter.Domain/Markdown/Ast/LinkNode.cs b/DiscordChatExporter.Core/Markdown/Ast/LinkNode.cs similarity index 88% rename from DiscordChatExporter.Domain/Markdown/Ast/LinkNode.cs rename to DiscordChatExporter.Core/Markdown/Ast/LinkNode.cs index 1a6fcfa..2c9f481 100644 --- a/DiscordChatExporter.Domain/Markdown/Ast/LinkNode.cs +++ b/DiscordChatExporter.Core/Markdown/Ast/LinkNode.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Markdown.Ast +namespace DiscordChatExporter.Core.Markdown.Ast { internal class LinkNode : MarkdownNode { diff --git a/DiscordChatExporter.Domain/Markdown/Ast/MarkdownNode.cs b/DiscordChatExporter.Core/Markdown/Ast/MarkdownNode.cs similarity index 50% rename from DiscordChatExporter.Domain/Markdown/Ast/MarkdownNode.cs rename to DiscordChatExporter.Core/Markdown/Ast/MarkdownNode.cs index eae58be..6bf3baf 100644 --- a/DiscordChatExporter.Domain/Markdown/Ast/MarkdownNode.cs +++ b/DiscordChatExporter.Core/Markdown/Ast/MarkdownNode.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Markdown.Ast +namespace DiscordChatExporter.Core.Markdown.Ast { internal abstract class MarkdownNode { diff --git a/DiscordChatExporter.Domain/Markdown/Ast/MentionNode.cs b/DiscordChatExporter.Core/Markdown/Ast/MentionNode.cs similarity index 88% rename from DiscordChatExporter.Domain/Markdown/Ast/MentionNode.cs rename to DiscordChatExporter.Core/Markdown/Ast/MentionNode.cs index fff0491..c2fdd03 100644 --- a/DiscordChatExporter.Domain/Markdown/Ast/MentionNode.cs +++ b/DiscordChatExporter.Core/Markdown/Ast/MentionNode.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Markdown.Ast +namespace DiscordChatExporter.Core.Markdown.Ast { internal enum MentionType { diff --git a/DiscordChatExporter.Domain/Markdown/Ast/MultiLineCodeBlockNode.cs b/DiscordChatExporter.Core/Markdown/Ast/MultiLineCodeBlockNode.cs similarity index 87% rename from DiscordChatExporter.Domain/Markdown/Ast/MultiLineCodeBlockNode.cs rename to DiscordChatExporter.Core/Markdown/Ast/MultiLineCodeBlockNode.cs index cb3d053..d53406d 100644 --- a/DiscordChatExporter.Domain/Markdown/Ast/MultiLineCodeBlockNode.cs +++ b/DiscordChatExporter.Core/Markdown/Ast/MultiLineCodeBlockNode.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Markdown.Ast +namespace DiscordChatExporter.Core.Markdown.Ast { internal class MultiLineCodeBlockNode : MarkdownNode { diff --git a/DiscordChatExporter.Domain/Markdown/Ast/TextNode.cs b/DiscordChatExporter.Core/Markdown/Ast/TextNode.cs similarity index 80% rename from DiscordChatExporter.Domain/Markdown/Ast/TextNode.cs rename to DiscordChatExporter.Core/Markdown/Ast/TextNode.cs index ead23d0..66bad0e 100644 --- a/DiscordChatExporter.Domain/Markdown/Ast/TextNode.cs +++ b/DiscordChatExporter.Core/Markdown/Ast/TextNode.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Markdown.Ast +namespace DiscordChatExporter.Core.Markdown.Ast { internal class TextNode : MarkdownNode { diff --git a/DiscordChatExporter.Domain/Markdown/MarkdownParser.cs b/DiscordChatExporter.Core/Markdown/MarkdownParser.cs similarity index 98% rename from DiscordChatExporter.Domain/Markdown/MarkdownParser.cs rename to DiscordChatExporter.Core/Markdown/MarkdownParser.cs index d0447af..39d5157 100644 --- a/DiscordChatExporter.Domain/Markdown/MarkdownParser.cs +++ b/DiscordChatExporter.Core/Markdown/MarkdownParser.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; -using DiscordChatExporter.Domain.Markdown.Ast; -using DiscordChatExporter.Domain.Markdown.Matching; +using DiscordChatExporter.Core.Markdown.Ast; +using DiscordChatExporter.Core.Markdown.Matching; -namespace DiscordChatExporter.Domain.Markdown +namespace DiscordChatExporter.Core.Markdown { // The following parsing logic is meant to replicate Discord's markdown grammar as close as possible internal static partial class MarkdownParser diff --git a/DiscordChatExporter.Domain/Markdown/MarkdownVisitor.cs b/DiscordChatExporter.Core/Markdown/MarkdownVisitor.cs similarity index 94% rename from DiscordChatExporter.Domain/Markdown/MarkdownVisitor.cs rename to DiscordChatExporter.Core/Markdown/MarkdownVisitor.cs index 40e3a38..56100ff 100644 --- a/DiscordChatExporter.Domain/Markdown/MarkdownVisitor.cs +++ b/DiscordChatExporter.Core/Markdown/MarkdownVisitor.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; -using DiscordChatExporter.Domain.Markdown.Ast; +using DiscordChatExporter.Core.Markdown.Ast; -namespace DiscordChatExporter.Domain.Markdown +namespace DiscordChatExporter.Core.Markdown { internal abstract class MarkdownVisitor { diff --git a/DiscordChatExporter.Domain/Markdown/Matching/AggregateMatcher.cs b/DiscordChatExporter.Core/Markdown/Matching/AggregateMatcher.cs similarity index 96% rename from DiscordChatExporter.Domain/Markdown/Matching/AggregateMatcher.cs rename to DiscordChatExporter.Core/Markdown/Matching/AggregateMatcher.cs index 1664469..3d51ba9 100644 --- a/DiscordChatExporter.Domain/Markdown/Matching/AggregateMatcher.cs +++ b/DiscordChatExporter.Core/Markdown/Matching/AggregateMatcher.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace DiscordChatExporter.Domain.Markdown.Matching +namespace DiscordChatExporter.Core.Markdown.Matching { internal class AggregateMatcher : IMatcher { diff --git a/DiscordChatExporter.Domain/Markdown/Matching/IMatcher.cs b/DiscordChatExporter.Core/Markdown/Matching/IMatcher.cs similarity index 97% rename from DiscordChatExporter.Domain/Markdown/Matching/IMatcher.cs rename to DiscordChatExporter.Core/Markdown/Matching/IMatcher.cs index 9315b21..c459977 100644 --- a/DiscordChatExporter.Domain/Markdown/Matching/IMatcher.cs +++ b/DiscordChatExporter.Core/Markdown/Matching/IMatcher.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace DiscordChatExporter.Domain.Markdown.Matching +namespace DiscordChatExporter.Core.Markdown.Matching { internal interface IMatcher { diff --git a/DiscordChatExporter.Domain/Markdown/Matching/ParsedMatch.cs b/DiscordChatExporter.Core/Markdown/Matching/ParsedMatch.cs similarity index 82% rename from DiscordChatExporter.Domain/Markdown/Matching/ParsedMatch.cs rename to DiscordChatExporter.Core/Markdown/Matching/ParsedMatch.cs index 3392185..a144e03 100644 --- a/DiscordChatExporter.Domain/Markdown/Matching/ParsedMatch.cs +++ b/DiscordChatExporter.Core/Markdown/Matching/ParsedMatch.cs @@ -1,4 +1,4 @@ -namespace DiscordChatExporter.Domain.Markdown.Matching +namespace DiscordChatExporter.Core.Markdown.Matching { internal class ParsedMatch { diff --git a/DiscordChatExporter.Domain/Markdown/Matching/RegexMatcher.cs b/DiscordChatExporter.Core/Markdown/Matching/RegexMatcher.cs similarity index 96% rename from DiscordChatExporter.Domain/Markdown/Matching/RegexMatcher.cs rename to DiscordChatExporter.Core/Markdown/Matching/RegexMatcher.cs index 3e9d75b..3179bee 100644 --- a/DiscordChatExporter.Domain/Markdown/Matching/RegexMatcher.cs +++ b/DiscordChatExporter.Core/Markdown/Matching/RegexMatcher.cs @@ -1,7 +1,7 @@ using System; using System.Text.RegularExpressions; -namespace DiscordChatExporter.Domain.Markdown.Matching +namespace DiscordChatExporter.Core.Markdown.Matching { internal class RegexMatcher : IMatcher { diff --git a/DiscordChatExporter.Domain/Markdown/Matching/StringMatcher.cs b/DiscordChatExporter.Core/Markdown/Matching/StringMatcher.cs similarity index 95% rename from DiscordChatExporter.Domain/Markdown/Matching/StringMatcher.cs rename to DiscordChatExporter.Core/Markdown/Matching/StringMatcher.cs index e166dac..adb5ca1 100644 --- a/DiscordChatExporter.Domain/Markdown/Matching/StringMatcher.cs +++ b/DiscordChatExporter.Core/Markdown/Matching/StringMatcher.cs @@ -1,6 +1,6 @@ using System; -namespace DiscordChatExporter.Domain.Markdown.Matching +namespace DiscordChatExporter.Core.Markdown.Matching { internal class StringMatcher : IMatcher { diff --git a/DiscordChatExporter.Domain/Markdown/Matching/StringPart.cs b/DiscordChatExporter.Core/Markdown/Matching/StringPart.cs similarity index 94% rename from DiscordChatExporter.Domain/Markdown/Matching/StringPart.cs rename to DiscordChatExporter.Core/Markdown/Matching/StringPart.cs index cd3ad28..6c823d5 100644 --- a/DiscordChatExporter.Domain/Markdown/Matching/StringPart.cs +++ b/DiscordChatExporter.Core/Markdown/Matching/StringPart.cs @@ -1,6 +1,6 @@ using System.Text.RegularExpressions; -namespace DiscordChatExporter.Domain.Markdown.Matching +namespace DiscordChatExporter.Core.Markdown.Matching { internal readonly struct StringPart { diff --git a/DiscordChatExporter.Domain/Utilities/AsyncExtensions.cs b/DiscordChatExporter.Core/Utils/Extensions/AsyncExtensions.cs similarity index 96% rename from DiscordChatExporter.Domain/Utilities/AsyncExtensions.cs rename to DiscordChatExporter.Core/Utils/Extensions/AsyncExtensions.cs index e6f0bd3..de342da 100644 --- a/DiscordChatExporter.Domain/Utilities/AsyncExtensions.cs +++ b/DiscordChatExporter.Core/Utils/Extensions/AsyncExtensions.cs @@ -5,7 +5,7 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; -namespace DiscordChatExporter.Domain.Utilities +namespace DiscordChatExporter.Core.Utils.Extensions { public static class AsyncExtensions { diff --git a/DiscordChatExporter.Domain/Internal/Extensions/BinaryExtensions.cs b/DiscordChatExporter.Core/Utils/Extensions/BinaryExtensions.cs similarity index 75% rename from DiscordChatExporter.Domain/Internal/Extensions/BinaryExtensions.cs rename to DiscordChatExporter.Core/Utils/Extensions/BinaryExtensions.cs index e29c10f..5894377 100644 --- a/DiscordChatExporter.Domain/Internal/Extensions/BinaryExtensions.cs +++ b/DiscordChatExporter.Core/Utils/Extensions/BinaryExtensions.cs @@ -1,8 +1,8 @@ using System.Text; -namespace DiscordChatExporter.Domain.Internal.Extensions +namespace DiscordChatExporter.Core.Utils.Extensions { - internal static class BinaryExtensions + public static class BinaryExtensions { public static string ToHex(this byte[] data) { diff --git a/DiscordChatExporter.Domain/Internal/Extensions/ColorExtensions.cs b/DiscordChatExporter.Core/Utils/Extensions/ColorExtensions.cs similarity index 80% rename from DiscordChatExporter.Domain/Internal/Extensions/ColorExtensions.cs rename to DiscordChatExporter.Core/Utils/Extensions/ColorExtensions.cs index c6ed05d..10d5fbb 100644 --- a/DiscordChatExporter.Domain/Internal/Extensions/ColorExtensions.cs +++ b/DiscordChatExporter.Core/Utils/Extensions/ColorExtensions.cs @@ -1,8 +1,8 @@ using System.Drawing; -namespace DiscordChatExporter.Domain.Internal.Extensions +namespace DiscordChatExporter.Core.Utils.Extensions { - internal static class ColorExtensions + public static class ColorExtensions { public static Color WithAlpha(this Color color, int alpha) => Color.FromArgb(alpha, color); diff --git a/DiscordChatExporter.Domain/Internal/Extensions/DateExtensions.cs b/DiscordChatExporter.Core/Utils/Extensions/DateExtensions.cs similarity index 70% rename from DiscordChatExporter.Domain/Internal/Extensions/DateExtensions.cs rename to DiscordChatExporter.Core/Utils/Extensions/DateExtensions.cs index 384844a..9a4c1ca 100644 --- a/DiscordChatExporter.Domain/Internal/Extensions/DateExtensions.cs +++ b/DiscordChatExporter.Core/Utils/Extensions/DateExtensions.cs @@ -1,9 +1,9 @@ using System; using System.Globalization; -namespace DiscordChatExporter.Domain.Internal.Extensions +namespace DiscordChatExporter.Core.Utils.Extensions { - internal static class DateExtensions + public static class DateExtensions { public static string ToLocalString(this DateTimeOffset dateTime, string format) => dateTime.ToLocalTime().ToString(format, CultureInfo.InvariantCulture); diff --git a/DiscordChatExporter.Domain/Internal/Extensions/GenericExtensions.cs b/DiscordChatExporter.Core/Utils/Extensions/GenericExtensions.cs similarity index 50% rename from DiscordChatExporter.Domain/Internal/Extensions/GenericExtensions.cs rename to DiscordChatExporter.Core/Utils/Extensions/GenericExtensions.cs index a68406a..ad5befe 100644 --- a/DiscordChatExporter.Domain/Internal/Extensions/GenericExtensions.cs +++ b/DiscordChatExporter.Core/Utils/Extensions/GenericExtensions.cs @@ -1,9 +1,11 @@ using System; -namespace DiscordChatExporter.Domain.Internal.Extensions +namespace DiscordChatExporter.Core.Utils.Extensions { - internal static class GenericExtensions + public static class GenericExtensions { + public static TOut Pipe(this TIn input, Func transform) => transform(input); + public static T? NullIf(this T value, Func predicate) where T : struct => !predicate(value) ? value diff --git a/DiscordChatExporter.Domain/Internal/Extensions/HttpExtensions.cs b/DiscordChatExporter.Core/Utils/Extensions/HttpExtensions.cs similarity index 72% rename from DiscordChatExporter.Domain/Internal/Extensions/HttpExtensions.cs rename to DiscordChatExporter.Core/Utils/Extensions/HttpExtensions.cs index e42a132..2b8d9ec 100644 --- a/DiscordChatExporter.Domain/Internal/Extensions/HttpExtensions.cs +++ b/DiscordChatExporter.Core/Utils/Extensions/HttpExtensions.cs @@ -1,8 +1,8 @@ using System.Net.Http.Headers; -namespace DiscordChatExporter.Domain.Internal.Extensions +namespace DiscordChatExporter.Core.Utils.Extensions { - internal static class HttpExtensions + public static class HttpExtensions { public static string? TryGetValue(this HttpContentHeaders headers, string name) => headers.TryGetValues(name, out var values) diff --git a/DiscordChatExporter.Domain/Internal/Extensions/StringExtensions.cs b/DiscordChatExporter.Core/Utils/Extensions/StringExtensions.cs similarity index 80% rename from DiscordChatExporter.Domain/Internal/Extensions/StringExtensions.cs rename to DiscordChatExporter.Core/Utils/Extensions/StringExtensions.cs index be6d74b..06ca98f 100644 --- a/DiscordChatExporter.Domain/Internal/Extensions/StringExtensions.cs +++ b/DiscordChatExporter.Core/Utils/Extensions/StringExtensions.cs @@ -1,8 +1,8 @@ using System.Text; -namespace DiscordChatExporter.Domain.Internal.Extensions +namespace DiscordChatExporter.Core.Utils.Extensions { - internal static class StringExtensions + public static class StringExtensions { public static string Truncate(this string str, int charCount) => str.Length > charCount diff --git a/DiscordChatExporter.Domain/Internal/Http.cs b/DiscordChatExporter.Core/Utils/Http.cs similarity index 97% rename from DiscordChatExporter.Domain/Internal/Http.cs rename to DiscordChatExporter.Core/Utils/Http.cs index 242441c..ca8438f 100644 --- a/DiscordChatExporter.Domain/Internal/Http.cs +++ b/DiscordChatExporter.Core/Utils/Http.cs @@ -7,9 +7,9 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using Polly; -namespace DiscordChatExporter.Domain.Internal +namespace DiscordChatExporter.Core.Utils { - internal static class Http + public static class Http { public static HttpClient Client { get; } = new(); diff --git a/DiscordChatExporter.Domain/Internal/PathEx.cs b/DiscordChatExporter.Core/Utils/PathEx.cs similarity index 83% rename from DiscordChatExporter.Domain/Internal/PathEx.cs rename to DiscordChatExporter.Core/Utils/PathEx.cs index 83b5949..1ef74a1 100644 --- a/DiscordChatExporter.Domain/Internal/PathEx.cs +++ b/DiscordChatExporter.Core/Utils/PathEx.cs @@ -1,9 +1,9 @@ using System.IO; using System.Text; -namespace DiscordChatExporter.Domain.Internal +namespace DiscordChatExporter.Core.Utils { - internal static class PathEx + public static class PathEx { public static StringBuilder EscapePath(StringBuilder pathBuffer) { diff --git a/DiscordChatExporter.Domain/Internal/UrlBuilder.cs b/DiscordChatExporter.Core/Utils/UrlBuilder.cs similarity index 93% rename from DiscordChatExporter.Domain/Internal/UrlBuilder.cs rename to DiscordChatExporter.Core/Utils/UrlBuilder.cs index 85de6f0..a7897c2 100644 --- a/DiscordChatExporter.Domain/Internal/UrlBuilder.cs +++ b/DiscordChatExporter.Core/Utils/UrlBuilder.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Net; using System.Text; -namespace DiscordChatExporter.Domain.Internal +namespace DiscordChatExporter.Core.Utils { - internal class UrlBuilder + public class UrlBuilder { private string _path = ""; diff --git a/DiscordChatExporter.Domain/Discord/Models/Common/IHasIdAndPosition.cs b/DiscordChatExporter.Domain/Discord/Models/Common/IHasIdAndPosition.cs deleted file mode 100644 index 10a4a72..0000000 --- a/DiscordChatExporter.Domain/Discord/Models/Common/IHasIdAndPosition.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace DiscordChatExporter.Domain.Discord.Models.Common -{ - public interface IHasIdAndPosition : IHasId - { - int? Position { get; } - } -} \ No newline at end of file diff --git a/DiscordChatExporter.Domain/Discord/Models/Common/PositionBasedComparer.cs b/DiscordChatExporter.Domain/Discord/Models/Common/PositionBasedComparer.cs deleted file mode 100644 index 00d7d16..0000000 --- a/DiscordChatExporter.Domain/Discord/Models/Common/PositionBasedComparer.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections.Generic; - -namespace DiscordChatExporter.Domain.Discord.Models.Common -{ - public partial class PositionBasedComparer : IComparer - { - public int Compare(IHasIdAndPosition? x, IHasIdAndPosition? y) - { - int result = Comparer.Default.Compare(x?.Position, y?.Position); - if (result == 0) - { - result = Comparer.Default.Compare(x?.Id.Value, y?.Id.Value); - } - return result; - } - } - - public partial class PositionBasedComparer - { - public static PositionBasedComparer Instance { get; } = new(); - } -} \ No newline at end of file diff --git a/DiscordChatExporter.Domain/Exporting/Writers/Html/PostambleTemplate.cshtml b/DiscordChatExporter.Domain/Exporting/Writers/Html/PostambleTemplate.cshtml deleted file mode 100644 index d8fd453..0000000 --- a/DiscordChatExporter.Domain/Exporting/Writers/Html/PostambleTemplate.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -@namespace DiscordChatExporter.Domain.Exporting.Writers.Html -@inherits MiniRazor.TemplateBase - - - -
-
Exported @Model.MessageCount.ToString("N0") message(s)
-
- - - - \ No newline at end of file diff --git a/DiscordChatExporter.Domain/Utilities/GeneralExtensions.cs b/DiscordChatExporter.Domain/Utilities/GeneralExtensions.cs deleted file mode 100644 index 1af67ce..0000000 --- a/DiscordChatExporter.Domain/Utilities/GeneralExtensions.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace DiscordChatExporter.Domain.Utilities -{ - public static class GeneralExtensions - { - public static TOut Pipe(this TIn input, Func transform) => transform(input); - } -} \ No newline at end of file diff --git a/DiscordChatExporter.Gui/App.xaml.cs b/DiscordChatExporter.Gui/App.xaml.cs index b097bfc..5d7fcfe 100644 --- a/DiscordChatExporter.Gui/App.xaml.cs +++ b/DiscordChatExporter.Gui/App.xaml.cs @@ -1,6 +1,6 @@ using System; using System.Reflection; -using DiscordChatExporter.Gui.Internal; +using DiscordChatExporter.Gui.Utils; using MaterialDesignThemes.Wpf; namespace DiscordChatExporter.Gui diff --git a/DiscordChatExporter.Gui/Behaviors/ChannelMultiSelectionListBoxBehavior.cs b/DiscordChatExporter.Gui/Behaviors/ChannelMultiSelectionListBoxBehavior.cs index a9de60d..08b9cd3 100644 --- a/DiscordChatExporter.Gui/Behaviors/ChannelMultiSelectionListBoxBehavior.cs +++ b/DiscordChatExporter.Gui/Behaviors/ChannelMultiSelectionListBoxBehavior.cs @@ -1,4 +1,4 @@ -using DiscordChatExporter.Domain.Discord.Models; +using DiscordChatExporter.Core.Discord.Data; namespace DiscordChatExporter.Gui.Behaviors { diff --git a/DiscordChatExporter.Gui/Converters/ExportFormatToStringConverter.cs b/DiscordChatExporter.Gui/Converters/ExportFormatToStringConverter.cs index 0e44dd7..d910530 100644 --- a/DiscordChatExporter.Gui/Converters/ExportFormatToStringConverter.cs +++ b/DiscordChatExporter.Gui/Converters/ExportFormatToStringConverter.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; using System.Windows.Data; -using DiscordChatExporter.Domain.Exporting; +using DiscordChatExporter.Core.Exporting; namespace DiscordChatExporter.Gui.Converters { diff --git a/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj b/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj index 5f7a73f..6a76c00 100644 --- a/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj +++ b/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj @@ -25,7 +25,7 @@ - + diff --git a/DiscordChatExporter.Gui/Services/SettingsService.cs b/DiscordChatExporter.Gui/Services/SettingsService.cs index b2b3b7d..1104f1d 100644 --- a/DiscordChatExporter.Gui/Services/SettingsService.cs +++ b/DiscordChatExporter.Gui/Services/SettingsService.cs @@ -1,5 +1,5 @@ -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Exporting; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Exporting; using Tyrrrz.Settings; namespace DiscordChatExporter.Gui.Services diff --git a/DiscordChatExporter.Gui/Internal/MediaColor.cs b/DiscordChatExporter.Gui/Utils/MediaColor.cs similarity index 80% rename from DiscordChatExporter.Gui/Internal/MediaColor.cs rename to DiscordChatExporter.Gui/Utils/MediaColor.cs index 8971696..40467fb 100644 --- a/DiscordChatExporter.Gui/Internal/MediaColor.cs +++ b/DiscordChatExporter.Gui/Utils/MediaColor.cs @@ -1,6 +1,6 @@ using System.Windows.Media; -namespace DiscordChatExporter.Gui.Internal +namespace DiscordChatExporter.Gui.Utils { internal static class MediaColor { diff --git a/DiscordChatExporter.Gui/Internal/ProcessEx.cs b/DiscordChatExporter.Gui/Utils/ProcessEx.cs similarity index 88% rename from DiscordChatExporter.Gui/Internal/ProcessEx.cs rename to DiscordChatExporter.Gui/Utils/ProcessEx.cs index c9c8218..2dde873 100644 --- a/DiscordChatExporter.Gui/Internal/ProcessEx.cs +++ b/DiscordChatExporter.Gui/Utils/ProcessEx.cs @@ -1,6 +1,6 @@ using System.Diagnostics; -namespace DiscordChatExporter.Gui.Internal +namespace DiscordChatExporter.Gui.Utils { internal static class ProcessEx { diff --git a/DiscordChatExporter.Gui/ViewModels/Dialogs/ExportSetupViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Dialogs/ExportSetupViewModel.cs index 7fa9f2a..a44ee08 100644 --- a/DiscordChatExporter.Gui/ViewModels/Dialogs/ExportSetupViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Dialogs/ExportSetupViewModel.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exporting; -using DiscordChatExporter.Domain.Utilities; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exporting; +using DiscordChatExporter.Core.Utils.Extensions; using DiscordChatExporter.Gui.Services; using DiscordChatExporter.Gui.ViewModels.Framework; diff --git a/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs b/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs index 8d07810..5213f13 100644 --- a/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs @@ -3,13 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using DiscordChatExporter.Domain.Discord; -using DiscordChatExporter.Domain.Discord.Models; -using DiscordChatExporter.Domain.Exceptions; -using DiscordChatExporter.Domain.Exporting; -using DiscordChatExporter.Domain.Utilities; -using DiscordChatExporter.Gui.Internal; +using DiscordChatExporter.Core.Discord; +using DiscordChatExporter.Core.Discord.Data; +using DiscordChatExporter.Core.Exceptions; +using DiscordChatExporter.Core.Exporting; +using DiscordChatExporter.Core.Utils.Extensions; using DiscordChatExporter.Gui.Services; +using DiscordChatExporter.Gui.Utils; using DiscordChatExporter.Gui.ViewModels.Dialogs; using DiscordChatExporter.Gui.ViewModels.Framework; using Gress; diff --git a/DiscordChatExporter.sln b/DiscordChatExporter.sln index 54c906d..34f9b7b 100644 --- a/DiscordChatExporter.sln +++ b/DiscordChatExporter.sln @@ -16,7 +16,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscordChatExporter.Gui", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscordChatExporter.Cli", "DiscordChatExporter.Cli\DiscordChatExporter.Cli.csproj", "{D08624B6-3081-4BCB-91F8-E9832FACC6CE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscordChatExporter.Domain", "DiscordChatExporter.Domain\DiscordChatExporter.Domain.csproj", "{E19980B9-2B84-4257-A517-540FF1E3FCDD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscordChatExporter.Core", "DiscordChatExporter.Core\DiscordChatExporter.Core.csproj", "{E19980B9-2B84-4257-A517-540FF1E3FCDD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Dockerfile b/Dockerfile index 61c2421..264b65a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /src COPY favicon.ico ./ COPY Directory.Build.props ./ -COPY DiscordChatExporter.Domain DiscordChatExporter.Domain +COPY DiscordChatExporter.Core DiscordChatExporter.Core COPY DiscordChatExporter.Cli DiscordChatExporter.Cli RUN dotnet publish DiscordChatExporter.Cli -o DiscordChatExporter.Cli/publish -c Release diff --git a/Readme.md b/Readme.md index f1a28dc..b1bc31a 100644 --- a/Readme.md +++ b/Readme.md @@ -77,20 +77,19 @@ The following table lists all available download options: - 🚀 - .NET Runtime is already embedded or installed automatically - 🦄 - Community-maintained resource -> Note: DiscordChatExporter requires **.NET v3.1 Runtime** in order to work! +> Note that DiscordChatExporter requires **.NET v3.1 Runtime** in order to work! Refer to the **Requirements** column in the above table to download the appropriate installer for your system. ## Features - Graphical user interface (Windows) - Command line interface (Windows, Linux, macOS) -- Works with both user and bot tokens -- Exports on the fly without buffering messages in memory -- Allows exporting messages in a specified range -- Supports file partitioning based on message count -- Uses custom markdown parser compatible with Discord syntax -- Handles all rich media features, including attachments, embeds, emojis, etc -- Renders to HTML (dark & light), TXT, CSV, JSON +- Support for both user and bot tokens +- Support for Discord's dialect of markdown +- Support for attachments, embeds, emojis, and other rich media features +- Multiple output formats: HTML (dark/light), TXT, CSV, JSON +- File partitioning, date ranges, and other export options +- Exports messages on the fly without buffering in-memory ## Screenshots