-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAGVSystemConfigsCompareHelper.cs
More file actions
111 lines (96 loc) · 4.58 KB
/
AGVSystemConfigsCompareHelper.cs
File metadata and controls
111 lines (96 loc) · 4.58 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using AGVSystem.Models.Automation;
using AGVSystemCommonNet6.Configuration;
using AGVSystemCommonNet6.Configuration.Charge;
using AGVSystemCommonNet6.MAP;
using AGVSystemCommonNet6.Utilis.DiskMonitor;
using AGVSystemCommonNet6.Utilis.Snap;
using EquipmentManagment.ChargeStation;
using EquipmentManagment.Device.Options;
using EquipmentManagment.MainEquipment;
namespace AGVSystem
{
public class AGVSystemConfigsCompareHelper : AppConfigsCompareHelper
{
public override List<CompareResultWrapper> Compare(DateTime date)
{
string snapshotOfDate = Path.Combine(SystemConfigsSnapshotFolder, date.ToString("yyyy-MM-dd"));
List<CompareResultWrapper> resultCollection = new();
void AddIfHasDiff<T>(string classifyName, string snapshotPath, string currentPath)
{
try
{
var diff = GetCompareResult<T>(snapshotPath, currentPath);
if (diff != null && diff.Any())
{
resultCollection.Add(new CompareResultWrapper
{
classifyName = classifyName,
diffResultList = diff
});
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
// =============================
// 基本設定檔
// =============================
AddIfHasDiff<SystemConfigs>(
"SystemConfigs.json",
Path.Combine(snapshotOfDate, "SystemConfigs.json"),
Path.Combine(AGVSConfigulator.ConfigsFilesFolder, "SystemConfigs.json")
);
AddIfHasDiff<ChargeConfigs>(
"ChargeConfiguration.json",
Path.Combine(snapshotOfDate, "ChargeConfiguration.json"),
Path.Combine(AGVSConfigulator.ConfigsFilesFolder, "ChargeConfiguration.json")
);
AddIfHasDiff<DailyReportConfiguration>(
"DailyReportConfig.json",
Path.Combine(snapshotOfDate, "DailyReportConfig.json"),
Path.Combine(AGVSConfigulator.ConfigsFilesFolder, "DailyReportConfig.json")
);
AddIfHasDiff<DiskStatusMonitorConfiguration>(
"DiskStatusMonitorConfig.json",
Path.Combine(snapshotOfDate, "DiskStatusMonitorConfig.json"),
Path.Combine(AGVSConfigulator.ConfigsFilesFolder, "DiskStatusMonitorConfig.json")
);
// =============================
// EQ 管理設定
// =============================
string eqFolderName = AGVSConfigulator.SysConfigs.EQManagementConfigs.EquipmentManagementConfigFolder.TrimStart('/');
string snapEQFolder = Path.Combine(snapshotOfDate, eqFolderName);
string currEQFolder = Path.Combine(AGVSConfigulator.ConfigsFilesFolder, eqFolderName);
AddIfHasDiff<Dictionary<string, clsEndPointOptions>>(
"EQConfigs.json",
Path.Combine(snapEQFolder, "EQConfigs.json"),
Path.Combine(currEQFolder, "EQConfigs.json")
);
AddIfHasDiff<Dictionary<string, clsChargeStationOptions>>(
"ChargStationConfigs.json",
Path.Combine(snapEQFolder, "ChargStationConfigs.json"),
Path.Combine(currEQFolder, "ChargStationConfigs.json")
);
AddIfHasDiff<Dictionary<string, clsRackOptions>>(
"WIPConfigs.json",
Path.Combine(snapEQFolder, "WIPConfigs.json"),
Path.Combine(currEQFolder, "WIPConfigs.json")
);
// =============================
// MAP 設定
// =============================
string mapFolderName = AGVSConfigulator.SysConfigs.MapConfigs.MapFolder.TrimStart('/');
string mapFileName = AGVSConfigulator.SysConfigs.MapConfigs.CurrentMapFileName;
string snapMapFolder = Path.Combine(snapshotOfDate, mapFolderName);
string currMapFolder = Path.Combine(AGVSConfigulator.ConfigsFilesFolder, mapFolderName);
AddIfHasDiff<Dictionary<string, Map>>(
"MAP",
Path.Combine(snapMapFolder, mapFileName),
Path.Combine(currMapFolder, mapFileName)
);
return resultCollection;
}
}
}