mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-24 19:54:22 -04:00
Remove Tyrrrz.Extensions package
This commit is contained in:
parent
720e53caab
commit
1db2bb4170
8 changed files with 20 additions and 28 deletions
|
@ -9,7 +9,6 @@
|
|||
<PackageReference Include="CliFx" Version="2.0.6" />
|
||||
<PackageReference Include="Spectre.Console" Version="0.42.0" />
|
||||
<PackageReference Include="Gress" Version="1.2.0" />
|
||||
<PackageReference Include="Tyrrrz.Extensions" Version="1.6.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Text.Json;
|
|||
using DiscordChatExporter.Core.Discord.Data.Common;
|
||||
using DiscordChatExporter.Core.Utils.Extensions;
|
||||
using JsonExtensions.Reading;
|
||||
using Tyrrrz.Extensions;
|
||||
|
||||
namespace DiscordChatExporter.Core.Discord.Data
|
||||
{
|
||||
|
@ -55,7 +54,7 @@ namespace DiscordChatExporter.Core.Discord.Data
|
|||
json.GetPropertyOrNull("name")?.GetStringOrNull() ??
|
||||
// DM channel
|
||||
json.GetPropertyOrNull("recipients")?.EnumerateArray().Select(User.Parse).Select(u => u.Name)
|
||||
.JoinToString(", ") ??
|
||||
.Pipe(s => string.Join(", ", s)) ??
|
||||
// Fallback
|
||||
id.ToString();
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Text.Json;
|
|||
using DiscordChatExporter.Core.Utils;
|
||||
using DiscordChatExporter.Core.Utils.Extensions;
|
||||
using JsonExtensions.Reading;
|
||||
using Tyrrrz.Extensions;
|
||||
|
||||
namespace DiscordChatExporter.Core.Discord.Data
|
||||
{
|
||||
|
@ -24,12 +23,13 @@ namespace DiscordChatExporter.Core.Discord.Data
|
|||
|
||||
public partial record Emoji
|
||||
{
|
||||
private static string GetTwemojiName(string name) => name
|
||||
private static string GetTwemojiName(string name) => string.Join("-",
|
||||
name
|
||||
.GetRunes()
|
||||
// Variant selector rune is skipped in Twemoji names
|
||||
.Where(r => r.Value != 0xfe0f)
|
||||
.Select(r => r.Value.ToString("x"))
|
||||
.JoinToString("-");
|
||||
);
|
||||
|
||||
public static string GetImageUrl(string? id, string name, bool isAnimated)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<PackageReference Include="MiniRazor.CodeGen" Version="2.2.0" />
|
||||
<PackageReference Include="Polly" Version="7.2.2" />
|
||||
<PackageReference Include="Superpower" Version="3.0.0" />
|
||||
<PackageReference Include="Tyrrrz.Extensions" Version="1.6.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -6,7 +6,6 @@ using System.Threading.Tasks;
|
|||
using DiscordChatExporter.Core.Discord.Data;
|
||||
using DiscordChatExporter.Core.Discord.Data.Embeds;
|
||||
using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors;
|
||||
using Tyrrrz.Extensions;
|
||||
|
||||
namespace DiscordChatExporter.Core.Exporting.Writers
|
||||
{
|
||||
|
@ -125,7 +124,7 @@ namespace DiscordChatExporter.Core.Exporting.Writers
|
|||
|
||||
public override async ValueTask WritePreambleAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
await _writer.WriteLineAsync('='.Repeat(62));
|
||||
await _writer.WriteLineAsync(new string('=', 62));
|
||||
await _writer.WriteLineAsync($"Guild: {Context.Request.Guild.Name}");
|
||||
await _writer.WriteLineAsync($"Channel: {Context.Request.Channel.Category.Name} / {Context.Request.Channel.Name}");
|
||||
|
||||
|
@ -138,7 +137,7 @@ namespace DiscordChatExporter.Core.Exporting.Writers
|
|||
if (Context.Request.Before is not null)
|
||||
await _writer.WriteLineAsync($"Before: {Context.FormatDate(Context.Request.Before.Value.ToDate())}");
|
||||
|
||||
await _writer.WriteLineAsync('='.Repeat(62));
|
||||
await _writer.WriteLineAsync(new string('=', 62));
|
||||
await _writer.WriteLineAsync();
|
||||
}
|
||||
|
||||
|
@ -167,9 +166,9 @@ namespace DiscordChatExporter.Core.Exporting.Writers
|
|||
|
||||
public override async ValueTask WritePostambleAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
await _writer.WriteLineAsync('='.Repeat(62));
|
||||
await _writer.WriteLineAsync(new string('=', 62));
|
||||
await _writer.WriteLineAsync($"Exported {MessagesWritten:N0} message(s)");
|
||||
await _writer.WriteLineAsync('='.Repeat(62));
|
||||
await _writer.WriteLineAsync(new string('=', 62));
|
||||
}
|
||||
|
||||
public override async ValueTask DisposeAsync()
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.0" />
|
||||
<PackageReference Include="Onova" Version="2.6.2" />
|
||||
<PackageReference Include="Stylet" Version="1.3.6" />
|
||||
<PackageReference Include="Tyrrrz.Extensions" Version="1.6.5" />
|
||||
<PackageReference Include="Tyrrrz.Settings" Version="1.3.4" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using DiscordChatExporter.Gui.Services;
|
||||
using System;
|
||||
using DiscordChatExporter.Gui.Services;
|
||||
using DiscordChatExporter.Gui.ViewModels.Framework;
|
||||
using Tyrrrz.Extensions;
|
||||
|
||||
namespace DiscordChatExporter.Gui.ViewModels.Dialogs
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
|
|||
public int ParallelLimit
|
||||
{
|
||||
get => _settingsService.ParallelLimit;
|
||||
set => _settingsService.ParallelLimit = value.Clamp(1, 10);
|
||||
set => _settingsService.ParallelLimit = Math.Clamp(value, 1, 10);
|
||||
}
|
||||
|
||||
public bool ShouldReuseMedia
|
||||
|
@ -44,9 +44,7 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
|
|||
set => _settingsService.ShouldReuseMedia = value;
|
||||
}
|
||||
|
||||
public SettingsViewModel(SettingsService settingsService)
|
||||
{
|
||||
public SettingsViewModel(SettingsService settingsService) =>
|
||||
_settingsService = settingsService;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,6 @@ using DiscordChatExporter.Gui.ViewModels.Framework;
|
|||
using Gress;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Stylet;
|
||||
using Tyrrrz.Extensions;
|
||||
|
||||
namespace DiscordChatExporter.Gui.ViewModels
|
||||
{
|
||||
|
@ -69,11 +68,11 @@ namespace DiscordChatExporter.Gui.ViewModels
|
|||
);
|
||||
|
||||
ProgressManager.Bind(o => o.IsActive, (_, _) =>
|
||||
IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress.IsEither(0, 1)
|
||||
IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress is <= 0 or >= 1
|
||||
);
|
||||
|
||||
ProgressManager.Bind(o => o.Progress, (_, _) =>
|
||||
IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress.IsEither(0, 1)
|
||||
IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress is <= 0 or >= 1
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -243,7 +242,7 @@ namespace DiscordChatExporter.Gui.ViewModels
|
|||
{
|
||||
operation.Dispose();
|
||||
}
|
||||
}, _settingsService.ParallelLimit.ClampMin(1));
|
||||
}, Math.Max(1, _settingsService.ParallelLimit));
|
||||
|
||||
// Notify of overall completion
|
||||
if (successfulExportCount > 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue