2020-08-04 22:22:57 +00:00
|
|
|
|
using Dalamud.Configuration;
|
|
|
|
|
using Dalamud.Plugin;
|
2020-08-22 03:27:12 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2020-08-04 22:22:57 +00:00
|
|
|
|
using System;
|
2020-08-06 04:17:14 +00:00
|
|
|
|
using System.Collections.Generic;
|
2020-08-22 03:27:12 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text.RegularExpressions;
|
2020-08-04 22:22:57 +00:00
|
|
|
|
|
|
|
|
|
namespace NoSoliciting {
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class PluginConfiguration : IPluginConfiguration {
|
|
|
|
|
[NonSerialized]
|
2020-08-04 23:30:29 +00:00
|
|
|
|
private DalamudPluginInterface pi;
|
2020-08-04 22:22:57 +00:00
|
|
|
|
|
|
|
|
|
public int Version { get; set; } = 1;
|
|
|
|
|
|
2020-08-21 17:46:42 +00:00
|
|
|
|
[Obsolete("Use EnabledFilters")]
|
2020-08-04 22:22:57 +00:00
|
|
|
|
public bool FilterChat { get; set; } = true;
|
2020-08-21 17:46:42 +00:00
|
|
|
|
[Obsolete("Use EnabledFilters")]
|
2020-08-21 09:00:04 +00:00
|
|
|
|
public bool FilterFCRecruitments { get; set; } = false;
|
2020-08-21 17:46:42 +00:00
|
|
|
|
[Obsolete("Use EnabledFilters")]
|
2020-08-21 09:00:04 +00:00
|
|
|
|
public bool FilterChatRPAds { get; set; } = false;
|
|
|
|
|
|
2020-08-21 17:46:42 +00:00
|
|
|
|
[Obsolete("Use EnabledFilters")]
|
2020-08-04 22:22:57 +00:00
|
|
|
|
public bool FilterPartyFinder { get; set; } = true;
|
2020-08-21 17:46:42 +00:00
|
|
|
|
[Obsolete("Use EnabledFilters")]
|
2020-08-21 09:00:04 +00:00
|
|
|
|
public bool FilterPartyFinderRPAds { get; set; } = false;
|
2020-08-04 22:22:57 +00:00
|
|
|
|
|
2020-08-21 17:46:42 +00:00
|
|
|
|
public Dictionary<string, bool> FilterStatus { get; private set; } = new Dictionary<string, bool>();
|
|
|
|
|
|
2020-08-06 04:17:14 +00:00
|
|
|
|
public bool AdvancedMode { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
public bool CustomChatFilter { get; set; } = false;
|
|
|
|
|
public List<string> ChatSubstrings { get; } = new List<string>();
|
|
|
|
|
public List<string> ChatRegexes { get; } = new List<string>();
|
2020-08-22 03:27:12 +00:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public List<Regex> CompiledChatRegexes { get; private set; } = new List<Regex>();
|
2020-08-06 04:17:14 +00:00
|
|
|
|
|
|
|
|
|
public bool CustomPFFilter { get; set; } = false;
|
|
|
|
|
public List<string> PFSubstrings { get; } = new List<string>();
|
|
|
|
|
public List<string> PFRegexes { get; } = new List<string>();
|
2020-08-22 03:27:12 +00:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public List<Regex> CompiledPFRegexes { get; private set; } = new List<Regex>();
|
2020-08-06 04:17:14 +00:00
|
|
|
|
|
2020-08-23 14:55:52 +00:00
|
|
|
|
public bool FilterHugeItemLevelPFs { get; set; } = false;
|
|
|
|
|
|
2020-08-04 23:30:29 +00:00
|
|
|
|
public void Initialise(DalamudPluginInterface pi) {
|
2020-08-04 22:22:57 +00:00
|
|
|
|
this.pi = pi ?? throw new ArgumentNullException(nameof(pi), "DalamudPluginInterface cannot be null");
|
2020-08-22 03:27:12 +00:00
|
|
|
|
this.CompileRegexes();
|
2020-08-04 22:22:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Save() {
|
|
|
|
|
this.pi.SavePluginConfig(this);
|
|
|
|
|
}
|
2020-08-22 03:27:12 +00:00
|
|
|
|
|
|
|
|
|
public void CompileRegexes() {
|
|
|
|
|
this.CompiledChatRegexes = this.ChatRegexes
|
|
|
|
|
.Select(reg => new Regex(reg, RegexOptions.Compiled))
|
|
|
|
|
.ToList();
|
|
|
|
|
this.CompiledPFRegexes = this.PFRegexes
|
|
|
|
|
.Select(reg => new Regex(reg, RegexOptions.Compiled))
|
|
|
|
|
.ToList();
|
|
|
|
|
}
|
2020-08-04 22:22:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|