Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWindowManager.SettingView.cs
More file actions
Latest commit
376 lines (358 loc) · 31.9 KB
/
Copy pathWindowManager.SettingView.cs
File metadata and controls
376 lines (358 loc) · 31.9 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
usingSystem;
usingSystem.IO;
usingSystem.Text;
usingSystem.Runtime.InteropServices;
usingSystem.Windows.Controls;
usingPAYMAP_BACKEND.Views;
usingMahApps.Metro.Controls;
usingOpenFileDialog=Microsoft.Win32.OpenFileDialog;
usingSaveFileDialog=Microsoft.Win32.SaveFileDialog;
namespacePAYMAP_BACKEND
{
partialclassWindowManager
{
privatestaticSettingView_settingView;
privatestaticButton_settingFileLoad;
privatestaticButton_settingFileSave;
privatestaticButton_settingFileImport;
privatestaticButton_settingFileExport;
privatestaticTextBox_settingPortMain;
privatestaticTextBox_settingPortRemote;
privatestaticTextBox_settingPortDEVX;
privatestaticToggleSwitch_settingAuthLevel1;
privatestaticToggleSwitch_settingAuthLevel2;
privatestaticToggleSwitch_settingAuthLevel3;
privatestaticTextBox_settingVersionLive;
privatestaticTextBox_settingVersionMin;
privatestaticToggleSwitch_settingThreadDashboard;
privatestaticTextBox_settingThreadDashboardInterval;
privatestaticToggleSwitch_settingThreadDEVX;
privatestaticTextBox_settingThreadDEVXInterval;
privatestaticTextBox_settingAPIFirebase;
privatestaticTextBox_settingAPICatcher;
privatestaticTextBox_settingAPIReviewer;
privatestaticTextBox_settingDBAddress;
privatestaticTextBox_settingDBPort;
privatestaticToggleSwitch_settingDEVXMaster;
privatestaticToggleSwitch_settingDEVXReport;
privatestaticToggleSwitch_settingDEVXCommand;
privatestaticButton_settingControlRestore;
privatestaticButton_settingControlApply;
publicstaticstringSettingDefaultFilePath=AppDomain.CurrentDomain.BaseDirectory+"config.ini";
privatestaticvoidInitializeSettingWindow()
{
if(_settingView==null)return;
_settingFileLoad=(Button)_settingView.FindName("SettingFileLoad");
_settingFileSave=(Button)_settingView.FindName("SettingFileSave");
_settingFileImport=(Button)_settingView.FindName("SettingFileImport");
_settingFileExport=(Button)_settingView.FindName("SettingFileExport");
if(_settingFileLoad==null||_settingFileSave==null||_settingFileImport==null||_settingFileExport==null)return;
_settingPortMain=(TextBox)_settingView.FindName("SettingPortMain");
_settingPortRemote=(TextBox)_settingView.FindName("SettingPortRemote");
_settingPortDEVX=(TextBox)_settingView.FindName("SettingPortDEVX");
if(_settingPortMain==null||_settingPortRemote==null||_settingPortDEVX==null)return;
_settingAuthLevel1=(ToggleSwitch)_settingView.FindName("SettingAuthLevel1");
_settingAuthLevel2=(ToggleSwitch)_settingView.FindName("SettingAuthLevel2");
_settingAuthLevel3=(ToggleSwitch)_settingView.FindName("SettingAuthLevel3");
if(_settingAuthLevel1==null||_settingAuthLevel2==null||_settingAuthLevel3==null)return;
_settingVersionLive=(TextBox)_settingView.FindName("SettingVersionLive");
_settingVersionMin=(TextBox)_settingView.FindName("SettingVersionMin");
if(_settingVersionLive==null||_settingVersionMin==null)return;
_settingThreadDashboard=(ToggleSwitch)_settingView.FindName("SettingThreadDashboard");
_settingThreadDashboardInterval=(TextBox)_settingView.FindName("SettingThreadDashboardInterval");
_settingThreadDEVX=(ToggleSwitch)_settingView.FindName("SettingThreadDEVX");
_settingThreadDEVXInterval=(TextBox)_settingView.FindName("SettingThreadDEVXInterval");
if(_settingThreadDashboard==null||_settingThreadDashboardInterval==null||_settingThreadDEVX==null||_settingThreadDEVXInterval==null)return;
_settingAPIFirebase=(TextBox)_settingView.FindName("SettingAPIFirebase");
_settingAPICatcher=(TextBox)_settingView.FindName("SettingAPICatcher");
_settingAPIReviewer=(TextBox)_settingView.FindName("SettingAPIReviewer");
if(_settingAPIFirebase==null||_settingAPICatcher==null||_settingAPIReviewer==null)return;
_settingDBAddress=(TextBox)_settingView.FindName("SettingDBAddress");
_settingDBPort=(TextBox)_settingView.FindName("SettingDBPort");
if(_settingDBAddress==null||_settingDBPort==null)return;
_settingDEVXMaster=(ToggleSwitch)_settingView.FindName("SettingDEVXMaster");
_settingDEVXReport=(ToggleSwitch)_settingView.FindName("SettingDEVXReport");
_settingDEVXCommand=(ToggleSwitch)_settingView.FindName("SettingDEVXCommand");
if(_settingDEVXMaster==null||_settingDEVXReport==null||_settingDEVXCommand==null)return;
_settingControlRestore=(Button)_settingView.FindName("SettingControlRestore");
_settingControlApply=(Button)_settingView.FindName("SettingControlApply");
if(_settingControlRestore==null||_settingControlApply==null)return;
_settingFileLoad.Click+=(sender,args)=>LoadSettingFile(SettingDefaultFilePath);
_settingFileSave.Click+=(sender,args)=>SaveSettingFile(SettingDefaultFilePath);
_settingFileImport.Click+=(sender,args)=>LoadSettingFile(null);
_settingFileExport.Click+=(sender,args)=>SaveSettingFile(null);
_settingControlRestore.Click+=(sender,args)=>RefreshSettingData();
_settingControlApply.Click+=(sender,args)=>ApplySettingData();
RefreshSettingData();
}
privatestaticvoidRefreshSettingData()
{
if(_settingPortMain!=null)_settingPortMain.Text=App.PaymapSettings.PortMain.ToString();
if(_settingPortRemote!=null)_settingPortRemote.Text=App.PaymapSettings.PortRemote.ToString();
if(_settingPortDEVX!=null)_settingPortDEVX.Text=App.PaymapSettings.PortDEVX.ToString();
if(_settingAuthLevel1!=null)_settingAuthLevel1.IsChecked=App.PaymapSettings.AuthLevel1;
if(_settingAuthLevel2!=null)_settingAuthLevel2.IsChecked=App.PaymapSettings.AuthLevel2;
if(_settingAuthLevel3!=null)_settingAuthLevel3.IsChecked=App.PaymapSettings.AuthLevel3;
if(_settingVersionLive!=null)_settingVersionLive.Text=App.PaymapSettings.VersionLive.ToString();
if(_settingVersionMin!=null)_settingVersionMin.Text=App.PaymapSettings.VersionMin.ToString();
if(_settingThreadDashboard!=null)_settingThreadDashboard.IsChecked=App.PaymapSettings.ThreadSwitchDashboard;
if(_settingThreadDashboardInterval!=null)_settingThreadDashboardInterval.Text=App.PaymapSettings.ThreadIntervalDashboard.ToString();
if(_settingThreadDEVX!=null)_settingThreadDEVX.IsChecked=App.PaymapSettings.ThreadSwitchDEVX;
if(_settingThreadDEVXInterval!=null)_settingThreadDEVXInterval.Text=App.PaymapSettings.ThreadIntervalDEVX.ToString();
if(_settingAPIFirebase!=null)_settingAPIFirebase.Text=App.PaymapSettings.APIFirebase;
if(_settingAPICatcher!=null)_settingAPICatcher.Text=App.PaymapSettings.APICatcher;
if(_settingAPIReviewer!=null)_settingAPIReviewer.Text=App.PaymapSettings.APIReviewer;
if(_settingDBAddress!=null)_settingDBAddress.Text=App.PaymapSettings.DBAddress;
if(_settingDBPort!=null)_settingDBPort.Text=App.PaymapSettings.DBPort.ToString();
if(_settingDEVXMaster!=null)_settingDEVXMaster.IsChecked=App.PaymapSettings.DEVXMaster;
if(_settingDEVXReport!=null)_settingDEVXReport.IsChecked=App.PaymapSettings.DEVXReport;
if(_settingDEVXCommand!=null)_settingDEVXCommand.IsChecked=App.PaymapSettings.DEVXCommand;
}
privatestaticvoidApplySettingData()
{
if(_settingPortMain!=null)int.TryParse(_settingPortMain.Text,outApp.PaymapSettings.PortMain);
if(_settingPortRemote!=null)int.TryParse(_settingPortRemote.Text,outApp.PaymapSettings.PortRemote);
if(_settingPortDEVX!=null)int.TryParse(_settingPortDEVX.Text,outApp.PaymapSettings.PortDEVX);
if(_settingAuthLevel1!=null)App.PaymapSettings.AuthLevel1=_settingAuthLevel1.IsChecked.HasValue&&_settingAuthLevel1.IsChecked.Value;
if(_settingAuthLevel2!=null)App.PaymapSettings.AuthLevel2=_settingAuthLevel2.IsChecked.HasValue&&_settingAuthLevel2.IsChecked.Value;
if(_settingAuthLevel3!=null)App.PaymapSettings.AuthLevel3=_settingAuthLevel3.IsChecked.HasValue&&_settingAuthLevel3.IsChecked.Value;
if(_settingVersionLive!=null)int.TryParse(_settingVersionLive.Text,outApp.PaymapSettings.VersionLive);
if(_settingVersionMin!=null)int.TryParse(_settingVersionMin.Text,outApp.PaymapSettings.VersionMin);
if(_settingThreadDashboard!=null)App.PaymapSettings.ThreadSwitchDashboard=_settingThreadDashboard.IsChecked.HasValue&&_settingThreadDashboard.IsChecked.Value;
if(_settingThreadDashboardInterval!=null)int.TryParse(_settingThreadDashboardInterval.Text,outApp.PaymapSettings.ThreadIntervalDashboard);
if(_settingThreadDEVX!=null)App.PaymapSettings.ThreadSwitchDEVX=_settingThreadDEVX.IsChecked.HasValue&&_settingThreadDEVX.IsChecked.Value;
if(_settingThreadDEVXInterval!=null)int.TryParse(_settingThreadDEVXInterval.Text,outApp.PaymapSettings.ThreadIntervalDEVX);
if(_settingAPIFirebase!=null)App.PaymapSettings.APIFirebase=_settingAPIFirebase.Text;
if(_settingAPICatcher!=null)App.PaymapSettings.APICatcher=_settingAPICatcher.Text;
if(_settingAPIReviewer!=null)App.PaymapSettings.APIReviewer=_settingAPIReviewer.Text;
if(_settingDBAddress!=null)App.PaymapSettings.DBAddress=_settingDBAddress.Text;
if(_settingDBPort!=null)int.TryParse(_settingDBPort.Text,outApp.PaymapSettings.DBPort);
if(_settingDEVXMaster!=null)App.PaymapSettings.DEVXMaster=_settingDEVXMaster.IsChecked.HasValue&&_settingDEVXMaster.IsChecked.Value;
if(_settingDEVXReport!=null)App.PaymapSettings.DEVXReport=_settingDEVXReport.IsChecked.HasValue&&_settingDEVXReport.IsChecked.Value;
if(_settingDEVXCommand!=null)App.PaymapSettings.DEVXCommand=_settingDEVXCommand.IsChecked.HasValue&&_settingDEVXCommand.IsChecked.Value;
}
publicstaticvoidSetSettingView(SettingViewsettingView)
{
_settingView=settingView;
InitializeSettingWindow();
}
privatestaticvoidLoadSettingFile(stringfilePath)
{
if(filePath==null)
{
OpenFileDialogopenFileDialog=newOpenFileDialog
{
Filter="Setting File|config.ini",
InitialDirectory=AppDomain.CurrentDomain.BaseDirectory
};
if(openFileDialog.ShowDialog()==true)
{
LoadSettingFile(openFileDialog.FileName);
return;
}
}
vartempPortMain=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionPort,PaymapSettingKeys.IntPortMain);
if(!string.IsNullOrEmpty(tempPortMain))int.TryParse(tempPortMain,outApp.PaymapSettings.PortMain);
vartempPortRemote=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionPort,PaymapSettingKeys.IntPortRemote);
if(!string.IsNullOrEmpty(tempPortRemote))int.TryParse(tempPortRemote,outApp.PaymapSettings.PortRemote);
vartempPortDEVX=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionPort,PaymapSettingKeys.IntPortDEVX);
if(!string.IsNullOrEmpty(tempPortDEVX))int.TryParse(tempPortDEVX,outApp.PaymapSettings.PortDEVX);
vartempAuthLevel1=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionAuth,PaymapSettingKeys.BoolAuthLevel1);
if(!string.IsNullOrEmpty(tempAuthLevel1))bool.TryParse(tempAuthLevel1,outApp.PaymapSettings.AuthLevel1);
vartempAuthLevel2=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionAuth,PaymapSettingKeys.BoolAuthLevel2);
if(!string.IsNullOrEmpty(tempAuthLevel2))bool.TryParse(tempAuthLevel2,outApp.PaymapSettings.AuthLevel2);
vartempAuthLevel3=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionAuth,PaymapSettingKeys.BoolAuthLevel3);
if(!string.IsNullOrEmpty(tempAuthLevel3))bool.TryParse(tempAuthLevel3,outApp.PaymapSettings.AuthLevel3);
vartempVersionLive=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionVersion,PaymapSettingKeys.IntVersionLive);
if(!string.IsNullOrEmpty(tempVersionLive))int.TryParse(tempVersionLive,outApp.PaymapSettings.VersionLive);
vartempVersionMin=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionVersion,PaymapSettingKeys.IntVersionMin);
if(!string.IsNullOrEmpty(tempVersionMin))int.TryParse(tempVersionMin,outApp.PaymapSettings.VersionMin);
vartempThreadDashboard=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionThread,PaymapSettingKeys.BoolThreadDashboard);
if(!string.IsNullOrEmpty(tempThreadDashboard))bool.TryParse(tempThreadDashboard,outApp.PaymapSettings.ThreadSwitchDashboard);
vartempThreadDashboardInterval=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionThread,PaymapSettingKeys.IntThreadIntervalDashboard);
if(!string.IsNullOrEmpty(tempThreadDashboardInterval))int.TryParse(tempThreadDashboardInterval,outApp.PaymapSettings.ThreadIntervalDashboard);
vartempThreadDEVX=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionThread,PaymapSettingKeys.BoolThreadDEVX);
if(!string.IsNullOrEmpty(tempThreadDEVX))bool.TryParse(tempThreadDEVX,outApp.PaymapSettings.ThreadSwitchDEVX);
vartempThreadDEVXInterval=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionThread,PaymapSettingKeys.IntThreadIntervalDEVX);
if(!string.IsNullOrEmpty(tempThreadDEVXInterval))int.TryParse(tempThreadDEVXInterval,outApp.PaymapSettings.ThreadIntervalDEVX);
vartempAPIFirebase=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionAPI,PaymapSettingKeys.StringAPIFirebase);
if(!string.IsNullOrEmpty(tempAPIFirebase))App.PaymapSettings.APIFirebase=tempAPIFirebase;
vartempAPICatcher=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionAPI,PaymapSettingKeys.StringAPICatcher);
if(!string.IsNullOrEmpty(tempAPICatcher))App.PaymapSettings.APICatcher=tempAPICatcher;
vartempAPIReviewer=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionAPI,PaymapSettingKeys.StringAPIReviewer);
if(!string.IsNullOrEmpty(tempAPIReviewer))App.PaymapSettings.APIReviewer=tempAPIReviewer;
vartempDBLocation=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionDB,PaymapSettingKeys.StringDBAddress);
if(!string.IsNullOrEmpty(tempDBLocation))App.PaymapSettings.DBAddress=tempDBLocation;
vartempDBPort=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionDB,PaymapSettingKeys.IntDBPort);
if(!string.IsNullOrEmpty(tempDBPort))int.TryParse(tempDBPort,outApp.PaymapSettings.DBPort);
vartempDEVXMaster=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionDEVX,PaymapSettingKeys.BoolDEVXMaster);
if(!string.IsNullOrEmpty(tempDEVXMaster))bool.TryParse(tempDEVXMaster,outApp.PaymapSettings.DEVXMaster);
vartempDEVXReport=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionDEVX,PaymapSettingKeys.BoolDEVXReport);
if(!string.IsNullOrEmpty(tempDEVXReport))bool.TryParse(tempDEVXReport,outApp.PaymapSettings.DEVXReport);
vartempDEVXCommand=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionDEVX,PaymapSettingKeys.BoolDEVXCommand);
if(!string.IsNullOrEmpty(tempDEVXCommand))bool.TryParse(tempDEVXCommand,outApp.PaymapSettings.DEVXCommand);
vartempLogLevel1=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel1);
if(!string.IsNullOrEmpty(tempLogLevel1))bool.TryParse(tempLogLevel1,outApp.PaymapSettings.LogLevel1);
vartempLogLevel2=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel2);
if(!string.IsNullOrEmpty(tempLogLevel2))bool.TryParse(tempLogLevel2,outApp.PaymapSettings.LogLevel2);
vartempLogLevel3=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel3);
if(!string.IsNullOrEmpty(tempLogLevel3))bool.TryParse(tempLogLevel3,outApp.PaymapSettings.LogLevel3);
vartempLogLevel4=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel4);
if(!string.IsNullOrEmpty(tempLogLevel4))bool.TryParse(tempLogLevel4,outApp.PaymapSettings.LogLevel4);
vartempLogLevel5=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel5);
if(!string.IsNullOrEmpty(tempLogLevel5))bool.TryParse(tempLogLevel5,outApp.PaymapSettings.LogLevel5);
vartempLogFilterLevel1=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel1);
if(!string.IsNullOrEmpty(tempLogFilterLevel1))bool.TryParse(tempLogFilterLevel1,outApp.PaymapSettings.LogFilterLevel1);
vartempLogFilterLevel2=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel2);
if(!string.IsNullOrEmpty(tempLogFilterLevel2))bool.TryParse(tempLogFilterLevel2,outApp.PaymapSettings.LogFilterLevel2);
vartempLogFilterLevel3=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel3);
if(!string.IsNullOrEmpty(tempLogFilterLevel3))bool.TryParse(tempLogFilterLevel3,outApp.PaymapSettings.LogFilterLevel3);
vartempLogFilterLevel4=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel4);
if(!string.IsNullOrEmpty(tempLogFilterLevel4))bool.TryParse(tempLogFilterLevel4,outApp.PaymapSettings.LogFilterLevel4);
vartempLogFilterLevel5=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel5);
if(!string.IsNullOrEmpty(tempLogFilterLevel5))bool.TryParse(tempLogFilterLevel5,outApp.PaymapSettings.LogFilterLevel5);
vartempLogFilterType1=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType1);
if(!string.IsNullOrEmpty(tempLogFilterType1))bool.TryParse(tempLogFilterType1,outApp.PaymapSettings.LogFilterType1);
vartempLogFilterType2=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType2);
if(!string.IsNullOrEmpty(tempLogFilterType2))bool.TryParse(tempLogFilterType2,outApp.PaymapSettings.LogFilterType2);
vartempLogFilterType3=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType3);
if(!string.IsNullOrEmpty(tempLogFilterType3))bool.TryParse(tempLogFilterType3,outApp.PaymapSettings.LogFilterType3);
vartempLogFilterType4=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType4);
if(!string.IsNullOrEmpty(tempLogFilterType4))bool.TryParse(tempLogFilterType4,outApp.PaymapSettings.LogFilterType4);
vartempLogFilterType5=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType5);
if(!string.IsNullOrEmpty(tempLogFilterType5))bool.TryParse(tempLogFilterType5,outApp.PaymapSettings.LogFilterType5);
vartempLogFilterType6=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType6);
if(!string.IsNullOrEmpty(tempLogFilterType6))bool.TryParse(tempLogFilterType6,outApp.PaymapSettings.LogFilterType6);
vartempLogFilterType7=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType7);
if(!string.IsNullOrEmpty(tempLogFilterType7))bool.TryParse(tempLogFilterType7,outApp.PaymapSettings.LogFilterType7);
vartempLogFilterType8=ConfigSystem.ReadConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType8);
if(!string.IsNullOrEmpty(tempLogFilterType8))bool.TryParse(tempLogFilterType8,outApp.PaymapSettings.LogFilterType8);
RefreshSettingData();
}
privatestaticvoidSaveSettingFile(stringfilePath)
{
if(filePath==null)
{
SaveFileDialogsaveFileDialog=newSaveFileDialog
{
Filter="Setting File|config.ini",
InitialDirectory=AppDomain.CurrentDomain.BaseDirectory
};
if(saveFileDialog.ShowDialog()==true)
{
SaveSettingFile(saveFileDialog.FileName);
return;
}
}
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionPort,PaymapSettingKeys.IntPortMain,App.PaymapSettings.PortMain.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionPort,PaymapSettingKeys.IntPortRemote,App.PaymapSettings.PortRemote.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionPort,PaymapSettingKeys.IntPortDEVX,App.PaymapSettings.PortDEVX.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionAuth,PaymapSettingKeys.BoolAuthLevel1,App.PaymapSettings.AuthLevel1.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionAuth,PaymapSettingKeys.BoolAuthLevel2,App.PaymapSettings.AuthLevel2.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionAuth,PaymapSettingKeys.BoolAuthLevel3,App.PaymapSettings.AuthLevel3.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionVersion,PaymapSettingKeys.IntVersionLive,App.PaymapSettings.VersionLive.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionVersion,PaymapSettingKeys.IntVersionMin,App.PaymapSettings.VersionMin.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionAuth,PaymapSettingKeys.BoolAuthLevel1,App.PaymapSettings.AuthLevel1.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionThread,PaymapSettingKeys.BoolThreadDashboard,App.PaymapSettings.ThreadSwitchDashboard.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionThread,PaymapSettingKeys.IntThreadIntervalDashboard,App.PaymapSettings.ThreadIntervalDashboard.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionThread,PaymapSettingKeys.BoolThreadDEVX,App.PaymapSettings.ThreadSwitchDEVX.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionThread,PaymapSettingKeys.IntThreadIntervalDEVX,App.PaymapSettings.ThreadIntervalDEVX.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionAPI,PaymapSettingKeys.StringAPIFirebase,App.PaymapSettings.APIFirebase);
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionAPI,PaymapSettingKeys.StringAPICatcher,App.PaymapSettings.APICatcher);
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionAPI,PaymapSettingKeys.StringAPIReviewer,App.PaymapSettings.APIReviewer);
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionDB,PaymapSettingKeys.StringDBAddress,App.PaymapSettings.DBAddress);
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionDB,PaymapSettingKeys.IntDBPort,App.PaymapSettings.DBPort.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionDEVX,PaymapSettingKeys.BoolDEVXMaster,App.PaymapSettings.DEVXMaster.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionDEVX,PaymapSettingKeys.BoolDEVXReport,App.PaymapSettings.DEVXReport.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionDEVX,PaymapSettingKeys.BoolDEVXCommand,App.PaymapSettings.DEVXCommand.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel1,App.PaymapSettings.LogLevel1.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel2,App.PaymapSettings.LogLevel2.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel3,App.PaymapSettings.LogLevel3.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel4,App.PaymapSettings.LogLevel4.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogLevel5,App.PaymapSettings.LogLevel5.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel1,App.PaymapSettings.LogFilterLevel1.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel2,App.PaymapSettings.LogFilterLevel2.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel3,App.PaymapSettings.LogFilterLevel3.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel4,App.PaymapSettings.LogFilterLevel4.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterLevel5,App.PaymapSettings.LogFilterLevel5.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType1,App.PaymapSettings.LogFilterType1.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType2,App.PaymapSettings.LogFilterType2.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType3,App.PaymapSettings.LogFilterType3.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType4,App.PaymapSettings.LogFilterType4.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType5,App.PaymapSettings.LogFilterType5.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType6,App.PaymapSettings.LogFilterType6.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType7,App.PaymapSettings.LogFilterType7.ToString());
ConfigSystem.WriteConfig(filePath,PaymapSettingKeys.SectionLog,PaymapSettingKeys.BoolLogFilterType8,App.PaymapSettings.LogFilterType8.ToString());
}
privatestaticclassPaymapSettingKeys
{
publicconststringSectionPort="PORT";
publicconststringIntPortMain="PortMain";
publicconststringIntPortRemote="PortRemote";
publicconststringIntPortDEVX="PortDEVX";
publicconststringSectionAuth="AUTH";
publicconststringBoolAuthLevel1="AuthLevel1";
publicconststringBoolAuthLevel2="AuthLevel2";
publicconststringBoolAuthLevel3="AuthLevel3";
publicconststringSectionVersion="VERSION";
publicconststringIntVersionMin="VersionMin";
publicconststringIntVersionLive="VersionLive";
publicconststringSectionThread="THREAD";
publicconststringBoolThreadDashboard="ThreadSwitchDashboard";
publicconststringBoolThreadDEVX="ThreadSwitchDEVX";
publicconststringIntThreadIntervalDashboard="ThreadIntervalDashboard";
publicconststringIntThreadIntervalDEVX="ThreadIntervalDEVX";
publicconststringSectionAPI="API";
publicconststringStringAPIFirebase="APIFirebase";
publicconststringStringAPICatcher="APICatcher";
publicconststringStringAPIReviewer="APIReviewer";
publicconststringSectionDB="DB";
publicconststringStringDBAddress="DBAddress";
publicconststringIntDBPort="DBPort";
publicconststringSectionDEVX="DEVX";
publicconststringBoolDEVXMaster="DEVXMaster";
publicconststringBoolDEVXReport="DEVXReport";
publicconststringBoolDEVXCommand="DEVXCommand";
publicconststringSectionLog="LOG";
publicconststringBoolLogLevel1="LogLevel1";
publicconststringBoolLogLevel2="LogLevel2";
publicconststringBoolLogLevel3="LogLevel3";
publicconststringBoolLogLevel4="LogLevel4";
publicconststringBoolLogLevel5="LogLevel5";
publicconststringBoolLogFilterLevel1="LogFilterLevel1";
publicconststringBoolLogFilterLevel2="LogFilterLevel2";
publicconststringBoolLogFilterLevel3="LogFilterLevel3";
publicconststringBoolLogFilterLevel4="LogFilterLevel4";
publicconststringBoolLogFilterLevel5="LogFilterLevel5";
publicconststringBoolLogFilterType1="LogFilterType1";
publicconststringBoolLogFilterType2="LogFilterType2";
publicconststringBoolLogFilterType3="LogFilterType3";
publicconststringBoolLogFilterType4="LogFilterType4";
publicconststringBoolLogFilterType5="LogFilterType5";
publicconststringBoolLogFilterType6="LogFilterType6";
publicconststringBoolLogFilterType7="LogFilterType7";
publicconststringBoolLogFilterType8="LogFilterType8";
}
privatestaticclassConfigSystem
{
[DllImport("kernel32")]
privatestaticexternlongWritePrivateProfileString(stringsection,stringkey,stringval,stringfilePath);
[DllImport("kernel32")]
privatestaticexternintGetPrivateProfileString(stringsection,stringkey,stringdef,StringBuilderretVal,intsize,stringfilePath);
publicstaticvoidWriteConfig(stringfile,stringsection,stringkey,stringval)
{
WritePrivateProfileString(section,key,val,GetFile(file));
}
publicstaticstringReadConfig(stringfile,stringsection,stringkey)
{
StringBuildertemp=newStringBuilder(255);
GetPrivateProfileString(section,key,null,temp,255,GetFile(file));
returntemp.ToString();
}
privatestaticstringGetFile(stringfile)
{
returnPath.Combine(AppDomain.CurrentDomain.BaseDirectory,file.EndsWith(".ini")?file:file+".ini");
}
}
}
}