class Config
{
private static Config _instance = null; public static Config Instance
{
get
{
if (_instance==null)
{
_instance = new Config() {};
string filepath = AppDomain.CurrentDomain.BaseDirectory + "Config.txt";
if (File.Exists(filepath))
{
_instance = File.ReadAllText(filepath, Encoding.UTF8).FromJson<Config>();
}
}
return _instance;
}
set { _instance = value; }
} public void SaveInstance()
{
string filepath = AppDomain.CurrentDomain.BaseDirectory + "Config.txt";
File.WriteAllText(filepath, _instance.ToJson(), Encoding.UTF8);
} public string MesServerUrl { get; set; } = "localhost:8080/Mes"; public long HangerOneId { get; set; } = ;// 吊挂产线1的ID public long HangerTwoId { get; set; } = ;// 吊挂产线2的ID }