refactor: use new new syntax

This commit is contained in:
Anna 2021-02-16 12:15:00 -05:00
parent 6033c2ed79
commit fd9e9330fc
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
4 changed files with 17 additions and 17 deletions

View File

@ -154,12 +154,12 @@ namespace NoSoliciting {
[YamlIgnore] [YamlIgnore]
public string Id { get; private set; } public string Id { get; private set; }
public List<List<Matcher>> RequiredMatchers { get; private set; } = new List<List<Matcher>>(); public List<List<Matcher>> RequiredMatchers { get; private set; } = new();
public List<List<Matcher>> LikelyMatchers { get; private set; } = new List<List<Matcher>>(); public List<List<Matcher>> LikelyMatchers { get; private set; } = new();
public int LikelihoodThreshold { get; private set; } public int LikelihoodThreshold { get; private set; }
public bool IgnoreCase { get; private set; } public bool IgnoreCase { get; private set; }
public bool Normalise { get; private set; } = true; public bool Normalise { get; private set; } = true;
public List<XivChatType> Channels { get; private set; } = new List<XivChatType>(); public List<XivChatType> Channels { get; private set; } = new();
public OptionNames Option { get; private set; } public OptionNames Option { get; private set; }
public bool Default { get; private set; } public bool Default { get; private set; }
@ -216,7 +216,7 @@ namespace NoSoliciting {
} }
public Definition Clone() { public Definition Clone() {
return new Definition { return new() {
RequiredMatchers = this.RequiredMatchers, RequiredMatchers = this.RequiredMatchers,
LikelyMatchers = this.LikelyMatchers, LikelyMatchers = this.LikelyMatchers,
LikelihoodThreshold = this.LikelihoodThreshold, LikelihoodThreshold = this.LikelihoodThreshold,

View File

@ -8,7 +8,7 @@ using System.Text;
namespace NoSoliciting { namespace NoSoliciting {
public static class FilterUtil { public static class FilterUtil {
private static readonly Dictionary<char, string> Replacements = new Dictionary<char, string> { private static readonly Dictionary<char, string> Replacements = new() {
// numerals // numerals
['\ue055'] = "1", ['\ue055'] = "1",
['\ue056'] = "2", ['\ue056'] = "2",

View File

@ -24,10 +24,10 @@ namespace NoSoliciting {
public bool MlReady => this.Config.UseMachineLearning && this.MlFilter != null; public bool MlReady => this.Config.UseMachineLearning && this.MlFilter != null;
public bool DefsReady => !this.Config.UseMachineLearning && this.Definitions != null; public bool DefsReady => !this.Config.UseMachineLearning && this.Definitions != null;
private readonly List<Message> _messageHistory = new List<Message>(); private readonly List<Message> _messageHistory = new();
public IEnumerable<Message> MessageHistory => this._messageHistory; public IEnumerable<Message> MessageHistory => this._messageHistory;
private readonly List<Message> _partyFinderHistory = new List<Message>(); private readonly List<Message> _partyFinderHistory = new();
public IEnumerable<Message> PartyFinderHistory => this._partyFinderHistory; public IEnumerable<Message> PartyFinderHistory => this._partyFinderHistory;
// ReSharper disable once MemberCanBePrivate.Global // ReSharper disable once MemberCanBePrivate.Global

View File

@ -10,7 +10,7 @@ using NoSoliciting.Ml;
namespace NoSoliciting { namespace NoSoliciting {
[Serializable] [Serializable]
public class PluginConfiguration : IPluginConfiguration { public class PluginConfiguration : IPluginConfiguration {
public static readonly PluginConfiguration Default = new PluginConfiguration(); public static readonly PluginConfiguration Default = new();
[NonSerialized] [NonSerialized]
private DalamudPluginInterface pi; private DalamudPluginInterface pi;
@ -32,34 +32,34 @@ namespace NoSoliciting {
[Obsolete("Use FilterStatus")] [Obsolete("Use FilterStatus")]
public bool FilterPartyFinderRPAds { get; set; } = false; public bool FilterPartyFinderRPAds { get; set; } = false;
public Dictionary<string, bool> FilterStatus { get; private set; } = new Dictionary<string, bool>(); public Dictionary<string, bool> FilterStatus { get; private set; } = new();
public bool AdvancedMode { get; set; } public bool AdvancedMode { get; set; }
public bool CustomChatFilter { get; set; } public bool CustomChatFilter { get; set; }
public List<string> ChatSubstrings { get; } = new List<string>(); public List<string> ChatSubstrings { get; } = new();
public List<string> ChatRegexes { get; } = new List<string>(); public List<string> ChatRegexes { get; } = new();
[JsonIgnore] [JsonIgnore]
public List<Regex> CompiledChatRegexes { get; private set; } = new List<Regex>(); public List<Regex> CompiledChatRegexes { get; private set; } = new();
public bool CustomPFFilter { get; set; } public bool CustomPFFilter { get; set; }
public List<string> PFSubstrings { get; } = new List<string>(); public List<string> PFSubstrings { get; } = new();
public List<string> PFRegexes { get; } = new List<string>(); public List<string> PFRegexes { get; } = new();
[JsonIgnore] [JsonIgnore]
public List<Regex> CompiledPFRegexes { get; private set; } = new List<Regex>(); public List<Regex> CompiledPFRegexes { get; private set; } = new();
public bool FilterHugeItemLevelPFs { get; set; } public bool FilterHugeItemLevelPFs { get; set; }
public bool UseMachineLearning { get; set; } public bool UseMachineLearning { get; set; }
public HashSet<MessageCategory> BasicMlFilters { get; set; } = new HashSet<MessageCategory> { public HashSet<MessageCategory> BasicMlFilters { get; set; } = new() {
MessageCategory.RmtGil, MessageCategory.RmtGil,
MessageCategory.RmtContent, MessageCategory.RmtContent,
MessageCategory.Phishing, MessageCategory.Phishing,
}; };
public Dictionary<MessageCategory, HashSet<ChatType>> MlFilters { get; set; } = new Dictionary<MessageCategory, HashSet<ChatType>> { public Dictionary<MessageCategory, HashSet<ChatType>> MlFilters { get; set; } = new() {
[MessageCategory.RmtGil] = new HashSet<ChatType> { [MessageCategory.RmtGil] = new HashSet<ChatType> {
ChatType.Say, ChatType.Say,
}, },