From fd9e9330fc83b434e4f21e2f54599eecb04bef23 Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Tue, 16 Feb 2021 12:15:00 -0500 Subject: [PATCH] refactor: use new new syntax --- NoSoliciting/Definitions.cs | 8 ++++---- NoSoliciting/FilterUtil.cs | 2 +- NoSoliciting/Plugin.cs | 4 ++-- NoSoliciting/PluginConfiguration.cs | 20 ++++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/NoSoliciting/Definitions.cs b/NoSoliciting/Definitions.cs index f4a67d3..dde5624 100644 --- a/NoSoliciting/Definitions.cs +++ b/NoSoliciting/Definitions.cs @@ -154,12 +154,12 @@ namespace NoSoliciting { [YamlIgnore] public string Id { get; private set; } - public List> RequiredMatchers { get; private set; } = new List>(); - public List> LikelyMatchers { get; private set; } = new List>(); + public List> RequiredMatchers { get; private set; } = new(); + public List> LikelyMatchers { get; private set; } = new(); public int LikelihoodThreshold { get; private set; } public bool IgnoreCase { get; private set; } public bool Normalise { get; private set; } = true; - public List Channels { get; private set; } = new List(); + public List Channels { get; private set; } = new(); public OptionNames Option { get; private set; } public bool Default { get; private set; } @@ -216,7 +216,7 @@ namespace NoSoliciting { } public Definition Clone() { - return new Definition { + return new() { RequiredMatchers = this.RequiredMatchers, LikelyMatchers = this.LikelyMatchers, LikelihoodThreshold = this.LikelihoodThreshold, diff --git a/NoSoliciting/FilterUtil.cs b/NoSoliciting/FilterUtil.cs index f63d707..0c8bbdc 100644 --- a/NoSoliciting/FilterUtil.cs +++ b/NoSoliciting/FilterUtil.cs @@ -8,7 +8,7 @@ using System.Text; namespace NoSoliciting { public static class FilterUtil { - private static readonly Dictionary Replacements = new Dictionary { + private static readonly Dictionary Replacements = new() { // numerals ['\ue055'] = "1", ['\ue056'] = "2", diff --git a/NoSoliciting/Plugin.cs b/NoSoliciting/Plugin.cs index c8176d3..d5cafcb 100644 --- a/NoSoliciting/Plugin.cs +++ b/NoSoliciting/Plugin.cs @@ -24,10 +24,10 @@ namespace NoSoliciting { public bool MlReady => this.Config.UseMachineLearning && this.MlFilter != null; public bool DefsReady => !this.Config.UseMachineLearning && this.Definitions != null; - private readonly List _messageHistory = new List(); + private readonly List _messageHistory = new(); public IEnumerable MessageHistory => this._messageHistory; - private readonly List _partyFinderHistory = new List(); + private readonly List _partyFinderHistory = new(); public IEnumerable PartyFinderHistory => this._partyFinderHistory; // ReSharper disable once MemberCanBePrivate.Global diff --git a/NoSoliciting/PluginConfiguration.cs b/NoSoliciting/PluginConfiguration.cs index c0cae5e..8cfcd7c 100644 --- a/NoSoliciting/PluginConfiguration.cs +++ b/NoSoliciting/PluginConfiguration.cs @@ -10,7 +10,7 @@ using NoSoliciting.Ml; namespace NoSoliciting { [Serializable] public class PluginConfiguration : IPluginConfiguration { - public static readonly PluginConfiguration Default = new PluginConfiguration(); + public static readonly PluginConfiguration Default = new(); [NonSerialized] private DalamudPluginInterface pi; @@ -32,34 +32,34 @@ namespace NoSoliciting { [Obsolete("Use FilterStatus")] public bool FilterPartyFinderRPAds { get; set; } = false; - public Dictionary FilterStatus { get; private set; } = new Dictionary(); + public Dictionary FilterStatus { get; private set; } = new(); public bool AdvancedMode { get; set; } public bool CustomChatFilter { get; set; } - public List ChatSubstrings { get; } = new List(); - public List ChatRegexes { get; } = new List(); + public List ChatSubstrings { get; } = new(); + public List ChatRegexes { get; } = new(); [JsonIgnore] - public List CompiledChatRegexes { get; private set; } = new List(); + public List CompiledChatRegexes { get; private set; } = new(); public bool CustomPFFilter { get; set; } - public List PFSubstrings { get; } = new List(); - public List PFRegexes { get; } = new List(); + public List PFSubstrings { get; } = new(); + public List PFRegexes { get; } = new(); [JsonIgnore] - public List CompiledPFRegexes { get; private set; } = new List(); + public List CompiledPFRegexes { get; private set; } = new(); public bool FilterHugeItemLevelPFs { get; set; } public bool UseMachineLearning { get; set; } - public HashSet BasicMlFilters { get; set; } = new HashSet { + public HashSet BasicMlFilters { get; set; } = new() { MessageCategory.RmtGil, MessageCategory.RmtContent, MessageCategory.Phishing, }; - public Dictionary> MlFilters { get; set; } = new Dictionary> { + public Dictionary> MlFilters { get; set; } = new() { [MessageCategory.RmtGil] = new HashSet { ChatType.Say, },