mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
feat(StyleModel): Add GetFromCurrent(), GetConfiguredStyle/s()
This commit is contained in:
parent
d10218d8a0
commit
dd72261893
1 changed files with 25 additions and 0 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
@ -29,6 +32,28 @@ namespace Dalamud.Interface.Style
|
||||||
[JsonProperty("ver")]
|
[JsonProperty("ver")]
|
||||||
public int Version { get; set; }
|
public int Version { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a StyleModel based on the current Dalamud style, with the current version.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The current style.</returns>
|
||||||
|
public static StyleModel GetFromCurrent() => StyleModelV1.Get();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the current style model, as per configuration.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The current style, as per configuration.</returns>
|
||||||
|
public static StyleModel? GetConfiguredStyle()
|
||||||
|
{
|
||||||
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
|
return configuration.SavedStyles?.FirstOrDefault(x => x.Name == configuration.ChosenStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an enumerable of all saved styles.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Enumerable of saved styles.</returns>
|
||||||
|
public static IEnumerable<StyleModel>? GetConfiguredStyles() => Service<DalamudConfiguration>.Get().SavedStyles;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deserialize a style model.
|
/// Deserialize a style model.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue