diff --git a/DiscordChatExporter.Core/Exporting/HtmlMessageWriter.cs b/DiscordChatExporter.Core/Exporting/HtmlMessageWriter.cs index 5d071b4..1747afd 100644 --- a/DiscordChatExporter.Core/Exporting/HtmlMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/HtmlMessageWriter.cs @@ -15,7 +15,7 @@ internal class HtmlMessageWriter(Stream stream, ExportContext context, string th private readonly TextWriter _writer = new StreamWriter(stream); private readonly HtmlMinifier _minifier = new(); - private readonly List _messageGroup = new(); + private readonly List _messageGroup = []; private bool CanJoinGroup(Message message) { diff --git a/DiscordChatExporter.Core/Utils/PathEx.cs b/DiscordChatExporter.Core/Utils/PathEx.cs index c85b54a..26195a3 100644 --- a/DiscordChatExporter.Core/Utils/PathEx.cs +++ b/DiscordChatExporter.Core/Utils/PathEx.cs @@ -1,6 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; -using System.Runtime.InteropServices; using System.Text; namespace DiscordChatExporter.Core.Utils; @@ -8,7 +8,7 @@ namespace DiscordChatExporter.Core.Utils; public static class PathEx { private static readonly HashSet InvalidFileNameChars = - new(Path.GetInvalidFileNameChars()); + [..Path.GetInvalidFileNameChars()]; public static string EscapeFileName(string path) { @@ -19,7 +19,7 @@ public static class PathEx // File names cannot end with a dot on Windows // https://github.com/Tyrrrz/DiscordChatExporter/issues/977 - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + if (OperatingSystem.IsWindows()) { while (buffer.Length > 0 && buffer[^1] == '.') buffer.Remove(buffer.Length - 1, 1);