From dd722618933e25d8f90f74fbe90c6b15638b40f8 Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Wed, 20 Oct 2021 03:17:50 +0200 Subject: [PATCH] feat(StyleModel): Add GetFromCurrent(), GetConfiguredStyle/s() --- Dalamud/Interface/Style/StyleModel.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Dalamud/Interface/Style/StyleModel.cs b/Dalamud/Interface/Style/StyleModel.cs index 9bb95afb0..a397454eb 100644 --- a/Dalamud/Interface/Style/StyleModel.cs +++ b/Dalamud/Interface/Style/StyleModel.cs @@ -1,5 +1,8 @@ using System; +using System.Collections.Generic; +using System.Linq; +using Dalamud.Configuration.Internal; using Dalamud.Interface.Colors; using Dalamud.Utility; using Newtonsoft.Json; @@ -29,6 +32,28 @@ namespace Dalamud.Interface.Style [JsonProperty("ver")] public int Version { get; set; } + /// + /// Get a StyleModel based on the current Dalamud style, with the current version. + /// + /// The current style. + public static StyleModel GetFromCurrent() => StyleModelV1.Get(); + + /// + /// Get the current style model, as per configuration. + /// + /// The current style, as per configuration. + public static StyleModel? GetConfiguredStyle() + { + var configuration = Service.Get(); + return configuration.SavedStyles?.FirstOrDefault(x => x.Name == configuration.ChosenStyle); + } + + /// + /// Get an enumerable of all saved styles. + /// + /// Enumerable of saved styles. + public static IEnumerable? GetConfiguredStyles() => Service.Get().SavedStyles; + /// /// Deserialize a style model. ///