59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
using Milimoe.FunGame.Core.Api.Utility;
|
|
|
|
namespace Milimoe.FunGame.WebAPI.Constant
|
|
{
|
|
public class Configs
|
|
{
|
|
public static bool IsRun { get; set; } = true;
|
|
|
|
public static bool IsDebug { get; set; } = false;
|
|
|
|
public static List<long> Admins { get; set; } = [];
|
|
|
|
public static long BlackTimes { get; set; } = 5;
|
|
|
|
public static int BlackFrozenTime { get; set; } = 150;
|
|
|
|
public static List<string> TokenList { get; set; } = [];
|
|
|
|
public static string RemoteServerAddress { get; set; } = "";
|
|
|
|
public static PluginConfig PluginConfig { get; set; } = new("milimoe", "configs");
|
|
|
|
public static void Load()
|
|
{
|
|
PluginConfig.LoadConfig();
|
|
if (PluginConfig.TryGetValue("Admins", out object? value) && value != null)
|
|
{
|
|
Admins = (List<long>)value;
|
|
}
|
|
if (PluginConfig.TryGetValue("BlackTimes", out value) && value != null)
|
|
{
|
|
BlackTimes = (long)value;
|
|
}
|
|
if (PluginConfig.TryGetValue("BlackFrozenTime", out value) && value != null)
|
|
{
|
|
BlackFrozenTime = Convert.ToInt32((long)value);
|
|
}
|
|
if (PluginConfig.TryGetValue("TokenList", out value) && value != null)
|
|
{
|
|
TokenList = (List<string>)value;
|
|
}
|
|
if (PluginConfig.TryGetValue("RemoteServerAddress", out value) && value != null)
|
|
{
|
|
RemoteServerAddress = (string)value;
|
|
}
|
|
}
|
|
|
|
public static void Save()
|
|
{
|
|
PluginConfig.Add("Admins", Admins);
|
|
PluginConfig.Add("BlackTimes", BlackTimes);
|
|
PluginConfig.Add("BlackFrozenTime", BlackFrozenTime);
|
|
PluginConfig.Add("TokenList", TokenList);
|
|
PluginConfig.Add("RemoteServerAddress", RemoteServerAddress);
|
|
PluginConfig.SaveConfig();
|
|
}
|
|
}
|
|
}
|