set some json attributes for eventually changes of configuraiton in the future

This commit is contained in:
2022-11-08 07:42:58 +01:00
parent 1e3380cbd1
commit 9c927d91f3
4 changed files with 32 additions and 14 deletions

View File

@@ -13,21 +13,9 @@ namespace PlayerTags.Configuration
[Serializable]
public class PluginConfiguration : IPluginConfiguration
{
public int Version { get; set; } = 0;
public int Version { get; set; } = 1;
public bool IsVisible = false;
[Obsolete]
[JsonProperty("GeneralOptions")]
private Dictionary<Data.ActivityContext, GeneralOptionsClass> GeneralOptionsV1
{
set
{
GeneralOptions.Clear();
foreach (var kvp in value)
GeneralOptions.Add((ActivityType)kvp.Key, kvp.Value);
}
}
[JsonProperty("GeneralOptionsV2")]
public Dictionary<ActivityType, GeneralOptionsClass> GeneralOptions = new()
{
@@ -49,6 +37,8 @@ namespace PlayerTags.Configuration
public bool IsPlayersTabOthersVisible = false;
public bool IsGeneralOptionsAllTheSameEnabled = true;
public Tag AllTags = null;
[JsonProperty(TypeNameHandling = TypeNameHandling.None, ItemTypeNameHandling = TypeNameHandling.None)]
public Dictionary<string, InheritableData> AllTagsChanges = new Dictionary<string, InheritableData>();
@@ -81,6 +71,18 @@ namespace PlayerTags.Configuration
#region Obsulate Properties
[Obsolete]
[JsonProperty("GeneralOptions")]
private Dictionary<Data.ActivityContext, GeneralOptionsClass> GeneralOptionsV1
{
set
{
GeneralOptions.Clear();
foreach (var kvp in value)
GeneralOptions.Add((ActivityType)kvp.Key, kvp.Value);
}
}
[JsonProperty("NameplateFreeCompanyVisibility"), Obsolete]
private NameplateFreeCompanyVisibility NameplateFreeCompanyVisibilityV1
{

View File

@@ -1,4 +1,5 @@
using Dalamud.Game.Text.SeStringHandling;
using Newtonsoft.Json;
using Pilz.Dalamud.Icons;
using PlayerTags.Inheritables;
using PlayerTags.PluginStrings;
@@ -12,7 +13,10 @@ namespace PlayerTags.Data
{
public IPluginString Name { get; init; }
[JsonProperty("Parent")]
private Tag? m_Parent = null;
[JsonIgnore]
public Tag? Parent
{
get => m_Parent;
@@ -43,6 +47,7 @@ namespace PlayerTags.Data
public List<Tag> Children { get; } = new List<Tag>();
[JsonIgnore]
public IEnumerable<Tag> Descendents
{
get
@@ -58,7 +63,9 @@ namespace PlayerTags.Data
}
}
[JsonIgnore]
private Dictionary<string, IInheritable>? m_Inheritables = null;
[JsonIgnore]
public Dictionary<string, IInheritable> Inheritables
{
get
@@ -165,6 +172,7 @@ namespace PlayerTags.Data
[InheritableCategory("PlayerCategory")]
public InheritableValue<bool> IsVisibleForOtherPlayers = new InheritableValue<bool>(false);
[JsonIgnore]
public string[] IdentitiesToAddTo
{
get
@@ -179,6 +187,7 @@ namespace PlayerTags.Data
}
private Tag? m_Defaults;
[JsonIgnore]
public bool HasDefaults
{
get { return m_Defaults != null; }

View File

@@ -1,4 +1,6 @@
namespace PlayerTags.Inheritables
using Newtonsoft.Json;
namespace PlayerTags.Inheritables
{
public class InheritableReference<T> : IInheritable
where T : class
@@ -7,8 +9,10 @@
public InheritableBehavior Behavior { get; set; }
[JsonProperty]
public T Value;
[JsonIgnore]
public T? InheritedValue
{
get

View File

@@ -1,4 +1,5 @@
using Dalamud.Logging;
using Newtonsoft.Json;
using System;
namespace PlayerTags.Inheritables
@@ -10,8 +11,10 @@ namespace PlayerTags.Inheritables
public InheritableBehavior Behavior { get; set; }
[JsonProperty]
public T Value;
[JsonIgnore]
public T? InheritedValue
{
get