diff --git a/Glamourer/Configuration.cs b/Glamourer/Configuration.cs index 0885297..9bfe41d 100644 --- a/Glamourer/Configuration.cs +++ b/Glamourer/Configuration.cs @@ -34,11 +34,7 @@ public class Configuration : IPluginConfiguration, ISavable [JsonProperty(Order = int.MaxValue)] public ISortMode SortMode { get; set; } = ISortMode.FoldersFirst; - public List<(string Code, bool Enabled)> Codes { get; set; } = new List<(string Code, bool Enabled)>() - { - (CodeService.CodeInventoryString, false), - (CodeService.CodeMesmerString, false), - }; + public List<(string Code, bool Enabled)> Codes { get; set; } = new(); #if DEBUG public bool DebugMode { get; set; } = true; @@ -90,7 +86,10 @@ public class Configuration : IPluginConfiguration, ISavable "Error reading Configuration, reverting to default.\nYou may be able to restore your configuration using the rolling backups in the XIVLauncher/backups/Glamourer directory.", "Error reading Configuration", "Error", NotificationType.Error); } - + if (Codes.All(p => p.Code != CodeService.CodeInventoryString)) + Codes.Insert(0, (CodeService.CodeInventoryString, false)); + if (Codes.All(p => p.Code != CodeService.CodeMesmerString)) + Codes.Insert(0, (CodeService.CodeMesmerString, false)); migrator.Migrate(this); } @@ -106,7 +105,7 @@ public class Configuration : IPluginConfiguration, ISavable public static class Constants { - public const int CurrentVersion = 2; + public const int CurrentVersion = 4; public static readonly ISortMode[] ValidSortModes = { diff --git a/Glamourer/Glamourer.csproj b/Glamourer/Glamourer.csproj index f2f82bc..24551af 100644 --- a/Glamourer/Glamourer.csproj +++ b/Glamourer/Glamourer.csproj @@ -5,8 +5,8 @@ x64 Glamourer Glamourer - 0.2.0.3 - 0.2.0.3 + 0.2.0.4 + 0.2.0.4 SoftOtter Glamourer Copyright © 2020 diff --git a/Glamourer/Glamourer.json b/Glamourer/Glamourer.json index eafd421..25ead5e 100644 --- a/Glamourer/Glamourer.json +++ b/Glamourer/Glamourer.json @@ -5,7 +5,7 @@ "Description": "Adds functionality to change and store appearance of players, customization and equip. Requires Penumbra to be installed and activated to work. Can also add preview options to the Changed Items tab for Penumbra.", "Tags": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ], "InternalName": "Glamourer", - "AssemblyVersion": "0.2.0.3", + "AssemblyVersion": "0.2.0.4", "RepoUrl": "https://github.com/Ottermandias/Glamourer", "ApplicableVersion": "any", "DalamudApiLevel": 8, diff --git a/Glamourer/Services/ConfigMigrationService.cs b/Glamourer/Services/ConfigMigrationService.cs index c2fe89d..bc75a17 100644 --- a/Glamourer/Services/ConfigMigrationService.cs +++ b/Glamourer/Services/ConfigMigrationService.cs @@ -25,7 +25,7 @@ public class ConfigMigrationService public void Migrate(Configuration config) { - _config = config; + _config = config; if (config.Version >= Configuration.Constants.CurrentVersion || !File.Exists(_saveService.FileNames.ConfigFile)) { AddColors(config, false); @@ -34,7 +34,7 @@ public class ConfigMigrationService _data = JObject.Parse(File.ReadAllText(_saveService.FileNames.ConfigFile)); MigrateV1To2(); - MigrateV2To3(); + MigrateV2To4(); AddColors(config, true); } @@ -54,16 +54,13 @@ public class ConfigMigrationService _config.Colors[ColorId.EquipmentDesign] = equipmentColor; } - private void MigrateV2To3() + private void MigrateV2To4() { - if (_config.Version > 2) + if (_config.Version > 4) return; - _config.Version = 3; - if (_config.Codes.All(s => s.Code != CodeService.CodeInventoryString)) - _config.Codes.Add((CodeService.CodeInventoryString, false)); - if (_config.Codes.All(s => s.Code != CodeService.CodeMesmerString)) - _config.Codes.Add((CodeService.CodeMesmerString, false)); + _config.Version = 4; + _config.Codes = _config.Codes.DistinctBy(c => c.Code).ToList(); } private static void AddColors(Configuration config, bool forceSave) diff --git a/GlamourerTest.zip b/GlamourerTest.zip index 37c9e5a..d57e835 100644 Binary files a/GlamourerTest.zip and b/GlamourerTest.zip differ diff --git a/repo.json b/repo.json index 9b2cb2f..1a910f0 100644 --- a/repo.json +++ b/repo.json @@ -7,7 +7,7 @@ "Tags": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ], "InternalName": "Glamourer", "AssemblyVersion": "0.1.3.1", - "TestingAssemblyVersion": "0.2.0.3", + "TestingAssemblyVersion": "0.2.0.4", "RepoUrl": "https://github.com/Ottermandias/Glamourer", "ApplicableVersion": "any", "DalamudApiLevel": 8,