完善功能
This commit is contained in:
37
电子展板/Base/GlobalVariable.cs
Normal file
37
电子展板/Base/GlobalVariable.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using 电子展板.Utility.Core;
|
||||
using 电子展板.Utility.Extension;
|
||||
|
||||
namespace 电子展板.Base
|
||||
{
|
||||
public class GlobalVariable
|
||||
{
|
||||
private static MyConfig _config;
|
||||
/// <summary>
|
||||
/// 配置数据
|
||||
/// </summary>
|
||||
public static MyConfig Config
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_config == null)
|
||||
_config = File.ReadAllText(MyEnvironment.Root("/Configs/Config.json")).ToObject<MyConfig>();
|
||||
return _config;
|
||||
}
|
||||
set
|
||||
{
|
||||
_config = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveConfig()
|
||||
{
|
||||
File.WriteAllText(MyEnvironment.Root("/Configs/Config.json"), Config.ToJson());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user