Remove Tyrrrz.Extensions package

This commit is contained in:
Tyrrrz
2021-11-15 18:50:46 +02:00
parent 720e53caab
commit 1db2bb4170
8 changed files with 20 additions and 28 deletions

View File

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

View File

@@ -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
.GetRunes()
// Variant selector rune is skipped in Twemoji names
.Where(r => r.Value != 0xfe0f)
.Select(r => r.Value.ToString("x"))
.JoinToString("-");
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"))
);
public static string GetImageUrl(string? id, string name, bool isAnimated)
{

View File

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

View File

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