pull/524/head
Tyrrrz 4 years ago
parent bed0ade732
commit ebe4d58a42

@ -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);
}

@ -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).");
}
}
}

@ -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);
}

@ -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<Channel>();
// 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);
}

@ -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
{

@ -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);
}
}

@ -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);
}
}

@ -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}"
);
}
}
}
}

@ -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}"
);
}
}
}
}

@ -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}"
);
}
}
}
}

@ -12,7 +12,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DiscordChatExporter.Domain\DiscordChatExporter.Domain.csproj" />
<ProjectReference Include="..\DiscordChatExporter.Core\DiscordChatExporter.Core.csproj" />
</ItemGroup>
</Project>

@ -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)

@ -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;

@ -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

@ -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, "<unknown category>", 0);
}
}

@ -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

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Discord.Models.Common
namespace DiscordChatExporter.Core.Discord.Data.Common
{
public interface IHasId
{

@ -0,0 +1,7 @@
namespace DiscordChatExporter.Core.Discord.Data.Common
{
public interface IHasPosition
{
int? Position { get; }
}
}

@ -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<IHasId>
{

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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";

@ -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<Snowflake>());
public static Member CreateForUser(User user) => new(
user,
null,
Array.Empty<Snowflake>()
);
public static Member Parse(JsonElement json)
{

@ -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

@ -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

@ -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

@ -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;

@ -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;

@ -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

@ -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);

@ -1,7 +1,7 @@
using System;
using System.Net.Http;
namespace DiscordChatExporter.Domain.Exceptions
namespace DiscordChatExporter.Core.Exceptions
{
public partial class DiscordChatExporterException : Exception
{

@ -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
{

@ -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
{

@ -1,6 +1,6 @@
using System;
namespace DiscordChatExporter.Domain.Exporting
namespace DiscordChatExporter.Core.Exporting
{
public enum ExportFormat
{

@ -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
{

@ -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
{

@ -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
{

@ -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
{

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Exporting.Writers.Html
namespace DiscordChatExporter.Core.Exporting.Writers.Html
{
internal class LayoutTemplateContext
{

@ -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

@ -1,8 +1,8 @@
@using System
@using System.Linq
@using System.Threading.Tasks
@namespace DiscordChatExporter.Domain.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Domain.Exporting.Writers.Html.MessageGroupTemplateContext>
@namespace DiscordChatExporter.Core.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Core.Exporting.Writers.Html.MessageGroupTemplateContext>
@{
string FormatDate(DateTimeOffset date) => Model.ExportContext.FormatDate(date);

@ -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
{

@ -0,0 +1,12 @@
@namespace DiscordChatExporter.Core.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Core.Exporting.Writers.Html.LayoutTemplateContext>
</div>
<div class="postamble">
<div class="postamble__entry">Exported @Model.MessageCount.ToString("N0") message(s)</div>
</div>
</body>
</html>

@ -1,15 +1,15 @@
@using System
@using System.Threading.Tasks
@using Tyrrrz.Extensions
@namespace DiscordChatExporter.Domain.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Domain.Exporting.Writers.Html.LayoutTemplateContext>
@namespace DiscordChatExporter.Core.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Core.Exporting.Writers.Html.LayoutTemplateContext>
@{
string FormatDate(DateTimeOffset date) => Model.ExportContext.FormatDate(date);
ValueTask<string> 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");
}
<!DOCTYPE html>

@ -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
{

@ -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
{

@ -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
{

@ -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
{

@ -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
{

@ -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
{

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Markdown.Ast
namespace DiscordChatExporter.Core.Markdown.Ast
{
internal class EmojiNode : MarkdownNode
{

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DiscordChatExporter.Domain.Markdown.Ast
namespace DiscordChatExporter.Core.Markdown.Ast
{
internal enum TextFormatting
{

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Markdown.Ast
namespace DiscordChatExporter.Core.Markdown.Ast
{
internal class InlineCodeBlockNode : MarkdownNode
{

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Markdown.Ast
namespace DiscordChatExporter.Core.Markdown.Ast
{
internal class LinkNode : MarkdownNode
{

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Markdown.Ast
namespace DiscordChatExporter.Core.Markdown.Ast
{
internal abstract class MarkdownNode
{

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Markdown.Ast
namespace DiscordChatExporter.Core.Markdown.Ast
{
internal enum MentionType
{

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Markdown.Ast
namespace DiscordChatExporter.Core.Markdown.Ast
{
internal class MultiLineCodeBlockNode : MarkdownNode
{

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Markdown.Ast
namespace DiscordChatExporter.Core.Markdown.Ast
{
internal class TextNode : MarkdownNode
{

@ -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

@ -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
{

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DiscordChatExporter.Domain.Markdown.Matching
namespace DiscordChatExporter.Core.Markdown.Matching
{
internal class AggregateMatcher<T> : IMatcher<T>
{

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace DiscordChatExporter.Domain.Markdown.Matching
namespace DiscordChatExporter.Core.Markdown.Matching
{
internal interface IMatcher<T>
{

@ -1,4 +1,4 @@
namespace DiscordChatExporter.Domain.Markdown.Matching
namespace DiscordChatExporter.Core.Markdown.Matching
{
internal class ParsedMatch<T>
{

@ -1,7 +1,7 @@
using System;
using System.Text.RegularExpressions;
namespace DiscordChatExporter.Domain.Markdown.Matching
namespace DiscordChatExporter.Core.Markdown.Matching
{
internal class RegexMatcher<T> : IMatcher<T>
{

@ -1,6 +1,6 @@
using System;
namespace DiscordChatExporter.Domain.Markdown.Matching
namespace DiscordChatExporter.Core.Markdown.Matching
{
internal class StringMatcher<T> : IMatcher<T>
{

@ -1,6 +1,6 @@
using System.Text.RegularExpressions;
namespace DiscordChatExporter.Domain.Markdown.Matching
namespace DiscordChatExporter.Core.Markdown.Matching
{
internal readonly struct StringPart
{

@ -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
{

@ -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)
{

@ -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);

@ -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);

@ -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<TIn, TOut>(this TIn input, Func<TIn, TOut> transform) => transform(input);
public static T? NullIf<T>(this T value, Func<T, bool> predicate) where T : struct =>
!predicate(value)
? value

@ -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)

@ -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

@ -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();

@ -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)
{

@ -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 = "";

@ -1,7 +0,0 @@
namespace DiscordChatExporter.Domain.Discord.Models.Common
{
public interface IHasIdAndPosition : IHasId
{
int? Position { get; }
}
}

@ -1,22 +0,0 @@
using System.Collections.Generic;
namespace DiscordChatExporter.Domain.Discord.Models.Common
{
public partial class PositionBasedComparer : IComparer<IHasIdAndPosition>
{
public int Compare(IHasIdAndPosition? x, IHasIdAndPosition? y)
{
int result = Comparer<int?>.Default.Compare(x?.Position, y?.Position);
if (result == 0)
{
result = Comparer<ulong?>.Default.Compare(x?.Id.Value, y?.Id.Value);
}
return result;
}
}
public partial class PositionBasedComparer
{
public static PositionBasedComparer Instance { get; } = new();
}
}

@ -1,12 +0,0 @@
@namespace DiscordChatExporter.Domain.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Domain.Exporting.Writers.Html.LayoutTemplateContext>
</div>
<div class="postamble">
<div class="postamble__entry">Exported @Model.MessageCount.ToString("N0") message(s)</div>
</div>
</body>
</html>

@ -1,9 +0,0 @@
using System;
namespace DiscordChatExporter.Domain.Utilities
{
public static class GeneralExtensions
{
public static TOut Pipe<TIn, TOut>(this TIn input, Func<TIn, TOut> transform) => transform(input);
}
}

@ -1,6 +1,6 @@
using System;
using System.Reflection;
using DiscordChatExporter.Gui.Internal;
using DiscordChatExporter.Gui.Utils;
using MaterialDesignThemes.Wpf;
namespace DiscordChatExporter.Gui

@ -1,4 +1,4 @@
using DiscordChatExporter.Domain.Discord.Models;
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Gui.Behaviors
{

@ -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
{

@ -25,7 +25,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DiscordChatExporter.Domain\DiscordChatExporter.Domain.csproj" />
<ProjectReference Include="..\DiscordChatExporter.Core\DiscordChatExporter.Core.csproj" />
</ItemGroup>
<Target Name="Format XAML" AfterTargets="BeforeBuild">

@ -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

@ -1,6 +1,6 @@
using System.Windows.Media;
namespace DiscordChatExporter.Gui.Internal
namespace DiscordChatExporter.Gui.Utils
{
internal static class MediaColor
{

@ -1,6 +1,6 @@
using System.Diagnostics;
namespace DiscordChatExporter.Gui.Internal
namespace DiscordChatExporter.Gui.Utils
{
internal static class ProcessEx
{

@ -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;

@ -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;

@ -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

@ -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

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save