From d8ee7430bbf67b24c0d709703eb94db1380315a1 Mon Sep 17 00:00:00 2001 From: Zacharie Day Date: Wed, 2 Sep 2020 19:36:55 -0400 Subject: [PATCH] Mark old conditions as obsolete and add migration --- HudSwap/PluginConfig.cs | 30 ++++++++++++++++++++++++++++-- HudSwap/PluginUI.cs | 2 -- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/HudSwap/PluginConfig.cs b/HudSwap/PluginConfig.cs index 0558a11..886106d 100644 --- a/HudSwap/PluginConfig.cs +++ b/HudSwap/PluginConfig.cs @@ -40,17 +40,20 @@ namespace HudSwap { public Guid roleplayingLayout = Guid.Empty; #pragma warning restore CA1051 // Do not declare visible instance fields + [Obsolete("Superceded by HudConditionMatches")] public Dictionary StatusLayouts { get; } = new Dictionary(); - + [Obsolete("Superceded by HudConditionMatches")] public Dictionary JobLayouts { get; } = new Dictionary(); + [Obsolete("Superceded by HudConditionMatches")] public bool HighPriorityJobs { get; set; } = false; + [Obsolete("Superceded by HudConditionMatches")] public bool JobsCombatOnly { get; set; } = false; [Obsolete("Use Layouts2 instead")] public Dictionary> Layouts { get; } = new Dictionary>(); public Dictionary Layouts2 { get; } = new Dictionary(); - public List HudConditionMatches = new List(); + public List HudConditionMatches { get; } = new List(); public void Initialize(DalamudPluginInterface pluginInterface) { this.pi = pluginInterface; @@ -106,6 +109,29 @@ namespace HudSwap { } this.Layouts.Clear(); } + + if (this.JobLayouts.Count != 0) { + foreach (var jobLayout in JobLayouts) + this.HudConditionMatches.Add(new HudConditionMatch() { + ClassJob = jobLayout.Key, + Status = JobsCombatOnly ? Status.InCombat : default, + LayoutId = jobLayout.Value + }); + + JobLayouts.Clear(); + } + + if (this.StatusLayouts.Count != 0) { + foreach (var statusLayout in StatusLayouts) { + var match = new HudConditionMatch() {Status = statusLayout.Key, LayoutId = statusLayout.Value}; + if (HighPriorityJobs) + this.HudConditionMatches.Add(match); + else + this.HudConditionMatches.Insert(0, match); + } + + StatusLayouts.Clear(); + } #pragma warning restore 618 } } diff --git a/HudSwap/PluginUI.cs b/HudSwap/PluginUI.cs index 8b2fa80..753eb8b 100644 --- a/HudSwap/PluginUI.cs +++ b/HudSwap/PluginUI.cs @@ -40,8 +40,6 @@ namespace HudSwap { private string renameName = ""; private Guid selectedLayout = Guid.Empty; - private string jobFilter = ""; - private int editingConditionIndex = -1; private HudConditionMatch editingCondition;