Use a few new APIs

This commit is contained in:
Tyrrrz 2024-08-10 22:28:07 +03:00
parent c978a4cf60
commit 73e2e0624b
2 changed files with 5 additions and 5 deletions

View file

@ -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<Message> _messageGroup = new();
private readonly List<Message> _messageGroup = [];
private bool CanJoinGroup(Message message)
{

View file

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