wzp
2021-07-28 864986e4cad03f6b9bba9a7e65379db496b62a6a
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
using Common;
using System;
 
namespace CMPPHOST
{
  
 
    public class SysConf
    {
        private int _activeTestInterval;
        private bool _autoConnection;
        private int _currentMsgLevel;
        private string _dbConnstr;
        private string _dbPassWD;
        private string _dbSource;
        private string _dbUserID;
        private string _initialCatalog;
        private static SysConf _instance;
        private int _msgListBoxMaxRow;
        private int _mtLimit;
        private string _passwd;
        private string _programId;
        private int _reSubmitInterval;
        private string _serverip;
        private int _serverport;
        private int _slidingWindowSize;
        private string _spcode;
        private string _spid;
        internal static readonly string AppFile = @".\app.config";
        internal static readonly string LogFilePath = @".\Syslog\";
 
        public int SMSCount = 0;
        public int SubmitSmsCount = 0;
        public DateTime startTime = DateTime.MinValue;
        public DateTime endTime = DateTime.MinValue;
        public int ActiveTestInterval
        {
            get
            {
                return this._activeTestInterval;
            }
            set
            {
                this._activeTestInterval = value;
                AppConfiguration.UpdateConfValue(AppFile, "ActiveTestInterval", this._activeTestInterval.ToString());
            }
        }
 
        public bool AutoConnection
        {
            get
            {
                return this._autoConnection;
            }
            set
            {
                this._autoConnection = value;
                AppConfiguration.UpdateConfValue(AppFile, "AutoConnection", this._autoConnection.ToString());
            }
        }
 
        public int CurrentMsgLevel
        {
            get
            {
                return this._currentMsgLevel;
            }
            set
            {
                this._currentMsgLevel = value;
                AppConfiguration.UpdateConfValue(AppFile, "CurrentMsgLevel", this._currentMsgLevel.ToString());
            }
        }
 
        public string DBConnstr
        {
            get
            {
                return this._dbConnstr;
            }
            set
            {
                this._dbConnstr = value;
            }
        }
 
        public string DBPassWD
        {
            get
            {
                return this._dbPassWD;
            }
            set
            {
                this._dbPassWD = value;
                AppConfiguration.UpdateConfValue(AppFile, "DBPassWD", this._dbPassWD.ToString());
            }
        }
 
        public string DBSource
        {
            get
            {
                return this._dbSource;
            }
            set
            {
                this._dbSource = value;
                AppConfiguration.UpdateConfValue(AppFile, "DBSource", this._dbSource.ToString());
            }
        }
 
        public string DBUserID
        {
            get
            {
                return this._dbUserID;
            }
            set
            {
                this._dbUserID = value;
                AppConfiguration.UpdateConfValue(AppFile, "DBUserID", this._dbUserID.ToString());
            }
        }
 
        internal string InitialCatalog
        {
            get
            {
                return this._initialCatalog;
            }
            set
            {
                this._initialCatalog = value;
                AppConfiguration.UpdateConfValue(AppFile, "InitialCatalog", this._initialCatalog.ToString());
            }
        }
 
        public static SysConf Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new SysConf();
                    _instance._spcode = AppConfiguration.GetConfValue(AppFile, "SPCODE");
                    _instance._spid = AppConfiguration.GetConfValue(AppFile, "SPID");
                    _instance._passwd = AppConfiguration.GetConfValue(AppFile, "PASSWD");
                    _instance._serverip = AppConfiguration.GetConfValue(AppFile, "ServerIP");
                    _instance._serverport = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "ServerPort"), 0);
                    _instance._dbSource = AppConfiguration.GetConfValue(AppFile, "DBSource");
                    _instance._initialCatalog = AppConfiguration.GetConfValue(AppFile, "InitialCatalog");
                    _instance._dbUserID = AppConfiguration.GetConfValue(AppFile, "DBUserID");
                    _instance._dbPassWD = AppConfiguration.GetConfValue(AppFile, "DBPassWD");
                    _instance._msgListBoxMaxRow = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "MsgListBoxMaxRow"), 100);
                    _instance._mtLimit = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "MTLimit"), 10);
                    _instance._currentMsgLevel = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "CurrentMsgLevel"), 2);
                    _instance._slidingWindowSize = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "SlidingWindowSize"), 10);
                    _instance._reSubmitInterval = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "ReSubmitInterval"), 30);
                    _instance._activeTestInterval = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "ActiveTestInterval"), 30);
                    _instance._autoConnection = true;
                    if (AppConfiguration.GetConfValue(AppFile, "AutoConnection").ToUpper() == "FALSE")
                    {
                        _instance._autoConnection = false;
                    }
                    _instance._programId = AppConfiguration.GetConfValue(AppFile, "ProgramID");
                    if (_instance._programId.Length <= 0)
                    {
                        _instance._programId = "1";
                    }
                }
                return _instance;
            }
        }
 
        internal int MsgListBoxMaxRow
        {
            get
            {
                return this._msgListBoxMaxRow;
            }
            set
            {
                this._msgListBoxMaxRow = value;
                AppConfiguration.UpdateConfValue(AppFile, "MsgListBoxMaxRow", this._msgListBoxMaxRow.ToString());
            }
        }
 
        internal int MTLimit
        {
            get
            {
                return this._mtLimit;
            }
            set
            {
                this._mtLimit = value;
                AppConfiguration.UpdateConfValue(AppFile, "MTLimit", this._mtLimit.ToString());
            }
        }
 
        public string PASSWD
        {
            get
            {
                return this._passwd;
            }
            set
            {
                this._passwd = value;
                AppConfiguration.UpdateConfValue(AppFile, "PASSWD", this._passwd);
            }
        }
 
        internal string ProgramID
        {
            get
            {
                return this._programId;
            }
            set
            {
                this._programId = value;
                AppConfiguration.UpdateConfValue(AppFile, "ProgramID", this._programId);
            }
        }
 
        public int ReSubmitInterval
        {
            get
            {
                return this._reSubmitInterval;
            }
            set
            {
                this._reSubmitInterval = value;
                AppConfiguration.UpdateConfValue(AppFile, "ReSubmitInterval", this._reSubmitInterval.ToString());
            }
        }
 
        public string ServerIP
        {
            get
            {
                return this._serverip;
            }
            set
            {
                this._serverip = value;
                AppConfiguration.UpdateConfValue(AppFile, "ServerIP", this._serverip);
            }
        }
 
        public int ServerPort
        {
            get
            {
                return this._serverport;
            }
            set
            {
                this._serverport = value;
                AppConfiguration.UpdateConfValue(AppFile, "ServerPort", this._serverport.ToString());
            }
        }
 
        public int SlidingWindowSize
        {
            get
            {
                return this._slidingWindowSize;
            }
            set
            {
                this._slidingWindowSize = value;
                AppConfiguration.UpdateConfValue(AppFile, "SlidingWindowSize", this._slidingWindowSize.ToString());
            }
        }
 
        public string SpCode
        {
            get
            {
                return this._spcode;
            }
            set
            {
                this._spcode = value;
                AppConfiguration.UpdateConfValue(AppFile, "SPCODE", this._spcode);
            }
        }
 
        public string SPID
        {
            get
            {
                return this._spid;
            }
            set
            {
                this._spid = value;
                AppConfiguration.UpdateConfValue(AppFile, "SPID", this._spid);
            }
        }
    }
}