From bcac83e207c170f4a56f1795f7821a700e2a67eb Mon Sep 17 00:00:00 2001 From: Jordan Fearnley Date: Sun, 12 Nov 2023 20:07:57 +0000 Subject: [PATCH] Fix: Revert IDE suggested changes --- Helpers/DiscordHelper.cs | 11 +++++------ Helpers/FileTracker.cs | 2 +- Helpers/MessageTracker.cs | 4 ++-- Settings/SettingsProvider.cs | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Helpers/DiscordHelper.cs b/Helpers/DiscordHelper.cs index 8d69e30..f762add 100644 --- a/Helpers/DiscordHelper.cs +++ b/Helpers/DiscordHelper.cs @@ -66,7 +66,7 @@ public async Task PatchWebhook(IVideoFile file, IAnime anime, IEpisode episode, { try { - MultipartFormDataContent form = []; + MultipartFormDataContent form = new(); Webhook webhook = GetMatchedWebhook(file, anime, episode); string json = JsonSerializer.Serialize(webhook, _options); @@ -161,13 +161,13 @@ private Webhook GetMatchedWebhook(IVideoFile file, IAnime anime, IEpisode episod private static List GetUnmatchedFields(string dumpResult, AniDBSearchResult searchResult) { List output = - [ + new() { new WebhookField() { Name = "ED2K", Value = $"{dumpResult}" } - ]; + }; foreach (AniDBSeries result in searchResult.List) { @@ -187,8 +187,7 @@ private static List GetMatchedFields(IAnime series, IEpisode episo AnimeTitle episodeTitle = episode.Titles.FirstOrDefault(t => t.Language == TitleLanguage.English); string episodeNumber = episode.Number.ToString("00", CultureInfo.InvariantCulture); - return - [ + return new() { new WebhookField() { Name = "Anime", @@ -201,7 +200,7 @@ private static List GetMatchedFields(IAnime series, IEpisode episo Value = $"{episodeNumber} - [{episodeTitle.Title}](https://anidb.net/episode/{episode.EpisodeID})", Inline = true }, - ]; + }; } private static WebhookFooter GetFooter(IVideoFile file) diff --git a/Helpers/FileTracker.cs b/Helpers/FileTracker.cs index 47a7f73..2104557 100644 --- a/Helpers/FileTracker.cs +++ b/Helpers/FileTracker.cs @@ -9,7 +9,7 @@ public class FileTracker public FileTracker() { - _fileSet = []; + _fileSet = new(); } public bool TryAddFile(IVideoFile fileInfo) diff --git a/Helpers/MessageTracker.cs b/Helpers/MessageTracker.cs index d1bcc60..219203b 100644 --- a/Helpers/MessageTracker.cs +++ b/Helpers/MessageTracker.cs @@ -26,8 +26,8 @@ public MessageTracker(ISettingsProvider settingsProvider, IDiscordHelper discord _discordHelper = discordHelper; _shokoHelper = shokoHelper; - _messageSet = []; - _processedSet = []; + _messageSet = new(); + _processedSet = new(); if (_settings.Shoko.AutomaticMatch.WatchReactions) { diff --git a/Settings/SettingsProvider.cs b/Settings/SettingsProvider.cs index 10190c7..76463be 100644 --- a/Settings/SettingsProvider.cs +++ b/Settings/SettingsProvider.cs @@ -74,7 +74,7 @@ private CustomSettings GetSettingsFromFile() private static void ValidateSettings(ISettings settings) { - List validationResults = []; + List validationResults = new(); ValidationContext validationContext = new(settings); bool isValid = Validator.TryValidateObject(