Let's try this again.

This commit is contained in:
Ottermandias 2023-07-13 20:13:27 +02:00
parent 0ce194feae
commit bc4d808a4e
6 changed files with 16 additions and 20 deletions

View file

@ -34,11 +34,7 @@ public class Configuration : IPluginConfiguration, ISavable
[JsonProperty(Order = int.MaxValue)]
public ISortMode<Design> SortMode { get; set; } = ISortMode<Design>.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<Design>[] ValidSortModes =
{

View file

@ -5,8 +5,8 @@
<PlatformTarget>x64</PlatformTarget>
<RootNamespace>Glamourer</RootNamespace>
<AssemblyName>Glamourer</AssemblyName>
<FileVersion>0.2.0.3</FileVersion>
<AssemblyVersion>0.2.0.3</AssemblyVersion>
<FileVersion>0.2.0.4</FileVersion>
<AssemblyVersion>0.2.0.4</AssemblyVersion>
<Company>SoftOtter</Company>
<Product>Glamourer</Product>
<Copyright>Copyright © 2020</Copyright>

View file

@ -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,

View file

@ -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)

Binary file not shown.

View file

@ -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,