feat: transfer styles from non-polymorphic configuration

This commit is contained in:
goaaats 2021-10-20 18:00:06 +02:00
parent 913b0f157c
commit e58ebfdfba
No known key found for this signature in database
GPG key ID: F18F057873895461
3 changed files with 21 additions and 1 deletions

View file

@ -125,7 +125,7 @@ namespace Dalamud
framework.Enable();
Log.Information("[T1] Framework ENABLE!");
Log.Information("[T1] Load complete!");
}
catch (Exception ex)
{
@ -233,6 +233,7 @@ namespace Dalamud
Service<DalamudAtkTweaks>.Set().Enable();
this.IsReady = true;
Log.Information("[T2] Load complete!");
}
catch (Exception ex)
{

View file

@ -369,6 +369,8 @@ namespace Dalamud.Interface.Internal
this.SetupFonts();
StyleModel.TransferOldModels();
if (configuration.SavedStyles == null || configuration.SavedStyles.All(x => x.Name != StyleModelV1.DalamudStandard.Name))
{
configuration.SavedStyles = new List<StyleModel> { StyleModelV1.DalamudStandard, StyleModelV1.DalamudClassic };

View file

@ -70,6 +70,23 @@ namespace Dalamud.Interface.Style
throw new ArgumentException("Was not a compressed style model.");
}
/// <summary>
/// [TEMPORARY] Transfer old non-polymorphic style models to the new format.
/// </summary>
public static void TransferOldModels()
{
var configuration = Service<DalamudConfiguration>.Get();
if (configuration.SavedStylesOld == null)
return;
configuration.SavedStyles = new List<StyleModel>();
configuration.SavedStyles.AddRange(configuration.SavedStylesOld);
configuration.SavedStylesOld = null;
configuration.Save();
}
/// <summary>
/// Serialize this style model.
/// </summary>