PositionDebugManager.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class PosDebugResultManager
{
public static List<PosDebugResult> posResultList;
public static bool isInit = false;
static string filePath = Common.ConfigAppSettings.GetValue(Common.Setting_Init.ConfigPath_PosDebugInfo);
public static void Init(List<string> posNumList)
{
if (!System.IO.File.Exists(filePath))
{
posResultList = new List<PosDebugResult>();
foreach (var item in posNumList)
{
posResultList.Add(new PosDebugResult() { Name = item });
}
}
else
{
string txt = System.IO.File.ReadAllText(filePath);
posResultList = Common.JsonHelper.DeserializeJsonToList<PosDebugResult>(txt);
}
isInit = true;
}
public static int GetResult(string name)
{
if (!isInit)
return -1;
PosDebugResult debugResult = posResultList.Find(s => s.Name.Equals(name));
return debugResult.ResCode;
}
public static void SetResult(string name,int code)
{
if (!isInit)
return;
PosDebugResult debugResult = posResultList.Find(s => s.Name.Equals(name));
debugResult.ResCode = code;
}
}
}