Compare commits

...

11 Commits

Author SHA1 Message Date
tyrrrz 31de8a5b06 Apply updated formatting rules 2026-07-04 18:51:27 +03:00
dependabot[bot] efd430ed29 Bump the actions group with 3 updates (#1564)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-04 18:49:28 +03:00
dependabot[bot] 623c688e1b Bump the nuget group with 14 updates (#1565)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-04 18:48:21 +03:00
tyrrrz 05f8df51e9 Refactor 2026-06-26 13:31:15 +03:00
Jacob Pfundstein e2c633b004 Include starter message in thread exports and skip placeholder (#1557)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 12:59:20 +03:00
tyrrrz b11a57a825 Fix formatting 2026-06-20 14:33:04 +03:00
Nick f502e577c2 Check for media.discordapp.net in addition to cdn.discordapp.com when stripping signature parameters from media URLs (#1554)
Co-authored-by: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com>
2026-06-20 14:30:34 +03:00
Nick 8bc9fe7c72 Catch both old uppercase 5-char hash and newer lowercase 5-char hash when migrating to new hash (#1552)
Co-authored-by: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com>
2026-06-20 14:16:48 +03:00
Jacob Pfundstein 97485c280b Fix output path detection to correctly identify directories and files (#1556) 2026-06-20 13:55:49 +03:00
Jacob Pfundstein 5a57c4202d Validate output path early to prevent errors when exporting multiple channels (#1555)
Co-authored-by: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com>
2026-06-18 15:37:58 +03:00
tyrrrz acac8f7bbb Update packages 2026-06-08 15:52:10 +03:00
19 changed files with 1232 additions and 1057 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install Docker Buildx - name: Install Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
@@ -55,7 +55,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install Docker Buildx - name: Install Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
+7 -7
View File
@@ -26,10 +26,10 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install .NET - name: Install .NET
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
# Build the project separately to discern between build and format errors # Build the project separately to discern between build and format errors
- name: Build - name: Build
@@ -62,10 +62,10 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install .NET - name: Install .NET
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
- name: Run tests - name: Run tests
env: env:
@@ -81,7 +81,7 @@ jobs:
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
- name: Upload coverage - name: Upload coverage
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
@@ -117,10 +117,10 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install .NET - name: Install .NET
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
- name: Publish app - name: Publish app
run: > run: >
+15 -15
View File
@@ -4,38 +4,38 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageVersion Include="AngleSharp" Version="1.4.0" /> <PackageVersion Include="AngleSharp" Version="1.5.1" />
<PackageVersion Include="AsyncImageLoader.Avalonia" Version="3.8.0" /> <PackageVersion Include="AsyncImageLoader.Avalonia" Version="3.8.0" />
<PackageVersion Include="AsyncKeyedLock" Version="8.0.2" /> <PackageVersion Include="AsyncKeyedLock" Version="8.0.2" />
<PackageVersion Include="Avalonia" Version="12.0.4" /> <PackageVersion Include="Avalonia" Version="12.0.5" />
<PackageVersion Include="Avalonia.Desktop" Version="12.0.4" /> <PackageVersion Include="Avalonia.Desktop" Version="12.0.5" />
<PackageVersion Include="CliFx" Version="3.0.0" /> <PackageVersion Include="CliFx" Version="3.0.0" />
<PackageVersion Include="Cogwheel" Version="2.1.1" /> <PackageVersion Include="Cogwheel" Version="2.1.1" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2" /> <PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageVersion Include="coverlet.collector" Version="10.0.1" /> <PackageVersion Include="coverlet.collector" Version="10.0.1" />
<PackageVersion Include="CSharpier.MsBuild" Version="1.2.6" /> <PackageVersion Include="CSharpier.MsBuild" Version="1.3.0" />
<PackageVersion Include="Deorcify" Version="1.1.0" /> <PackageVersion Include="Deorcify" Version="2.0.1" />
<PackageVersion Include="DialogHost.Avalonia" Version="0.12.2" /> <PackageVersion Include="DialogHost.Avalonia" Version="0.12.2" />
<PackageVersion Include="FluentAssertions" Version="8.10.0" /> <PackageVersion Include="FluentAssertions" Version="8.10.0" />
<PackageVersion Include="GitHubActionsTestLogger" Version="3.0.4" /> <PackageVersion Include="GitHubActionsTestLogger" Version="3.0.4" />
<PackageVersion Include="Gress" Version="2.2.0" /> <PackageVersion Include="Gress" Version="2.2.0" />
<PackageVersion Include="JsonExtensions" Version="1.2.0" /> <PackageVersion Include="JsonExtensions" Version="1.2.3" />
<PackageVersion Include="Markdig" Version="1.2.0" /> <PackageVersion Include="Markdig" Version="1.3.2" />
<PackageVersion Include="Material.Avalonia" Version="3.16.1" /> <PackageVersion Include="Material.Avalonia" Version="3.16.1" />
<PackageVersion Include="Material.Icons.Avalonia" Version="3.0.2" /> <PackageVersion Include="Material.Icons.Avalonia" Version="3.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.8" /> <PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.9" />
<PackageVersion <PackageVersion
Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Include="Microsoft.Extensions.Configuration.EnvironmentVariables"
Version="10.0.8" Version="10.0.9"
/> />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.8" /> <PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.8" /> <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.9" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.6.0" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.7.0" />
<PackageVersion Include="Onova" Version="2.6.13" /> <PackageVersion Include="Onova" Version="2.6.13" />
<PackageVersion Include="Polly" Version="8.6.6" /> <PackageVersion Include="Polly" Version="8.7.0" />
<PackageVersion Include="PowerKit" Version="1.2.0" /> <PackageVersion Include="PowerKit" Version="2.0.2" />
<PackageVersion Include="RazorBlade" Version="1.0.0" /> <PackageVersion Include="RazorBlade" Version="1.0.0" />
<PackageVersion Include="Spectre.Console" Version="0.55.2" /> <PackageVersion Include="Spectre.Console" Version="0.57.1" />
<PackageVersion Include="Superpower" Version="3.1.0" /> <PackageVersion Include="Superpower" Version="3.1.0" />
<PackageVersion Include="ThisAssembly.Project" Version="2.1.2" /> <PackageVersion Include="ThisAssembly.Project" Version="2.1.2" />
<PackageVersion Include="WebMarkupMin.Core" Version="2.21.0" /> <PackageVersion Include="WebMarkupMin.Core" Version="2.21.0" />
@@ -14,13 +14,13 @@
<PackageReference Include="coverlet.collector" PrivateAssets="all" /> <PackageReference Include="coverlet.collector" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" PrivateAssets="all" /> <PackageReference Include="CSharpier.MsBuild" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" /> <PackageReference Include="FluentAssertions" />
<PackageReference Include="GitHubActionsTestLogger" PrivateAssets="all" /> <PackageReference Include="GitHubActionsTestLogger" />
<PackageReference Include="JsonExtensions" /> <PackageReference Include="JsonExtensions" />
<PackageReference Include="Microsoft.Extensions.Configuration" /> <PackageReference Include="Microsoft.Extensions.Configuration" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" /> <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" /> <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" />
<PackageReference Include="Microsoft.NET.Test.Sdk" /> <PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="PowerKit" PrivateAssets="all" /> <PackageReference Include="PowerKit" />
<PackageReference Include="xunit" /> <PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" /> <PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
</ItemGroup> </ItemGroup>
@@ -165,6 +165,37 @@ public abstract class ExportCommandBase : DiscordCommandBase
throw new CommandException("Option --media-dir cannot be used without --media."); throw new CommandException("Option --media-dir cannot be used without --media.");
} }
// Make sure the user does not try to export multiple channels into one file.
// Output path must either be a directory or contain template tokens for this to work.
// Validate this up-front, before fetching threads, because thread fetching can take a
// long time and it's frustrating to fail only after it completes.
// https://github.com/Tyrrrz/DiscordChatExporter/issues/799
// https://github.com/Tyrrrz/DiscordChatExporter/issues/917
// https://github.com/Tyrrrz/DiscordChatExporter/issues/1549
var mayExportMultipleChannels =
// Multiple channels were provided explicitly
channels.Count > 1
// Thread inclusion can add more channels to the export
|| ThreadInclusionMode != ThreadInclusionMode.None;
var isValidOutputPath =
// Anything is valid when exporting a single channel
!mayExportMultipleChannels
// When using template tokens, assume the user knows what they're doing
|| OutputPath.Contains('%')
// Otherwise, require an existing directory or an unambiguous directory path
|| Directory.Exists(OutputPath)
|| Path.EndsInDirectorySeparator(OutputPath);
if (!isValidOutputPath)
{
throw new CommandException(
"Attempted to export multiple channels, but the output path is neither a directory nor a template. "
+ "If the provided output path is meant to be treated as a directory, make sure it ends with a slash. "
+ $"Provided output path: '{OutputPath}'."
);
}
var unwrappedChannels = new List<Channel>(channels); var unwrappedChannels = new List<Channel>(channels);
// Unwrap threads // Unwrap threads
@@ -205,28 +236,6 @@ public abstract class ExportCommandBase : DiscordCommandBase
await console.Output.WriteLineAsync($"Fetched {fetchedThreadsCount} thread(s)."); await console.Output.WriteLineAsync($"Fetched {fetchedThreadsCount} thread(s).");
} }
// Make sure the user does not try to export multiple channels into one file.
// Output path must either be a directory or contain template tokens for this to work.
// https://github.com/Tyrrrz/DiscordChatExporter/issues/799
// https://github.com/Tyrrrz/DiscordChatExporter/issues/917
var isValidOutputPath =
// Anything is valid when exporting a single channel
unwrappedChannels.Count <= 1
// When using template tokens, assume the user knows what they're doing
|| OutputPath.Contains('%')
// Otherwise, require an existing directory or an unambiguous directory path
|| Directory.Exists(OutputPath)
|| Path.EndsInDirectorySeparator(OutputPath);
if (!isValidOutputPath)
{
throw new CommandException(
"Attempted to export multiple channels, but the output path is neither a directory nor a template. "
+ "If the provided output path is meant to be treated as a directory, make sure it ends with a slash. "
+ $"Provided output path: '{OutputPath}'."
);
}
// Export // Export
var errorsByChannel = new ConcurrentDictionary<Channel, string>(); var errorsByChannel = new ConcurrentDictionary<Channel, string>();
var warningsByChannel = new ConcurrentDictionary<Channel, string>(); var warningsByChannel = new ConcurrentDictionary<Channel, string>();
@@ -9,9 +9,9 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="CliFx" /> <PackageReference Include="CliFx" />
<PackageReference Include="CSharpier.MsBuild" PrivateAssets="all" /> <PackageReference Include="CSharpier.MsBuild" PrivateAssets="all" />
<PackageReference Include="Deorcify" PrivateAssets="all" /> <PackageReference Include="Deorcify" />
<PackageReference Include="Gress" /> <PackageReference Include="Gress" />
<PackageReference Include="PowerKit" PrivateAssets="all" /> <PackageReference Include="PowerKit" />
<PackageReference Include="Spectre.Console" /> <PackageReference Include="Spectre.Console" />
</ItemGroup> </ItemGroup>
@@ -13,4 +13,5 @@ public enum MessageKind
GuildMemberJoin = 7, GuildMemberJoin = 7,
ThreadCreated = 18, ThreadCreated = 18,
Reply = 19, Reply = 19,
ThreadStarterMessage = 21,
} }
@@ -30,9 +30,8 @@ public class DiscordClient(
string url, string url,
TokenKind tokenKind, TokenKind tokenKind,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
) ) =>
{ await Http.ResponseResiliencePipeline.ExecuteAsync(
return await Http.ResponseResiliencePipeline.ExecuteAsync(
async innerCancellationToken => async innerCancellationToken =>
{ {
using var request = new HttpRequestMessage(HttpMethod.Get, new Uri(_baseUri, url)); using var request = new HttpRequestMessage(HttpMethod.Get, new Uri(_baseUri, url));
@@ -91,7 +90,6 @@ public class DiscordClient(
}, },
cancellationToken cancellationToken
); );
}
private async ValueTask<TokenKind> ResolveTokenKindAsync( private async ValueTask<TokenKind> ResolveTokenKindAsync(
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
@@ -364,6 +362,7 @@ public class DiscordClient(
$"guilds/{guildId}/members/{memberId}", $"guilds/{guildId}/members/{memberId}",
cancellationToken cancellationToken
); );
return response?.Pipe(j => Member.Parse(j, guildId)); return response?.Pipe(j => Member.Parse(j, guildId));
} }
@@ -412,14 +411,12 @@ public class DiscordClient(
?.GetNonWhiteSpaceStringOrNull() ?.GetNonWhiteSpaceStringOrNull()
?.Pipe(Snowflake.Parse); ?.Pipe(Snowflake.Parse);
Channel? parent = null; // It's possible for the parent channel to be inaccessible, despite the
if (parentId is not null) // child channel being accessible.
{ // https://github.com/Tyrrrz/DiscordChatExporter/issues/1108
// It's possible for the parent channel to be inaccessible, despite the var parent = parentId is not null
// child channel being accessible. ? await TryGetChannelAsync(parentId.Value, cancellationToken)
// https://github.com/Tyrrrz/DiscordChatExporter/issues/1108 : null;
parent = await TryGetChannelAsync(parentId.Value, cancellationToken);
}
return Channel.Parse(response.Value, parent); return Channel.Parse(response.Value, parent);
} }
@@ -607,8 +604,12 @@ public class DiscordClient(
.SetQueryParameter("after", (after ?? Snowflake.Zero).ToString()) .SetQueryParameter("after", (after ?? Snowflake.Zero).ToString())
.Build(); .Build();
var response = await GetJsonResponseAsync(url, cancellationToken); // Can be null on channels that the user cannot access
var message = response.EnumerateArray().Select(Message.Parse).FirstOrDefault(); var response = await TryGetJsonResponseAsync(url, cancellationToken);
if (response is null)
return null;
var message = response.Value.EnumerateArray().Select(Message.Parse).FirstOrDefault();
return message; return message;
} }
@@ -625,8 +626,39 @@ public class DiscordClient(
.SetQueryParameter("before", before?.ToString()) .SetQueryParameter("before", before?.ToString())
.Build(); .Build();
var response = await GetJsonResponseAsync(url, cancellationToken); // Can be null on channels that the user cannot access
return response.EnumerateArray().Select(Message.Parse).LastOrDefault(); var response = await TryGetJsonResponseAsync(url, cancellationToken);
if (response is null)
return null;
return response.Value.EnumerateArray().Select(Message.Parse).LastOrDefault();
}
public async ValueTask<Message?> TryGetMessageAsync(
Snowflake channelId,
Snowflake messageId,
CancellationToken cancellationToken = default
)
{
// Use the regular message listing endpoint with the 'around' parameter instead of the
// dedicated single-message endpoint, because the latter is not accessible to user tokens.
var url = new UrlBuilder()
.SetPath($"channels/{channelId}/messages")
.SetQueryParameter("around", messageId.ToString())
.SetQueryParameter("limit", "1")
.Build();
// Can be null on channels that the user cannot access
var response = await TryGetJsonResponseAsync(url, cancellationToken);
if (response is null)
return null;
// The endpoint returns messages around the requested ID, so make sure to only return
// the message that exactly matches it (it may be absent if it has been deleted).
return response
.Value.EnumerateArray()
.Select(Message.Parse)
.FirstOrDefault(m => m.Id == messageId);
} }
public async IAsyncEnumerable<Message> GetMessagesAsync( public async IAsyncEnumerable<Message> GetMessagesAsync(
@@ -701,7 +733,21 @@ public class DiscordClient(
); );
} }
yield return message; // Some messages, for example thread starter messages, are returned by the API as content-less references.
// Try to resolve them to the actual message so that they appear as they do in the Discord client.
var actualMessage =
message.Kind == MessageKind.ThreadStarterMessage
&& message.Reference?.ChannelId is { } referencedChannelId
&& message.Reference?.MessageId is { } referencedMessageId
? await TryGetMessageAsync(
referencedChannelId,
referencedMessageId,
cancellationToken
)
: null;
yield return actualMessage ?? message;
currentAfter = message.Id; currentAfter = message.Id;
} }
} }
@@ -769,7 +815,20 @@ public class DiscordClient(
); );
} }
yield return message; // Some messages, for example thread starter messages, are returned by the API as content-less references.
// Try to resolve them to the actual message so that they appear as they do in the Discord client.
var actualMessage =
message.Kind == MessageKind.ThreadStarterMessage
&& message.Reference?.ChannelId is { } referencedChannelId
&& message.Reference?.MessageId is { } referencedMessageId
? await TryGetMessageAsync(
referencedChannelId,
referencedMessageId,
cancellationToken
)
: null;
yield return actualMessage ?? message;
} }
currentBefore = messages.Last().Id; currentBefore = messages.Last().Id;
@@ -6,7 +6,7 @@
<PackageReference Include="Gress" /> <PackageReference Include="Gress" />
<PackageReference Include="JsonExtensions" /> <PackageReference Include="JsonExtensions" />
<PackageReference Include="Polly" /> <PackageReference Include="Polly" />
<PackageReference Include="PowerKit" PrivateAssets="all" /> <PackageReference Include="PowerKit" />
<PackageReference Include="RazorBlade" /> <PackageReference Include="RazorBlade" />
<PackageReference Include="Superpower" /> <PackageReference Include="Superpower" />
<PackageReference Include="WebMarkupMin.Core" /> <PackageReference Include="WebMarkupMin.Core" />
@@ -38,23 +38,28 @@ internal partial class ExportAssetDownloader(string workingDirPath, bool reuse)
return _previousPathsByUrl[url] = filePath; return _previousPathsByUrl[url] = filePath;
// Check for a file cached by the legacy naming scheme (5-char hash) and rename it // Check for a file cached by the legacy naming scheme (5-char hash) and rename it
// to the new naming scheme to preserve backwards compatibility with existing exports // to the new naming scheme to preserve backwards compatibility with existing exports.
// This will catch both the 5-char lowercase hash and the 5-char uppercase hash variants.
if (reuse) if (reuse)
{ {
var legacyFilePath = Path.Combine(workingDirPath, GetLegacyFileNameFromUrl(url)); var legacyFileNames = GetLegacyFileNamesFromUrl(url);
if (File.Exists(legacyFilePath)) foreach (var legacyFileName in legacyFileNames)
{ {
// Overwrite in case the destination file was created concurrently between our var legacyFilePath = Path.Combine(workingDirPath, legacyFileName);
// earlier existence check and this move operation if (File.Exists(legacyFilePath))
try
{ {
File.Move(legacyFilePath, filePath, overwrite: true); // Overwrite in case the destination file was created concurrently between our
return _previousPathsByUrl[url] = filePath; // earlier existence check and this move operation
} try
catch (IOException) {
{ File.Move(legacyFilePath, filePath, true);
// The legacy file was moved or deleted concurrently or something else happened. return _previousPathsByUrl[url] = filePath;
// Upgrading old files is not crucial, so we can just move on. }
catch (IOException)
{
// The legacy file was moved or deleted concurrently or something else happened.
// Upgrading old files is not crucial, so we can just move on.
}
} }
} }
} }
@@ -87,10 +92,16 @@ internal partial class ExportAssetDownloader
{ {
private static string NormalizeUrl(string url) private static string NormalizeUrl(string url)
{ {
// Remove signature parameters from Discord CDN URLs to normalize them // Remove signature parameters from Discord CDN/media URLs to normalize them
var uri = new Uri(url); var uri = new Uri(url);
if (!string.Equals(uri.Host, "cdn.discordapp.com", StringComparison.OrdinalIgnoreCase))
if (
!string.Equals(uri.Host, "cdn.discordapp.com", StringComparison.OrdinalIgnoreCase)
&& !string.Equals(uri.Host, "media.discordapp.net", StringComparison.OrdinalIgnoreCase)
)
{
return url; return url;
}
var query = HttpUtility.ParseQueryString(uri.Query); var query = HttpUtility.ParseQueryString(uri.Query);
query.Remove("ex"); query.Remove("ex");
@@ -137,13 +148,16 @@ internal partial class ExportAssetDownloader
); );
// Legacy naming used a 5-char hash, kept for backwards compatibility with existing exports // Legacy naming used a 5-char hash, kept for backwards compatibility with existing exports
private static string GetLegacyFileNameFromUrl(string url) => private static IReadOnlyList<string> GetLegacyFileNamesFromUrl(string url)
GetFileNameFromUrl( {
url, var hashData = SHA256.HashData(Encoding.UTF8.GetBytes(NormalizeUrl(url)));
SHA256
.HashData(Encoding.UTF8.GetBytes(NormalizeUrl(url))) return
.Pipe(Convert.ToHexStringLower) [
// 5 chars = 20 bits, reaches 1% collision probability at ~145 files // Lowercase variant (introduced in 2.46.1)
.Truncate(5) GetFileNameFromUrl(url, Convert.ToHexStringLower(hashData).Truncate(5)),
); // Uppercase variant (original)
GetFileNameFromUrl(url, Convert.ToHexString(hashData).Truncate(5)),
];
}
} }
@@ -206,10 +206,15 @@ public partial class ExportRequest
{ {
var actualOutputPath = FormatPath(outputPath, guild, channel, after, before); var actualOutputPath = FormatPath(outputPath, guild, channel, after, before);
// Output is a directory // Determine whether the output path refers to a directory or a file.
// The extension-based heuristic is evaluated on the original, unsubstituted path,
// because the value of a template token (e.g. a guild or channel name) may contain
// a period that would otherwise be mistaken for a file extension, incorrectly causing
// a directory path to be treated as a file.
// https://github.com/Tyrrrz/DiscordChatExporter/issues/1502
if ( if (
Directory.Exists(actualOutputPath) Directory.Exists(actualOutputPath)
|| string.IsNullOrWhiteSpace(Path.GetExtension(actualOutputPath)) || string.IsNullOrWhiteSpace(Path.GetExtension(outputPath))
) )
{ {
var fileName = GetDefaultOutputFileName(guild, channel, format, after, before); var fileName = GetDefaultOutputFileName(guild, channel, format, after, before);
+146 -141
View File
@@ -1,160 +1,165 @@
<Application <Application
x:Class="DiscordChatExporter.Gui.App" x:Class="DiscordChatExporter.Gui.App"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia" xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:framework="clr-namespace:DiscordChatExporter.Gui.Framework" xmlns:framework="clr-namespace:DiscordChatExporter.Gui.Framework"
xmlns:materialAssists="clr-namespace:Material.Styles.Assists;assembly=Material.Styles" xmlns:materialAssists="clr-namespace:Material.Styles.Assists;assembly=Material.Styles"
xmlns:materialControls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles" xmlns:materialControls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:materialStyles="clr-namespace:Material.Styles.Themes;assembly=Material.Styles" xmlns:materialStyles="clr-namespace:Material.Styles.Themes;assembly=Material.Styles"
Name="DiscordChatExporter" Name="DiscordChatExporter"
ActualThemeVariantChanged="Application_OnActualThemeVariantChanged"> ActualThemeVariantChanged="Application_OnActualThemeVariantChanged"
<Application.DataTemplates> >
<framework:ViewManager /> <Application.DataTemplates>
</Application.DataTemplates> <framework:ViewManager />
</Application.DataTemplates>
<Application.Styles> <Application.Styles>
<!-- This theme is used as a stub to pre-load default resources, the actual colors are set through code --> <!-- This theme is used as a stub to pre-load default resources, the actual colors are set through code -->
<materialStyles:MaterialTheme <materialStyles:MaterialTheme
BaseTheme="Light" BaseTheme="Light"
PrimaryColor="Grey" PrimaryColor="Grey"
SecondaryColor="DeepOrange" /> SecondaryColor="DeepOrange"
<materialIcons:MaterialIconStyles /> />
<dialogHostAvalonia:DialogHostStyles /> <materialIcons:MaterialIconStyles />
<dialogHostAvalonia:DialogHostStyles />
<!-- Combo box --> <!-- Combo box -->
<Style Selector="ComboBox"> <Style Selector="ComboBox">
<Setter Property="FontSize" Value="14" /> <Setter Property="FontSize" Value="14" />
<Style Selector="^ /template/ Panel#PART_RootPanel"> <Style Selector="^ /template/ Panel#PART_RootPanel">
<Setter Property="Height" Value="22" /> <Setter Property="Height" Value="22" />
</Style>
<Style Selector="^ /template/ ToggleButton">
<Style Selector="^:checked, ^:unchecked">
<Setter Property="Margin" Value="0" />
<Setter Property="CornerRadius" Value="0" />
<Style Selector="^ ContentPresenter#contentPresenter">
<Setter Property="Margin" Value="12,8" />
</Style>
</Style>
</Style>
</Style>
<!-- Dialog host -->
<Style Selector="dialogHostAvalonia|DialogHost">
<Setter Property="DialogMargin" Value="0" />
</Style>
<Style Selector="dialogHostAvalonia|DialogOverlayPopupHost">
<Setter Property="Margin" Value="48" />
<Setter Property="Background" Value="{DynamicResource MaterialPaperBrush}" />
</Style>
<!-- Snack bar host -->
<Style Selector="materialControls|SnackbarHost">
<Setter Property="SnackbarHorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Style Selector="^ /template/ ItemsControl#PART_SnackbarHostItemsContainer materialControls|Card">
<Setter Property="Background" Value="{DynamicResource MaterialDarkBackgroundBrush}" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDarkForegroundBrush}" />
</Style>
<Style Selector="^ /template/ ItemsControl#PART_SnackbarHostItemsContainer Button">
<Setter Property="Foreground" Value="{DynamicResource MaterialSecondaryMidBrush}" />
</Style>
</Style>
<!-- Progress bar -->
<Style Selector="ProgressBar">
<Setter Property="Minimum" Value="0" />
<Setter Property="Maximum" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource MaterialSecondaryMidBrush}" />
<Setter Property="materialAssists:TransitionAssist.DisableTransitions" Value="True" />
<Style Selector="^:horizontal">
<Setter Property="MinHeight" Value="0" />
</Style>
</Style>
<!-- Slider -->
<Style Selector="Slider">
<Style Selector="^ /template/ ProgressBar#PART_ProgressLayer">
<Style Selector="^:horizontal">
<Style Selector="^ Panel#PART_InnerPanel">
<Setter Property="Height" Value="2" />
<Style Selector="^ Border#PART_InactiveState">
<Setter Property="Margin" Value="0" />
<Setter Property="Height" Value="2" />
</Style> </Style>
<Style Selector="^ /template/ ToggleButton"> <Style Selector="^ Border#PART_Indicator">
<Style Selector="^:checked, ^:unchecked"> <Setter Property="Margin" Value="0" />
<Setter Property="Margin" Value="0" />
<Setter Property="CornerRadius" Value="0" />
<Style Selector="^ ContentPresenter#contentPresenter">
<Setter Property="Margin" Value="12,8" />
</Style>
</Style>
</Style> </Style>
</Style>
</Style>
</Style>
<Style Selector="^ /template/ Track#PART_Track">
<Style Selector="^:horizontal">
<Setter Property="Margin" Value="4,0" />
</Style> </Style>
<!-- Dialog host --> <Style Selector="^ Border#PART_HoverEffect">
<Style Selector="dialogHostAvalonia|DialogHost"> <Setter Property="Width" Value="24" />
<Setter Property="DialogMargin" Value="0" /> <Setter Property="Height" Value="24" />
</Style> </Style>
<Style Selector="dialogHostAvalonia|DialogOverlayPopupHost"> <Style Selector="^ Border#PART_ThumbGrip">
<Setter Property="Margin" Value="48" /> <Setter Property="Width" Value="12" />
<Setter Property="Background" Value="{DynamicResource MaterialPaperBrush}" /> <Setter Property="Height" Value="12" />
</Style> </Style>
</Style>
</Style>
<!-- Snack bar host --> <!-- Run -->
<Style Selector="materialControls|SnackbarHost"> <Style Selector="Run">
<Setter Property="SnackbarHorizontalAlignment" Value="Stretch" /> <Setter Property="BaselineAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" /> </Style>
<Style Selector="^ /template/ ItemsControl#PART_SnackbarHostItemsContainer materialControls|Card"> <!-- Text box -->
<Setter Property="Background" Value="{DynamicResource MaterialDarkBackgroundBrush}" /> <Style Selector="TextBox">
<Setter Property="Foreground" Value="{DynamicResource MaterialDarkForegroundBrush}" /> <Setter Property="FontSize" Value="14" />
</Style> </Style>
<Style Selector="^ /template/ ItemsControl#PART_SnackbarHostItemsContainer Button"> <!-- Toggle button -->
<Setter Property="Foreground" Value="{DynamicResource MaterialSecondaryMidBrush}" /> <Style Selector="ToggleButton">
</Style> <Setter Property="TextElement.FontWeight" Value="Medium" />
</Style> </Style>
<!-- Progress bar --> <!-- Toggle switch -->
<Style Selector="ProgressBar"> <Style Selector="ToggleSwitch">
<Setter Property="Minimum" Value="0" /> <Setter
<Setter Property="Maximum" Value="1" /> Property="materialAssists:ToggleSwitchAssist.SwitchThumbOffBackground"
<Setter Property="Foreground" Value="{DynamicResource MaterialSecondaryMidBrush}" /> Value="{DynamicResource ToggleBackgroundBrush}"
<Setter Property="materialAssists:TransitionAssist.DisableTransitions" Value="True" /> />
</Style>
<Style Selector="^:horizontal"> <!-- Tooltip -->
<Setter Property="MinHeight" Value="0" /> <Style Selector="ToolTip">
</Style> <Setter Property="TextElement.FontSize" Value="14" />
</Style> <Setter Property="TextElement.FontWeight" Value="Normal" />
<Setter Property="TextElement.FontStyle" Value="Normal" />
<Setter Property="TextElement.FontStretch" Value="Normal" />
</Style>
</Application.Styles>
<!-- Slider --> <Application.Resources>
<Style Selector="Slider"> <ResourceDictionary>
<Style Selector="^ /template/ ProgressBar#PART_ProgressLayer"> <ResourceDictionary.ThemeDictionaries>
<Style Selector="^:horizontal"> <ResourceDictionary x:Key="Default">
<Style Selector="^ Panel#PART_InnerPanel"> <SolidColorBrush x:Key="ToggleBackgroundBrush" Color="#FFFFFF" />
<Setter Property="Height" Value="2" />
<Style Selector="^ Border#PART_InactiveState">
<Setter Property="Margin" Value="0" />
<Setter Property="Height" Value="2" />
</Style>
<Style Selector="^ Border#PART_Indicator">
<Setter Property="Margin" Value="0" />
</Style>
</Style>
</Style>
</Style>
<Style Selector="^ /template/ Track#PART_Track">
<Style Selector="^:horizontal">
<Setter Property="Margin" Value="4,0" />
</Style>
<Style Selector="^ Border#PART_HoverEffect">
<Setter Property="Width" Value="24" />
<Setter Property="Height" Value="24" />
</Style>
<Style Selector="^ Border#PART_ThumbGrip">
<Setter Property="Width" Value="12" />
<Setter Property="Height" Value="12" />
</Style>
</Style>
</Style>
<!-- Run -->
<Style Selector="Run">
<Setter Property="BaselineAlignment" Value="Center" />
</Style>
<!-- Text box -->
<Style Selector="TextBox">
<Setter Property="FontSize" Value="14" />
</Style>
<!-- Toggle button -->
<Style Selector="ToggleButton">
<Setter Property="TextElement.FontWeight" Value="Medium" />
</Style>
<!-- Toggle switch -->
<Style Selector="ToggleSwitch">
<Setter Property="materialAssists:ToggleSwitchAssist.SwitchThumbOffBackground" Value="{DynamicResource ToggleBackgroundBrush}" />
</Style>
<!-- Tooltip -->
<Style Selector="ToolTip">
<Setter Property="TextElement.FontSize" Value="14" />
<Setter Property="TextElement.FontWeight" Value="Normal" />
<Setter Property="TextElement.FontStyle" Value="Normal" />
<Setter Property="TextElement.FontStretch" Value="Normal" />
</Style>
</Application.Styles>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="ToggleBackgroundBrush" Color="#FFFFFF" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="ToggleBackgroundBrush" Color="#8E8E8E" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> <ResourceDictionary x:Key="Dark">
</Application> <SolidColorBrush x:Key="ToggleBackgroundBrush" Color="#8E8E8E" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
@@ -31,7 +31,7 @@
<PackageReference Include="Cogwheel" /> <PackageReference Include="Cogwheel" />
<PackageReference Include="CommunityToolkit.Mvvm" /> <PackageReference Include="CommunityToolkit.Mvvm" />
<PackageReference Include="CSharpier.MsBuild" PrivateAssets="all" /> <PackageReference Include="CSharpier.MsBuild" PrivateAssets="all" />
<PackageReference Include="Deorcify" PrivateAssets="all" /> <PackageReference Include="Deorcify" />
<PackageReference Include="DialogHost.Avalonia" /> <PackageReference Include="DialogHost.Avalonia" />
<PackageReference Include="Gress" /> <PackageReference Include="Gress" />
<PackageReference Include="Markdig" /> <PackageReference Include="Markdig" />
@@ -39,7 +39,7 @@
<PackageReference Include="Material.Icons.Avalonia" /> <PackageReference Include="Material.Icons.Avalonia" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Onova" /> <PackageReference Include="Onova" />
<PackageReference Include="PowerKit" PrivateAssets="all" /> <PackageReference Include="PowerKit" />
<PackageReference Include="ThisAssembly.Project" PrivateAssets="all" /> <PackageReference Include="ThisAssembly.Project" PrivateAssets="all" />
</ItemGroup> </ItemGroup>
@@ -1,307 +1,323 @@
<UserControl <UserControl
x:Class="DiscordChatExporter.Gui.Views.Components.DashboardView" x:Class="DiscordChatExporter.Gui.Views.Components.DashboardView"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia" xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
xmlns:components="clr-namespace:DiscordChatExporter.Gui.ViewModels.Components" xmlns:components="clr-namespace:DiscordChatExporter.Gui.ViewModels.Components"
xmlns:converters="clr-namespace:DiscordChatExporter.Gui.Converters" xmlns:converters="clr-namespace:DiscordChatExporter.Gui.Converters"
xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:materialStyles="clr-namespace:Material.Styles.Controls;assembly=Material.Styles" xmlns:materialStyles="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
x:Name="UserControl" x:Name="UserControl"
x:DataType="components:DashboardViewModel" x:DataType="components:DashboardViewModel"
Loaded="UserControl_OnLoaded"> Loaded="UserControl_OnLoaded"
<DockPanel> >
<!-- Header --> <DockPanel>
<StackPanel <!-- Header -->
Background="{DynamicResource MaterialDarkBackgroundBrush}" <StackPanel
DockPanel.Dock="Top" Background="{DynamicResource MaterialDarkBackgroundBrush}"
Orientation="Vertical"> DockPanel.Dock="Top"
<Grid Margin="12,12,8,12" ColumnDefinitions="*,Auto"> Orientation="Vertical"
<materialStyles:Card Grid.Column="0"> >
<!-- Token --> <Grid Margin="12,12,8,12" ColumnDefinitions="*,Auto">
<TextBox <materialStyles:Card Grid.Column="0">
x:Name="TokenValueTextBox" <!-- Token -->
FontSize="16" <TextBox
PasswordChar="*" x:Name="TokenValueTextBox"
PlaceholderText="{Binding LocalizationManager.TokenPlaceholderText}" FontSize="16"
RevealPassword="{Binding $self.IsFocused}" PasswordChar="*"
Text="{Binding Token}" PlaceholderText="{Binding LocalizationManager.TokenPlaceholderText}"
Theme="{DynamicResource SoloTextBox}"> RevealPassword="{Binding $self.IsFocused}"
<TextBox.InnerLeftContent> Text="{Binding Token}"
<materialIcons:MaterialIcon Theme="{DynamicResource SoloTextBox}"
Grid.Column="0" >
Width="24" <TextBox.InnerLeftContent>
Height="24" <materialIcons:MaterialIcon
Margin="4,0,8,0" Grid.Column="0"
Foreground="{DynamicResource PrimaryHueMidBrush}" Width="24"
Kind="Key" /> Height="24"
</TextBox.InnerLeftContent> Margin="4,0,8,0"
<TextBox.InnerRightContent> Foreground="{DynamicResource PrimaryHueMidBrush}"
<Button Kind="Key"
Grid.Column="2" />
Margin="8,0,0,0" </TextBox.InnerLeftContent>
Padding="4" <TextBox.InnerRightContent>
Command="{Binding PullGuildsCommand}" <Button
IsDefault="True" Grid.Column="2"
Theme="{DynamicResource MaterialFlatButton}" Margin="8,0,0,0"
ToolTip.Tip="{Binding LocalizationManager.PullGuildsTooltip}"> Padding="4"
<materialIcons:MaterialIcon Command="{Binding PullGuildsCommand}"
Width="24" IsDefault="True"
Height="24" Theme="{DynamicResource MaterialFlatButton}"
Kind="ArrowRight" /> ToolTip.Tip="{Binding LocalizationManager.PullGuildsTooltip}"
</Button> >
</TextBox.InnerRightContent> <materialIcons:MaterialIcon Width="24" Height="24" Kind="ArrowRight" />
</TextBox> </Button>
</materialStyles:Card> </TextBox.InnerRightContent>
</TextBox>
</materialStyles:Card>
<!-- Settings button --> <!-- Settings button -->
<Button <Button
Grid.Column="1" Grid.Column="1"
Margin="8,0,0,0" Margin="8,0,0,0"
Padding="8" Padding="8"
VerticalAlignment="Center" VerticalAlignment="Center"
Command="{Binding ShowSettingsCommand}" Command="{Binding ShowSettingsCommand}"
Foreground="{DynamicResource MaterialDarkForegroundBrush}" Foreground="{DynamicResource MaterialDarkForegroundBrush}"
Theme="{DynamicResource MaterialFlatButton}" Theme="{DynamicResource MaterialFlatButton}"
ToolTip.Tip="{Binding LocalizationManager.SettingsTooltip}"> ToolTip.Tip="{Binding LocalizationManager.SettingsTooltip}"
<materialIcons:MaterialIcon >
Width="24" <materialIcons:MaterialIcon Width="24" Height="24" Kind="Settings" />
Height="24" </Button>
Kind="Settings" /> </Grid>
</Button>
</Grid>
<!-- Progress --> <!-- Progress -->
<ProgressBar <ProgressBar
Height="2" Height="2"
Background="Transparent" Background="Transparent"
IsIndeterminate="{Binding IsProgressIndeterminate}" IsIndeterminate="{Binding IsProgressIndeterminate}"
Value="{Binding Progress.Current.Fraction, Mode=OneWay}" /> Value="{Binding Progress.Current.Fraction, Mode=OneWay}"
</StackPanel> />
</StackPanel>
<!-- Body --> <!-- Body -->
<Panel <Panel
Background="{DynamicResource MaterialCardBackgroundBrush}" Background="{DynamicResource MaterialCardBackgroundBrush}"
DockPanel.Dock="Bottom" DockPanel.Dock="Bottom"
IsEnabled="{Binding !IsBusy}"> IsEnabled="{Binding !IsBusy}"
<Panel.Styles> >
<Style Selector="Panel"> <Panel.Styles>
<Style Selector="^:disabled"> <Style Selector="Panel">
<Setter Property="Opacity" Value="0.5" /> <Style Selector="^:disabled">
</Style> <Setter Property="Opacity" Value="0.5" />
</Style>
</Style>
</Panel.Styles>
<!-- Guilds and channels -->
<Grid ColumnDefinitions="Auto,*" IsVisible="{Binding !!AvailableGuilds.Count}">
<!-- Guilds -->
<Border
Grid.Column="0"
BorderBrush="{DynamicResource MaterialDividerBrush}"
BorderThickness="0,0,1,0"
>
<ListBox
x:Name="AvailableGuildsListBox"
ItemsSource="{Binding AvailableGuilds}"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
SelectedItem="{Binding SelectedGuild}"
SelectionChanged="AvailableGuildsListBox_OnSelectionChanged"
SelectionMode="Single"
>
<ListBox.Styles>
<Style Selector="ListBox">
<Style Selector="^ ListBoxItem">
<Setter Property="Padding" Value="0" />
<Setter Property="Cursor" Value="Hand" />
</Style> </Style>
</Panel.Styles> </Style>
<!-- Guilds and channels --> </ListBox.Styles>
<Grid ColumnDefinitions="Auto,*" IsVisible="{Binding !!AvailableGuilds.Count}"> <ListBox.ItemTemplate>
<!-- Guilds --> <DataTemplate>
<Border <Panel Background="Transparent" ToolTip.Tip="{Binding Name}">
<!-- Guild icon placeholder -->
<Ellipse
Width="48"
Height="48"
Margin="12"
Fill="{DynamicResource MaterialDividerBrush}"
/>
<!-- Guild icon -->
<Ellipse Width="48" Height="48" Margin="12">
<Ellipse.Fill>
<ImageBrush asyncImageLoader:ImageBrushLoader.Source="{Binding IconUrl}" />
</Ellipse.Fill>
</Ellipse>
</Panel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<!-- Channels -->
<Border Grid.Column="1">
<TreeView
x:Name="AvailableChannelsTreeView"
ItemsSource="{Binding AvailableChannels}"
SelectedItems="{Binding SelectedChannels}"
SelectionChanged="AvailableChannelsTreeView_OnSelectionChanged"
SelectionMode="Multiple"
TextSearch.Text="Name"
>
<TreeView.Styles>
<Style Selector="TreeView">
<Style Selector="^ TreeViewItem">
<Setter Property="Padding" Value="0" />
<Setter Property="Cursor" Value="Hand" />
</Style>
</Style>
</TreeView.Styles>
<TreeView.ItemTemplate>
<TreeDataTemplate ItemsSource="{Binding Children}">
<Grid
Background="Transparent"
Classes.category="{Binding Channel.IsCategory}"
ColumnDefinitions="Auto,*,Auto"
DoubleTapped="ChannelGrid_OnDoubleTapped"
>
<Grid.Styles>
<Style Selector="Grid">
<Style Selector="^:not(.category)">
<Setter Property="ToolTip.Tip">
<Template>
<TextBlock>
<Run Text="{Binding #UserControl.DataContext.LocalizationManager.LastMessageSentTooltip}" />
<Run
FontWeight="SemiBold"
Text="{Binding Channel.LastMessageId, Converter={x:Static converters:SnowflakeToTimestampStringConverter.Instance}, TargetNullValue=never, Mode=OneWay}"
/>
</TextBlock>
</Template>
</Setter>
</Style>
</Style>
</Grid.Styles>
<!-- Channel icon -->
<materialIcons:MaterialIcon
Grid.Column="0" Grid.Column="0"
BorderBrush="{DynamicResource MaterialDividerBrush}" Margin="0,0,4,0"
BorderThickness="0,0,1,0"> Classes.voice="{Binding Channel.IsVoice}"
<ListBox IsVisible="{Binding !Channel.IsCategory}"
x:Name="AvailableGuildsListBox" >
ItemsSource="{Binding AvailableGuilds}" <materialIcons:MaterialIcon.Styles>
ScrollViewer.VerticalScrollBarVisibility="Hidden" <Style Selector="materialIcons|MaterialIcon">
SelectedItem="{Binding SelectedGuild}" <Setter Property="Kind" Value="Pound" />
SelectionChanged="AvailableGuildsListBox_OnSelectionChanged"
SelectionMode="Single">
<ListBox.Styles>
<Style Selector="ListBox">
<Style Selector="^ ListBoxItem">
<Setter Property="Padding" Value="0" />
<Setter Property="Cursor" Value="Hand" />
</Style>
</Style>
</ListBox.Styles>
<ListBox.ItemTemplate>
<DataTemplate>
<Panel Background="Transparent" ToolTip.Tip="{Binding Name}">
<!-- Guild icon placeholder -->
<Ellipse
Width="48"
Height="48"
Margin="12"
Fill="{DynamicResource MaterialDividerBrush}" />
<!-- Guild icon --> <Style Selector="^.voice">
<Ellipse <Setter Property="Kind" Value="VolumeHigh" />
Width="48" </Style>
Height="48" </Style>
Margin="12"> </materialIcons:MaterialIcon.Styles>
<Ellipse.Fill> </materialIcons:MaterialIcon>
<ImageBrush asyncImageLoader:ImageBrushLoader.Source="{Binding IconUrl}" />
</Ellipse.Fill>
</Ellipse>
</Panel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<!-- Channels --> <!-- Channel name -->
<Border Grid.Column="1"> <TextBlock
<TreeView Grid.Column="1"
x:Name="AvailableChannelsTreeView" Margin="0,12"
ItemsSource="{Binding AvailableChannels}" FontSize="14"
SelectedItems="{Binding SelectedChannels}" Text="{Binding Channel.Name, Mode=OneWay}"
SelectionChanged="AvailableChannelsTreeView_OnSelectionChanged" />
SelectionMode="Multiple"
TextSearch.Text="Name">
<TreeView.Styles>
<Style Selector="TreeView">
<Style Selector="^ TreeViewItem">
<Setter Property="Padding" Value="0" />
<Setter Property="Cursor" Value="Hand" />
</Style>
</Style>
</TreeView.Styles>
<TreeView.ItemTemplate>
<TreeDataTemplate ItemsSource="{Binding Children}">
<Grid
Background="Transparent"
Classes.category="{Binding Channel.IsCategory}"
ColumnDefinitions="Auto,*,Auto"
DoubleTapped="ChannelGrid_OnDoubleTapped">
<Grid.Styles>
<Style Selector="Grid">
<Style Selector="^:not(.category)">
<Setter Property="ToolTip.Tip">
<Template>
<TextBlock>
<Run Text="{Binding #UserControl.DataContext.LocalizationManager.LastMessageSentTooltip}" />
<Run FontWeight="SemiBold" Text="{Binding Channel.LastMessageId, Converter={x:Static converters:SnowflakeToTimestampStringConverter.Instance}, TargetNullValue=never, Mode=OneWay}" />
</TextBlock>
</Template>
</Setter>
</Style>
</Style>
</Grid.Styles>
<!-- Channel icon --> <!-- Checkmark -->
<materialIcons:MaterialIcon <materialIcons:MaterialIcon
Grid.Column="0" Grid.Column="2"
Margin="0,0,4,0" Width="24"
Classes.voice="{Binding Channel.IsVoice}" Height="24"
IsVisible="{Binding !Channel.IsCategory}"> Margin="16,0"
<materialIcons:MaterialIcon.Styles> IsVisible="{Binding $parent[TreeViewItem].IsSelected}"
<Style Selector="materialIcons|MaterialIcon"> Kind="Check"
<Setter Property="Kind" Value="Pound" /> />
</Grid>
</TreeDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Border>
</Grid>
<Style Selector="^.voice"> <!-- Placeholder / usage instructions -->
<Setter Property="Kind" Value="VolumeHigh" /> <Panel IsVisible="{Binding !AvailableGuilds.Count}">
</Style> <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
</Style> <StackPanel Margin="32,16" Spacing="0">
</materialIcons:MaterialIcon.Styles> <!-- User token -->
</materialIcons:MaterialIcon> <TextBlock>
<InlineUIContainer>
<!-- Channel name -->
<TextBlock
Grid.Column="1"
Margin="0,12"
FontSize="14"
Text="{Binding Channel.Name, Mode=OneWay}" />
<!-- Checkmark -->
<materialIcons:MaterialIcon
Grid.Column="2"
Width="24"
Height="24"
Margin="16,0"
IsVisible="{Binding $parent[TreeViewItem].IsSelected}"
Kind="Check" />
</Grid>
</TreeDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Border>
</Grid>
<!-- Placeholder / usage instructions -->
<Panel IsVisible="{Binding !AvailableGuilds.Count}">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<StackPanel Margin="32,16" Spacing="0">
<!-- User token -->
<TextBlock>
<InlineUIContainer>
<materialIcons:MaterialIcon
Width="18"
Height="18"
Foreground="{DynamicResource PrimaryHueMidBrush}"
Kind="Account" />
</InlineUIContainer>
<Run Text="" />
<Run
FontSize="16"
FontWeight="SemiBold"
Text="{Binding LocalizationManager.TokenPersonalHeader}" />
</TextBlock>
<TextBlock
FontSize="14"
FontWeight="Light"
Inlines="{Binding LocalizationManager.TokenPersonalTosWarning, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
LineHeight="23"
TextWrapping="Wrap" />
<TextBlock
FontSize="14"
FontWeight="Light"
Inlines="{Binding LocalizationManager.TokenPersonalInstructions, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
LineHeight="23"
TextWrapping="Wrap" />
<!-- Bot token -->
<TextBlock Margin="0,12,0,0">
<InlineUIContainer>
<materialIcons:MaterialIcon
Width="18"
Height="18"
Foreground="{DynamicResource PrimaryHueMidBrush}"
Kind="Robot" />
</InlineUIContainer>
<Run Text="" />
<Run
FontSize="16"
FontWeight="SemiBold"
Text="{Binding LocalizationManager.TokenBotHeader}" />
</TextBlock>
<TextBlock
FontSize="14"
FontWeight="Light"
Inlines="{Binding LocalizationManager.TokenBotInstructions, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
LineHeight="23"
TextWrapping="Wrap" />
<TextBlock
Margin="0,12,0,0"
FontSize="14"
FontWeight="Light"
Inlines="{Binding LocalizationManager.TokenHelpText, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
LineHeight="23"
TextWrapping="Wrap" />
</StackPanel>
</ScrollViewer>
</Panel>
<!-- Export button -->
<Button
Width="56"
Height="56"
Margin="32,24"
Padding="0"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Background="{DynamicResource MaterialSecondaryMidBrush}"
Command="{Binding ExportCommand}"
Foreground="{DynamicResource MaterialSecondaryMidForegroundBrush}"
IsVisible="{Binding $self.IsEffectivelyEnabled}"
Theme="{DynamicResource MaterialIconButton}">
<materialIcons:MaterialIcon <materialIcons:MaterialIcon
Width="32" Width="18"
Height="32" Height="18"
Kind="Download" /> Foreground="{DynamicResource PrimaryHueMidBrush}"
</Button> Kind="Account"
</Panel> />
</DockPanel> </InlineUIContainer>
<Run Text="" />
<Run
FontSize="16"
FontWeight="SemiBold"
Text="{Binding LocalizationManager.TokenPersonalHeader}"
/>
</TextBlock>
<TextBlock
FontSize="14"
FontWeight="Light"
Inlines="{Binding LocalizationManager.TokenPersonalTosWarning, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
LineHeight="23"
TextWrapping="Wrap"
/>
<TextBlock
FontSize="14"
FontWeight="Light"
Inlines="{Binding LocalizationManager.TokenPersonalInstructions, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
LineHeight="23"
TextWrapping="Wrap"
/>
<!-- Bot token -->
<TextBlock Margin="0,12,0,0">
<InlineUIContainer>
<materialIcons:MaterialIcon
Width="18"
Height="18"
Foreground="{DynamicResource PrimaryHueMidBrush}"
Kind="Robot"
/>
</InlineUIContainer>
<Run Text="" />
<Run
FontSize="16"
FontWeight="SemiBold"
Text="{Binding LocalizationManager.TokenBotHeader}"
/>
</TextBlock>
<TextBlock
FontSize="14"
FontWeight="Light"
Inlines="{Binding LocalizationManager.TokenBotInstructions, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
LineHeight="23"
TextWrapping="Wrap"
/>
<TextBlock
Margin="0,12,0,0"
FontSize="14"
FontWeight="Light"
Inlines="{Binding LocalizationManager.TokenHelpText, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
LineHeight="23"
TextWrapping="Wrap"
/>
</StackPanel>
</ScrollViewer>
</Panel>
<!-- Export button -->
<Button
Width="56"
Height="56"
Margin="32,24"
Padding="0"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Background="{DynamicResource MaterialSecondaryMidBrush}"
Command="{Binding ExportCommand}"
Foreground="{DynamicResource MaterialSecondaryMidForegroundBrush}"
IsVisible="{Binding $self.IsEffectivelyEnabled}"
Theme="{DynamicResource MaterialIconButton}"
>
<materialIcons:MaterialIcon Width="32" Height="32" Kind="Download" />
</Button>
</Panel>
</DockPanel>
</UserControl> </UserControl>
@@ -1,20 +1,22 @@
<UserControl <UserControl
x:Class="DiscordChatExporter.Gui.Views.Controls.HyperLink" x:Class="DiscordChatExporter.Gui.Views.Controls.HyperLink"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:DiscordChatExporter.Gui.Views.Controls"> xmlns:controls="clr-namespace:DiscordChatExporter.Gui.Views.Controls"
<TextBlock >
x:Name="TextBlock" <TextBlock
Cursor="Hand" x:Name="TextBlock"
Foreground="{DynamicResource MaterialSecondaryDarkBrush}" Cursor="Hand"
PointerReleased="TextBlock_OnPointerReleased" Foreground="{DynamicResource MaterialSecondaryDarkBrush}"
Text="{Binding $parent[controls:HyperLink].Text, Mode=OneWay}"> PointerReleased="TextBlock_OnPointerReleased"
<TextBlock.Styles> Text="{Binding $parent[controls:HyperLink].Text, Mode=OneWay}"
<Style Selector="TextBlock"> >
<Style Selector="^:pointerover"> <TextBlock.Styles>
<Setter Property="TextDecorations" Value="Underline" /> <Style Selector="TextBlock">
</Style> <Style Selector="^:pointerover">
</Style> <Setter Property="TextDecorations" Value="Underline" />
</TextBlock.Styles> </Style>
</TextBlock> </Style>
</UserControl> </TextBlock.Styles>
</TextBlock>
</UserControl>
@@ -1,285 +1,308 @@
<UserControl <UserControl
x:Class="DiscordChatExporter.Gui.Views.Dialogs.ExportSetupView" x:Class="DiscordChatExporter.Gui.Views.Dialogs.ExportSetupView"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia" xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
xmlns:converters="clr-namespace:DiscordChatExporter.Gui.Converters" xmlns:converters="clr-namespace:DiscordChatExporter.Gui.Converters"
xmlns:dialogs="clr-namespace:DiscordChatExporter.Gui.ViewModels.Dialogs" xmlns:dialogs="clr-namespace:DiscordChatExporter.Gui.ViewModels.Dialogs"
xmlns:materialAssists="clr-namespace:Material.Styles.Assists;assembly=Material.Styles" xmlns:materialAssists="clr-namespace:Material.Styles.Assists;assembly=Material.Styles"
xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:utils="clr-namespace:DiscordChatExporter.Gui.Utils" xmlns:utils="clr-namespace:DiscordChatExporter.Gui.Utils"
x:Name="UserControl" x:Name="UserControl"
Width="380" Width="380"
x:DataType="dialogs:ExportSetupViewModel"> x:DataType="dialogs:ExportSetupViewModel"
<Grid RowDefinitions="Auto,*,Auto"> >
<!-- Guild/channel info --> <Grid RowDefinitions="Auto,*,Auto">
<Grid <!-- Guild/channel info -->
Grid.Row="0" <Grid Grid.Row="0" Margin="16" ColumnDefinitions="Auto,*">
Margin="16" <!-- Guild icon -->
ColumnDefinitions="Auto,*"> <Ellipse Grid.Column="0" Width="32" Height="32">
<!-- Guild icon --> <Ellipse.Fill>
<Ellipse <ImageBrush asyncImageLoader:ImageBrushLoader.Source="{Binding Guild.IconUrl}" />
Grid.Column="0" </Ellipse.Fill>
Width="32" </Ellipse>
Height="32">
<Ellipse.Fill>
<ImageBrush asyncImageLoader:ImageBrushLoader.Source="{Binding Guild.IconUrl}" />
</Ellipse.Fill>
</Ellipse>
<!-- Channel count (for multiple channels) --> <!-- Channel count (for multiple channels) -->
<TextBlock <TextBlock
Grid.Column="1" Grid.Column="1"
Margin="8,0,0,0" Margin="8,0,0,0"
VerticalAlignment="Center" VerticalAlignment="Center"
FontSize="19" FontSize="19"
FontWeight="Light" FontWeight="Light"
IsVisible="{Binding !IsSingleChannel}" IsVisible="{Binding !IsSingleChannel}"
TextTrimming="CharacterEllipsis"> TextTrimming="CharacterEllipsis"
<Run Text="{Binding Channels.Count, FallbackValue=0, Mode=OneWay}" /> >
<Run Text="{Binding LocalizationManager.ChannelsSelectedText}" /> <Run Text="{Binding Channels.Count, FallbackValue=0, Mode=OneWay}" />
</TextBlock> <Run Text="{Binding LocalizationManager.ChannelsSelectedText}" />
</TextBlock>
<!-- Category and channel name (for single channel) --> <!-- Category and channel name (for single channel) -->
<TextBlock <TextBlock
Grid.Column="1" Grid.Column="1"
Margin="8,0,0,0" Margin="8,0,0,0"
VerticalAlignment="Center" VerticalAlignment="Center"
FontSize="19" FontSize="19"
FontWeight="Light" FontWeight="Light"
IsVisible="{Binding IsSingleChannel}" IsVisible="{Binding IsSingleChannel}"
TextTrimming="CharacterEllipsis" TextTrimming="CharacterEllipsis"
ToolTip.Tip="{Binding Channels[0], Converter={x:Static converters:ChannelToHierarchicalNameStringConverter.Instance}}"> ToolTip.Tip="{Binding Channels[0], Converter={x:Static converters:ChannelToHierarchicalNameStringConverter.Instance}}"
<Run Text="{Binding Channels[0].Parent.Name, StringFormat='{}{0} / ', FallbackValue='', TargetNullValue='', Mode=OneWay}" /><Run FontWeight="SemiBold" Text="{Binding Channels[0].Name, Mode=OneWay}" /> >
</TextBlock> <Run Text="{Binding Channels[0].Parent.Name, StringFormat='{}{0} / ', FallbackValue='', TargetNullValue='', Mode=OneWay}" />
</Grid> <Run FontWeight="SemiBold" Text="{Binding Channels[0].Name, Mode=OneWay}" />
</TextBlock>
<Border
Grid.Row="1"
Padding="0,8"
BorderBrush="{DynamicResource MaterialDividerBrush}"
BorderThickness="0,1">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<StackPanel Orientation="Vertical">
<!-- Output path -->
<TextBox
Margin="16,8"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.OutputPathLabel}"
Text="{Binding OutputPath}"
Theme="{DynamicResource FilledTextBox}">
<ToolTip.Tip>
<TextBlock
MaxWidth="400"
Inlines="{Binding LocalizationManager.OutputPathTooltip, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
TextWrapping="Wrap" />
</ToolTip.Tip>
<TextBox.InnerRightContent>
<Button
Margin="8,8,8,6"
Padding="8"
VerticalAlignment="Center"
Command="{Binding ShowOutputPathPromptCommand}"
Theme="{DynamicResource MaterialFlatButton}">
<materialIcons:MaterialIcon
Width="20"
Height="20"
Kind="FolderOpen" />
</Button>
</TextBox.InnerRightContent>
</TextBox>
<!-- Format -->
<ComboBox
Margin="16,8"
materialAssists:ComboBoxAssist.Label="{Binding LocalizationManager.FormatLabel}"
ItemsSource="{Binding AvailableFormats}"
SelectedItem="{Binding SelectedFormat}"
Theme="{DynamicResource MaterialFilledComboBox}"
ToolTip.Tip="{Binding LocalizationManager.FormatTooltip}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={x:Static converters:ExportFormatToStringConverter.Instance}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Advanced section -->
<StackPanel
Margin="16,8"
IsVisible="{Binding IsAdvancedSectionDisplayed}"
Orientation="Vertical"
Spacing="16">
<!-- Date limits -->
<Grid
ColumnDefinitions="*,*"
ColumnSpacing="16"
RowDefinitions="*,*"
RowSpacing="16">
<DatePicker
Grid.Row="0"
Grid.Column="0"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.AfterDateLabel}"
SelectedDate="{Binding AfterDate}"
ToolTip.Tip="{Binding LocalizationManager.AfterDateTooltip}">
<DatePicker.Styles>
<Style Selector="DatePicker">
<Style Selector="^ /template/ TextBox#DisplayTextBox">
<Setter Property="Theme" Value="{DynamicResource FilledTextBox}" />
</Style>
</Style>
</DatePicker.Styles>
</DatePicker>
<DatePicker
Grid.Row="0"
Grid.Column="1"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.BeforeDateLabel}"
SelectedDate="{Binding BeforeDate}"
ToolTip.Tip="{Binding LocalizationManager.BeforeDateTooltip}">
<DatePicker.Styles>
<Style Selector="DatePicker">
<Style Selector="^ /template/ TextBox#DisplayTextBox">
<Setter Property="Theme" Value="{DynamicResource FilledTextBox}" />
</Style>
</Style>
</DatePicker.Styles>
</DatePicker>
<!-- Time limits -->
<TimePicker
Grid.Row="1"
Grid.Column="0"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.AfterTimeLabel}"
ClockIdentifier="{x:Static utils:Internationalization.AvaloniaClockIdentifier}"
IsEnabled="{Binding IsAfterDateSet}"
SelectedTime="{Binding AfterTime}"
ToolTip.Tip="{Binding LocalizationManager.AfterTimeTooltip}">
<TimePicker.Styles>
<Style Selector="TimePicker">
<Style Selector="^ /template/ TextBox#PART_DisplayTextBox">
<Setter Property="Theme" Value="{DynamicResource FilledTextBox}" />
</Style>
</Style>
</TimePicker.Styles>
</TimePicker>
<TimePicker
Grid.Row="1"
Grid.Column="1"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.BeforeTimeLabel}"
ClockIdentifier="{x:Static utils:Internationalization.AvaloniaClockIdentifier}"
IsEnabled="{Binding IsBeforeDateSet}"
SelectedTime="{Binding BeforeTime}"
ToolTip.Tip="{Binding LocalizationManager.BeforeTimeTooltip}">
<TimePicker.Styles>
<Style Selector="TimePicker">
<Style Selector="^ /template/ TextBox#PART_DisplayTextBox">
<Setter Property="Theme" Value="{DynamicResource FilledTextBox}" />
</Style>
</Style>
</TimePicker.Styles>
</TimePicker>
</Grid>
<!-- Partitioning -->
<TextBox
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.PartitionLimitLabel}"
Text="{Binding PartitionLimitValue}"
Theme="{DynamicResource FilledTextBox}"
ToolTip.Tip="{Binding LocalizationManager.PartitionLimitTooltip}" />
<!-- Filtering -->
<TextBox
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.MessageFilterLabel}"
Text="{Binding MessageFilterValue}"
Theme="{DynamicResource FilledTextBox}"
ToolTip.Tip="{Binding LocalizationManager.MessageFilterTooltip}" />
<!-- Reverse message order -->
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.ReverseMessageOrderTooltip}">
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.ReverseMessageOrderLabel}" />
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding IsReverseMessageOrder}" />
</DockPanel>
<!-- Markdown formatting -->
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.FormatMarkdownTooltip}">
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.FormatMarkdownLabel}" />
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding ShouldFormatMarkdown}" />
</DockPanel>
<!-- Download assets -->
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.DownloadAssetsTooltip}">
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.DownloadAssetsLabel}" />
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding ShouldDownloadAssets}" />
</DockPanel>
<!-- Reuse assets -->
<DockPanel
IsEnabled="{Binding ShouldDownloadAssets}"
LastChildFill="False"
ToolTip.Tip="{Binding LocalizationManager.ReuseAssetsTooltip}">
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.ReuseAssetsLabel}" />
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding ShouldReuseAssets}" />
</DockPanel>
<!-- Assets path -->
<TextBox
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.AssetsDirPathLabel}"
IsEnabled="{Binding ShouldDownloadAssets}"
Text="{Binding AssetsDirPath}"
Theme="{DynamicResource FilledTextBox}"
ToolTip.Tip="{Binding LocalizationManager.AssetsDirPathTooltip}">
<TextBox.InnerRightContent>
<Button
Margin="8,8,8,6"
Padding="8"
VerticalAlignment="Center"
Command="{Binding ShowAssetsDirPathPromptCommand}"
Theme="{DynamicResource MaterialFlatButton}">
<materialIcons:MaterialIcon
Width="20"
Height="20"
Kind="FolderOpen" />
</Button>
</TextBox.InnerRightContent>
</TextBox>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Border>
<!-- Buttons -->
<Grid
Grid.Row="2"
Margin="16"
ColumnDefinitions="Auto,*,Auto,Auto"
ColumnSpacing="8">
<ToggleButton
Grid.Column="0"
IsChecked="{Binding IsAdvancedSectionDisplayed}"
Theme="{DynamicResource MaterialOutlineButton}"
ToolTip.Tip="{Binding LocalizationManager.AdvancedOptionsTooltip}">
<Button.Styles>
<Style Selector="ToggleButton">
<Setter Property="Content" Value="MORE" />
<Style Selector="^:checked">
<Setter Property="Content" Value="LESS" />
</Style>
</Style>
</Button.Styles>
</ToggleButton>
<Button
Grid.Column="2"
Command="{Binding ConfirmCommand}"
Content="{Binding LocalizationManager.ExportButton}"
IsDefault="True"
Theme="{DynamicResource MaterialOutlineButton}" />
<Button
Grid.Column="3"
Command="{Binding CloseCommand}"
Content="{Binding LocalizationManager.CancelButton}"
IsCancel="True"
Theme="{DynamicResource MaterialOutlineButton}" />
</Grid>
</Grid> </Grid>
<Border
Grid.Row="1"
Padding="0,8"
BorderBrush="{DynamicResource MaterialDividerBrush}"
BorderThickness="0,1"
>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<StackPanel Orientation="Vertical">
<!-- Output path -->
<TextBox
Margin="16,8"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.OutputPathLabel}"
Text="{Binding OutputPath}"
Theme="{DynamicResource FilledTextBox}"
>
<ToolTip.Tip>
<TextBlock
MaxWidth="400"
Inlines="{Binding LocalizationManager.OutputPathTooltip, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
TextWrapping="Wrap"
/>
</ToolTip.Tip>
<TextBox.InnerRightContent>
<Button
Margin="8,8,8,6"
Padding="8"
VerticalAlignment="Center"
Command="{Binding ShowOutputPathPromptCommand}"
Theme="{DynamicResource MaterialFlatButton}"
>
<materialIcons:MaterialIcon Width="20" Height="20" Kind="FolderOpen" />
</Button>
</TextBox.InnerRightContent>
</TextBox>
<!-- Format -->
<ComboBox
Margin="16,8"
materialAssists:ComboBoxAssist.Label="{Binding LocalizationManager.FormatLabel}"
ItemsSource="{Binding AvailableFormats}"
SelectedItem="{Binding SelectedFormat}"
Theme="{DynamicResource MaterialFilledComboBox}"
ToolTip.Tip="{Binding LocalizationManager.FormatTooltip}"
>
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={x:Static converters:ExportFormatToStringConverter.Instance}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Advanced section -->
<StackPanel
Margin="16,8"
IsVisible="{Binding IsAdvancedSectionDisplayed}"
Orientation="Vertical"
Spacing="16"
>
<!-- Date limits -->
<Grid ColumnDefinitions="*,*" ColumnSpacing="16" RowDefinitions="*,*" RowSpacing="16">
<DatePicker
Grid.Row="0"
Grid.Column="0"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.AfterDateLabel}"
SelectedDate="{Binding AfterDate}"
ToolTip.Tip="{Binding LocalizationManager.AfterDateTooltip}"
>
<DatePicker.Styles>
<Style Selector="DatePicker">
<Style Selector="^ /template/ TextBox#DisplayTextBox">
<Setter Property="Theme" Value="{DynamicResource FilledTextBox}" />
</Style>
</Style>
</DatePicker.Styles>
</DatePicker>
<DatePicker
Grid.Row="0"
Grid.Column="1"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.BeforeDateLabel}"
SelectedDate="{Binding BeforeDate}"
ToolTip.Tip="{Binding LocalizationManager.BeforeDateTooltip}"
>
<DatePicker.Styles>
<Style Selector="DatePicker">
<Style Selector="^ /template/ TextBox#DisplayTextBox">
<Setter Property="Theme" Value="{DynamicResource FilledTextBox}" />
</Style>
</Style>
</DatePicker.Styles>
</DatePicker>
<!-- Time limits -->
<TimePicker
Grid.Row="1"
Grid.Column="0"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.AfterTimeLabel}"
ClockIdentifier="{x:Static utils:Internationalization.AvaloniaClockIdentifier}"
IsEnabled="{Binding IsAfterDateSet}"
SelectedTime="{Binding AfterTime}"
ToolTip.Tip="{Binding LocalizationManager.AfterTimeTooltip}"
>
<TimePicker.Styles>
<Style Selector="TimePicker">
<Style Selector="^ /template/ TextBox#PART_DisplayTextBox">
<Setter Property="Theme" Value="{DynamicResource FilledTextBox}" />
</Style>
</Style>
</TimePicker.Styles>
</TimePicker>
<TimePicker
Grid.Row="1"
Grid.Column="1"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.BeforeTimeLabel}"
ClockIdentifier="{x:Static utils:Internationalization.AvaloniaClockIdentifier}"
IsEnabled="{Binding IsBeforeDateSet}"
SelectedTime="{Binding BeforeTime}"
ToolTip.Tip="{Binding LocalizationManager.BeforeTimeTooltip}"
>
<TimePicker.Styles>
<Style Selector="TimePicker">
<Style Selector="^ /template/ TextBox#PART_DisplayTextBox">
<Setter Property="Theme" Value="{DynamicResource FilledTextBox}" />
</Style>
</Style>
</TimePicker.Styles>
</TimePicker>
</Grid>
<!-- Partitioning -->
<TextBox
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.PartitionLimitLabel}"
Text="{Binding PartitionLimitValue}"
Theme="{DynamicResource FilledTextBox}"
ToolTip.Tip="{Binding LocalizationManager.PartitionLimitTooltip}"
/>
<!-- Filtering -->
<TextBox
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.MessageFilterLabel}"
Text="{Binding MessageFilterValue}"
Theme="{DynamicResource FilledTextBox}"
ToolTip.Tip="{Binding LocalizationManager.MessageFilterTooltip}"
/>
<!-- Reverse message order -->
<DockPanel
LastChildFill="False"
ToolTip.Tip="{Binding LocalizationManager.ReverseMessageOrderTooltip}"
>
<TextBlock
DockPanel.Dock="Left"
Text="{Binding LocalizationManager.ReverseMessageOrderLabel}"
/>
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding IsReverseMessageOrder}" />
</DockPanel>
<!-- Markdown formatting -->
<DockPanel
LastChildFill="False"
ToolTip.Tip="{Binding LocalizationManager.FormatMarkdownTooltip}"
>
<TextBlock
DockPanel.Dock="Left"
Text="{Binding LocalizationManager.FormatMarkdownLabel}"
/>
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding ShouldFormatMarkdown}" />
</DockPanel>
<!-- Download assets -->
<DockPanel
LastChildFill="False"
ToolTip.Tip="{Binding LocalizationManager.DownloadAssetsTooltip}"
>
<TextBlock
DockPanel.Dock="Left"
Text="{Binding LocalizationManager.DownloadAssetsLabel}"
/>
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding ShouldDownloadAssets}" />
</DockPanel>
<!-- Reuse assets -->
<DockPanel
IsEnabled="{Binding ShouldDownloadAssets}"
LastChildFill="False"
ToolTip.Tip="{Binding LocalizationManager.ReuseAssetsTooltip}"
>
<TextBlock
DockPanel.Dock="Left"
Text="{Binding LocalizationManager.ReuseAssetsLabel}"
/>
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding ShouldReuseAssets}" />
</DockPanel>
<!-- Assets path -->
<TextBox
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.AssetsDirPathLabel}"
IsEnabled="{Binding ShouldDownloadAssets}"
Text="{Binding AssetsDirPath}"
Theme="{DynamicResource FilledTextBox}"
ToolTip.Tip="{Binding LocalizationManager.AssetsDirPathTooltip}"
>
<TextBox.InnerRightContent>
<Button
Margin="8,8,8,6"
Padding="8"
VerticalAlignment="Center"
Command="{Binding ShowAssetsDirPathPromptCommand}"
Theme="{DynamicResource MaterialFlatButton}"
>
<materialIcons:MaterialIcon Width="20" Height="20" Kind="FolderOpen" />
</Button>
</TextBox.InnerRightContent>
</TextBox>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Border>
<!-- Buttons -->
<Grid Grid.Row="2" Margin="16" ColumnDefinitions="Auto,*,Auto,Auto" ColumnSpacing="8">
<ToggleButton
Grid.Column="0"
IsChecked="{Binding IsAdvancedSectionDisplayed}"
Theme="{DynamicResource MaterialOutlineButton}"
ToolTip.Tip="{Binding LocalizationManager.AdvancedOptionsTooltip}"
>
<Button.Styles>
<Style Selector="ToggleButton">
<Setter Property="Content" Value="MORE" />
<Style Selector="^:checked">
<Setter Property="Content" Value="LESS" />
</Style>
</Style>
</Button.Styles>
</ToggleButton>
<Button
Grid.Column="2"
Command="{Binding ConfirmCommand}"
Content="{Binding LocalizationManager.ExportButton}"
IsDefault="True"
Theme="{DynamicResource MaterialOutlineButton}"
/>
<Button
Grid.Column="3"
Command="{Binding CloseCommand}"
Content="{Binding LocalizationManager.CancelButton}"
IsCancel="True"
Theme="{DynamicResource MaterialOutlineButton}"
/>
</Grid>
</Grid>
</UserControl> </UserControl>
@@ -1,72 +1,73 @@
<UserControl <UserControl
x:Class="DiscordChatExporter.Gui.Views.Dialogs.MessageBoxView" x:Class="DiscordChatExporter.Gui.Views.Dialogs.MessageBoxView"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dialogs="clr-namespace:DiscordChatExporter.Gui.ViewModels.Dialogs" xmlns:dialogs="clr-namespace:DiscordChatExporter.Gui.ViewModels.Dialogs"
xmlns:system="clr-namespace:System;assembly=System.Runtime" xmlns:system="clr-namespace:System;assembly=System.Runtime"
Width="500" Width="500"
x:DataType="dialogs:MessageBoxViewModel"> x:DataType="dialogs:MessageBoxViewModel"
<Grid RowDefinitions="Auto,*,Auto"> >
<!-- Title --> <Grid RowDefinitions="Auto,*,Auto">
<!-- Title -->
<TextBlock
Grid.Row="0"
Margin="16"
FontSize="19"
FontWeight="Light"
Text="{Binding Title}"
TextTrimming="CharacterEllipsis"
ToolTip.Tip="{Binding Title}"
/>
<!-- Message -->
<Border
Grid.Row="1"
Padding="0,8"
BorderBrush="{DynamicResource MaterialDividerBrush}"
BorderThickness="0,1"
>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<TextBlock Margin="16,8" Text="{Binding Message}" TextWrapping="Wrap" />
</ScrollViewer>
</Border>
<UniformGrid Grid.Row="2" Margin="8" Columns="{Binding ButtonsCount}">
<!-- OK -->
<Button
Margin="8"
HorizontalContentAlignment="Stretch"
Command="{Binding CloseCommand}"
IsDefault="True"
IsVisible="{Binding IsDefaultButtonVisible}"
Theme="{DynamicResource MaterialOutlineButton}"
ToolTip.Tip="{Binding DefaultButtonText}"
>
<Button.CommandParameter>
<system:Boolean>True</system:Boolean>
</Button.CommandParameter>
<TextBlock <TextBlock
Grid.Row="0" Text="{Binding DefaultButtonText}"
Margin="16" TextAlignment="Center"
FontSize="19" TextTrimming="CharacterEllipsis"
FontWeight="Light" />
Text="{Binding Title}" </Button>
TextTrimming="CharacterEllipsis"
ToolTip.Tip="{Binding Title}" />
<!-- Message --> <!-- Cancel -->
<Border <Button
Grid.Row="1" Margin="8"
Padding="0,8" HorizontalContentAlignment="Stretch"
BorderBrush="{DynamicResource MaterialDividerBrush}" Command="{Binding CloseCommand}"
BorderThickness="0,1"> IsCancel="True"
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> IsVisible="{Binding IsCancelButtonVisible}"
<TextBlock Theme="{DynamicResource MaterialOutlineButton}"
Margin="16,8" ToolTip.Tip="{Binding CancelButtonText}"
Text="{Binding Message}" >
TextWrapping="Wrap" /> <TextBlock
</ScrollViewer> Text="{Binding CancelButtonText}"
</Border> TextAlignment="Center"
TextTrimming="CharacterEllipsis"
<UniformGrid />
Grid.Row="2" </Button>
Margin="8" </UniformGrid>
Columns="{Binding ButtonsCount}"> </Grid>
<!-- OK --> </UserControl>
<Button
Margin="8"
HorizontalContentAlignment="Stretch"
Command="{Binding CloseCommand}"
IsDefault="True"
IsVisible="{Binding IsDefaultButtonVisible}"
Theme="{DynamicResource MaterialOutlineButton}"
ToolTip.Tip="{Binding DefaultButtonText}">
<Button.CommandParameter>
<system:Boolean>True</system:Boolean>
</Button.CommandParameter>
<TextBlock
Text="{Binding DefaultButtonText}"
TextAlignment="Center"
TextTrimming="CharacterEllipsis" />
</Button>
<!-- Cancel -->
<Button
Margin="8"
HorizontalContentAlignment="Stretch"
Command="{Binding CloseCommand}"
IsCancel="True"
IsVisible="{Binding IsCancelButtonVisible}"
Theme="{DynamicResource MaterialOutlineButton}"
ToolTip.Tip="{Binding CancelButtonText}">
<TextBlock
Text="{Binding CancelButtonText}"
TextAlignment="Center"
TextTrimming="CharacterEllipsis" />
</Button>
</UniformGrid>
</Grid>
</UserControl>
@@ -1,148 +1,187 @@
<UserControl <UserControl
x:Class="DiscordChatExporter.Gui.Views.Dialogs.SettingsView" x:Class="DiscordChatExporter.Gui.Views.Dialogs.SettingsView"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:DiscordChatExporter.Gui.Converters" xmlns:converters="clr-namespace:DiscordChatExporter.Gui.Converters"
xmlns:dialogs="clr-namespace:DiscordChatExporter.Gui.ViewModels.Dialogs" xmlns:dialogs="clr-namespace:DiscordChatExporter.Gui.ViewModels.Dialogs"
Width="380" Width="380"
x:DataType="dialogs:SettingsViewModel"> x:DataType="dialogs:SettingsViewModel"
<Grid RowDefinitions="Auto,*,Auto"> >
<TextBlock <Grid RowDefinitions="Auto,*,Auto">
Grid.Row="0" <TextBlock
Margin="16" Grid.Row="0"
FontSize="19" Margin="16"
FontWeight="Light" FontSize="19"
Text="{Binding LocalizationManager.SettingsTitle}" /> FontWeight="Light"
Text="{Binding LocalizationManager.SettingsTitle}"
/>
<Border <Border
Grid.Row="1" Grid.Row="1"
Padding="0,8" Padding="0,8"
BorderBrush="{DynamicResource MaterialDividerBrush}" BorderBrush="{DynamicResource MaterialDividerBrush}"
BorderThickness="0,1"> BorderThickness="0,1"
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> >
<StackPanel <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
Margin="16,8" <StackPanel Margin="16,8" Orientation="Vertical" Spacing="16">
Orientation="Vertical" <!-- Theme -->
Spacing="16"> <DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.ThemeTooltip}">
<!-- Theme --> <TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.ThemeLabel}" />
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.ThemeTooltip}"> <ComboBox
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.ThemeLabel}" /> Width="150"
<ComboBox DockPanel.Dock="Right"
Width="150" ItemsSource="{Binding AvailableThemes}"
DockPanel.Dock="Right" SelectedItem="{Binding Theme}"
ItemsSource="{Binding AvailableThemes}" />
SelectedItem="{Binding Theme}" /> </DockPanel>
</DockPanel>
<!-- Language --> <!-- Language -->
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.LanguageTooltip}"> <DockPanel
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.LanguageLabel}" /> LastChildFill="False"
<ComboBox ToolTip.Tip="{Binding LocalizationManager.LanguageTooltip}"
Width="150" >
DockPanel.Dock="Right" <TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.LanguageLabel}" />
ItemsSource="{Binding AvailableLanguages}" <ComboBox
SelectedItem="{Binding Language}" /> Width="150"
</DockPanel> DockPanel.Dock="Right"
ItemsSource="{Binding AvailableLanguages}"
SelectedItem="{Binding Language}"
/>
</DockPanel>
<!-- Auto-updates --> <!-- Auto-updates -->
<DockPanel <DockPanel
IsVisible="{Binding IsAutoUpdateAvailable}" IsVisible="{Binding IsAutoUpdateAvailable}"
LastChildFill="False" LastChildFill="False"
ToolTip.Tip="{Binding LocalizationManager.AutoUpdateTooltip}"> ToolTip.Tip="{Binding LocalizationManager.AutoUpdateTooltip}"
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.AutoUpdateLabel}" /> >
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding IsAutoUpdateEnabled}" /> <TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.AutoUpdateLabel}" />
</DockPanel> <ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding IsAutoUpdateEnabled}" />
</DockPanel>
<!-- Persist token --> <!-- Persist token -->
<DockPanel LastChildFill="False"> <DockPanel LastChildFill="False">
<ToolTip.Tip> <ToolTip.Tip>
<TextBlock <TextBlock
MaxWidth="400" MaxWidth="400"
Inlines="{Binding LocalizationManager.PersistTokenTooltip, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}" Inlines="{Binding LocalizationManager.PersistTokenTooltip, Converter={x:Static converters:MarkdownToInlinesConverter.Instance}}"
TextWrapping="Wrap" /> TextWrapping="Wrap"
</ToolTip.Tip> />
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.PersistTokenLabel}" /> </ToolTip.Tip>
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding IsTokenPersisted}" /> <TextBlock
</DockPanel> DockPanel.Dock="Left"
Text="{Binding LocalizationManager.PersistTokenLabel}"
/>
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding IsTokenPersisted}" />
</DockPanel>
<!-- Rate limit preference --> <!-- Rate limit preference -->
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.RateLimitPreferenceTooltip}"> <DockPanel
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.RateLimitPreferenceLabel}" /> LastChildFill="False"
<ComboBox ToolTip.Tip="{Binding LocalizationManager.RateLimitPreferenceTooltip}"
Width="150" >
DockPanel.Dock="Right" <TextBlock
ItemsSource="{Binding AvailableRateLimitPreferences}" DockPanel.Dock="Left"
SelectedItem="{Binding RateLimitPreference}"> Text="{Binding LocalizationManager.RateLimitPreferenceLabel}"
<ComboBox.ItemTemplate> />
<DataTemplate> <ComboBox
<TextBlock Text="{Binding Converter={x:Static converters:RateLimitPreferenceToStringConverter.Instance}}" /> Width="150"
</DataTemplate> DockPanel.Dock="Right"
</ComboBox.ItemTemplate> ItemsSource="{Binding AvailableRateLimitPreferences}"
</ComboBox> SelectedItem="{Binding RateLimitPreference}"
</DockPanel> >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={x:Static converters:RateLimitPreferenceToStringConverter.Instance}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DockPanel>
<!-- Thread inclusion mode --> <!-- Thread inclusion mode -->
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.ShowThreadsTooltip}"> <DockPanel
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.ShowThreadsLabel}" /> LastChildFill="False"
<ComboBox ToolTip.Tip="{Binding LocalizationManager.ShowThreadsTooltip}"
Width="150" >
DockPanel.Dock="Right" <TextBlock
ItemsSource="{Binding AvailableThreadInclusionModes}" DockPanel.Dock="Left"
SelectedItem="{Binding ThreadInclusionMode}" /> Text="{Binding LocalizationManager.ShowThreadsLabel}"
</DockPanel> />
<ComboBox
Width="150"
DockPanel.Dock="Right"
ItemsSource="{Binding AvailableThreadInclusionModes}"
SelectedItem="{Binding ThreadInclusionMode}"
/>
</DockPanel>
<!-- Locale --> <!-- Locale -->
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.LocaleTooltip}"> <DockPanel
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.LocaleLabel}" /> LastChildFill="False"
<ComboBox ToolTip.Tip="{Binding LocalizationManager.LocaleTooltip}"
Width="150" >
DockPanel.Dock="Right" <TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.LocaleLabel}" />
ItemsSource="{Binding AvailableLocales}" <ComboBox
SelectedItem="{Binding Locale}"> Width="150"
<ComboBox.ItemTemplate> DockPanel.Dock="Right"
<DataTemplate> ItemsSource="{Binding AvailableLocales}"
<TextBlock Text="{Binding Converter={x:Static converters:LocaleToDisplayNameStringConverter.Instance}}" /> SelectedItem="{Binding Locale}"
</DataTemplate> >
</ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
</ComboBox> <DataTemplate>
</DockPanel> <TextBlock Text="{Binding Converter={x:Static converters:LocaleToDisplayNameStringConverter.Instance}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DockPanel>
<!-- UTC normalization --> <!-- UTC normalization -->
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.NormalizeToUtcTooltip}"> <DockPanel
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.NormalizeToUtcLabel}" /> LastChildFill="False"
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding IsUtcNormalizationEnabled}" /> ToolTip.Tip="{Binding LocalizationManager.NormalizeToUtcTooltip}"
</DockPanel> >
<TextBlock
DockPanel.Dock="Left"
Text="{Binding LocalizationManager.NormalizeToUtcLabel}"
/>
<ToggleSwitch DockPanel.Dock="Right" IsChecked="{Binding IsUtcNormalizationEnabled}" />
</DockPanel>
<!-- Parallel limit --> <!-- Parallel limit -->
<DockPanel LastChildFill="False" ToolTip.Tip="{Binding LocalizationManager.ParallelLimitTooltip}"> <DockPanel
<TextBlock DockPanel.Dock="Left" Text="{Binding LocalizationManager.ParallelLimitLabel}" /> LastChildFill="False"
<StackPanel ToolTip.Tip="{Binding LocalizationManager.ParallelLimitTooltip}"
DockPanel.Dock="Right" >
Orientation="Horizontal" <TextBlock
Spacing="10"> DockPanel.Dock="Left"
<TextBlock Text="{Binding ParallelLimit}" /> Text="{Binding LocalizationManager.ParallelLimitLabel}"
<Slider />
Width="150" <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Spacing="10">
IsSnapToTickEnabled="True" <TextBlock Text="{Binding ParallelLimit}" />
Maximum="10" <Slider
Minimum="1" Width="150"
TickFrequency="1" IsSnapToTickEnabled="True"
Value="{Binding ParallelLimit}" /> Maximum="10"
</StackPanel> Minimum="1"
</DockPanel> TickFrequency="1"
</StackPanel> Value="{Binding ParallelLimit}"
</ScrollViewer> />
</Border> </StackPanel>
</DockPanel>
</StackPanel>
</ScrollViewer>
</Border>
<!-- Close button --> <!-- Close button -->
<Button <Button
Grid.Row="2" Grid.Row="2"
Margin="16" Margin="16"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Command="{Binding CloseCommand}" Command="{Binding CloseCommand}"
Content="{Binding LocalizationManager.CloseButton}" Content="{Binding LocalizationManager.CloseButton}"
IsCancel="True" IsCancel="True"
IsDefault="True" IsDefault="True"
Theme="{DynamicResource MaterialOutlineButton}" /> Theme="{DynamicResource MaterialOutlineButton}"
</Grid> />
</Grid>
</UserControl> </UserControl>
+21 -20
View File
@@ -1,22 +1,23 @@
<Window <Window
x:Class="DiscordChatExporter.Gui.Views.MainView" x:Class="DiscordChatExporter.Gui.Views.MainView"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia" xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:materialStyles="clr-namespace:Material.Styles.Controls;assembly=Material.Styles" xmlns:materialStyles="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
xmlns:viewModels="clr-namespace:DiscordChatExporter.Gui.ViewModels" xmlns:viewModels="clr-namespace:DiscordChatExporter.Gui.ViewModels"
Title="{Binding Title}" Title="{Binding Title}"
Width="625" Width="625"
Height="665" Height="665"
MinWidth="600" MinWidth="600"
MinHeight="400" MinHeight="400"
x:DataType="viewModels:MainViewModel" x:DataType="viewModels:MainViewModel"
Icon="/favicon.ico" Icon="/favicon.ico"
RenderOptions.BitmapInterpolationMode="HighQuality" RenderOptions.BitmapInterpolationMode="HighQuality"
WindowStartupLocation="CenterScreen"> WindowStartupLocation="CenterScreen"
<dialogHostAvalonia:DialogHost x:Name="DialogHost" CloseOnClickAway="False"> >
<materialStyles:SnackbarHost HostName="Root" SnackbarMaxCounts="3"> <dialogHostAvalonia:DialogHost x:Name="DialogHost" CloseOnClickAway="False">
<ContentControl Content="{Binding Dashboard}" /> <materialStyles:SnackbarHost HostName="Root" SnackbarMaxCounts="3">
</materialStyles:SnackbarHost> <ContentControl Content="{Binding Dashboard}" />
</dialogHostAvalonia:DialogHost> </materialStyles:SnackbarHost>
</dialogHostAvalonia:DialogHost>
</Window> </Window>