refactor: use new new syntax

This commit is contained in:
Anna 2021-02-16 12:15:00 -05:00
parent fb315b5491
commit 934fe877e2
4 changed files with 17 additions and 17 deletions

View File

@ -154,12 +154,12 @@ namespace NoSoliciting {
[YamlIgnore]
public string Id { get; private set; }
public List<List<Matcher>> RequiredMatchers { get; private set; } = new List<List<Matcher>>();
public List<List<Matcher>> LikelyMatchers { 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();
public int LikelihoodThreshold { get; private set; }
public bool IgnoreCase { get; private set; }
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 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,

View File

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

View File

@ -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<Message> _messageHistory = new List<Message>();
private readonly List<Message> _messageHistory = new();
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;
// ReSharper disable once MemberCanBePrivate.Global

View File

@ -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<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 CustomChatFilter { get; set; }
public List<string> ChatSubstrings { get; } = new List<string>();
public List<string> ChatRegexes { get; } = new List<string>();
public List<string> ChatSubstrings { get; } = new();
public List<string> ChatRegexes { get; } = new();
[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 List<string> PFSubstrings { get; } = new List<string>();
public List<string> PFRegexes { get; } = new List<string>();
public List<string> PFSubstrings { get; } = new();
public List<string> PFRegexes { get; } = new();
[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 UseMachineLearning { get; set; }
public HashSet<MessageCategory> BasicMlFilters { get; set; } = new HashSet<MessageCategory> {
public HashSet<MessageCategory> BasicMlFilters { get; set; } = new() {
MessageCategory.RmtGil,
MessageCategory.RmtContent,
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> {
ChatType.Say,
},