mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-10 18:06:37 +02:00
Formatting
This commit is contained in:
parent
45ff1daff3
commit
a9eca1ceb2
5 changed files with 8877 additions and 8894 deletions
File diff suppressed because it is too large
Load diff
|
@ -18,8 +18,10 @@ internal class ExportContext(DiscordClient discord, ExportRequest request)
|
|||
private readonly Dictionary<Snowflake, Channel> _channelsById = new();
|
||||
private readonly Dictionary<Snowflake, Role> _rolesById = new();
|
||||
|
||||
private readonly ExportAssetDownloader _assetDownloader =
|
||||
new(request.AssetsDirPath, request.ShouldReuseAssets);
|
||||
private readonly ExportAssetDownloader _assetDownloader = new(
|
||||
request.AssetsDirPath,
|
||||
request.ShouldReuseAssets
|
||||
);
|
||||
|
||||
public DiscordClient Discord { get; } = discord;
|
||||
|
||||
|
|
|
@ -17,19 +17,18 @@ namespace DiscordChatExporter.Core.Exporting;
|
|||
internal class JsonMessageWriter(Stream stream, ExportContext context)
|
||||
: MessageWriter(stream, context)
|
||||
{
|
||||
private readonly Utf8JsonWriter _writer =
|
||||
new(
|
||||
stream,
|
||||
new JsonWriterOptions
|
||||
{
|
||||
// https://github.com/Tyrrrz/DiscordChatExporter/issues/450
|
||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
Indented = true,
|
||||
// Validation errors may mask actual failures
|
||||
// https://github.com/Tyrrrz/DiscordChatExporter/issues/413
|
||||
SkipValidation = true,
|
||||
}
|
||||
);
|
||||
private readonly Utf8JsonWriter _writer = new(
|
||||
stream,
|
||||
new JsonWriterOptions
|
||||
{
|
||||
// https://github.com/Tyrrrz/DiscordChatExporter/issues/450
|
||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
Indented = true,
|
||||
// Validation errors may mask actual failures
|
||||
// https://github.com/Tyrrrz/DiscordChatExporter/issues/413
|
||||
SkipValidation = true,
|
||||
}
|
||||
);
|
||||
|
||||
private async ValueTask<string> FormatMarkdownAsync(
|
||||
string markdown,
|
||||
|
@ -436,7 +435,11 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
|
|||
_writer.WriteString("id", attachment.Id.ToString());
|
||||
_writer.WriteString(
|
||||
"url",
|
||||
await Context.ResolveAssetUrlAsync(attachment.Url, cancellationToken, message.Timestamp)
|
||||
await Context.ResolveAssetUrlAsync(
|
||||
attachment.Url,
|
||||
cancellationToken,
|
||||
message.Timestamp
|
||||
)
|
||||
);
|
||||
_writer.WriteString("fileName", attachment.FileName);
|
||||
_writer.WriteNumber("fileSizeBytes", attachment.FileSize.TotalBytes);
|
||||
|
@ -466,7 +469,11 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
|
|||
_writer.WriteString("format", sticker.Format.ToString());
|
||||
_writer.WriteString(
|
||||
"sourceUrl",
|
||||
await Context.ResolveAssetUrlAsync(sticker.SourceUrl, cancellationToken, message.Timestamp)
|
||||
await Context.ResolveAssetUrlAsync(
|
||||
sticker.SourceUrl,
|
||||
cancellationToken,
|
||||
message.Timestamp
|
||||
)
|
||||
);
|
||||
|
||||
_writer.WriteEndObject();
|
||||
|
|
|
@ -10,8 +10,9 @@ public class UrlBuilder
|
|||
{
|
||||
private string _path = "";
|
||||
|
||||
private readonly Dictionary<string, string?> _queryParameters =
|
||||
new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly Dictionary<string, string?> _queryParameters = new(
|
||||
StringComparer.OrdinalIgnoreCase
|
||||
);
|
||||
|
||||
public UrlBuilder SetPath(string path)
|
||||
{
|
||||
|
|
|
@ -6,8 +6,9 @@ namespace DiscordChatExporter.Gui.Framework;
|
|||
|
||||
public abstract partial class DialogViewModelBase<T> : ViewModelBase
|
||||
{
|
||||
private readonly TaskCompletionSource<T> _closeTcs =
|
||||
new(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
private readonly TaskCompletionSource<T> _closeTcs = new(
|
||||
TaskCreationOptions.RunContinuationsAsynchronously
|
||||
);
|
||||
|
||||
[ObservableProperty]
|
||||
private T? _dialogResult;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue