CurrencyAlertClassic/SamplePlugin/Configuration.cs

41 lines
1.2 KiB
C#
Raw Permalink Normal View History

2022-01-05 14:46:15 +00:00
using CurrencyAlert.Enum;
using Dalamud.Configuration;
using Dalamud.Plugin;
using System;
using System.Collections.Generic;
2021-12-11 13:27:58 +00:00
2022-01-05 14:46:15 +00:00
namespace CurrencyAlert
{
[Serializable]
public class Configuration : IPluginConfiguration
{
2022-01-06 09:56:52 +00:00
public int Version { get; set; } = 4;
2022-01-05 14:46:15 +00:00
public Dictionary<Currency, bool> AlertEnabled { get; set; } = new Dictionary<Currency, bool>();
public Dictionary<Currency, int> Threshold { get; set; } = new Dictionary<Currency , int>();
[NonSerialized]
private DalamudPluginInterface? pluginInterface;
public Configuration()
2022-01-05 14:46:15 +00:00
{
EnumHelper.Each<Currency>(currency =>
{
this.AlertEnabled[currency] = true;
var defaultValue = EnumHelper.GetAttributeOfType<DefaultThresholdAttribute>(currency);
this.Threshold[currency] = defaultValue.Value;
});
}
public void Initialize(DalamudPluginInterface pluginInterface)
{
this.pluginInterface = pluginInterface;
}
2022-01-06 09:56:52 +00:00
public void Save()
2022-01-05 14:46:15 +00:00
{
this.pluginInterface!.SavePluginConfig(this);
}
}
}