TowerList.cs
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using Newtonsoft.Json;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class TowerList
{
public static Dictionary<string, TowerInfo> List = new Dictionary<string, TowerInfo>();
static TowerList() {
if (File.Exists("Config\\TowerList.json"))
{
try
{
var tl = File.ReadAllText("Config\\TowerList.json");
List = JsonConvert.DeserializeObject<Dictionary<string, TowerInfo>>(tl);
}
catch (Exception ex)
{
LogUtil.error("启动时美光料仓信息加载失败:" + ex);
}
}
}
public static void SaveTowerInfo()
{
try
{
File.WriteAllText("Config\\TowerList.json", JsonConvert.SerializeObject(List));
}
catch (Exception ex)
{
LogUtil.error("美光料仓信息保存失败:" + ex);
}
}
}
[Serializable]
public class TowerInfo
{
/// <summary>
/// 麦康宁料仓ID
/// </summary>
public string TowerID;
public string TowerName;
public string PosID;
public bool Enable=false;
public string DeviceGroupName;
}
}