@magic-xpa/utils 4.800.0-dev480.22 → 4.800.0-dev480.220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/magic-xpa-utils.umd.js +72 -1222
- package/bundles/magic-xpa-utils.umd.js.map +1 -1
- package/bundles/magic-xpa-utils.umd.min.js +1 -1
- package/bundles/magic-xpa-utils.umd.min.js.map +1 -1
- package/esm2015/index.js +1 -1
- package/esm2015/magic-xpa-utils.js +1 -4
- package/esm2015/src/Base64.js +1 -46
- package/esm2015/src/ChoiceUtils.js +1 -13
- package/esm2015/src/Constants.js +2 -14
- package/esm2015/src/DateTimeUtils.js +1 -2
- package/esm2015/src/DateUtil.js +1 -13
- package/esm2015/src/InternalInterface.js +4 -8
- package/esm2015/src/JSON_Utils.js +1 -1
- package/esm2015/src/Logger.js +2 -81
- package/esm2015/src/MagicConstants.js +1 -1
- package/esm2015/src/Misc.js +1 -60
- package/esm2015/src/MsgInterface.js +1 -1
- package/esm2015/src/PICInterface.js +20 -31
- package/esm2015/src/PlatformUtils.js +2 -2
- package/esm2015/src/Queue.js +1 -9
- package/esm2015/src/Randomizer.js +1 -1
- package/esm2015/src/RequestInfo.js +1 -4
- package/esm2015/src/Rtf.js +15 -199
- package/esm2015/src/StorageAttribute.js +1 -33
- package/esm2015/src/StrUtil.js +0 -0
- package/esm2015/src/SyncExecutionHelper.js +1 -16
- package/esm2015/src/UtilDateJpn.js +9 -89
- package/esm2015/src/UtilImeJpn.js +3 -32
- package/esm2015/src/UtilStrByteMode.js +15 -288
- package/esm2015/src/XMLConstants.js +1 -12
- package/esm2015/src/Xml/XmlParser.js +3 -100
- package/esm2015/src/enums.js +1 -1
- package/fesm2015/magic-xpa-utils.js +72 -1224
- package/fesm2015/magic-xpa-utils.js.map +1 -1
- package/magic-xpa-utils.d.ts +0 -3
- package/package.json +2 -2
- package/src/InternalInterface.d.ts +1 -1
- package/src/StrUtil.d.ts +0 -1
|
@@ -2,79 +2,28 @@ import { StringBuilder, Encoding, Hashtable, Stack, NChar, NNumber, NString, Ref
|
|
|
2
2
|
import { isNullOrUndefined } from 'util';
|
|
3
3
|
import { parseString } from 'xml2js';
|
|
4
4
|
|
|
5
|
-
/// <summary>JPN: DBCS support
|
|
6
5
|
class UtilStrByteMode {
|
|
7
|
-
/// <summary> Checks the environment whether it is running on DBCS environment
|
|
8
|
-
/// Returns true if the language code for the current default Locale is
|
|
9
|
-
/// DBCS language (in non-Unicode encoding).
|
|
10
|
-
///
|
|
11
|
-
/// </summary>
|
|
12
|
-
/// <returns> true if DBCS, or false if SBCS
|
|
13
|
-
/// </returns>
|
|
14
6
|
static isLocaleDefLangDBCS() {
|
|
15
7
|
return UtilStrByteMode._bLocaleDefLangJPN || UtilStrByteMode._bLocaleDefLangCHN || UtilStrByteMode._bLocaleDefLangKOR;
|
|
16
8
|
}
|
|
17
|
-
/// <summary> Checks whether the language code for the current default Locale
|
|
18
|
-
/// is JAPANESE.
|
|
19
|
-
///
|
|
20
|
-
/// </summary>
|
|
21
|
-
/// <returns> true if JAPANESE, or false if not
|
|
22
|
-
/// </returns>
|
|
23
9
|
static isLocaleDefLangJPN() {
|
|
24
10
|
return UtilStrByteMode._bLocaleDefLangJPN;
|
|
25
11
|
}
|
|
26
|
-
/// <summary> Checks whether the language code for the current default Locale
|
|
27
|
-
/// is KOREAN.
|
|
28
|
-
///
|
|
29
|
-
/// </summary>
|
|
30
|
-
/// <returns> true if KOREAN, or false if not
|
|
31
|
-
/// </returns>
|
|
32
12
|
static isLocaleDefLangKOR() {
|
|
33
13
|
return UtilStrByteMode._bLocaleDefLangKOR;
|
|
34
14
|
}
|
|
35
15
|
static isKoreanCharacter(c) {
|
|
36
|
-
return (44032 <=
|
|
37
|
-
}
|
|
38
|
-
/// <summary> Length of String
|
|
39
|
-
/// Returns the number of bytes (in default encoding).
|
|
40
|
-
///
|
|
41
|
-
/// </summary>
|
|
42
|
-
/// <param name="strVal:">string (in Unicode)
|
|
43
|
-
/// </param>
|
|
44
|
-
/// <returns> the number of bytes (in default encoding)
|
|
45
|
-
///
|
|
46
|
-
/// Example: lenB("abXYc")
|
|
47
|
-
/// Where 'a', 'b' and 'c' are SBCS, and 'X' and 'Y' are DBCS, it returns
|
|
48
|
-
/// 7.
|
|
49
|
-
/// </returns>
|
|
16
|
+
return (44032 <= c && c <= 55203) || (4352 <= c && c <= 4607) || (12592 <= c && c <= 12687) || (43360 <= c && c <= 43391) || (55216 <= c && c <= 55295);
|
|
17
|
+
}
|
|
50
18
|
static lenB(strVal) {
|
|
51
|
-
// convert to byte[] by default-encoding
|
|
52
19
|
return UtilStrByteMode.Encoding.GetByteCount(strVal);
|
|
53
20
|
}
|
|
54
|
-
/// <summary> Substring of String
|
|
55
|
-
/// Extracts a specified number of characters (a substring) from a string.
|
|
56
|
-
/// If a DBCS character is divided in two, it will be replace to a space.
|
|
57
|
-
///
|
|
58
|
-
/// </summary>
|
|
59
|
-
/// <param name="strVal:">string (in Unicode)
|
|
60
|
-
/// </param>
|
|
61
|
-
/// <param name="ofs:">starting position (byte) of the substring
|
|
62
|
-
/// </param>
|
|
63
|
-
/// <param name="len:">number of bytes to be extracted (i.e. bytes of substring)
|
|
64
|
-
/// </param>
|
|
65
|
-
/// <returns> substring
|
|
66
|
-
///
|
|
67
|
-
/// Example: midB("abXYc", 2, 4)
|
|
68
|
-
/// Where 'a', 'b' and 'c' are SBCS, and 'X' and 'Y' are DBCS, it returns
|
|
69
|
-
/// "bX ".
|
|
70
|
-
/// </returns>
|
|
71
21
|
static midB(strVal, ofs, len) {
|
|
72
|
-
let intValidMaxIndex = -1;
|
|
73
|
-
let intValidMinIndex = -1;
|
|
74
|
-
let bHeadSpace = false;
|
|
75
|
-
let bEndSpace = false;
|
|
22
|
+
let intValidMaxIndex = -1;
|
|
23
|
+
let intValidMinIndex = -1;
|
|
24
|
+
let bHeadSpace = false;
|
|
25
|
+
let bEndSpace = false;
|
|
76
26
|
let strRet;
|
|
77
|
-
// check and modify ofs & len
|
|
78
27
|
if (len <= 0)
|
|
79
28
|
return "";
|
|
80
29
|
if (ofs <= 0) {
|
|
@@ -88,7 +37,6 @@ class UtilStrByteMode {
|
|
|
88
37
|
let LenMax = intByteLength - ofs;
|
|
89
38
|
if (LenMax < len)
|
|
90
39
|
len = LenMax;
|
|
91
|
-
// set MinIndex and MaxIndex for substring
|
|
92
40
|
intByteLength = 0;
|
|
93
41
|
for (let intIndex = 0; intIndex < strVal.length; intIndex = intIndex + 1) {
|
|
94
42
|
let s = strVal.substr(intIndex, 1);
|
|
@@ -116,9 +64,7 @@ class UtilStrByteMode {
|
|
|
116
64
|
}
|
|
117
65
|
}
|
|
118
66
|
}
|
|
119
|
-
// prepare for substring
|
|
120
67
|
let strbufAddingBuf = new StringBuilder(len);
|
|
121
|
-
// execute Mid
|
|
122
68
|
if (bHeadSpace) {
|
|
123
69
|
strbufAddingBuf.Append(' ');
|
|
124
70
|
}
|
|
@@ -132,39 +78,9 @@ class UtilStrByteMode {
|
|
|
132
78
|
strbufAddingBuf = null;
|
|
133
79
|
return strRet;
|
|
134
80
|
}
|
|
135
|
-
/// <summary> Get Characters from Left of String
|
|
136
|
-
/// Returns a specified number of bytes from the left side of a string.
|
|
137
|
-
/// If a DBCS character is divided in two, it will be replace to a space.
|
|
138
|
-
///
|
|
139
|
-
/// </summary>
|
|
140
|
-
/// <param name="strVal:">string (in Unicode)
|
|
141
|
-
/// </param>
|
|
142
|
-
/// <param name="len:">number of bytes to be retured
|
|
143
|
-
/// </param>
|
|
144
|
-
/// <returns> output string
|
|
145
|
-
///
|
|
146
|
-
/// Example: leftB("abXYc", 4)
|
|
147
|
-
/// Where 'a', 'b' and 'c' are SBCS, and 'X' and 'Y' are DBCS, it returns
|
|
148
|
-
/// "abX".
|
|
149
|
-
/// </returns>
|
|
150
81
|
static leftB(strVal, len) {
|
|
151
82
|
return UtilStrByteMode.midB(strVal, 0, len);
|
|
152
83
|
}
|
|
153
|
-
/// <summary> Get Characters from Right of String
|
|
154
|
-
/// Returns a specified number of bytes from the right side of a string.
|
|
155
|
-
/// If a DBCS character is divided in two, it will be replace to a space.
|
|
156
|
-
///
|
|
157
|
-
/// </summary>
|
|
158
|
-
/// <param name="strVal:">string (in Unicode)
|
|
159
|
-
/// </param>
|
|
160
|
-
/// <param name="len:">number of bytes to be retured
|
|
161
|
-
/// </param>
|
|
162
|
-
/// <returns> output string
|
|
163
|
-
///
|
|
164
|
-
/// Example: rightB("abXYc", 4)
|
|
165
|
-
/// Where 'a', 'b' and 'c' are SBCS, and 'X' and 'Y' are DBCS, it returns
|
|
166
|
-
/// " Yc".
|
|
167
|
-
/// </returns>
|
|
168
84
|
static rightB(strVal, len) {
|
|
169
85
|
let byteFldsValLen = UtilStrByteMode.lenB(strVal);
|
|
170
86
|
if (len < 0) {
|
|
@@ -176,27 +92,6 @@ class UtilStrByteMode {
|
|
|
176
92
|
}
|
|
177
93
|
return UtilStrByteMode.midB(strVal, ofs, len);
|
|
178
94
|
}
|
|
179
|
-
/// <summary> Insert String
|
|
180
|
-
/// Inserts one string into another.
|
|
181
|
-
/// If a DBCS character is divided in two, it will be replace to a space.
|
|
182
|
-
///
|
|
183
|
-
/// </summary>
|
|
184
|
-
/// <param name="strTarget:">A string that represents the target string.
|
|
185
|
-
/// </param>
|
|
186
|
-
/// <param name="strSource:">A string that represents the source string.
|
|
187
|
-
/// </param>
|
|
188
|
-
/// <param name="ofs:">A number that represents the starting position (byte) in
|
|
189
|
-
/// the target.
|
|
190
|
-
/// </param>
|
|
191
|
-
/// <param name="len:">A number that represents the number of bytes from the
|
|
192
|
-
/// source that will be inserted into the target.
|
|
193
|
-
/// </param>
|
|
194
|
-
/// <returns> output string
|
|
195
|
-
///
|
|
196
|
-
/// Example: insB("abXYc", "de", 4, 1)
|
|
197
|
-
/// Where 'a', 'b', 'c', 'd' and 'e' are SBCS, and 'X' and 'Y' are DBCS,
|
|
198
|
-
/// it returns "ab d Yc".
|
|
199
|
-
/// </returns>
|
|
200
95
|
static insB(strTarget, strSource, ofs, len) {
|
|
201
96
|
if (ofs < 0) {
|
|
202
97
|
ofs = 0;
|
|
@@ -223,24 +118,6 @@ class UtilStrByteMode {
|
|
|
223
118
|
strbufRetVal.Append(UtilStrByteMode.rightB(strTarget, intTargetLenB - ofs));
|
|
224
119
|
return strbufRetVal.ToString();
|
|
225
120
|
}
|
|
226
|
-
/// <summary> Delete Characters
|
|
227
|
-
/// Delete characters from a string.
|
|
228
|
-
/// If a DBCS character is divided in two, it will be replace to a space.
|
|
229
|
-
///
|
|
230
|
-
/// </summary>
|
|
231
|
-
/// <param name="strVal:">string (in Unicode)
|
|
232
|
-
/// </param>
|
|
233
|
-
/// <param name="ofs:">The position (byte) of the first character to be deleted.
|
|
234
|
-
/// </param>
|
|
235
|
-
/// <param name="len:">The number of characters to be deleted, beginning with
|
|
236
|
-
/// position start and proceeding rightward.
|
|
237
|
-
/// </param>
|
|
238
|
-
/// <returns> output string
|
|
239
|
-
///
|
|
240
|
-
/// Example: delB("abXYc", 2, 4)
|
|
241
|
-
/// Where 'a', 'b' and 'c' are SBCS, and 'X' and 'Y' are DBCS, it returns
|
|
242
|
-
/// "a c".
|
|
243
|
-
/// </returns>
|
|
244
121
|
static delB(strVal, ofs, len) {
|
|
245
122
|
if (ofs < 0) {
|
|
246
123
|
ofs = 0;
|
|
@@ -272,55 +149,16 @@ class UtilStrByteMode {
|
|
|
272
149
|
}
|
|
273
150
|
return strRet;
|
|
274
151
|
}
|
|
275
|
-
/// <summary> In-String Search
|
|
276
|
-
/// Returns a number that represents the first position (byte) of a
|
|
277
|
-
/// substring within a string.
|
|
278
|
-
///
|
|
279
|
-
/// </summary>
|
|
280
|
-
/// <param name="strTarget:">string (in Unicode)
|
|
281
|
-
/// </param>
|
|
282
|
-
/// <param name="strSearch:">string which will be the search argument in string
|
|
283
|
-
/// </param>
|
|
284
|
-
/// <returns> number, 0 if not found
|
|
285
|
-
///
|
|
286
|
-
/// Example: instrB("abXYc", "Y")
|
|
287
|
-
/// Where 'a', 'b' and 'c' are SBCS, and 'X' and 'Y' are DBCS, it returns
|
|
288
|
-
/// 5.
|
|
289
|
-
/// </returns>
|
|
290
152
|
static instrB(strTarget, strSearch) {
|
|
291
153
|
if (strSearch.length === 0) {
|
|
292
|
-
// nothing to look for
|
|
293
154
|
return 0;
|
|
294
155
|
}
|
|
295
156
|
let ofs = strTarget.indexOf(strSearch);
|
|
296
157
|
if (ofs < 0) {
|
|
297
|
-
// not found
|
|
298
158
|
return 0;
|
|
299
159
|
}
|
|
300
160
|
return UtilStrByteMode.lenB(strTarget.substr(0, ofs)) + 1;
|
|
301
161
|
}
|
|
302
|
-
/// <summary> Replace Substring Within a String (Byte Mode)
|
|
303
|
-
/// Replaces a substring within a string with another substring.
|
|
304
|
-
/// If a DBCS character is divided in two, it will be replace to a space.
|
|
305
|
-
///
|
|
306
|
-
/// </summary>
|
|
307
|
-
/// <param name="strTarget:">target string where the replacement will take place.
|
|
308
|
-
/// </param>
|
|
309
|
-
/// <param name="strOrigin:">string that provides the substring to be copied to
|
|
310
|
-
/// target.
|
|
311
|
-
/// </param>
|
|
312
|
-
/// <param name="ofs:">the first position (byte) in the target string that will
|
|
313
|
-
/// receive the substring from origin.
|
|
314
|
-
/// </param>
|
|
315
|
-
/// <param name="len:">the number of bytes that will be moved from origin to
|
|
316
|
-
/// target, starting from the leftmost character of origin.
|
|
317
|
-
/// </param>
|
|
318
|
-
/// <returns> string containing modified target string
|
|
319
|
-
///
|
|
320
|
-
/// Example: repB("abXYc", "de", 4, 2)
|
|
321
|
-
/// Where 'a', 'b', 'c', 'd' and 'e' are SBCS, and 'X' and 'Y' are DBCS,
|
|
322
|
-
/// it returns "ab de c".
|
|
323
|
-
/// </returns>
|
|
324
162
|
static repB(strTarget, strOrigin, ofs, len) {
|
|
325
163
|
let strbufAddingBuf = new StringBuilder();
|
|
326
164
|
if (ofs < 0) {
|
|
@@ -343,33 +181,12 @@ class UtilStrByteMode {
|
|
|
343
181
|
if (intRightLen > 0) {
|
|
344
182
|
strbufAddingBuf.Append(UtilStrByteMode.rightB(strTarget, intRightLen));
|
|
345
183
|
}
|
|
346
|
-
// add blanks to the end
|
|
347
184
|
intAddSpaceLen = len - UtilStrByteMode.lenB(strOrigin);
|
|
348
185
|
for (; intAddSpaceLen > 0; intAddSpaceLen--) {
|
|
349
186
|
strbufAddingBuf.Append(' ');
|
|
350
187
|
}
|
|
351
188
|
return strbufAddingBuf.ToString();
|
|
352
189
|
}
|
|
353
|
-
/// <summary> Replace Substring Within a String (Character Mode)
|
|
354
|
-
/// Replaces a substring within a string with another substring.
|
|
355
|
-
///
|
|
356
|
-
/// </summary>
|
|
357
|
-
/// <param name="strTarget:">target string where the replacement will take place.
|
|
358
|
-
/// </param>
|
|
359
|
-
/// <param name="strOrigin:">string that provides the substring to be copied to
|
|
360
|
-
/// target.
|
|
361
|
-
/// </param>
|
|
362
|
-
/// <param name="ofs:">the first position (character) in the target string that
|
|
363
|
-
/// will receive the substring from origin.
|
|
364
|
-
/// </param>
|
|
365
|
-
/// <param name="len:">the number of characters that will be moved from origin
|
|
366
|
-
/// to target, starting from the leftmost character of origin.
|
|
367
|
-
/// </param>
|
|
368
|
-
/// <returns> string containing modified target string
|
|
369
|
-
///
|
|
370
|
-
/// Example: repB("abXYc", "de", 4, 2)
|
|
371
|
-
/// Whether each character is SBCS or DBCS, it returns "abXde".
|
|
372
|
-
/// </returns>
|
|
373
190
|
static repC(strTarget, strOrigin, ofs, len) {
|
|
374
191
|
let strbufAddingBuf = new StringBuilder();
|
|
375
192
|
if (ofs < 0) {
|
|
@@ -384,7 +201,6 @@ class UtilStrByteMode {
|
|
|
384
201
|
len = 0;
|
|
385
202
|
}
|
|
386
203
|
strbufAddingBuf.Append(strTarget.substr(0, ofs));
|
|
387
|
-
// add blanks between strTarget and strOrigin
|
|
388
204
|
let intAddSpaceLen = ofs - strTarget.length;
|
|
389
205
|
for (; intAddSpaceLen > 0; intAddSpaceLen--)
|
|
390
206
|
strbufAddingBuf.Append(' ');
|
|
@@ -398,18 +214,9 @@ class UtilStrByteMode {
|
|
|
398
214
|
}
|
|
399
215
|
return strbufAddingBuf.ToString();
|
|
400
216
|
}
|
|
401
|
-
/// <summary> Checks whether a character is 1 byte (halfwidth) or not (fullwidth)
|
|
402
|
-
/// Returns true if the character is represented by 1 byte in non-Unicode
|
|
403
|
-
/// encoding.
|
|
404
|
-
/// </summary>
|
|
405
|
-
/// <param name="letter:">a character to be checked.
|
|
406
|
-
/// </param>
|
|
407
|
-
/// <returns> true if the character is halfwidth (SBCS), or false if it is
|
|
408
|
-
/// fullwidth (DBCS).
|
|
409
|
-
/// </returns>
|
|
410
217
|
static isHalfWidth(str) {
|
|
411
218
|
let letter = str.charCodeAt(0);
|
|
412
|
-
if (32 <=
|
|
219
|
+
if (32 <= letter && letter <= 126) {
|
|
413
220
|
return true;
|
|
414
221
|
}
|
|
415
222
|
else {
|
|
@@ -419,33 +226,18 @@ class UtilStrByteMode {
|
|
|
419
226
|
}
|
|
420
227
|
return false;
|
|
421
228
|
}
|
|
422
|
-
/// <summary> Checks whether a character is halfwidth digit letter
|
|
423
|
-
/// Do not use "Character.isDigit" which cannot distinguish between
|
|
424
|
-
/// halfwidth digit letter(SBCS) and fullwidth difit letter(DBCS).
|
|
425
|
-
/// </summary>
|
|
426
|
-
/// <param name="letter:">a character to be checked.
|
|
427
|
-
/// </param>
|
|
428
|
-
/// <returns> true if the character is halfwidth digit letter, or
|
|
429
|
-
/// false if it is DBCS or not digit letter.
|
|
430
|
-
/// </returns>
|
|
431
229
|
static isDigit(letter) {
|
|
432
|
-
return 48 <=
|
|
433
|
-
}
|
|
434
|
-
/// <summary>Checks whether a character is one of those supported for # Alpha Mask</summary>
|
|
435
|
-
/// <param name="letter:">a character to be checked.
|
|
436
|
-
/// </param>
|
|
437
|
-
/// <returns> true if the character is halfwidth digit letter, or
|
|
438
|
-
/// false if it is DBCS or not digit letter.
|
|
439
|
-
/// </returns>
|
|
230
|
+
return 48 <= letter.charCodeAt(0) && letter.charCodeAt(0) <= 57;
|
|
231
|
+
}
|
|
440
232
|
static asNumeric(letter) {
|
|
441
233
|
let result;
|
|
442
234
|
switch (letter.charCodeAt(0)) {
|
|
443
|
-
case 42:
|
|
444
|
-
case 43:
|
|
445
|
-
case 44:
|
|
446
|
-
case 45:
|
|
447
|
-
case 46:
|
|
448
|
-
case 47:
|
|
235
|
+
case 42:
|
|
236
|
+
case 43:
|
|
237
|
+
case 44:
|
|
238
|
+
case 45:
|
|
239
|
+
case 46:
|
|
240
|
+
case 47:
|
|
449
241
|
result = true;
|
|
450
242
|
break;
|
|
451
243
|
default:
|
|
@@ -454,47 +246,12 @@ class UtilStrByteMode {
|
|
|
454
246
|
}
|
|
455
247
|
return result;
|
|
456
248
|
}
|
|
457
|
-
/// <summary> Converts a position for the 1st string (Source) to a position for
|
|
458
|
-
/// the 2nd string (Dest).
|
|
459
|
-
/// If a double byte character exists in the strings, the position for the
|
|
460
|
-
/// Source could be different from the position for the Dest.
|
|
461
|
-
/// (DBCS Support)
|
|
462
|
-
///
|
|
463
|
-
/// </summary>
|
|
464
|
-
/// <param name="strSource:">Source string
|
|
465
|
-
/// </param>
|
|
466
|
-
/// <param name="strDest:">Dest string
|
|
467
|
-
/// </param>
|
|
468
|
-
/// <param name="pos:">position in the Source string
|
|
469
|
-
/// </param>
|
|
470
|
-
/// <param name="isAdvance:">advance or retreat the ret pos if a DBCS char is split
|
|
471
|
-
/// </param>
|
|
472
|
-
/// <returns> position in the Dest string
|
|
473
|
-
///
|
|
474
|
-
/// Example: convPos("abcYZ", "YZabc", 4)
|
|
475
|
-
/// It returns 4, if the all characters in the strings are SBCS.
|
|
476
|
-
///
|
|
477
|
-
/// If 'a', 'b' and 'c' are SBCS, and 'Y' and 'Z' are DBCS, it
|
|
478
|
-
/// returns 3.
|
|
479
|
-
/// pos
|
|
480
|
-
/// Unicode index 0 1 2 3 [4]
|
|
481
|
-
/// +-------------+
|
|
482
|
-
/// Source string |a|b|c| Y | Z |
|
|
483
|
-
/// +-------------+
|
|
484
|
-
/// ANSI index 0 1 2 3 4[5]6
|
|
485
|
-
/// +-------------+
|
|
486
|
-
/// Dest string | Y | Z |a|b|c|
|
|
487
|
-
/// +-------------+
|
|
488
|
-
/// Unicode index 0 1 2[3]4
|
|
489
|
-
/// ret
|
|
490
|
-
/// </returns>
|
|
491
249
|
static convPos(strSource, strDest, pos, isAdvance) {
|
|
492
250
|
let retPos;
|
|
493
251
|
if (pos < 0)
|
|
494
252
|
return 0;
|
|
495
253
|
if (pos > strSource.length)
|
|
496
254
|
pos = strSource.length;
|
|
497
|
-
// add blanks to the Dest string if it is shorter than the Src string
|
|
498
255
|
let diffLen = UtilStrByteMode.lenB(strSource) - UtilStrByteMode.lenB(strDest);
|
|
499
256
|
if (diffLen > 0) {
|
|
500
257
|
let stringBuilder = new StringBuilder(strDest);
|
|
@@ -505,23 +262,11 @@ class UtilStrByteMode {
|
|
|
505
262
|
let byteSource = UtilStrByteMode.Encoding.GetBytes(strSource.substr(0, pos));
|
|
506
263
|
let strLeftB = UtilStrByteMode.leftB(strDest, byteSource.length);
|
|
507
264
|
retPos = strLeftB.length;
|
|
508
|
-
if (!isAdvance && retPos > 0 && strLeftB.charCodeAt(retPos - 1) === 32
|
|
265
|
+
if (!isAdvance && retPos > 0 && strLeftB.charCodeAt(retPos - 1) === 32 && strDest.charCodeAt(retPos - 1) !== 32) {
|
|
509
266
|
retPos = retPos - 1;
|
|
510
267
|
}
|
|
511
268
|
return retPos;
|
|
512
269
|
}
|
|
513
|
-
/// <summary> return the number of characters of picture which corresponds to
|
|
514
|
-
/// given string.
|
|
515
|
-
/// </summary>
|
|
516
|
-
/// <param name="str:">given string
|
|
517
|
-
/// </param>
|
|
518
|
-
/// <param name="picture:">picture
|
|
519
|
-
/// </param>
|
|
520
|
-
/// <returns> minimal length of picture
|
|
521
|
-
/// Example: getMinLenPicture("ZZ20/11/", "JJJJYY/MM/DD") [ZZ is DBCS]
|
|
522
|
-
/// It returns 10.
|
|
523
|
-
/// </returns>
|
|
524
|
-
/// (DBCS Support)
|
|
525
270
|
static getMinLenPicture(str, picture) {
|
|
526
271
|
let len = 0;
|
|
527
272
|
if (UtilStrByteMode.lenB(picture) - UtilStrByteMode.lenB(str) > 0) {
|
|
@@ -531,18 +276,6 @@ class UtilStrByteMode {
|
|
|
531
276
|
len = picture.length;
|
|
532
277
|
return len;
|
|
533
278
|
}
|
|
534
|
-
/// <summary>
|
|
535
|
-
/// </summary> Compares two specified strings in the DBCS sort order and returns an integer
|
|
536
|
-
/// that indicates their relative position.
|
|
537
|
-
/// <param name="str1:">The first string to compare.
|
|
538
|
-
/// </param>
|
|
539
|
-
/// <param name="str2:">The second string to compare.
|
|
540
|
-
/// </param>
|
|
541
|
-
/// <returns>an integer that indicates the lexical relationship between the two strings.
|
|
542
|
-
/// -1: str1 is less than str2.
|
|
543
|
-
/// 0: str1 equals str2.
|
|
544
|
-
/// 1: str1 is greater than str2.
|
|
545
|
-
/// </returns>
|
|
546
279
|
static strcmp(str1, str2) {
|
|
547
280
|
let array1 = UtilStrByteMode.Encoding.GetBytes(str1);
|
|
548
281
|
let array2 = UtilStrByteMode.Encoding.GetBytes(str2);
|
|
@@ -563,34 +296,24 @@ class UtilStrByteMode {
|
|
|
563
296
|
}
|
|
564
297
|
}
|
|
565
298
|
UtilStrByteMode.Encoding = Encoding.UTF8;
|
|
566
|
-
// TODO : need to check what to do with CultureInfo
|
|
567
299
|
UtilStrByteMode.strNavigatorLang = window.navigator.language;
|
|
568
300
|
UtilStrByteMode._bLocaleDefLangJPN = UtilStrByteMode.strNavigatorLang.startsWith('ja');
|
|
569
301
|
UtilStrByteMode._bLocaleDefLangCHN = UtilStrByteMode.strNavigatorLang.startsWith('zh');
|
|
570
302
|
UtilStrByteMode._bLocaleDefLangKOR = UtilStrByteMode.strNavigatorLang.startsWith('ko');
|
|
571
303
|
|
|
572
|
-
//@dynamic
|
|
573
304
|
class Rtf_SYMBOL {
|
|
574
|
-
/* index into property table if kwd == kwdProp */
|
|
575
|
-
/* index into destination table if kwd == kwdDest */
|
|
576
|
-
/* character to print if kwd == kwdChar */
|
|
577
305
|
constructor(keyWord, kwd, idxInRgprop) {
|
|
578
306
|
this.szKeyword = null;
|
|
579
|
-
/* RTF keyword */
|
|
580
307
|
this.kwd = null;
|
|
581
|
-
/* base action to take */
|
|
582
308
|
this.idxInRgprop = null;
|
|
583
309
|
this.szKeyword = keyWord;
|
|
584
310
|
this.kwd = kwd;
|
|
585
311
|
this.idxInRgprop = idxInRgprop;
|
|
586
312
|
}
|
|
587
313
|
}
|
|
588
|
-
// @dynamic
|
|
589
314
|
class Rtf_PROP {
|
|
590
|
-
/* structure containing value */
|
|
591
315
|
constructor(actn, prop) {
|
|
592
316
|
this.actn = null;
|
|
593
|
-
/* size of value */
|
|
594
317
|
this.prop = null;
|
|
595
318
|
this.actn = actn;
|
|
596
319
|
this.prop = prop;
|
|
@@ -639,7 +362,6 @@ var Rtf_IDEST;
|
|
|
639
362
|
Rtf_IDEST[Rtf_IDEST["COLOR"] = 1] = "COLOR";
|
|
640
363
|
Rtf_IDEST[Rtf_IDEST["SKIP"] = 2] = "SKIP";
|
|
641
364
|
})(Rtf_IDEST || (Rtf_IDEST = {}));
|
|
642
|
-
/* types of properties */
|
|
643
365
|
var Rtf_IPROP;
|
|
644
366
|
(function (Rtf_IPROP) {
|
|
645
367
|
Rtf_IPROP[Rtf_IPROP["BOLD"] = 0] = "BOLD";
|
|
@@ -676,7 +398,6 @@ var Rtf_IPROP;
|
|
|
676
398
|
Rtf_IPROP[Rtf_IPROP["XA_BULLET"] = 31] = "XA_BULLET";
|
|
677
399
|
Rtf_IPROP[Rtf_IPROP["MAX"] = 32] = "MAX";
|
|
678
400
|
})(Rtf_IPROP || (Rtf_IPROP = {}));
|
|
679
|
-
/* Rtf Destination State */
|
|
680
401
|
var Rtf_RDS;
|
|
681
402
|
(function (Rtf_RDS) {
|
|
682
403
|
Rtf_RDS[Rtf_RDS["NORM"] = 0] = "NORM";
|
|
@@ -696,15 +417,6 @@ var Rtf_ErrorRtf;
|
|
|
696
417
|
Rtf_ErrorRtf[Rtf_ErrorRtf["END_OF_FILE"] = 7] = "END_OF_FILE";
|
|
697
418
|
Rtf_ErrorRtf[Rtf_ErrorRtf["BUFFER_TOO_SMALL"] = 8] = "BUFFER_TOO_SMALL";
|
|
698
419
|
})(Rtf_ErrorRtf || (Rtf_ErrorRtf = {}));
|
|
699
|
-
// TODO :
|
|
700
|
-
// Rtf_RtfChar should actually be enum.
|
|
701
|
-
// But computed string values are not allowed to be defined in enum.
|
|
702
|
-
// So, we cannot have String.fromCharCode(XXX).
|
|
703
|
-
// We have 2 options:
|
|
704
|
-
// 1. Convert this enum into a class with all static readonly items.
|
|
705
|
-
// 2. Keep it as enum with numeric values (char codes).
|
|
706
|
-
// Going with #1 now, since @2 makes the code ugly.
|
|
707
|
-
// Will evalaute later if required.
|
|
708
420
|
class Rtf_RtfChar {
|
|
709
421
|
}
|
|
710
422
|
Rtf_RtfChar.CR = String.fromCharCode(0x0d);
|
|
@@ -727,8 +439,6 @@ var Rtf_RIS;
|
|
|
727
439
|
Rtf_RIS[Rtf_RIS["UNICODE"] = 3] = "UNICODE";
|
|
728
440
|
})(Rtf_RIS || (Rtf_RIS = {}));
|
|
729
441
|
class Rtf {
|
|
730
|
-
/// <summary> Constructor
|
|
731
|
-
/// </summary>
|
|
732
442
|
constructor() {
|
|
733
443
|
this._group = 0;
|
|
734
444
|
this._cbBin = 0;
|
|
@@ -757,13 +467,6 @@ class Rtf {
|
|
|
757
467
|
this.setCodePageTable();
|
|
758
468
|
}
|
|
759
469
|
}
|
|
760
|
-
/// <summary> Checks if the blob has a Rtf data or not
|
|
761
|
-
///
|
|
762
|
-
/// </summary>
|
|
763
|
-
/// <param name="str">
|
|
764
|
-
/// </param>
|
|
765
|
-
/// <returns>
|
|
766
|
-
/// </returns>
|
|
767
470
|
static isRtf(str) {
|
|
768
471
|
let isRtf = false;
|
|
769
472
|
if (str !== null && str.startsWith(this.RTF_PREFIX)) {
|
|
@@ -771,17 +474,6 @@ class Rtf {
|
|
|
771
474
|
}
|
|
772
475
|
return isRtf;
|
|
773
476
|
}
|
|
774
|
-
/// <summary> Converts Rtf Text to Plain Text
|
|
775
|
-
/// Step 1: Isolate RTF keywords and send them to ParseKeyword; Push and pop state at the start and end of
|
|
776
|
-
/// RTF groups Send text to ParseChar for further processing.
|
|
777
|
-
///
|
|
778
|
-
/// </summary>
|
|
779
|
-
/// <param name="rtfTxt">
|
|
780
|
-
/// </param>
|
|
781
|
-
/// <param name="outputTxt">
|
|
782
|
-
/// </param>
|
|
783
|
-
/// <returns>
|
|
784
|
-
/// </returns>
|
|
785
477
|
toTxt(rtfTxt, outputTxt) {
|
|
786
478
|
let cNibble = 2;
|
|
787
479
|
let b = 0;
|
|
@@ -807,7 +499,6 @@ class Rtf {
|
|
|
807
499
|
this._index++;
|
|
808
500
|
if (this._group < 0)
|
|
809
501
|
return Rtf_ErrorRtf.STACK_UNDERFLOW;
|
|
810
|
-
/* if we're parsing binary data, handle it directly */
|
|
811
502
|
if (this._internalState === Rtf_RIS.BIN) {
|
|
812
503
|
if ((ec = this.ParseChar(blobChar, outputTxt)) !== Rtf_ErrorRtf.OK)
|
|
813
504
|
return ec;
|
|
@@ -830,22 +521,16 @@ class Rtf {
|
|
|
830
521
|
return ec;
|
|
831
522
|
break;
|
|
832
523
|
case Rtf_RtfChar.LF:
|
|
833
|
-
case Rtf_RtfChar.CR:
|
|
524
|
+
case Rtf_RtfChar.CR:
|
|
834
525
|
if (this._processCrlfSpecial) {
|
|
835
|
-
/* Once we reach the 0x0a while ProcessCRLFSpecial_, reset the ProcessCRLFSpecial_ */
|
|
836
526
|
if (blobChar === Rtf_RtfChar.LF) {
|
|
837
527
|
this._processCrlfSpecial = false;
|
|
838
528
|
}
|
|
839
529
|
}
|
|
840
530
|
else {
|
|
841
|
-
/*---------------------------------------------------------------*/
|
|
842
|
-
/* skip new lines coming only from the RTF header 1/1/98 - #2390 */
|
|
843
|
-
/*---------------------------------------------------------------*/
|
|
844
|
-
/* Skip the LF (0x0a) if we are not in the ProcessCRLFSpecial_ */
|
|
845
531
|
if (blobChar === Rtf_RtfChar.LF || (blobChar === Rtf_RtfChar.CR && skipNewline && !this._outputOnce))
|
|
846
532
|
break;
|
|
847
533
|
}
|
|
848
|
-
/* falls through */
|
|
849
534
|
default:
|
|
850
535
|
if (blobChar !== Rtf_RtfChar.CR)
|
|
851
536
|
skipNewline = false;
|
|
@@ -859,7 +544,6 @@ class Rtf {
|
|
|
859
544
|
this._internalState = Rtf_RIS.NORM;
|
|
860
545
|
}
|
|
861
546
|
else {
|
|
862
|
-
/* parsing hex data */
|
|
863
547
|
if (this._internalState !== Rtf_RIS.HEX)
|
|
864
548
|
return Rtf_ErrorRtf.ASSERTION;
|
|
865
549
|
b = b << 4;
|
|
@@ -881,22 +565,18 @@ class Rtf {
|
|
|
881
565
|
if (cNibble === 0) {
|
|
882
566
|
if (UtilStrByteMode.isLocaleDefLangDBCS()) {
|
|
883
567
|
charset = this.getCharset(this._fontNum);
|
|
884
|
-
// leading byte of a double-byte character
|
|
885
568
|
if (!skipParseChar && Rtf.is1stByte(b, charset)) {
|
|
886
569
|
dbcsBytes[0] = b;
|
|
887
570
|
dbcsBytes[1] = 0;
|
|
888
571
|
skipParseChar = true;
|
|
889
572
|
}
|
|
890
573
|
else {
|
|
891
|
-
// trailing byte of a double-byte character
|
|
892
574
|
if (skipParseChar && Rtf.is2ndByte(b, charset))
|
|
893
575
|
dbcsBytes[1] = b;
|
|
894
|
-
// single-byte character
|
|
895
576
|
else {
|
|
896
577
|
dbcsBytes[0] = b;
|
|
897
578
|
dbcsBytes[1] = 0;
|
|
898
579
|
}
|
|
899
|
-
// convert DBCS to Unicode
|
|
900
580
|
codePage = this.getCodePage(charset);
|
|
901
581
|
let workStr = Encoding.GetEncoding(codePage).GetString(dbcsBytes, 0, 2);
|
|
902
582
|
b = workStr.charCodeAt(0);
|
|
@@ -912,36 +592,19 @@ class Rtf {
|
|
|
912
592
|
this._internalState = Rtf_RIS.NORM;
|
|
913
593
|
}
|
|
914
594
|
}
|
|
915
|
-
/* end else (ris != risNorm) */
|
|
916
595
|
break;
|
|
917
596
|
}
|
|
918
|
-
/* switch */
|
|
919
597
|
}
|
|
920
|
-
/* else (ris != risBin) */
|
|
921
598
|
}
|
|
922
|
-
/* while */
|
|
923
599
|
if (this._group < 0)
|
|
924
600
|
return Rtf_ErrorRtf.STACK_UNDERFLOW;
|
|
925
601
|
if (this._group > 0)
|
|
926
602
|
return Rtf_ErrorRtf.UNMATCHED_BRACE;
|
|
927
|
-
/*-------------------------------------------------------------------*/
|
|
928
|
-
/* Eliminate suffix of carrige return + line feed */
|
|
929
|
-
/* (Check last characters - just in case format is not the expected) */
|
|
930
|
-
/*-------------------------------------------------------------------*/
|
|
931
603
|
currPos = outputTxt.Length;
|
|
932
604
|
if (currPos >= 3 && (outputTxt.get_Item(currPos - 3) === Rtf_RtfChar.CR && outputTxt.get_Item(currPos - 2) === Rtf_RtfChar.LF && outputTxt.get_Item(currPos - 1) === Rtf_RtfChar.CR || outputTxt.get_Item(currPos - 3) === Rtf_RtfChar.LF && outputTxt.get_Item(currPos - 2) === Rtf_RtfChar.CR && outputTxt.get_Item(currPos - 1) === Rtf_RtfChar.CR))
|
|
933
605
|
outputTxt.Remove(currPos - 3, 3);
|
|
934
606
|
return Rtf_ErrorRtf.OK;
|
|
935
607
|
}
|
|
936
|
-
/// <summary> Route the character to the appropriate destination stream.
|
|
937
|
-
///
|
|
938
|
-
/// </summary>
|
|
939
|
-
/// <param name="ch">
|
|
940
|
-
/// </param>
|
|
941
|
-
/// <param name="outputTxt">
|
|
942
|
-
/// </param>
|
|
943
|
-
/// <returns>
|
|
944
|
-
/// </returns>
|
|
945
608
|
ParseChar(ch, outputTxt) {
|
|
946
609
|
let ret = Rtf_ErrorRtf.OK;
|
|
947
610
|
if (this._internalState === Rtf_RIS.BIN && --this._cbBin <= 0) {
|
|
@@ -949,28 +612,14 @@ class Rtf {
|
|
|
949
612
|
}
|
|
950
613
|
if (this._destState === Rtf_RDS.SKIP) {
|
|
951
614
|
}
|
|
952
|
-
/* Toss this character. */
|
|
953
615
|
else if (this._destState === Rtf_RDS.NORM) {
|
|
954
|
-
/* Output a character. Properties are valid at this point. */
|
|
955
616
|
ret = this.PrintChar(ch, outputTxt);
|
|
956
617
|
}
|
|
957
618
|
else {
|
|
958
|
-
/* handle other destinations.... */
|
|
959
619
|
}
|
|
960
620
|
return ret;
|
|
961
621
|
}
|
|
962
|
-
/// <summary> Send a character to the output file.
|
|
963
|
-
///
|
|
964
|
-
/// </summary>
|
|
965
|
-
/// <param name="ch">
|
|
966
|
-
/// </param>
|
|
967
|
-
/// <param name="outputTxt">
|
|
968
|
-
/// </param>
|
|
969
|
-
/// <returns>
|
|
970
|
-
/// </returns>
|
|
971
622
|
PrintChar(ch, outputTxt) {
|
|
972
|
-
/* Allow carrige return + line feed in text, but remove bullet sign */
|
|
973
|
-
/*------------------------------------------------------------------*/
|
|
974
623
|
if ((ch >= ' ' || ch === Rtf_RtfChar.CR || ch === Rtf_RtfChar.LF) && ch !== String.fromCharCode(183)) {
|
|
975
624
|
outputTxt.Append(ch);
|
|
976
625
|
}
|
|
@@ -979,11 +628,6 @@ class Rtf {
|
|
|
979
628
|
}
|
|
980
629
|
return Rtf_ErrorRtf.OK;
|
|
981
630
|
}
|
|
982
|
-
/// <summary> Save relevant info on a linked list of SAVE structures.
|
|
983
|
-
///
|
|
984
|
-
/// </summary>
|
|
985
|
-
/// <returns>
|
|
986
|
-
/// </returns>
|
|
987
631
|
PushState() {
|
|
988
632
|
let stackSave = new Rtf_StackSave();
|
|
989
633
|
if (stackSave === null) {
|
|
@@ -996,11 +640,6 @@ class Rtf {
|
|
|
996
640
|
this._group++;
|
|
997
641
|
return Rtf_ErrorRtf.OK;
|
|
998
642
|
}
|
|
999
|
-
/// <summary> Always restore relevant info from the top of the SAVE list.
|
|
1000
|
-
///
|
|
1001
|
-
/// </summary>
|
|
1002
|
-
/// <returns>
|
|
1003
|
-
/// </returns>
|
|
1004
643
|
PopState() {
|
|
1005
644
|
let savedPop = this._stack.pop();
|
|
1006
645
|
if (savedPop === null) {
|
|
@@ -1011,15 +650,6 @@ class Rtf {
|
|
|
1011
650
|
this._group--;
|
|
1012
651
|
return Rtf_ErrorRtf.OK;
|
|
1013
652
|
}
|
|
1014
|
-
/// <summary> Step 2: get a control word (and its associated value) and call TranslateKeyword to dispatch the control.
|
|
1015
|
-
///
|
|
1016
|
-
/// </summary>
|
|
1017
|
-
/// <param name="rtfTxt">
|
|
1018
|
-
/// </param>
|
|
1019
|
-
/// <param name="outputTxt">
|
|
1020
|
-
/// </param>
|
|
1021
|
-
/// <returns>
|
|
1022
|
-
/// </returns>
|
|
1023
653
|
ParseKeyword(rtfTxt, outputTxt) {
|
|
1024
654
|
let ch;
|
|
1025
655
|
let fNeg = false;
|
|
@@ -1028,7 +658,6 @@ class Rtf {
|
|
|
1028
658
|
if ((ch = rtfTxt[this._index++]) === String.fromCharCode(0)) {
|
|
1029
659
|
return Rtf_ErrorRtf.END_OF_FILE;
|
|
1030
660
|
}
|
|
1031
|
-
/* a control symbol; no delimiter. */
|
|
1032
661
|
if (!NChar.IsLetter(ch)) {
|
|
1033
662
|
szKeyword = szKeyword + ch;
|
|
1034
663
|
return this.TranslateKeyword(szKeyword, outputTxt);
|
|
@@ -1050,13 +679,6 @@ class Rtf {
|
|
|
1050
679
|
if (ch !== ' ')
|
|
1051
680
|
this._index--;
|
|
1052
681
|
if (szKeyword === Rtf.CHAR_PAR) {
|
|
1053
|
-
/* if we get a RTF sequence of \par[0xd][0xa], ie a \par kwd followed */
|
|
1054
|
-
/* immidiately by the CR and LF, then ignore the \par kwd. otherwise */
|
|
1055
|
-
/* we will translate the \par - which translates to a LF (0xa) and also */
|
|
1056
|
-
/* the following 0x0d is translated to 0x0a, thus resulting in TWO LF's */
|
|
1057
|
-
/* being inserted instead of just one LF. So by skipping [\par] and */
|
|
1058
|
-
/* translating only the [0xd 0xa] will result in only one LF appearing */
|
|
1059
|
-
/* - which is the desired behaviour */
|
|
1060
682
|
if (rtfTxt[this._index] === Rtf_RtfChar.CR && rtfTxt[this._index + 1] === Rtf_RtfChar.LF)
|
|
1061
683
|
this._processCrlfSpecial = true;
|
|
1062
684
|
}
|
|
@@ -1067,37 +689,22 @@ class Rtf {
|
|
|
1067
689
|
return this.TranslateKeyword(szKeyword, outputTxt);
|
|
1068
690
|
}
|
|
1069
691
|
}
|
|
1070
|
-
/// <summary> Step 3. Search rgsymRtf for szKeyword and evaluate it appropriately.
|
|
1071
|
-
///
|
|
1072
|
-
/// </summary>
|
|
1073
|
-
/// <param name="szKeyword">
|
|
1074
|
-
/// </param>
|
|
1075
|
-
/// <param name="outputTxt">
|
|
1076
|
-
/// </param>
|
|
1077
|
-
/// <returns>
|
|
1078
|
-
/// </returns>
|
|
1079
692
|
TranslateKeyword(szKeyword, outputTxt) {
|
|
1080
693
|
let result = Rtf_ErrorRtf.OK;
|
|
1081
694
|
let isym;
|
|
1082
|
-
/* search for szKeyword in rgsymRtf */
|
|
1083
695
|
for (isym = 0; isym < Rtf.rgsymRtf.length; isym++) {
|
|
1084
696
|
if (szKeyword === Rtf.rgsymRtf[isym].szKeyword) {
|
|
1085
697
|
break;
|
|
1086
698
|
}
|
|
1087
699
|
}
|
|
1088
|
-
/* control word not found */
|
|
1089
700
|
if (isym === Rtf.rgsymRtf.length) {
|
|
1090
701
|
if (this._skipDestIfUnk) {
|
|
1091
|
-
/* if this is a new destination */
|
|
1092
702
|
this._destState = Rtf_RDS.SKIP;
|
|
1093
|
-
/* skip the destination */
|
|
1094
703
|
}
|
|
1095
|
-
/* else just discard it */
|
|
1096
704
|
this._skipDestIfUnk = false;
|
|
1097
705
|
}
|
|
1098
706
|
else {
|
|
1099
707
|
result = Rtf_ErrorRtf.BAD_TABLE;
|
|
1100
|
-
/* found it! use kwd and idxInRgprop to determine what to do with it. */
|
|
1101
708
|
this._skipDestIfUnk = false;
|
|
1102
709
|
if (Rtf.rgsymRtf[isym].kwd === Rtf_KWD.PROP) {
|
|
1103
710
|
result = this.validateProp(Rtf.rgsymRtf[isym].idxInRgprop);
|
|
@@ -1114,21 +721,11 @@ class Rtf {
|
|
|
1114
721
|
}
|
|
1115
722
|
return result;
|
|
1116
723
|
}
|
|
1117
|
-
/// <summary> Validate the property identified by _iprop_ to the value _val_.
|
|
1118
|
-
/// previously called Applypropchange
|
|
1119
|
-
/// </summary>
|
|
1120
|
-
/// <param name="iprop">
|
|
1121
|
-
/// </param>
|
|
1122
|
-
/// <returns>
|
|
1123
|
-
/// </returns>
|
|
1124
724
|
validateProp(iprop) {
|
|
1125
725
|
let ret = Rtf_ErrorRtf.OK;
|
|
1126
726
|
if (this._destState === Rtf_RDS.SKIP) {
|
|
1127
|
-
/* If we're skipping text, */
|
|
1128
727
|
return ret;
|
|
1129
|
-
/* don't do anything. */
|
|
1130
728
|
}
|
|
1131
|
-
/* validate prop */
|
|
1132
729
|
if (Rtf.rgprop[iprop].prop !== Rtf_PROPTYPE.DOP && Rtf.rgprop[iprop].prop !== Rtf_PROPTYPE.SEP &&
|
|
1133
730
|
Rtf.rgprop[iprop].prop !== Rtf_PROPTYPE.PAP && Rtf.rgprop[iprop].prop !== Rtf_PROPTYPE.CHP &&
|
|
1134
731
|
Rtf.rgprop[iprop].actn !== Rtf_ACTN.SPEC) {
|
|
@@ -1139,35 +736,18 @@ class Rtf {
|
|
|
1139
736
|
}
|
|
1140
737
|
return ret;
|
|
1141
738
|
}
|
|
1142
|
-
/// <summary> Change to the destination state.
|
|
1143
|
-
/// previously called ChangeDest
|
|
1144
|
-
/// </summary>
|
|
1145
|
-
/// <returns>
|
|
1146
|
-
/// </returns>
|
|
1147
739
|
changeDestState() {
|
|
1148
740
|
if (this._destState === Rtf_RDS.SKIP) {
|
|
1149
|
-
/* if we're skipping text, */
|
|
1150
741
|
return Rtf_ErrorRtf.OK;
|
|
1151
|
-
/* don't do anything */
|
|
1152
742
|
}
|
|
1153
743
|
this._destState = Rtf_RDS.SKIP;
|
|
1154
|
-
/* when in doubt, skip it... */
|
|
1155
744
|
return Rtf_ErrorRtf.OK;
|
|
1156
745
|
}
|
|
1157
|
-
/// <summary> Evaluate an RTF control that needs special processing.
|
|
1158
|
-
///
|
|
1159
|
-
/// </summary>
|
|
1160
|
-
/// <param name="ipfn">
|
|
1161
|
-
/// </param>
|
|
1162
|
-
/// <returns>
|
|
1163
|
-
/// </returns>
|
|
1164
746
|
ParseSpecialKeyword(ipfn) {
|
|
1165
747
|
let ret = Rtf_ErrorRtf.OK;
|
|
1166
748
|
if (!UtilStrByteMode.isLocaleDefLangDBCS()) {
|
|
1167
749
|
if (this._destState === Rtf_RDS.SKIP && ipfn !== Rtf_IPFN.BIN) {
|
|
1168
|
-
/* if we're skipping, and it's not */
|
|
1169
750
|
return ret;
|
|
1170
|
-
/* the \bin keyword, ignore it. */
|
|
1171
751
|
}
|
|
1172
752
|
if (ipfn === Rtf_IPFN.FONT || ipfn === Rtf_IPFN.CHARSET || ipfn === Rtf_IPFN.UNICODE) {
|
|
1173
753
|
return ret;
|
|
@@ -1221,15 +801,6 @@ class Rtf {
|
|
|
1221
801
|
}
|
|
1222
802
|
return ret;
|
|
1223
803
|
}
|
|
1224
|
-
/// <summary> Checks if the byte is within the trailing byte range.
|
|
1225
|
-
///
|
|
1226
|
-
/// </summary>
|
|
1227
|
-
/// <param name="dbcsBytes">
|
|
1228
|
-
/// </param>
|
|
1229
|
-
/// <param name="charset">
|
|
1230
|
-
/// </param>
|
|
1231
|
-
/// <returns>
|
|
1232
|
-
/// </returns>
|
|
1233
804
|
static is2ndByte(dbcsBytes, charset) {
|
|
1234
805
|
let ret = false;
|
|
1235
806
|
if (dbcsBytes > 255)
|
|
@@ -1248,35 +819,21 @@ class Rtf {
|
|
|
1248
819
|
}
|
|
1249
820
|
return ret;
|
|
1250
821
|
}
|
|
1251
|
-
/// <summary> Create a hashtable of codepage associated with charset.
|
|
1252
|
-
///
|
|
1253
|
-
/// </summary>
|
|
1254
|
-
/// <param>
|
|
1255
|
-
/// <returns>
|
|
1256
|
-
/// </returns>
|
|
1257
822
|
setCodePageTable() {
|
|
1258
|
-
|
|
1259
|
-
this._codePageTable.set_Item(
|
|
1260
|
-
this._codePageTable.set_Item(
|
|
1261
|
-
this._codePageTable.set_Item(
|
|
1262
|
-
this._codePageTable.set_Item(
|
|
1263
|
-
this._codePageTable.set_Item(
|
|
1264
|
-
this._codePageTable.set_Item(
|
|
1265
|
-
this._codePageTable.set_Item(
|
|
1266
|
-
this._codePageTable.set_Item(
|
|
1267
|
-
this._codePageTable.set_Item(
|
|
1268
|
-
this._codePageTable.set_Item(
|
|
1269
|
-
this._codePageTable.set_Item(
|
|
1270
|
-
this._codePageTable.set_Item(
|
|
1271
|
-
|
|
1272
|
-
}
|
|
1273
|
-
/// <summary> Get codepage corresponding to the specified charset.
|
|
1274
|
-
///
|
|
1275
|
-
/// </summary>
|
|
1276
|
-
/// <param name="charset">
|
|
1277
|
-
/// </param>
|
|
1278
|
-
/// <returns>
|
|
1279
|
-
/// </returns>
|
|
823
|
+
this._codePageTable.set_Item(0, 1252);
|
|
824
|
+
this._codePageTable.set_Item(128, 932);
|
|
825
|
+
this._codePageTable.set_Item(129, 949);
|
|
826
|
+
this._codePageTable.set_Item(134, 936);
|
|
827
|
+
this._codePageTable.set_Item(136, 950);
|
|
828
|
+
this._codePageTable.set_Item(161, 1253);
|
|
829
|
+
this._codePageTable.set_Item(162, 1254);
|
|
830
|
+
this._codePageTable.set_Item(177, 1255);
|
|
831
|
+
this._codePageTable.set_Item(178, 1256);
|
|
832
|
+
this._codePageTable.set_Item(186, 1257);
|
|
833
|
+
this._codePageTable.set_Item(204, 1251);
|
|
834
|
+
this._codePageTable.set_Item(222, 874);
|
|
835
|
+
this._codePageTable.set_Item(238, 1250);
|
|
836
|
+
}
|
|
1280
837
|
getCodePage(charset) {
|
|
1281
838
|
let codePage = 0;
|
|
1282
839
|
if (this._codePageTable.ContainsKey(charset)) {
|
|
@@ -1284,13 +841,6 @@ class Rtf {
|
|
|
1284
841
|
}
|
|
1285
842
|
return codePage;
|
|
1286
843
|
}
|
|
1287
|
-
/// <summary> Get charset corresponding to the specified font index.
|
|
1288
|
-
///
|
|
1289
|
-
/// </summary>
|
|
1290
|
-
/// <param name="font">
|
|
1291
|
-
/// </param>
|
|
1292
|
-
/// <returns>
|
|
1293
|
-
/// </returns>
|
|
1294
844
|
getCharset(font) {
|
|
1295
845
|
let charset = 0;
|
|
1296
846
|
if (this._charsetTable.ContainsKey(font)) {
|
|
@@ -1301,7 +851,6 @@ class Rtf {
|
|
|
1301
851
|
}
|
|
1302
852
|
Rtf.RTF_PREFIX = "{\\rtf";
|
|
1303
853
|
Rtf.CHAR_PAR = "par";
|
|
1304
|
-
/* Property descriptions */
|
|
1305
854
|
Rtf.rgprop = [
|
|
1306
855
|
new Rtf_PROP(Rtf_ACTN.BYTE, Rtf_PROPTYPE.CHP), new Rtf_PROP(Rtf_ACTN.BYTE, Rtf_PROPTYPE.CHP),
|
|
1307
856
|
new Rtf_PROP(Rtf_ACTN.BYTE, Rtf_PROPTYPE.CHP), new Rtf_PROP(Rtf_ACTN.BYTE, Rtf_PROPTYPE.CHP),
|
|
@@ -1319,7 +868,6 @@ Rtf.rgprop = [
|
|
|
1319
868
|
new Rtf_PROP(Rtf_ACTN.BYTE, Rtf_PROPTYPE.PAP), new Rtf_PROP(Rtf_ACTN.SPEC, Rtf_PROPTYPE.PAP),
|
|
1320
869
|
new Rtf_PROP(Rtf_ACTN.SPEC, Rtf_PROPTYPE.CHP), new Rtf_PROP(Rtf_ACTN.SPEC, Rtf_PROPTYPE.SEP)
|
|
1321
870
|
];
|
|
1322
|
-
/* Keyword descriptions */
|
|
1323
871
|
Rtf.rgsymRtf = [
|
|
1324
872
|
new Rtf_SYMBOL("b", Rtf_KWD.PROP, Rtf_IPROP.BOLD), new Rtf_SYMBOL("ul", Rtf_KWD.PROP, Rtf_IPROP.UNDERLINE),
|
|
1325
873
|
new Rtf_SYMBOL("i", Rtf_KWD.PROP, Rtf_IPROP.ITALIC), new Rtf_SYMBOL("li", Rtf_KWD.PROP, Rtf_IPROP.LEFT_IND),
|
|
@@ -1377,7 +925,6 @@ const HTML_2_STR = 3;
|
|
|
1377
925
|
const HTML_2_SEQ = 4;
|
|
1378
926
|
const SEQ_2_STR = 5;
|
|
1379
927
|
class StrUtil {
|
|
1380
|
-
/// <summary> trim the end of the string</summary>
|
|
1381
928
|
static mem_trim(str, len) {
|
|
1382
929
|
let result;
|
|
1383
930
|
if (len > 0) {
|
|
@@ -1412,15 +959,6 @@ class StrUtil {
|
|
|
1412
959
|
}
|
|
1413
960
|
StrUtil.memcpy_1(dest, destCount, src, scrCountOrSrcCount, count);
|
|
1414
961
|
}
|
|
1415
|
-
/// <summary>
|
|
1416
|
-
/// copy part of string into another string, like memcpy of C, but 4 string only
|
|
1417
|
-
/// </summary>
|
|
1418
|
-
/// <param name = "dest">string</param>
|
|
1419
|
-
/// <param name = "destCount">of counter start from in destignation string</param>
|
|
1420
|
-
/// <param name = "src">string</param>
|
|
1421
|
-
/// <param name = "scrCount">of counter start from in source string</param>
|
|
1422
|
-
/// <param name = "count"></param>
|
|
1423
|
-
/// <returns> new value of destignation string</returns>
|
|
1424
962
|
static memcpy_0(dest, destCount, src, scrCount, count) {
|
|
1425
963
|
let stringBuilder = new StringBuilder(dest.substr(0, destCount));
|
|
1426
964
|
if (scrCount + count < src.length) {
|
|
@@ -1447,14 +985,6 @@ class StrUtil {
|
|
|
1447
985
|
}
|
|
1448
986
|
StrUtil.memset_1(dest, destCount, inVal, counter);
|
|
1449
987
|
}
|
|
1450
|
-
/// <summary>
|
|
1451
|
-
/// insert to string chars n times
|
|
1452
|
-
/// </summary>
|
|
1453
|
-
/// <param name = "dest">string</param>
|
|
1454
|
-
/// <param name = "destCount">of counter start from in destignation string to start insertion of char from</param>
|
|
1455
|
-
/// <param name = "inVal">2 insert</param>
|
|
1456
|
-
/// <param name = "counter">- number of times to insert the char</param>
|
|
1457
|
-
/// <returns> new value of destignation string</returns>
|
|
1458
988
|
static memset_0(dest, destCount, inVal, counter) {
|
|
1459
989
|
let first = new StringBuilder(dest.substr(0, destCount));
|
|
1460
990
|
while (counter > 0) {
|
|
@@ -1483,29 +1013,14 @@ class StrUtil {
|
|
|
1483
1013
|
}
|
|
1484
1014
|
return result;
|
|
1485
1015
|
}
|
|
1486
|
-
/*******************************/
|
|
1487
|
-
/// <summary>
|
|
1488
|
-
/// Reverses string values.
|
|
1489
|
-
/// </summary>
|
|
1490
|
-
/// <param name="text">The StringBuilder object containing the string to be reversed.</param>
|
|
1491
|
-
/// <returns>The reversed string contained in a StringBuilder object.</returns>
|
|
1492
1016
|
static ReverseString(text) {
|
|
1493
|
-
// TODO: use string.Reverse()
|
|
1494
1017
|
let array = NString.ToCharArray(text.ToString());
|
|
1495
1018
|
array.reverse();
|
|
1496
1019
|
return new StringBuilder(NString.FromChars(array));
|
|
1497
1020
|
}
|
|
1498
|
-
/// <summary> remove spaces from the right side of string</summary>
|
|
1499
|
-
/// <param name="str">the string to trim
|
|
1500
|
-
/// </param>
|
|
1501
1021
|
static rtrim(str) {
|
|
1502
1022
|
return StrUtil.rtrimWithNull(str, false);
|
|
1503
1023
|
}
|
|
1504
|
-
/// <summary> remove spaces and/or Null chars from the right side of string</summary>
|
|
1505
|
-
/// <param name="str">the string to trim
|
|
1506
|
-
/// </param>
|
|
1507
|
-
/// <param name="trimNullChars">Whether to remove NULL characters or not
|
|
1508
|
-
/// </param>
|
|
1509
1024
|
static rtrimWithNull(str, trimNullChars) {
|
|
1510
1025
|
let result;
|
|
1511
1026
|
if (typeof str === "undefined" || str === null || str.length === 0) {
|
|
@@ -1514,7 +1029,7 @@ class StrUtil {
|
|
|
1514
1029
|
else {
|
|
1515
1030
|
let idx = str.length - 1;
|
|
1516
1031
|
if (trimNullChars) {
|
|
1517
|
-
while (idx >= 0 && (str[idx] === ' ' || str[idx] === String.fromCharCode(0)
|
|
1032
|
+
while (idx >= 0 && (str[idx] === ' ' || str[idx] === String.fromCharCode(0))) {
|
|
1518
1033
|
idx = idx - 1;
|
|
1519
1034
|
}
|
|
1520
1035
|
}
|
|
@@ -1533,9 +1048,6 @@ class StrUtil {
|
|
|
1533
1048
|
}
|
|
1534
1049
|
return result;
|
|
1535
1050
|
}
|
|
1536
|
-
/// <summary> remove spaces from the left side of string</summary>
|
|
1537
|
-
/// <param name="str">the string to trim
|
|
1538
|
-
/// </param>
|
|
1539
1051
|
static ltrim(str) {
|
|
1540
1052
|
let length = str.length;
|
|
1541
1053
|
let i = 0;
|
|
@@ -1544,7 +1056,7 @@ class StrUtil {
|
|
|
1544
1056
|
result = str;
|
|
1545
1057
|
}
|
|
1546
1058
|
else {
|
|
1547
|
-
while (i < length && str[i] === ' '
|
|
1059
|
+
while (i < length && str[i] === ' ') {
|
|
1548
1060
|
i = i + 1;
|
|
1549
1061
|
}
|
|
1550
1062
|
if (i > 0) {
|
|
@@ -1554,16 +1066,6 @@ class StrUtil {
|
|
|
1554
1066
|
}
|
|
1555
1067
|
return result;
|
|
1556
1068
|
}
|
|
1557
|
-
/// <summary>This function for Deleting String from end & start of input
|
|
1558
|
-
/// String
|
|
1559
|
-
/// </summary>
|
|
1560
|
-
/// <param name="str">String , which can include strToDelete spaces on input
|
|
1561
|
-
/// </param>
|
|
1562
|
-
/// <param name="strToDelete">need delete this String from start/end of str.
|
|
1563
|
-
/// </param>
|
|
1564
|
-
/// <returns> String without strToDelete on end & start,
|
|
1565
|
-
/// or 'null' if Sting hasn't not characters inside
|
|
1566
|
-
/// </returns>
|
|
1567
1069
|
static DeleteStringsFromEnds(str, strToDelete) {
|
|
1568
1070
|
if (str.startsWith(strToDelete)) {
|
|
1569
1071
|
str = str.substr(strToDelete.length);
|
|
@@ -1580,11 +1082,6 @@ class StrUtil {
|
|
|
1580
1082
|
}
|
|
1581
1083
|
return result;
|
|
1582
1084
|
}
|
|
1583
|
-
/// <summary> pad a string with trailing spaces up to the given length</summary>
|
|
1584
|
-
/// <param name="str">the string to pad
|
|
1585
|
-
/// </param>
|
|
1586
|
-
/// <param name="len">the expected length after padding
|
|
1587
|
-
/// </param>
|
|
1588
1085
|
static padStr(str, len) {
|
|
1589
1086
|
let padLen = len - str.length;
|
|
1590
1087
|
if (padLen > 0) {
|
|
@@ -1598,67 +1095,9 @@ class StrUtil {
|
|
|
1598
1095
|
}
|
|
1599
1096
|
return str;
|
|
1600
1097
|
}
|
|
1601
|
-
/// <summary> this method will serve as a string tokenizer instead of using the c# split method
|
|
1602
|
-
/// since there are diffrences btween java tokenizer and c# split
|
|
1603
|
-
/// the implimentation given by the conversion tool is not Sufficient
|
|
1604
|
-
/// </summary>
|
|
1605
|
-
/// <param name="source">- the source string to be converted
|
|
1606
|
-
/// </param>
|
|
1607
|
-
/// <param name="delim">- the string of delimiters used to split the string (each character in the String is a delimiter
|
|
1608
|
-
/// </param>
|
|
1609
|
-
/// <returns> array of token according which is the same as string tokenizer in java
|
|
1610
|
-
/// </returns>
|
|
1611
1098
|
static tokenize(source, delim) {
|
|
1612
|
-
// It is mentioned in the comment that we should not use String.Split()
|
|
1613
|
-
// because its behavior is different than Java's tokenizer.
|
|
1614
|
-
// So, we were suppose to use our own implementation (the commented code below).
|
|
1615
|
-
// But all these years, we were calling XmlParser.getToken() which was actually
|
|
1616
|
-
// using String.Split(). And we didn't face any problem.
|
|
1617
|
-
// So, it seems that we do not have problem in using String.Split().
|
|
1618
|
-
// But now, we can improve the performance here...
|
|
1619
|
-
// XmlParser.getTokens() was getting a String[] using String.Split().
|
|
1620
|
-
// It was then creating a List<String> from this String[] and was returning it to
|
|
1621
|
-
// tokenize().
|
|
1622
|
-
// tokenize() was again converting this List<String> back to String[].
|
|
1623
|
-
// So why not call String.Split() directly?
|
|
1624
1099
|
return source.split(delim);
|
|
1625
|
-
|
|
1626
|
-
String [] tokens = null;
|
|
1627
|
-
|
|
1628
|
-
char [] delimArry = delim.toCharArray();
|
|
1629
|
-
|
|
1630
|
-
//since java discards delimiters from the start and end of the string and c# does not
|
|
1631
|
-
//we need to remove them manually
|
|
1632
|
-
// source = source.TrimEnd(delimArry);
|
|
1633
|
-
// source = source.TrimStart(delimArry);
|
|
1634
|
-
source = source.trim();
|
|
1635
|
-
|
|
1636
|
-
//now that we have remove starting and ending delimiters we can split
|
|
1637
|
-
tokens = source.Split(delimArry);
|
|
1638
|
-
|
|
1639
|
-
/*
|
|
1640
|
-
* only one problem: if we have two Subsequent delimiters for example :
|
|
1641
|
-
* the delimiter is ';' and the string is: "first;;second;third"
|
|
1642
|
-
* then in java String tokenizer will give us only 3 tokens :first,second and third
|
|
1643
|
-
* while is c# split wethod will return 4 tokens: first,empty string,second and third
|
|
1644
|
-
* we need to deal with that
|
|
1645
|
-
*/
|
|
1646
|
-
/*
|
|
1647
|
-
List res = new List();
|
|
1648
|
-
for (int i = 0 ; i < tokens.length; i++)
|
|
1649
|
-
{
|
|
1650
|
-
if (tokens[i] != "" )
|
|
1651
|
-
res.addItem(tokens[i]);
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
return (String [])(res.getAllItems (String.class));*/
|
|
1655
|
-
}
|
|
1656
|
-
/// <summary>
|
|
1657
|
-
/// translate from string to hexa dump char by char
|
|
1658
|
-
/// </summary>
|
|
1659
|
-
/// <param name = "string">to translate it to the byte stream</param>
|
|
1660
|
-
/// <param name = "minLength">the minimal length of hexa digits for each char</param>
|
|
1661
|
-
/// <returns> the byte stream in form of string</returns>
|
|
1100
|
+
}
|
|
1662
1101
|
static stringToHexaDump(str, minLength) {
|
|
1663
1102
|
let stringBuilder = new StringBuilder(str.length * minLength);
|
|
1664
1103
|
for (let indx = 0; indx < str.length; indx = indx + 1) {
|
|
@@ -1677,11 +1116,6 @@ class StrUtil {
|
|
|
1677
1116
|
}
|
|
1678
1117
|
return StrUtil.searchAndReplace_1(str, from, to);
|
|
1679
1118
|
}
|
|
1680
|
-
/// <summary> replace every appearance of 'from' in 'str' with 'to'</summary>
|
|
1681
|
-
/// <param name="str">the working base source string </param>
|
|
1682
|
-
/// <param name="from">the string to replace </param>
|
|
1683
|
-
/// <param name="to">the string use instead 'from' </param>
|
|
1684
|
-
/// <returns> modified String </returns>
|
|
1685
1119
|
static searchAndReplace_0(str, from, to) {
|
|
1686
1120
|
let lastSubStr = 0;
|
|
1687
1121
|
let startSubStr;
|
|
@@ -1702,11 +1136,6 @@ class StrUtil {
|
|
|
1702
1136
|
}
|
|
1703
1137
|
return result;
|
|
1704
1138
|
}
|
|
1705
|
-
/// <summary> replace every appearance of strings of 'from' in 'str' with the according string in 'to'</summary>
|
|
1706
|
-
/// <param name="str">the working base source string </param>
|
|
1707
|
-
/// <param name="from">the string to replace </param>
|
|
1708
|
-
/// <param name="to">the string use instead 'from' </param>
|
|
1709
|
-
/// <returns> modified String </returns>
|
|
1710
1139
|
static searchAndReplace_1(str, from, to) {
|
|
1711
1140
|
let lastSubStr = 0;
|
|
1712
1141
|
let sarIndex = 0;
|
|
@@ -1731,14 +1160,6 @@ class StrUtil {
|
|
|
1731
1160
|
result = tmpBuf.ToString();
|
|
1732
1161
|
return result;
|
|
1733
1162
|
}
|
|
1734
|
-
/// <summary> this functions is for use by the searchAndReplace() function -
|
|
1735
|
-
/// searches the offset of the strings from the array in the given string
|
|
1736
|
-
/// and returns the minimum offset found and sets the index of the found string
|
|
1737
|
-
/// to SARindex
|
|
1738
|
-
/// </summary>
|
|
1739
|
-
/// <param name="str">the string to search in </param>
|
|
1740
|
-
/// <param name="strings">an array of strings to search for </param>
|
|
1741
|
-
/// <param name="offset">where to start the search </param>
|
|
1742
1163
|
static indexOf(str, strings, offset, SARindex) {
|
|
1743
1164
|
let minOffset = -1;
|
|
1744
1165
|
for (let i = 0; i < strings.length; i = i + 1) {
|
|
@@ -1766,15 +1187,6 @@ class StrUtil {
|
|
|
1766
1187
|
}
|
|
1767
1188
|
return result;
|
|
1768
1189
|
}
|
|
1769
|
-
/// <summary> replace tokens in user string by vector values </summary>
|
|
1770
|
-
/// <param name="userString">- user buffer like "User %d, %d string"
|
|
1771
|
-
/// </param>
|
|
1772
|
-
/// <param name="token">- token used in user string - i.e. "%d"
|
|
1773
|
-
/// </param>
|
|
1774
|
-
/// <param name="occurrence">- number of token where replace will take part (1 for first occurrence)
|
|
1775
|
-
/// </param>
|
|
1776
|
-
/// <param name="value">- value to be inserted insted of token
|
|
1777
|
-
/// </param>
|
|
1778
1190
|
static replaceStringTokens(userString, token, occurrence, val) {
|
|
1779
1191
|
let tokenLen = token.length;
|
|
1780
1192
|
let currPosition = 0;
|
|
@@ -1797,12 +1209,6 @@ class StrUtil {
|
|
|
1797
1209
|
}
|
|
1798
1210
|
StrUtil.makePrintableTokens_1(source, type);
|
|
1799
1211
|
}
|
|
1800
|
-
/// <summary>
|
|
1801
|
-
/// converts special characters in a token to a printable format
|
|
1802
|
-
/// </summary>
|
|
1803
|
-
/// <param name = "source">a token </param>
|
|
1804
|
-
/// <param name = "type">type of conversion: STR_2_HTML, SEQ_2_HTML, HTML_2_SEQ, HTML_2_STR, SEQ_2_STR </param>
|
|
1805
|
-
/// <returns> token with converted special characters </returns>
|
|
1806
1212
|
static makePrintableTokens_0(source, type) {
|
|
1807
1213
|
let escStr = [
|
|
1808
1214
|
"\\", "-", ","
|
|
@@ -1836,11 +1242,6 @@ class StrUtil {
|
|
|
1836
1242
|
}
|
|
1837
1243
|
return result;
|
|
1838
1244
|
}
|
|
1839
|
-
/// <summary>
|
|
1840
|
-
/// converts special characters in a tokens collection to a printable format
|
|
1841
|
-
/// </summary>
|
|
1842
|
-
/// <param name = "source">vector of strings before tokenaizer </param>
|
|
1843
|
-
/// <param name = "type">type of conversion: STR_2_HTML, SEQ_2_HTML, HTML_2_SEQ, HTML_2_STR </param>
|
|
1844
1245
|
static makePrintableTokens_1(source, type) {
|
|
1845
1246
|
if (source !== null) {
|
|
1846
1247
|
let length = source.length;
|
|
@@ -1850,12 +1251,6 @@ class StrUtil {
|
|
|
1850
1251
|
}
|
|
1851
1252
|
}
|
|
1852
1253
|
}
|
|
1853
|
-
/// <summary>
|
|
1854
|
-
/// change non-printable characters like "new line" and "line feed" to their
|
|
1855
|
-
/// printable representation
|
|
1856
|
-
/// </summary>
|
|
1857
|
-
/// <param name = "source">is the string with non-printable characters </param>
|
|
1858
|
-
/// <returns> the new string where all the non-printable characters are converted </returns>
|
|
1859
1254
|
static makePrintable(source) {
|
|
1860
1255
|
let from = [
|
|
1861
1256
|
"\n", "\r", "'", "\\", "\"", "\0"
|
|
@@ -1865,12 +1260,6 @@ class StrUtil {
|
|
|
1865
1260
|
];
|
|
1866
1261
|
return StrUtil.searchAndReplace(source, from, to);
|
|
1867
1262
|
}
|
|
1868
|
-
/// <summary>
|
|
1869
|
-
/// change non-printable characters like "new line" and "line feed" to their
|
|
1870
|
-
/// printable representation (simplified version for range error message)
|
|
1871
|
-
/// </summary>
|
|
1872
|
-
/// <param name = "source">is the string with non-printable characters </param>
|
|
1873
|
-
/// <returns> the new string where all the non-printable characters are converted </returns>
|
|
1874
1263
|
static makePrintable2(source) {
|
|
1875
1264
|
let from = [
|
|
1876
1265
|
"\n", "\r", "\0"
|
|
@@ -1880,21 +1269,10 @@ class StrUtil {
|
|
|
1880
1269
|
];
|
|
1881
1270
|
return StrUtil.searchAndReplace(source, from, to);
|
|
1882
1271
|
}
|
|
1883
|
-
/// <summary>
|
|
1884
|
-
///
|
|
1885
|
-
/// </summary>
|
|
1886
|
-
/// <param name="s"></param>
|
|
1887
|
-
/// <param name="len"></param>
|
|
1888
|
-
/// <returns></returns>
|
|
1889
1272
|
static ZstringMake(s, len) {
|
|
1890
1273
|
len = StrUtil.mem_trim(s, len);
|
|
1891
1274
|
return s.substr(0, len);
|
|
1892
1275
|
}
|
|
1893
|
-
/// <summary>(public)
|
|
1894
|
-
/// returns plain text from rtf text
|
|
1895
|
-
/// </summary>
|
|
1896
|
-
/// <param name="rtfText">refer to the summary</param>
|
|
1897
|
-
/// <returns>refer to the summary</returns>
|
|
1898
1276
|
static GetPlainTextfromRtf(rtfText) {
|
|
1899
1277
|
if (Rtf.isRtf(rtfText)) {
|
|
1900
1278
|
let rtf = new Rtf();
|
|
@@ -1904,12 +1282,6 @@ class StrUtil {
|
|
|
1904
1282
|
}
|
|
1905
1283
|
return rtfText;
|
|
1906
1284
|
}
|
|
1907
|
-
/// <summary>
|
|
1908
|
-
/// Returns true if the string arrays str1 & str2 are equal
|
|
1909
|
-
/// </summary>
|
|
1910
|
-
/// <param name="str1"></param>
|
|
1911
|
-
/// <param name="str2"></param>
|
|
1912
|
-
/// <returns></returns>
|
|
1913
1285
|
static StringsArraysEqual(str1, str2) {
|
|
1914
1286
|
let result;
|
|
1915
1287
|
if (str1 === null && str2 === null) {
|
|
@@ -1936,12 +1308,6 @@ class StrUtil {
|
|
|
1936
1308
|
}
|
|
1937
1309
|
return result;
|
|
1938
1310
|
}
|
|
1939
|
-
/// <summary>
|
|
1940
|
-
/// The code is copied from tsk_open_bnd_wild and SearchAndReplaceWildChars
|
|
1941
|
-
/// The refactoring is not performed for backwards compatibility
|
|
1942
|
-
/// The code replaces special charachters :* ? with recieved filler
|
|
1943
|
-
/// </summary>
|
|
1944
|
-
/// <returns></returns>
|
|
1945
1311
|
static SearchAndReplaceWildChars(buf, len, filler) {
|
|
1946
1312
|
buf = NString.PadRight(buf, len);
|
|
1947
1313
|
let escChar = false;
|
|
@@ -1952,7 +1318,6 @@ class StrUtil {
|
|
|
1952
1318
|
case ('\\'):
|
|
1953
1319
|
{
|
|
1954
1320
|
let isNextCharWild = true;
|
|
1955
|
-
//If next char is not wild , then copy '\', if this is first char.
|
|
1956
1321
|
if ((i + 1 < len) && (buf[i + 1] != '*' && buf[i + 1] != '\\'))
|
|
1957
1322
|
isNextCharWild = false;
|
|
1958
1323
|
if (escChar || !isNextCharWild)
|
|
@@ -1982,22 +1347,12 @@ class StrUtil {
|
|
|
1982
1347
|
let text = tmpBuf.ToString();
|
|
1983
1348
|
return NString.TrimEnd(NString.TrimEnd(text, ['\0']));
|
|
1984
1349
|
}
|
|
1985
|
-
/// <summary>
|
|
1986
|
-
/// Remove the task path delimiter from the error string.
|
|
1987
|
-
/// </summary>
|
|
1988
|
-
/// <param name = "source">string with delimiter </param>
|
|
1989
|
-
/// <returns> string for console error </returns>
|
|
1990
1350
|
static getConsoleErorString(source) {
|
|
1991
1351
|
let consoleErorString = "";
|
|
1992
1352
|
if (!isNullOrUndefined(source))
|
|
1993
1353
|
consoleErorString = this.searchAndReplace(source, TASK_PATH_DELIMITER, "");
|
|
1994
1354
|
return consoleErorString;
|
|
1995
1355
|
}
|
|
1996
|
-
/// <summary>
|
|
1997
|
-
/// Remove the task path from the error string.
|
|
1998
|
-
/// </summary>
|
|
1999
|
-
/// <param name = "source">string with delimiter </param>
|
|
2000
|
-
/// <returns> string for console error </returns>
|
|
2001
1356
|
static getMsgBoxErorString(source) {
|
|
2002
1357
|
let tokens;
|
|
2003
1358
|
let msgBoxErorString = new StringBuilder("");
|
|
@@ -2013,25 +1368,11 @@ class StrUtil {
|
|
|
2013
1368
|
}
|
|
2014
1369
|
StrUtil._paddingSpaces = null;
|
|
2015
1370
|
|
|
2016
|
-
// In order to convert some functionality to Visual C#, the Java Language Conversion Assistant
|
|
2017
|
-
/// <summary>
|
|
2018
|
-
/// Contains conversion support elements such as classes, interfaces and static methods.
|
|
2019
|
-
/// </summary>
|
|
2020
1371
|
class Misc {
|
|
2021
|
-
/// <summary>
|
|
2022
|
-
/// Writes the exception stack trace to the received stream
|
|
2023
|
-
/// </summary>
|
|
2024
|
-
/// <param name="throwable">Exception to obtain information from</param>
|
|
2025
|
-
/// <param name="stream">Output sream used to write to</param>
|
|
2026
1372
|
static WriteStackTrace(throwable) {
|
|
2027
1373
|
console.log(throwable.Message);
|
|
2028
1374
|
console.log(throwable.StackTrace);
|
|
2029
1375
|
}
|
|
2030
|
-
/// <summary>
|
|
2031
|
-
/// Receives a byte array and returns it transformed in an byte array
|
|
2032
|
-
/// </summary>
|
|
2033
|
-
/// <param name="byteArray">Byte array to process</param>
|
|
2034
|
-
/// <returns>The transformed array</returns>
|
|
2035
1376
|
static ToSByteArray(byteArray) {
|
|
2036
1377
|
let sbyteArray = null;
|
|
2037
1378
|
if (byteArray !== null) {
|
|
@@ -2042,11 +1383,6 @@ class Misc {
|
|
|
2042
1383
|
}
|
|
2043
1384
|
return sbyteArray;
|
|
2044
1385
|
}
|
|
2045
|
-
/// <summary>
|
|
2046
|
-
/// Receives sbyte array and returns it transformed in a byte array
|
|
2047
|
-
/// </summary>
|
|
2048
|
-
/// <param name="sbyteArray">sbyte array to process</param>
|
|
2049
|
-
/// <returns>The transformed array</returns>
|
|
2050
1386
|
static ToByteArray(sbyteArray) {
|
|
2051
1387
|
let byteArray = null;
|
|
2052
1388
|
if (sbyteArray !== null) {
|
|
@@ -2057,11 +1393,6 @@ class Misc {
|
|
|
2057
1393
|
}
|
|
2058
1394
|
return byteArray;
|
|
2059
1395
|
}
|
|
2060
|
-
/// <summary> Compares number of bytes in two byte arrays</summary>
|
|
2061
|
-
/// <param name="source"></param>
|
|
2062
|
-
/// <param name="destination"></param>
|
|
2063
|
-
/// <param name="numberOfBytes"></param>
|
|
2064
|
-
/// <returns> boolen true if equal</returns>
|
|
2065
1396
|
static CompareByteArray(source, destination, numberOfBytes) {
|
|
2066
1397
|
if (source.length >= numberOfBytes && destination.length >= numberOfBytes) {
|
|
2067
1398
|
for (let len = 0; len < numberOfBytes; len++) {
|
|
@@ -2073,13 +1404,6 @@ class Misc {
|
|
|
2073
1404
|
return false;
|
|
2074
1405
|
return true;
|
|
2075
1406
|
}
|
|
2076
|
-
/// <summary>
|
|
2077
|
-
/// Performs an unsigned bitwise right shift with the specified number
|
|
2078
|
-
/// </summary>
|
|
2079
|
-
/// <param name="number">Number to operate on</param>
|
|
2080
|
-
/// <param name="bits">Ammount of bits to shift</param>
|
|
2081
|
-
/// <returns>The resulting number from the shift operation</returns>
|
|
2082
|
-
// TODO: instead of calling URShift(number, bits), we can use((uint)number) >> bits.
|
|
2083
1407
|
static URShift(number, bits) {
|
|
2084
1408
|
let result;
|
|
2085
1409
|
if (number >= 0) {
|
|
@@ -2090,20 +1414,9 @@ class Misc {
|
|
|
2090
1414
|
}
|
|
2091
1415
|
return result;
|
|
2092
1416
|
}
|
|
2093
|
-
/// <summary>
|
|
2094
|
-
/// get system's time in milliseconds
|
|
2095
|
-
/// </summary>
|
|
2096
|
-
/// <returns></returns>
|
|
2097
1417
|
static getSystemMilliseconds() {
|
|
2098
|
-
// TODO - check if we need this adjustment
|
|
2099
1418
|
return Math.floor((DateTime.Now.Ticks - 621355968000000000) / 10000);
|
|
2100
1419
|
}
|
|
2101
|
-
/// <summary>
|
|
2102
|
-
/// Compares 2 int arrays
|
|
2103
|
-
/// </summary>
|
|
2104
|
-
/// <param name="arrayOne"></param>
|
|
2105
|
-
/// <param name="arrayTwo"></param>
|
|
2106
|
-
/// <returns>true if arrays are equal else false</returns>
|
|
2107
1420
|
static CompareIntArrays(arrayOne, arrayTwo) {
|
|
2108
1421
|
let areEqual = false;
|
|
2109
1422
|
if (arrayOne === arrayTwo) {
|
|
@@ -2123,11 +1436,6 @@ class Misc {
|
|
|
2123
1436
|
}
|
|
2124
1437
|
return areEqual;
|
|
2125
1438
|
}
|
|
2126
|
-
/// <summary>
|
|
2127
|
-
/// Returns the comma separated string for the values passed in int array.
|
|
2128
|
-
/// </summary>
|
|
2129
|
-
/// <param name="values">Integer array</param>
|
|
2130
|
-
/// <returns>comma separated string</returns>
|
|
2131
1439
|
static GetCommaSeperatedString(intArray) {
|
|
2132
1440
|
let temp = new StringBuilder();
|
|
2133
1441
|
for (let val = 0; val < intArray.length; val = val + 1) {
|
|
@@ -2139,11 +1447,6 @@ class Misc {
|
|
|
2139
1447
|
}
|
|
2140
1448
|
return temp.ToString();
|
|
2141
1449
|
}
|
|
2142
|
-
/// <summary>
|
|
2143
|
-
/// Returns int array out of comma separated string
|
|
2144
|
-
/// </summary>
|
|
2145
|
-
/// <param name="value">comma separated string</param>
|
|
2146
|
-
/// <returns>Integer array</returns>
|
|
2147
1450
|
static GetIntArray(commaSeparatedValue) {
|
|
2148
1451
|
let intArray = new Array(0);
|
|
2149
1452
|
if (!NString.IsNullOrEmpty(commaSeparatedValue)) {
|
|
@@ -2171,24 +1474,9 @@ class Base64 {
|
|
|
2171
1474
|
else
|
|
2172
1475
|
return Base64.encode_2(strOrData);
|
|
2173
1476
|
}
|
|
2174
|
-
/// <summary> This method encodes the given string using the base64-encoding
|
|
2175
|
-
/// specified in RFC-2045 (Section 6.8). It's used for example in the
|
|
2176
|
-
/// "Basic" authorization scheme.
|
|
2177
|
-
/// </summary>
|
|
2178
|
-
/// <param name="str">the string </param>
|
|
2179
|
-
/// <param name="encoding"> Environment.Encoding </param>
|
|
2180
|
-
/// <returns> the base64-encoded str </returns>
|
|
2181
1477
|
static encode_0(str, encoding) {
|
|
2182
1478
|
return Base64.encode(str, false, encoding);
|
|
2183
1479
|
}
|
|
2184
|
-
/// <summary> Encodes string using the base64-encoding.
|
|
2185
|
-
/// If isUseEnvCharset is true, use the specific charset when converting
|
|
2186
|
-
/// string to byte array. (DBCS support)
|
|
2187
|
-
/// </summary>
|
|
2188
|
-
/// <param name="str">the string </param>
|
|
2189
|
-
/// <param name="isUseEnvCharset"> </param>
|
|
2190
|
-
/// <param name="encoding"> Environment.Encoding </param>
|
|
2191
|
-
/// <returns> the base64-encoded str </returns>
|
|
2192
1480
|
static encode_1(str, isUseEnvCharset, encoding) {
|
|
2193
1481
|
let result;
|
|
2194
1482
|
if (str === null) {
|
|
@@ -2212,18 +1500,12 @@ class Base64 {
|
|
|
2212
1500
|
}
|
|
2213
1501
|
return result;
|
|
2214
1502
|
}
|
|
2215
|
-
/// <summary> This method encodes the given byte[] using the base64-encoding
|
|
2216
|
-
/// specified in RFC-2045 (Section 6.8).
|
|
2217
|
-
/// </summary>
|
|
2218
|
-
/// <param name="data">the data </param>
|
|
2219
|
-
/// <returns> the base64-encoded data </returns>
|
|
2220
1503
|
static encode_2(data) {
|
|
2221
1504
|
if (data === null)
|
|
2222
1505
|
return null;
|
|
2223
1506
|
let dest = new Uint8Array(Math.floor((data.length + 2) / 3) * 4);
|
|
2224
1507
|
let sidx = 0;
|
|
2225
1508
|
let didx = 0;
|
|
2226
|
-
// 3-byte to 4-byte conversion + 0-63 to ASCII printable conversion
|
|
2227
1509
|
while (sidx < data.length - 2) {
|
|
2228
1510
|
dest[didx++] = Base64._base64EncMap[Misc.URShift(data[sidx], 2) & 63];
|
|
2229
1511
|
dest[didx++] = Base64._base64EncMap[(Misc.URShift(data[sidx + 1], 4) & 15) | (data[sidx] << 4 & 63)];
|
|
@@ -2241,7 +1523,6 @@ class Base64 {
|
|
|
2241
1523
|
dest[didx++] = Base64._base64EncMap[data[sidx] << 4 & 63];
|
|
2242
1524
|
}
|
|
2243
1525
|
}
|
|
2244
|
-
// add padding
|
|
2245
1526
|
while (didx < dest.length) {
|
|
2246
1527
|
dest[didx] = 61;
|
|
2247
1528
|
didx = didx + 1;
|
|
@@ -2256,20 +1537,9 @@ class Base64 {
|
|
|
2256
1537
|
else
|
|
2257
1538
|
return Base64.decode_2(strOrData);
|
|
2258
1539
|
}
|
|
2259
|
-
/// <summary> This method decodes the given string using the base64-encoding
|
|
2260
|
-
/// specified in RFC-2045 (Section 6.8).
|
|
2261
|
-
/// </summary>
|
|
2262
|
-
/// <param name="str">the base64-encoded string. </param>
|
|
2263
|
-
/// <returns> the decoded str.</returns>
|
|
2264
1540
|
static decode_0(str) {
|
|
2265
1541
|
return Base64.decode(str, null);
|
|
2266
1542
|
}
|
|
2267
|
-
/// <summary> This method decodes the given string using the base64-encoding
|
|
2268
|
-
/// specified in RFC-2045 (Section 6.8).
|
|
2269
|
-
/// </summary>
|
|
2270
|
-
/// <param name="str">the base64-encoded string. </param>
|
|
2271
|
-
/// <param name="encoding">Environment.Encoding or null.</param>
|
|
2272
|
-
/// <returns> the decoded str.</returns>
|
|
2273
1543
|
static decode_1(str, encoding) {
|
|
2274
1544
|
let result;
|
|
2275
1545
|
if (str === null) {
|
|
@@ -2293,11 +1563,6 @@ class Base64 {
|
|
|
2293
1563
|
}
|
|
2294
1564
|
return result;
|
|
2295
1565
|
}
|
|
2296
|
-
/// <summary> This method decodes the given byte[] using the base64-encoding
|
|
2297
|
-
/// specified in RFC-2045 (Section 6.8).
|
|
2298
|
-
/// </summary>
|
|
2299
|
-
/// <param name="data">the base64-encoded data.</param>
|
|
2300
|
-
/// <returns> the decoded <var>data</va
|
|
2301
1566
|
static decode_2(data) {
|
|
2302
1567
|
if (data === null)
|
|
2303
1568
|
return null;
|
|
@@ -2306,11 +1571,9 @@ class Base64 {
|
|
|
2306
1571
|
tail = tail - 1;
|
|
2307
1572
|
}
|
|
2308
1573
|
let dest = new Uint8Array(tail - Math.floor(data.length / 4));
|
|
2309
|
-
// ASCII printable to 0-63 conversion
|
|
2310
1574
|
for (let idx = 0; idx < data.length; idx = idx + 1) {
|
|
2311
1575
|
data[idx] = Base64._base64DecMap[data[idx]];
|
|
2312
1576
|
}
|
|
2313
|
-
// 4-byte to 3-byte conversion
|
|
2314
1577
|
let sidx = 0;
|
|
2315
1578
|
let didx;
|
|
2316
1579
|
for (didx = 0; didx < dest.length - 2; didx = didx + 3) {
|
|
@@ -2325,7 +1588,6 @@ class Base64 {
|
|
|
2325
1588
|
dest[didx] = (((data[sidx + 1] << 4) & 255) | (Misc.URShift(data[sidx + 2], 2) & 15));
|
|
2326
1589
|
return dest;
|
|
2327
1590
|
}
|
|
2328
|
-
/// <summary> decoded and return an hex representation of the data</summary>
|
|
2329
1591
|
static decodeToHex(str) {
|
|
2330
1592
|
if (str === null)
|
|
2331
1593
|
return null;
|
|
@@ -2333,13 +1595,9 @@ class Base64 {
|
|
|
2333
1595
|
return str;
|
|
2334
1596
|
return StrUtil.stringToHexaDump(Base64.decode(str), 2);
|
|
2335
1597
|
}
|
|
2336
|
-
/// <summary> decodes a string to byte array</summary>
|
|
2337
1598
|
static decodeToByte(str) {
|
|
2338
1599
|
if (str === null)
|
|
2339
1600
|
return null;
|
|
2340
|
-
// QCR 740918 if we have and empty expression it is sent from the server as empty string
|
|
2341
|
-
// and changed locally to a string with one blank either way they are not valid base64 encoded
|
|
2342
|
-
// string and should not be decoded.
|
|
2343
1601
|
if (str === "" || str === " ")
|
|
2344
1602
|
return new Uint8Array(0);
|
|
2345
1603
|
try {
|
|
@@ -2370,18 +1628,6 @@ Base64._base64EncMap = Base64.initializeEncMap();
|
|
|
2370
1628
|
Base64._base64DecMap = Base64.initializeDecMap();
|
|
2371
1629
|
|
|
2372
1630
|
class ChoiceUtils {
|
|
2373
|
-
/// <summary>
|
|
2374
|
-
/// init the display Value from string
|
|
2375
|
-
/// </summary>
|
|
2376
|
-
/// <param name = "choiceDispStr">the all substring separated with comma.
|
|
2377
|
-
/// The behavior:
|
|
2378
|
-
/// a. when have "\" before char a-z need to ignore the \ put the a-z char
|
|
2379
|
-
/// b. when "\," -> ","
|
|
2380
|
-
/// c. when "\-" -> "-"
|
|
2381
|
-
/// d. when "\\" -> "\"
|
|
2382
|
-
/// e. when "\\\\" -> "\\"
|
|
2383
|
-
/// the display can be all string. and we don't need to check validation according to the dataType(as we do in Link
|
|
2384
|
-
/// </param>
|
|
2385
1631
|
static GetDisplayListFromString(choiceDispStr, removeAccelerators, shouldMakePrintable, shouldTrimOptions) {
|
|
2386
1632
|
let fromHelp = new Array("\\\\", "\\-", "\\,");
|
|
2387
1633
|
let toHelp = new Array("XX", "XX", "XX");
|
|
@@ -2458,19 +1704,15 @@ class ChoiceUtils {
|
|
|
2458
1704
|
}
|
|
2459
1705
|
}
|
|
2460
1706
|
|
|
2461
|
-
//This class contains all the constants which are used in MgxpaRIA.exe as well as in MgGui.dll.
|
|
2462
1707
|
class Constants {
|
|
2463
1708
|
constructor() {
|
|
2464
1709
|
}
|
|
2465
1710
|
}
|
|
2466
|
-
/// <summary> Null Arithmetic values</summary>
|
|
2467
1711
|
Constants.NULL_ARITH_NULLIFY = 'N';
|
|
2468
1712
|
Constants.NULL_ARITH_USE_DEF = 'U';
|
|
2469
|
-
/// <summary> select program : select mode property</summary>
|
|
2470
1713
|
Constants.SELPRG_MODE_BEFORE = 'B';
|
|
2471
1714
|
Constants.SELPRG_MODE_AFTER = 'A';
|
|
2472
1715
|
Constants.SELPRG_MODE_PROMPT = 'P';
|
|
2473
|
-
/// <summary> move in View</summary>
|
|
2474
1716
|
Constants.MOVE_UNIT_TABLE = 'T';
|
|
2475
1717
|
Constants.MOVE_UNIT_PAGE = 'P';
|
|
2476
1718
|
Constants.MOVE_UNIT_ROW = 'R';
|
|
@@ -2484,7 +1726,6 @@ Constants.MOVE_DIRECTION_PARENT = 'A';
|
|
|
2484
1726
|
Constants.MOVE_DIRECTION_FIRST_SON = 'F';
|
|
2485
1727
|
Constants.MOVE_DIRECTION_NEXT_SIBLING = 'X';
|
|
2486
1728
|
Constants.MOVE_DIRECTION_PREV_SIBLING = 'V';
|
|
2487
|
-
/// <summary> refresh types for a task form</summary>
|
|
2488
1729
|
Constants.TASK_REFRESH_FORM = 'F';
|
|
2489
1730
|
Constants.TASK_REFRESH_TABLE = 'T';
|
|
2490
1731
|
Constants.TASK_REFRESH_TREE_AND_FORM = 'R';
|
|
@@ -2495,15 +1736,12 @@ Constants.TASK_MODE_MODIFY = 'M';
|
|
|
2495
1736
|
Constants.TASK_MODE_CREATE = 'C';
|
|
2496
1737
|
Constants.TASK_MODE_DELETE = 'D';
|
|
2497
1738
|
Constants.TASK_MODE_NONE = ' ';
|
|
2498
|
-
/// <summary> task level</summary>
|
|
2499
1739
|
Constants.TASK_LEVEL_NONE = ' ';
|
|
2500
1740
|
Constants.TASK_LEVEL_TASK = 'T';
|
|
2501
1741
|
Constants.TASK_LEVEL_RECORD = 'R';
|
|
2502
1742
|
Constants.TASK_LEVEL_CONTROL = 'C';
|
|
2503
|
-
/// <summary> special records constants</summary>
|
|
2504
1743
|
Constants.MG_DATAVIEW_FIRST_RECORD = Int32.MinValue;
|
|
2505
1744
|
Constants.MG_DATAVIEW_LAST_RECORD = Int32.MaxValue;
|
|
2506
|
-
/// <summary> action states for keyboard mapping</summary>
|
|
2507
1745
|
Constants.ACT_STT_TBL_SCREEN_MODE = 0x0001;
|
|
2508
1746
|
Constants.ACT_STT_TBL_LEFT_TO_RIGHT = 0x0002;
|
|
2509
1747
|
Constants.ACT_STT_TBL_SCREEN_TOP = 0x0004;
|
|
@@ -2518,17 +1756,13 @@ Constants.ACT_STT_EDT_LINE_END = 0x0400;
|
|
|
2518
1756
|
Constants.ACT_STT_EDT_EDITING = 0x0800;
|
|
2519
1757
|
Constants.ACT_STT_TREE_PARK = 0x1000;
|
|
2520
1758
|
Constants.ACT_STT_TREE_EDITING = 0x2000;
|
|
2521
|
-
Constants.ForwardSlashWebUsage = "web";
|
|
1759
|
+
Constants.ForwardSlashWebUsage = "web";
|
|
2522
1760
|
Constants.HTTP_PROTOCOL = "http://";
|
|
2523
1761
|
Constants.HTTPS_PROTOCOL = "https://";
|
|
2524
1762
|
Constants.FILE_PROTOCOL = "file://";
|
|
2525
|
-
/// <summary>threads constants</summary>
|
|
2526
1763
|
Constants.MG_GUI_THREAD = "MG_GUI_THREAD";
|
|
2527
1764
|
Constants.MG_WORK_THREAD = "MG_WORK_THREAD";
|
|
2528
1765
|
Constants.MG_TIMER_THREAD = "MG_TIMER_THREAD";
|
|
2529
|
-
/// <summary>
|
|
2530
|
-
/// property name for the runtime designer
|
|
2531
|
-
/// </summary>
|
|
2532
1766
|
Constants.ConfigurationFilePropertyName = "Configuration file";
|
|
2533
1767
|
Constants.WinPropText = "Text";
|
|
2534
1768
|
Constants.WinPropLayer = "Layer";
|
|
@@ -2562,12 +1796,9 @@ XMLConstants.MG_TAG_OPEN = XMLConstants.TAG_OPEN + XMLConstants.MG_TAG_XML + " "
|
|
|
2562
1796
|
XMLConstants.MG_TAG_TASK = "task";
|
|
2563
1797
|
XMLConstants.MG_TAG_TASK_END = "/task";
|
|
2564
1798
|
XMLConstants.MG_TAG_RECOMPUTE = "recompute";
|
|
2565
|
-
//TODO: this class contains the constants which are used for XML parsing.
|
|
2566
|
-
//Check if we can move it to Util.dll
|
|
2567
1799
|
XMLConstants.MG_ATTR_VB_VIEW_ROWIDX = "db_view_rowidx";
|
|
2568
1800
|
XMLConstants.MG_ATTR_CONTROL_ISN = "controlIsn";
|
|
2569
1801
|
XMLConstants.MG_HOR_ALIGMENT_IS_INHERITED = "horizontalAlignmentIsFromSystemDefault";
|
|
2570
|
-
// MainHeaders
|
|
2571
1802
|
XMLConstants.MAX_PATH = 260;
|
|
2572
1803
|
XMLConstants.FILE_NAME_SIZE = XMLConstants.MAX_PATH + 1;
|
|
2573
1804
|
XMLConstants.CDATA_START = "<![CDATA[";
|
|
@@ -2653,13 +1884,11 @@ XMLConstants.MG_ATTR_ISSPECIFIC = "isSpecific";
|
|
|
2653
1884
|
XMLConstants.MG_ATTR_IS_GUI_THREAD_EXECUTION = "isGuiThreadExecution";
|
|
2654
1885
|
XMLConstants.MG_TAG_TASKDEFINITIONID_ENTRY = "taskDefinitionId";
|
|
2655
1886
|
XMLConstants.MG_TAG_OBJECT_REFERENCE = "objectRef";
|
|
2656
|
-
//Help types
|
|
2657
1887
|
XMLConstants.MG_ATTR_HLP_TYP_TOOLTIP = "T";
|
|
2658
1888
|
XMLConstants.MG_ATTR_HLP_TYP_PROMPT = "P";
|
|
2659
1889
|
XMLConstants.MG_ATTR_HLP_TYP_URL = "U";
|
|
2660
1890
|
XMLConstants.MG_ATTR_HLP_TYP_INTERNAL = "I";
|
|
2661
1891
|
XMLConstants.MG_ATTR_HLP_TYP_WINDOWS = "W";
|
|
2662
|
-
//Internal help attributes.
|
|
2663
1892
|
XMLConstants.MG_ATTR_INTERNAL_HELP_TYPE = "type";
|
|
2664
1893
|
XMLConstants.MG_ATTR_INTERNAL_HELP_NAME = "name";
|
|
2665
1894
|
XMLConstants.MG_ATTR_INTERNAL_HELP_FRAMEX = "framex";
|
|
@@ -2674,26 +1903,20 @@ XMLConstants.MG_ATTR_INTERNAL_HELP_BORDERSTYLE = "borderstyle";
|
|
|
2674
1903
|
XMLConstants.MG_ATTR_INTERNAL_TITLE_BAR = "titlebar";
|
|
2675
1904
|
XMLConstants.MG_ATTR_INTERNAL_HELP_SYSTEM_MENU = "sysmenu";
|
|
2676
1905
|
XMLConstants.MG_ATTR_INTERNAL_HELP_FONT_TABLE_INDEX = "fonttableindex";
|
|
2677
|
-
//Windows help attributes.
|
|
2678
1906
|
XMLConstants.MG_ATTR_WINDOWS_HELP_FILE = "file";
|
|
2679
1907
|
XMLConstants.MG_ATTR_WINDOWS_HELP_COMMAND = "command";
|
|
2680
1908
|
XMLConstants.MG_ATTR_WINDOWS_HELP_KEY = "key";
|
|
2681
|
-
//Print data attributes.
|
|
2682
1909
|
XMLConstants.MG_TAG_PRINT_DATA = "Print_data";
|
|
2683
1910
|
XMLConstants.MG_TAG_PRINT_DATA_END = "/Print_data";
|
|
2684
1911
|
XMLConstants.MG_TAG_RECORD = "Record";
|
|
2685
1912
|
XMLConstants.MG_TAG_RECORD_END = "/Record";
|
|
2686
|
-
//Custom Validators attributes.
|
|
2687
1913
|
XMLConstants.MG_TAG_CUSTOM_VALIDATORS = "CustomValidators";
|
|
2688
1914
|
XMLConstants.MG_TAG_CUSTOM_VALIDATORS_END = "/CustomValidators";
|
|
2689
1915
|
XMLConstants.MG_TAG_CUSTOM_VALIDATOR = "CustomValidator";
|
|
2690
|
-
// date/time formats for DateTimeUtils
|
|
2691
|
-
//TODO: isolate to a different file?
|
|
2692
1916
|
XMLConstants.ERROR_LOG_TIME_FORMAT = "HH:mm:ss.S";
|
|
2693
1917
|
XMLConstants.ERROR_LOG_DATE_FORMAT = "DD/MM/YYYY";
|
|
2694
1918
|
XMLConstants.HTTP_ERROR_TIME_FORMAT = "HH:mm:ss";
|
|
2695
1919
|
XMLConstants.CACHED_DATE_TIME_FORMAT = "DD/MM/YYYY HH:mm:ss";
|
|
2696
|
-
//webs constants
|
|
2697
1920
|
XMLConstants.MG_TAG_WS_READ_REQUEST = "Read";
|
|
2698
1921
|
XMLConstants.MG_TAG_WS_CREATE_REQUEST = "Create";
|
|
2699
1922
|
XMLConstants.MG_TAG_WS_CREATE_REQUEST_END = "/Create";
|
|
@@ -2724,7 +1947,6 @@ XMLConstants.MG_TAG_MENUS_CLOSE = "/Menus";
|
|
|
2724
1947
|
XMLConstants.MG_TAG_MENU = "Menu";
|
|
2725
1948
|
|
|
2726
1949
|
class DateTimeUtils {
|
|
2727
|
-
/// <summary> returns the number in a 2 digit string
|
|
2728
1950
|
static int2str(n) {
|
|
2729
1951
|
return (n > 9) ? n.toString() : ("0" + n);
|
|
2730
1952
|
}
|
|
@@ -2776,16 +1998,10 @@ class DateTimeUtils {
|
|
|
2776
1998
|
}
|
|
2777
1999
|
}
|
|
2778
2000
|
|
|
2779
|
-
/// <summary>
|
|
2780
|
-
/// An interface to define the constantes used by the Picture mechanism.
|
|
2781
|
-
/// </summary>
|
|
2782
2001
|
class PICInterface {
|
|
2783
2002
|
constructor() {
|
|
2784
2003
|
}
|
|
2785
2004
|
}
|
|
2786
|
-
//--------------------------------------------------------------------------
|
|
2787
|
-
// TEMP!
|
|
2788
|
-
//--------------------------------------------------------------------------
|
|
2789
2005
|
PICInterface.PIC_X = 1;
|
|
2790
2006
|
PICInterface.PIC_U = 2;
|
|
2791
2007
|
PICInterface.PIC_L = 3;
|
|
@@ -2803,32 +2019,30 @@ PICInterface.PIC_HH = 14;
|
|
|
2803
2019
|
PICInterface.PIC_MMT = 15;
|
|
2804
2020
|
PICInterface.PIC_SS = 16;
|
|
2805
2021
|
PICInterface.PIC_PM = 17;
|
|
2806
|
-
PICInterface.PIC_HYYYYY = 18;
|
|
2807
|
-
PICInterface.PIC_HL = 19;
|
|
2808
|
-
PICInterface.PIC_HDD = 20;
|
|
2809
|
-
PICInterface.PIC_MS = 21;
|
|
2810
|
-
PICInterface.PIC_LOCAL = 23;
|
|
2022
|
+
PICInterface.PIC_HYYYYY = 18;
|
|
2023
|
+
PICInterface.PIC_HL = 19;
|
|
2024
|
+
PICInterface.PIC_HDD = 20;
|
|
2025
|
+
PICInterface.PIC_MS = 21;
|
|
2026
|
+
PICInterface.PIC_LOCAL = 23;
|
|
2811
2027
|
PICInterface.PIC_MAX_MSK_LEN = 100;
|
|
2812
|
-
|
|
2813
|
-
PICInterface.
|
|
2814
|
-
PICInterface.
|
|
2815
|
-
PICInterface.
|
|
2816
|
-
PICInterface.
|
|
2817
|
-
PICInterface.
|
|
2818
|
-
|
|
2819
|
-
PICInterface.
|
|
2820
|
-
PICInterface.
|
|
2821
|
-
PICInterface.
|
|
2822
|
-
PICInterface.PIC_S = PICInterface.PIC_LOCAL + 8; // SBCS only
|
|
2823
|
-
PICInterface.PIC_MAX_OP = 31; // is reserved for DLL"s picture
|
|
2028
|
+
PICInterface.PIC_JY1 = PICInterface.PIC_LOCAL + 0;
|
|
2029
|
+
PICInterface.PIC_JY2 = PICInterface.PIC_LOCAL + 1;
|
|
2030
|
+
PICInterface.PIC_JY4 = PICInterface.PIC_LOCAL + 2;
|
|
2031
|
+
PICInterface.PIC_YJ = PICInterface.PIC_LOCAL + 3;
|
|
2032
|
+
PICInterface.PIC_BB = PICInterface.PIC_LOCAL + 4;
|
|
2033
|
+
PICInterface.PIC_J = PICInterface.PIC_LOCAL + 5;
|
|
2034
|
+
PICInterface.PIC_T = PICInterface.PIC_LOCAL + 6;
|
|
2035
|
+
PICInterface.PIC_G = PICInterface.PIC_LOCAL + 7;
|
|
2036
|
+
PICInterface.PIC_S = PICInterface.PIC_LOCAL + 8;
|
|
2037
|
+
PICInterface.PIC_MAX_OP = 31;
|
|
2824
2038
|
PICInterface.NULL_CHAR = -1;
|
|
2825
2039
|
PICInterface.DB_STR_MAX = 255;
|
|
2826
|
-
PICInterface.DAYSINFOURCENT = 146097;
|
|
2827
|
-
PICInterface.DAYSINCENTURY = 36524;
|
|
2828
|
-
PICInterface.DAYSINFOURYEAR = 1461;
|
|
2040
|
+
PICInterface.DAYSINFOURCENT = 146097;
|
|
2041
|
+
PICInterface.DAYSINCENTURY = 36524;
|
|
2042
|
+
PICInterface.DAYSINFOURYEAR = 1461;
|
|
2829
2043
|
PICInterface.DAYSINYEAR = 365;
|
|
2830
2044
|
PICInterface.DAYSINMONTH = 31;
|
|
2831
|
-
PICInterface.DATE_BUDDHIST_GAP = 543;
|
|
2045
|
+
PICInterface.DATE_BUDDHIST_GAP = 543;
|
|
2832
2046
|
PICInterface.DEFAULT_DATE = "693961";
|
|
2833
2047
|
PICInterface.DEFAULT_TIME = "0";
|
|
2834
2048
|
PICInterface.date_day_tab = [
|
|
@@ -2840,9 +2054,6 @@ PICInterface.date_month_str = [
|
|
|
2840
2054
|
PICInterface.date_dow_str = [
|
|
2841
2055
|
" ", "Sunday ", "Monday ", "Tuesday ", "Wednesday ", "Thursday ", "Friday ", "Saturday "
|
|
2842
2056
|
];
|
|
2843
|
-
//public final static readonly int DEF_century = 1920;
|
|
2844
|
-
//public final static readonly Nchar DEF_date_mode = 'E';
|
|
2845
|
-
// vec of pictures that can be given a numeric char only
|
|
2846
2057
|
PICInterface.NumDirective = [
|
|
2847
2058
|
4, 5, 6, 7, 9, 10, 11, 12, 14, 15, 16
|
|
2848
2059
|
];
|
|
@@ -2850,15 +2061,9 @@ PICInterface.NumDirective = [
|
|
|
2850
2061
|
const DATE_MONTH_LEN = 10;
|
|
2851
2062
|
const DATE_DOW_LEN = 10;
|
|
2852
2063
|
class DateUtil {
|
|
2853
|
-
/// <summary>
|
|
2854
|
-
/// extract the vector which contains the names of the months, as specified by the
|
|
2855
|
-
/// language CAB
|
|
2856
|
-
/// </summary>
|
|
2857
2064
|
static getLocalMonths(names) {
|
|
2858
2065
|
let monthLen = DATE_MONTH_LEN;
|
|
2859
|
-
// if it's the first time then access the language CAB and take the values
|
|
2860
2066
|
if (typeof DateUtil._localMonths[0] === "undefined") {
|
|
2861
|
-
//cut the string into separate values
|
|
2862
2067
|
if (names !== null) {
|
|
2863
2068
|
DateUtil._localMonths[0] = PICInterface.date_month_str[0];
|
|
2864
2069
|
for (let i = 1; i < DateUtil._localMonths.length; i = i + 1) {
|
|
@@ -2881,15 +2086,9 @@ class DateUtil {
|
|
|
2881
2086
|
}
|
|
2882
2087
|
return DateUtil._localMonths;
|
|
2883
2088
|
}
|
|
2884
|
-
/// <summary>
|
|
2885
|
-
/// extract the vector which contains the names of the days, as specified by the
|
|
2886
|
-
/// language CAB
|
|
2887
|
-
/// </summary>
|
|
2888
2089
|
static getLocalDays(names) {
|
|
2889
2090
|
let dowLen = DATE_DOW_LEN;
|
|
2890
|
-
// if it's the first time then access the language CAB and take the values
|
|
2891
2091
|
if (typeof DateUtil._localDays[0] === "undefined") {
|
|
2892
|
-
//cut the string into separate values
|
|
2893
2092
|
if (names !== null) {
|
|
2894
2093
|
DateUtil._localDays[0] = PICInterface.date_dow_str[0];
|
|
2895
2094
|
for (let i = 1; i < DateUtil._localDays.length; i = i + 1) {
|
|
@@ -4679,7 +3878,6 @@ var NotifyCollectionChangedAction;
|
|
|
4679
3878
|
NotifyCollectionChangedAction[NotifyCollectionChangedAction["Reset"] = 4] = "Reset";
|
|
4680
3879
|
})(NotifyCollectionChangedAction || (NotifyCollectionChangedAction = {}));
|
|
4681
3880
|
|
|
4682
|
-
/// <summary> this interface defines the internal events codes</summary>
|
|
4683
3881
|
class InternalInterface {
|
|
4684
3882
|
constructor() {
|
|
4685
3883
|
}
|
|
@@ -4953,7 +4151,6 @@ InternalInterface.MG_ACT_TREE_RENAME_RT_EXIT = 413;
|
|
|
4953
4151
|
InternalInterface.MG_ACT_SERVER_TERMINATION = 420;
|
|
4954
4152
|
InternalInterface.MG_ACT_SUBFORM_REFRESH = 432;
|
|
4955
4153
|
InternalInterface.MG_ACT_CONTEXT_MENU = 439;
|
|
4956
|
-
InternalInterface.MG_ACT_DEFAULT_BUTTON = 459;
|
|
4957
4154
|
InternalInterface.MG_ACT_NEXT_RT_WINDOW = 462;
|
|
4958
4155
|
InternalInterface.MG_ACT_PREV_RT_WINDOW = 463;
|
|
4959
4156
|
InternalInterface.MG_ACT_EMPTY_DATAVIEW = 521;
|
|
@@ -4987,8 +4184,8 @@ InternalInterface.MG_ACT_NO_PROG_EXE_RIGHTS = 619;
|
|
|
4987
4184
|
InternalInterface.MG_ACT_CRELINE_ABOVE = 634;
|
|
4988
4185
|
InternalInterface.MG_ACT_CONTEXT_TERMINATION = 635;
|
|
4989
4186
|
InternalInterface.MG_ACT_CONTEXT_TIMEOUT_RESET = 636;
|
|
4990
|
-
InternalInterface.
|
|
4991
|
-
|
|
4187
|
+
InternalInterface.MG_ACT_CONTEXT_REMOVE = 647;
|
|
4188
|
+
InternalInterface.MG_ACT_TOT_CNT = 648;
|
|
4992
4189
|
InternalInterface.MG_ACT_TASK_PREFIX = 1001;
|
|
4993
4190
|
InternalInterface.MG_ACT_TASK_SUFFIX = 1002;
|
|
4994
4191
|
InternalInterface.MG_ACT_REC_PREFIX = 1003;
|
|
@@ -5005,7 +4202,6 @@ InternalInterface.MG_ACT_CYCLE_NEXT_REC = 1017;
|
|
|
5005
4202
|
InternalInterface.MG_ACT_CYCLE_NEXT_DELETE_REC = 1018;
|
|
5006
4203
|
InternalInterface.MG_ACT_COMPUTE = 1020;
|
|
5007
4204
|
InternalInterface.MG_ACT_DUMMY = 1111;
|
|
5008
|
-
// INTERNAL EVENTS for WebClient
|
|
5009
4205
|
InternalInterface.MG_ACT_CTRL_FOCUS = 2001;
|
|
5010
4206
|
InternalInterface.MG_ACT_CTRL_MOUSEUP = 2002;
|
|
5011
4207
|
InternalInterface.MG_ACT_CTRL_KEYDOWN = 2003;
|
|
@@ -5015,13 +4211,12 @@ InternalInterface.MG_ACT_RESIZE = 2006;
|
|
|
5015
4211
|
InternalInterface.MG_ACT_ROW_DATA_CURR_PAGE = 2007;
|
|
5016
4212
|
InternalInterface.MG_ACT_DV_TO_GUI = 2008;
|
|
5017
4213
|
InternalInterface.MG_ACT_DISABLE_EVENTS = 2010;
|
|
5018
|
-
// toggle insert is temp 539 , it should match the code in online once it will be created.
|
|
5019
4214
|
InternalInterface.MG_ACT_TOGGLE_INSERT = 2011;
|
|
5020
4215
|
InternalInterface.MG_ACT_INCREMENTAL_LOCATE = 2017;
|
|
5021
4216
|
InternalInterface.MG_ACT_MOVE_TO_FIRST_CTRL = 2018;
|
|
5022
4217
|
InternalInterface.MG_ACT_SET_EXTERNAL_VALUE = 2019;
|
|
5023
4218
|
InternalInterface.MG_ACT_CTRL_FOCUS_ON_NON_MAGIC_CONTROL = 2020;
|
|
5024
|
-
InternalInterface.MG_ACT_FETCH_RECORDS_AHEAD_FROM_SERVER = 2021;
|
|
4219
|
+
InternalInterface.MG_ACT_FETCH_RECORDS_AHEAD_FROM_SERVER = 2021;
|
|
5025
4220
|
|
|
5026
4221
|
class JSON_Utils {
|
|
5027
4222
|
static JSONFromXML(xml, onComplete) {
|
|
@@ -5032,16 +4227,13 @@ class JSON_Utils {
|
|
|
5032
4227
|
class OSEnvironment {
|
|
5033
4228
|
static getStackTrace() {
|
|
5034
4229
|
let ex = new Exception();
|
|
5035
|
-
ex.errorLevel++;
|
|
4230
|
+
ex.errorLevel++;
|
|
5036
4231
|
return ex.StackTrace;
|
|
5037
4232
|
}
|
|
5038
4233
|
}
|
|
5039
4234
|
OSEnvironment.EolSeq = "\n";
|
|
5040
4235
|
OSEnvironment.TabSeq = "\t";
|
|
5041
4236
|
|
|
5042
|
-
/// <summary>
|
|
5043
|
-
/// The class is responsible to maintain the Request information while sending a request to server
|
|
5044
|
-
/// </summary>
|
|
5045
4237
|
class RequestInfo {
|
|
5046
4238
|
constructor() {
|
|
5047
4239
|
this.runtimeTaskTree = new List();
|
|
@@ -5073,16 +4265,9 @@ var LogType;
|
|
|
5073
4265
|
LogType[LogType["warning"] = 2] = "warning";
|
|
5074
4266
|
LogType[LogType["error"] = 3] = "error";
|
|
5075
4267
|
})(LogType || (LogType = {}));
|
|
5076
|
-
/// <summary>
|
|
5077
|
-
/// Logger class will take care of client side logging . It will check for various log levels and accordingly will write messages in log file.
|
|
5078
|
-
/// </summary>
|
|
5079
|
-
//@dynamic
|
|
5080
4268
|
class Logger {
|
|
5081
4269
|
constructor() {
|
|
5082
|
-
this.LogLevel = 0;
|
|
5083
|
-
/// <summary>
|
|
5084
|
-
/// While writing the error messages in the file play the beep.
|
|
5085
|
-
/// </summary>
|
|
4270
|
+
this.LogLevel = 0;
|
|
5086
4271
|
this.ShouldBeep = false;
|
|
5087
4272
|
}
|
|
5088
4273
|
static set Instance(value) {
|
|
@@ -5094,26 +4279,10 @@ class Logger {
|
|
|
5094
4279
|
}
|
|
5095
4280
|
return Logger.instance;
|
|
5096
4281
|
}
|
|
5097
|
-
/// <summary>
|
|
5098
|
-
/// Initialize logger
|
|
5099
|
-
/// </summary>
|
|
5100
|
-
/// <param name="logLevel"></param>
|
|
5101
|
-
/// <param name="internalLogSync"></param>
|
|
5102
4282
|
Initialize(logLevel, internalLogSync, shouldBeep) {
|
|
5103
4283
|
try {
|
|
5104
|
-
// let logSync: LogSyncMode = LogSyncMode.Session;
|
|
5105
4284
|
this.LogLevel = logLevel;
|
|
5106
4285
|
this.ShouldBeep = shouldBeep;
|
|
5107
|
-
// TODO: implement
|
|
5108
|
-
// String strLogSync = internalLogSync;
|
|
5109
|
-
// if (!string.IsNullOrEmpty(strLogSync))
|
|
5110
|
-
// {
|
|
5111
|
-
// if (strLogSync.StartsWith("M", StringComparison.CurrentCultureIgnoreCase))
|
|
5112
|
-
// logSync = LogSyncMode.Message;
|
|
5113
|
-
// else if (strLogSync.StartsWith("F", StringComparison.CurrentCultureIgnoreCase))
|
|
5114
|
-
// logSync = LogSyncMode.Flush;
|
|
5115
|
-
// }
|
|
5116
|
-
//
|
|
5117
4286
|
}
|
|
5118
4287
|
catch (e) {
|
|
5119
4288
|
this.WriteDevToLog("ClientManager.init(): " + e.Message);
|
|
@@ -5137,9 +4306,6 @@ class Logger {
|
|
|
5137
4306
|
ShouldLogExtendedServerRelatedMessages() {
|
|
5138
4307
|
return (Logger.Instance.ShouldLog(Logger_LogLevels.ServerMessages) || Logger.Instance.ShouldLog(Logger_LogLevels.Support) || Logger.Instance.ShouldLog(Logger_LogLevels.Development)) && this.LogLevel !== Logger_LogLevels.Basic;
|
|
5139
4308
|
}
|
|
5140
|
-
/// <summary></summary>
|
|
5141
|
-
/// <param name="msg"></param>
|
|
5142
|
-
/// <param name="openIfNecessary">open the log file if not opened yet</param>
|
|
5143
4309
|
WriteToLog(msg, openIfNecessary, logType = LogType.info) {
|
|
5144
4310
|
if (this.LogLevel > Logger_LogLevels.None || openIfNecessary) {
|
|
5145
4311
|
msg = NString.Format("{0} {1}", (this.LogLevel === Logger_LogLevels.Basic) ? new Date().toISOString() : DateTimeUtils.ToString(DateTime.Now, XMLConstants.ERROR_LOG_TIME_FORMAT, this), msg);
|
|
@@ -5155,26 +4321,16 @@ class Logger {
|
|
|
5155
4321
|
}
|
|
5156
4322
|
}
|
|
5157
4323
|
}
|
|
5158
|
-
/// <summary>
|
|
5159
|
-
/// write a server access to the log
|
|
5160
|
-
/// </summary>
|
|
5161
|
-
/// <param name="msg">the message to write to the log</param>
|
|
5162
4324
|
WriteServerToLog(msg) {
|
|
5163
4325
|
if (this.ShouldLogServerRelatedMessages()) {
|
|
5164
4326
|
this.WriteToLog(NString.Format("Server, Thread={0}: ", Thread.CurrentThread.ManagedThreadId) + msg, false, LogType.info);
|
|
5165
4327
|
}
|
|
5166
4328
|
}
|
|
5167
|
-
/// <summary>
|
|
5168
|
-
/// write a server access to the log, including the content
|
|
5169
|
-
/// </summary>
|
|
5170
|
-
/// <param name="msg">the message to write to the log</param>
|
|
5171
4329
|
WriteServerMessagesToLog(msg) {
|
|
5172
4330
|
if (this.ShouldLogExtendedServerRelatedMessages()) {
|
|
5173
4331
|
this.WriteToLog("Server#: " + msg, false, LogType.info);
|
|
5174
4332
|
}
|
|
5175
4333
|
}
|
|
5176
|
-
/// <summary>Write a QC message to the log</summary>
|
|
5177
|
-
/// <param name="msg">the message to write to the log</param>
|
|
5178
4334
|
WriteSupportToLog(msg, skipLine) {
|
|
5179
4335
|
if (this.LogLevel >= Logger_LogLevels.Support && this.LogLevel !== Logger_LogLevels.Basic) {
|
|
5180
4336
|
if (skipLine) {
|
|
@@ -5185,31 +4341,16 @@ class Logger {
|
|
|
5185
4341
|
}
|
|
5186
4342
|
}
|
|
5187
4343
|
}
|
|
5188
|
-
/// <summary>
|
|
5189
|
-
/// write a performance message to the log
|
|
5190
|
-
/// </summary>
|
|
5191
|
-
/// <param name="msg">the message to write to the log</param>
|
|
5192
4344
|
WriteGuiToLog(msg) {
|
|
5193
4345
|
if (this.LogLevel >= Logger_LogLevels.Gui && this.LogLevel !== Logger_LogLevels.Basic) {
|
|
5194
4346
|
this.WriteToLog(msg, false, LogType.info);
|
|
5195
4347
|
}
|
|
5196
4348
|
}
|
|
5197
|
-
/// <summary>
|
|
5198
|
-
/// write a developer message to the log
|
|
5199
|
-
/// </summary>
|
|
5200
|
-
/// <param name="msg">the message to write to the log</param>
|
|
5201
4349
|
WriteDevToLog(msg) {
|
|
5202
4350
|
if (this.LogLevel >= Logger_LogLevels.Development && this.LogLevel !== Logger_LogLevels.Basic) {
|
|
5203
4351
|
this.WriteToLog("DEV: " + msg, false, LogType.info);
|
|
5204
4352
|
}
|
|
5205
4353
|
}
|
|
5206
|
-
/// <summary>
|
|
5207
|
-
/// Writes a basic level entry to log
|
|
5208
|
-
/// </summary>
|
|
5209
|
-
/// <param name="messageDirection">message direction relative to the current module (RIA client). Can be either MessageEntering or MessageLeaving</param>
|
|
5210
|
-
/// <param name="statusCode">HTTP status code</param>
|
|
5211
|
-
/// <param name="contentLength">length of the http message</param>
|
|
5212
|
-
/// <param name="httpHeaders">HTTP headers</param>
|
|
5213
4354
|
WriteBasicToLog(messageDirection, contextID, sessionCounter, clientID, serverID, responseTime, statusCode, httpHeaders, contentLength) {
|
|
5214
4355
|
if (this.LogLevel === Logger_LogLevels.Basic) {
|
|
5215
4356
|
let text = httpHeaders;
|
|
@@ -5217,8 +4358,6 @@ class Logger {
|
|
|
5217
4358
|
text = NString.Replace(text, "\r\n", "|");
|
|
5218
4359
|
let arg_E4_0 = "RIA,{0}_{1},{2},{3},{4},{5},-,{6},{7},{8},{9},{10},{11}";
|
|
5219
4360
|
let expr_3E = new Array(12);
|
|
5220
|
-
// TODO : need to check How to handle Process class.
|
|
5221
|
-
// expr_3E[0] = Process.GetCurrentProcess().Id;
|
|
5222
4361
|
expr_3E[1] = Thread.CurrentThread.ManagedThreadId;
|
|
5223
4362
|
expr_3E[2] = new Date().toISOString();
|
|
5224
4363
|
expr_3E[3] = ((messageDirection === Logger_MessageDirection.MessageLeaving) ? "MSGL" : "MSGE");
|
|
@@ -5237,37 +4376,14 @@ class Logger {
|
|
|
5237
4376
|
console.log(value);
|
|
5238
4377
|
}
|
|
5239
4378
|
}
|
|
5240
|
-
/// <summary>
|
|
5241
|
-
/// Writes request information to log
|
|
5242
|
-
/// </summary>
|
|
5243
|
-
/// <param name="clientSession">The clientSession object to be logged</param>
|
|
5244
4379
|
WriteRequestInfoToLog(requestInfo, extraMessageStr) {
|
|
5245
4380
|
if (this.LogLevel === Logger_LogLevels.RequestInfo) {
|
|
5246
|
-
// Chrome debugger automatically recomputes logged objects.
|
|
5247
|
-
// Hence, clone the requestInfo object to print the details at the time of logging
|
|
5248
4381
|
console.log(extraMessageStr, RequestInfo.clone(requestInfo));
|
|
5249
4382
|
}
|
|
5250
4383
|
}
|
|
5251
|
-
/// <summary>
|
|
5252
|
-
/// Writes a request exception basic level entry to log
|
|
5253
|
-
/// </summary>
|
|
5254
|
-
/// <param name="contextID"></param>
|
|
5255
|
-
/// <param name="sessionCounter"></param>
|
|
5256
|
-
/// <param name="clientID"></param>
|
|
5257
|
-
/// <param name="serverID"></param>
|
|
5258
|
-
/// <param name="ex">the logged exception</param>
|
|
5259
4384
|
WriteBasicErrorToLog(contextID, sessionCounter, clientID, serverID, ex) {
|
|
5260
4385
|
Debug.Assert(this.LogLevel === Logger_LogLevels.Basic);
|
|
5261
|
-
|
|
5262
|
-
// let value: string = NString.Format("RIA,{0}_{1},{2},{3},{4},{5},-,{6},{7},-,-,-,{8} {9}", [
|
|
5263
|
-
// Process.GetCurrentProcess().Id, Thread.CurrentThread.ManagedThreadId, DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"), "RES", contextID, sessionCounter, clientID, serverID, ex.GetType(), ex.Message
|
|
5264
|
-
// ]);
|
|
5265
|
-
// NConsole.WriteLine(value);
|
|
5266
|
-
}
|
|
5267
|
-
/// <summary>
|
|
5268
|
-
/// Write an error to the log
|
|
5269
|
-
/// </summary>
|
|
5270
|
-
/// <param name="msg">the message to write to the log</param>
|
|
4386
|
+
}
|
|
5271
4387
|
WriteErrorToLog(msg) {
|
|
5272
4388
|
this.WriteToLog("MagicWeb [ERROR]: " + StrUtil.getConsoleErorString(msg), true, LogType.error);
|
|
5273
4389
|
}
|
|
@@ -5347,9 +4463,6 @@ class Logger {
|
|
|
5347
4463
|
}
|
|
5348
4464
|
this.WriteToLog(stringBuilder.ToString(), true);
|
|
5349
4465
|
}
|
|
5350
|
-
/// <summary>
|
|
5351
|
-
/// Flush the log writer.
|
|
5352
|
-
/// </summary>
|
|
5353
4466
|
Flush() {
|
|
5354
4467
|
}
|
|
5355
4468
|
}
|
|
@@ -5559,14 +4672,11 @@ MsgInterface.DefaultMessages = [
|
|
|
5559
4672
|
new DefaultMsgDetails("STR_MOBILE_TAB_CONTROL_LAYER_0", "Controls cannot be linked to layer 0 of the tab control."), new DefaultMsgDetails("STR_MOBILE_TAB_DISPLAY_LIST_ERROR", "The number of entries in the Display List property must be zero or match the number of entries in the Items List property."), new DefaultMsgDetails("RC_ERROR_ARG_TYPE_STRING_NUMBER_MISMATCH", "The number of characters in the argument type string does not match the number of total arguments"), new DefaultMsgDetails("RC_ERROR_ILLEGAL_ARG_ATTR_TYPE", "Illegal argument attribute type"), new DefaultMsgDetails("RC_ERROR_ILLEGAL_RETURN_VAL_ATTR_TYPE", "Illegal return value attribute type"), new DefaultMsgDetails("STR_ERR_WEBCLIENT_PROGRAM_RELOADED", "Changes were done at the server side. Browser will be refreshed in order to get the latest changes."), new DefaultMsgDetails("STR_ERR_EXECUTED_PROGRAM_CHANGED", "Executed program changed at the server side. Browser will be refreshed in order to get the latest changes.")
|
|
5560
4673
|
];
|
|
5561
4674
|
|
|
5562
|
-
/// <summary> implementation of a general queue</summary>
|
|
5563
4675
|
class Queue {
|
|
5564
|
-
/// <summary> </summary>
|
|
5565
4676
|
constructor() {
|
|
5566
4677
|
this._queueVec = null;
|
|
5567
4678
|
this._queueVec = new List();
|
|
5568
4679
|
}
|
|
5569
|
-
/// <summary> returns the first object in the queue</summary>
|
|
5570
4680
|
get() {
|
|
5571
4681
|
let returnValue = null;
|
|
5572
4682
|
if (this._queueVec.length > 0) {
|
|
@@ -5575,20 +4685,15 @@ class Queue {
|
|
|
5575
4685
|
}
|
|
5576
4686
|
return returnValue;
|
|
5577
4687
|
}
|
|
5578
|
-
/// <summary> add an object to the end of the queue</summary>
|
|
5579
|
-
/// <param name="obj">the object to add
|
|
5580
4688
|
put(obj) {
|
|
5581
4689
|
this._queueVec.push(obj);
|
|
5582
4690
|
}
|
|
5583
|
-
/// <summary> remove all the objects from the queue</summary>
|
|
5584
4691
|
clear() {
|
|
5585
4692
|
this._queueVec.Clear();
|
|
5586
4693
|
}
|
|
5587
|
-
/// <summary> returns true if the queue is empty</summary>
|
|
5588
4694
|
isEmpty() {
|
|
5589
4695
|
return this._queueVec.length === 0;
|
|
5590
4696
|
}
|
|
5591
|
-
/// <summary> returns size of the queue</summary>
|
|
5592
4697
|
Size() {
|
|
5593
4698
|
return this._queueVec.length;
|
|
5594
4699
|
}
|
|
@@ -5628,15 +4733,7 @@ Randomizer._mod = 0.0;
|
|
|
5628
4733
|
Randomizer._mul = 0.0;
|
|
5629
4734
|
Randomizer._seed = 0.0;
|
|
5630
4735
|
|
|
5631
|
-
/// <summary>
|
|
5632
|
-
/// type checking for enum 'StorageAttribute'
|
|
5633
|
-
/// </summary>
|
|
5634
4736
|
class StorageAttributeCheck {
|
|
5635
|
-
/// <summary>
|
|
5636
|
-
/// is the both types belong to the same inner data types
|
|
5637
|
-
/// </summary>
|
|
5638
|
-
/// <param name = "type1">data type</param>
|
|
5639
|
-
/// <param name = "type2">data type</param>
|
|
5640
4737
|
static isTheSameType(type1, type2) {
|
|
5641
4738
|
return type1 === type2 || (StorageAttributeCheck.isTypeNumeric(type1) && StorageAttributeCheck.isTypeNumeric(type2)) || (StorageAttributeCheck.isTypeLogical(type1) && StorageAttributeCheck.isTypeLogical(type2)) || (StorageAttributeCheck.IsTypeAlphaOrUnicode(type1) && StorageAttributeCheck.IsTypeAlphaOrUnicode(type2)) || (StorageAttributeCheck.isTypeBlob(type1) && StorageAttributeCheck.isTypeBlob(type2)) || (StorageAttributeCheck.isTypeDotNet(type1) && StorageAttributeCheck.isTypeDotNet(type2));
|
|
5642
4739
|
}
|
|
@@ -5646,36 +4743,18 @@ class StorageAttributeCheck {
|
|
|
5646
4743
|
static isTypeAlpha(type) {
|
|
5647
4744
|
return type === StorageAttribute.ALPHA || type === StorageAttribute.MEMO;
|
|
5648
4745
|
}
|
|
5649
|
-
/// <summary>
|
|
5650
|
-
/// is the both types belong to the NUMERIC inner type
|
|
5651
|
-
/// </summary>
|
|
5652
4746
|
static isTypeNumeric(type) {
|
|
5653
4747
|
return type === StorageAttribute.DATE || type === StorageAttribute.TIME || type === StorageAttribute.NUMERIC;
|
|
5654
4748
|
}
|
|
5655
|
-
/// <summary>
|
|
5656
|
-
/// is the both types belong to the LOGICAL inner type
|
|
5657
|
-
/// </summary>
|
|
5658
4749
|
static isTypeLogical(type) {
|
|
5659
4750
|
return type === StorageAttribute.BOOLEAN;
|
|
5660
4751
|
}
|
|
5661
|
-
/// <summary>
|
|
5662
|
-
/// is the type is DOTNET
|
|
5663
|
-
/// </summary>
|
|
5664
4752
|
static isTypeDotNet(type) {
|
|
5665
4753
|
return type === StorageAttribute.DOTNET;
|
|
5666
4754
|
}
|
|
5667
|
-
/// <summary>
|
|
5668
|
-
/// is the type ALPHA or UNICODE
|
|
5669
|
-
/// </summary>
|
|
5670
|
-
/// <param name = "type">data type</param>
|
|
5671
4755
|
static IsTypeAlphaOrUnicode(type) {
|
|
5672
4756
|
return type === StorageAttribute.ALPHA || type === StorageAttribute.UNICODE;
|
|
5673
4757
|
}
|
|
5674
|
-
/// <summary>
|
|
5675
|
-
/// is the inner type ALPHA or UNICODE
|
|
5676
|
-
/// </summary>
|
|
5677
|
-
/// <param name = "type1">data type</param>
|
|
5678
|
-
/// <param name = "type2">data type</param>
|
|
5679
4758
|
static StorageFldAlphaOrUnicode(type1, type2) {
|
|
5680
4759
|
return StorageAttributeCheck.IsTypeAlphaOrUnicode(type1) && StorageAttributeCheck.IsTypeAlphaOrUnicode(type2);
|
|
5681
4760
|
}
|
|
@@ -5691,12 +4770,6 @@ class StorageAttributeCheck {
|
|
|
5691
4770
|
return ((type1AlphaOrUnicode && type2Blob) || (type2AlphaOrUnicode && type1Blob));
|
|
5692
4771
|
}
|
|
5693
4772
|
}
|
|
5694
|
-
/// <summary>
|
|
5695
|
-
/// Check if types are compatible or not.
|
|
5696
|
-
/// </summary>
|
|
5697
|
-
/// <param name="sourceAttribute"></param>
|
|
5698
|
-
/// <param name="destinationAttribute"></param>
|
|
5699
|
-
/// <returns></returns>
|
|
5700
4773
|
static IsTypeCompatibile(sourceAttribute, destinationAttribute) {
|
|
5701
4774
|
let isTypeCompatible = false;
|
|
5702
4775
|
switch (sourceAttribute) {
|
|
@@ -5743,36 +4816,21 @@ class StorageAttributeCheck {
|
|
|
5743
4816
|
}
|
|
5744
4817
|
}
|
|
5745
4818
|
|
|
5746
|
-
/// <summary>
|
|
5747
|
-
/// Helper class for synchronized execution.
|
|
5748
|
-
/// It works by creating a promise and then waiting for the promise to be completed
|
|
5749
|
-
/// </summary>
|
|
5750
|
-
// @dynamic
|
|
5751
4819
|
class SyncExecutionHelper {
|
|
5752
4820
|
constructor() {
|
|
5753
|
-
// resolver is caller when promise is fullfilled
|
|
5754
4821
|
this.resolver = null;
|
|
5755
4822
|
}
|
|
5756
|
-
/// <summary>
|
|
5757
|
-
/// get instance of SyncExecutionHelper
|
|
5758
|
-
/// </summary>
|
|
5759
4823
|
static get Instance() {
|
|
5760
4824
|
if (SyncExecutionHelper._instance === null)
|
|
5761
4825
|
SyncExecutionHelper._instance = new SyncExecutionHelper();
|
|
5762
4826
|
return SyncExecutionHelper._instance;
|
|
5763
4827
|
}
|
|
5764
|
-
/// <summary>
|
|
5765
|
-
/// To wait, create a promise and add wait for it to complete
|
|
5766
|
-
/// </summary>
|
|
5767
4828
|
Wait() {
|
|
5768
4829
|
Logger.Instance.WriteDevToLog("SyncExecutionHelper.Wait()");
|
|
5769
4830
|
return new Promise((resolve, reject) => {
|
|
5770
4831
|
this.resolver = resolve;
|
|
5771
4832
|
}).then();
|
|
5772
4833
|
}
|
|
5773
|
-
/// <summary>
|
|
5774
|
-
/// To resume call the resolver
|
|
5775
|
-
/// </summary>
|
|
5776
4834
|
Pulse() {
|
|
5777
4835
|
let resolver = this.resolver;
|
|
5778
4836
|
if (resolver != null) {
|
|
@@ -5793,13 +4851,6 @@ const IDX_DAY = 2;
|
|
|
5793
4851
|
const IDX_DOY = 3;
|
|
5794
4852
|
class UtilDateJpn {
|
|
5795
4853
|
constructor() {
|
|
5796
|
-
/// <summary>
|
|
5797
|
-
/// JPN: Japanese date picture support
|
|
5798
|
-
/// Utility Class for Japanese date
|
|
5799
|
-
/// </summary>
|
|
5800
|
-
/// <author> Toshiro Nakayoshi (MSJ)
|
|
5801
|
-
/// </author>
|
|
5802
|
-
// ---- gengo (the name of an era) ---------------------------------------
|
|
5803
4854
|
this.MaxGengo = MAX_GENGO;
|
|
5804
4855
|
}
|
|
5805
4856
|
static getInstance() {
|
|
@@ -5825,18 +4876,6 @@ class UtilDateJpn {
|
|
|
5825
4876
|
}
|
|
5826
4877
|
return UtilDateJpn.JmonthStr[month];
|
|
5827
4878
|
}
|
|
5828
|
-
/// <summary>
|
|
5829
|
-
/// Convert a year (A.D.) into Japanese year of an era
|
|
5830
|
-
/// This method is modeled after "date_jpn_year_ofs" function in
|
|
5831
|
-
/// "\mglocal\jpn\jpndate_jpn.cpp".
|
|
5832
|
-
/// </summary>
|
|
5833
|
-
/// <param name = "intYear:">year (A.D.)
|
|
5834
|
-
/// </param>
|
|
5835
|
-
/// <param name = "intDoy:">DOY
|
|
5836
|
-
/// </param>
|
|
5837
|
-
/// <returns> year of an era.
|
|
5838
|
-
/// if either param is invalid, it returns 0.
|
|
5839
|
-
/// </returns>
|
|
5840
4879
|
date_jpn_year_ofs(intYear, intDoy) {
|
|
5841
4880
|
let result;
|
|
5842
4881
|
if (intYear < 1 || intDoy < 1) {
|
|
@@ -5854,20 +4893,6 @@ class UtilDateJpn {
|
|
|
5854
4893
|
}
|
|
5855
4894
|
return result;
|
|
5856
4895
|
}
|
|
5857
|
-
/// <summary>
|
|
5858
|
-
/// Convert a year (A.D.) into a name of a Japanese era
|
|
5859
|
-
/// This method is modeled after "date_jpn_yr_2_a" function in
|
|
5860
|
-
/// "\mglocal\jpn\jpndate_jpn.cpp".
|
|
5861
|
-
/// </summary>
|
|
5862
|
-
/// <param name = "intYear:">year (A.D.)
|
|
5863
|
-
/// </param>
|
|
5864
|
-
/// <param name = "intDoy:">DOY
|
|
5865
|
-
/// </param>
|
|
5866
|
-
/// <param name = "isKanji:">return a full name (true) or the first letter (false).
|
|
5867
|
-
/// </param>
|
|
5868
|
-
/// <returns> name of an era
|
|
5869
|
-
/// if either param is invalid, it returns "?".
|
|
5870
|
-
/// </returns>
|
|
5871
4896
|
date_jpn_yr_2_a(intYear, intDoy, isKanji) {
|
|
5872
4897
|
let num;
|
|
5873
4898
|
if (intYear < 1 || intDoy < 1) {
|
|
@@ -5891,17 +4916,6 @@ class UtilDateJpn {
|
|
|
5891
4916
|
}
|
|
5892
4917
|
return result;
|
|
5893
4918
|
}
|
|
5894
|
-
/// <summary>
|
|
5895
|
-
/// Get the first year (A.D.) of a specified Japanese era
|
|
5896
|
-
/// This method is modeled after "date_jpn_yr_4_a" function in
|
|
5897
|
-
/// "\mglocal\jpn\jpndate_jpn.cpp".
|
|
5898
|
-
/// </summary>
|
|
5899
|
-
/// <param name = "ucp_str:">name of a specified Japanese era
|
|
5900
|
-
/// </param>
|
|
5901
|
-
/// <param name = "s_len:">length (the number of bytes) of ucp_str
|
|
5902
|
-
/// </param>
|
|
5903
|
-
/// <returns> year (A.D.)
|
|
5904
|
-
/// </returns>
|
|
5905
4919
|
date_jpn_yr_4_a(ucp_str, s_len) {
|
|
5906
4920
|
let i = this.MaxGengo - 1;
|
|
5907
4921
|
if (s_len > 0) {
|
|
@@ -5940,17 +4954,6 @@ class UtilDateJpn {
|
|
|
5940
4954
|
}
|
|
5941
4955
|
return result;
|
|
5942
4956
|
}
|
|
5943
|
-
/// <summary>
|
|
5944
|
-
/// Get the name of an era in date string
|
|
5945
|
-
/// </summary>
|
|
5946
|
-
/// <param name = "strDate:">string of input strDate
|
|
5947
|
-
/// </param>
|
|
5948
|
-
/// <param name = "strPicture:">string of picture
|
|
5949
|
-
/// </param>
|
|
5950
|
-
/// <param name = "intStartPos:">start position to search
|
|
5951
|
-
/// </param>
|
|
5952
|
-
/// <returns> name of an era
|
|
5953
|
-
/// </returns>
|
|
5954
4957
|
static getEraNameStrInDate(strDate, strPicture, intStartPos) {
|
|
5955
4958
|
let result = null;
|
|
5956
4959
|
let intPicIdxOfs = 0;
|
|
@@ -5969,7 +4972,6 @@ class UtilDateJpn {
|
|
|
5969
4972
|
intLetters = 2;
|
|
5970
4973
|
}
|
|
5971
4974
|
else {
|
|
5972
|
-
// If "strDate" contains DBCS, the position of "strPicture" has to skip next index.
|
|
5973
4975
|
if (i < strDate.length) {
|
|
5974
4976
|
if (!UtilStrByteMode.isHalfWidth(strDate[i]) && UtilStrByteMode.isHalfWidth(strPicture[i + intPicIdxOfs])) {
|
|
5975
4977
|
intPicIdxOfs = intPicIdxOfs + 1;
|
|
@@ -5981,19 +4983,10 @@ class UtilDateJpn {
|
|
|
5981
4983
|
}
|
|
5982
4984
|
}
|
|
5983
4985
|
result = strDate.substr(i, intLetters);
|
|
5984
|
-
break;
|
|
4986
|
+
break;
|
|
5985
4987
|
}
|
|
5986
4988
|
return result;
|
|
5987
4989
|
}
|
|
5988
|
-
/// <summary>
|
|
5989
|
-
/// Get the length of the name of an era in picture
|
|
5990
|
-
/// </summary>
|
|
5991
|
-
/// <param name = "strPicture">string of picture
|
|
5992
|
-
/// </param>
|
|
5993
|
-
/// <param name = "intStartPos">start position to search
|
|
5994
|
-
/// </param>
|
|
5995
|
-
/// <returns> length of the name (the number of bytes)
|
|
5996
|
-
/// </returns>
|
|
5997
4990
|
static getEraNameLenInPicture(strPicture, intStartPos) {
|
|
5998
4991
|
let intLetters = 0;
|
|
5999
4992
|
for (let i = intStartPos; i < strPicture.length; i = i + 1) {
|
|
@@ -6016,15 +5009,6 @@ class UtilDateJpn {
|
|
|
6016
5009
|
}
|
|
6017
5010
|
return intLetters;
|
|
6018
5011
|
}
|
|
6019
|
-
/// <summary>
|
|
6020
|
-
/// Get the start year of an era in picture
|
|
6021
|
-
/// </summary>
|
|
6022
|
-
/// <param name = "strDate:">string of input strDate
|
|
6023
|
-
/// </param>
|
|
6024
|
-
/// <param name = "strPicture:">string of picture
|
|
6025
|
-
/// </param>
|
|
6026
|
-
/// <returns> start year of the era
|
|
6027
|
-
/// </returns>
|
|
6028
5012
|
getStartYearOfEra(strDate, strPicture) {
|
|
6029
5013
|
let eraNameStrInDate = UtilDateJpn.getEraNameStrInDate(strDate, strPicture, 0);
|
|
6030
5014
|
let result;
|
|
@@ -6043,13 +5027,7 @@ class UtilDateJpn {
|
|
|
6043
5027
|
}
|
|
6044
5028
|
return result;
|
|
6045
5029
|
}
|
|
6046
|
-
/// <summary> Add extra Gengo data into the Gengo tables</summary>
|
|
6047
|
-
/// <param name="strExtraGengo:">
|
|
6048
|
-
/// </param>
|
|
6049
|
-
/// <returns>
|
|
6050
|
-
/// </returns>
|
|
6051
5030
|
addExtraGengo(strExtraGengo) {
|
|
6052
|
-
// e.g. strExtraGengo = "2012/04/01,092,AaABCD;2013/04/01,091,WwWXYZ;"
|
|
6053
5031
|
let strGengoInfo = strExtraGengo.split(';');
|
|
6054
5032
|
for (let i = 0; i < strGengoInfo.length; i = i + 1) {
|
|
6055
5033
|
if (strGengoInfo[i].length > 0) {
|
|
@@ -6057,13 +5035,13 @@ class UtilDateJpn {
|
|
|
6057
5035
|
if (strTok.length === 3 && strTok[0].length > 0 && strTok[1].length > 0 && strTok[2].length > 0) {
|
|
6058
5036
|
let strDate = strTok[0].split('/');
|
|
6059
5037
|
if (strDate.length === 3 && strDate[0].length > 0 && strDate[1].length > 0 && strDate[2].length > 0) {
|
|
6060
|
-
UtilDateJpn.GengoStr[MAX_GENGO + i][0] = strTok[2].substr(0, 1);
|
|
6061
|
-
UtilDateJpn.GengoStr[MAX_GENGO + i][1] = strTok[2].substr(1, 1);
|
|
6062
|
-
UtilDateJpn.GengoStr[MAX_GENGO + i][2] = strTok[2].substr(2);
|
|
6063
|
-
UtilDateJpn.StartDayOfGengo[MAX_GENGO + i][0] = NNumber.Parse(strDate[0]);
|
|
6064
|
-
UtilDateJpn.StartDayOfGengo[MAX_GENGO + i][1] = NNumber.Parse(strDate[1]);
|
|
6065
|
-
UtilDateJpn.StartDayOfGengo[MAX_GENGO + i][2] = NNumber.Parse(strDate[2]);
|
|
6066
|
-
UtilDateJpn.StartDayOfGengo[MAX_GENGO + i][3] = NNumber.Parse(strTok[1]);
|
|
5038
|
+
UtilDateJpn.GengoStr[MAX_GENGO + i][0] = strTok[2].substr(0, 1);
|
|
5039
|
+
UtilDateJpn.GengoStr[MAX_GENGO + i][1] = strTok[2].substr(1, 1);
|
|
5040
|
+
UtilDateJpn.GengoStr[MAX_GENGO + i][2] = strTok[2].substr(2);
|
|
5041
|
+
UtilDateJpn.StartDayOfGengo[MAX_GENGO + i][0] = NNumber.Parse(strDate[0]);
|
|
5042
|
+
UtilDateJpn.StartDayOfGengo[MAX_GENGO + i][1] = NNumber.Parse(strDate[1]);
|
|
5043
|
+
UtilDateJpn.StartDayOfGengo[MAX_GENGO + i][2] = NNumber.Parse(strDate[2]);
|
|
5044
|
+
UtilDateJpn.StartDayOfGengo[MAX_GENGO + i][3] = NNumber.Parse(strTok[1]);
|
|
6067
5045
|
this.MaxGengo++;
|
|
6068
5046
|
}
|
|
6069
5047
|
}
|
|
@@ -6101,70 +5079,42 @@ UtilDateJpn.StartDayOfGengo = [
|
|
|
6101
5079
|
[0, 0, 0, 0]
|
|
6102
5080
|
];
|
|
6103
5081
|
|
|
6104
|
-
/// <summary>JPN: IME support
|
|
6105
|
-
/// Utility Class for Input Method Editor
|
|
6106
|
-
/// </summary>
|
|
6107
|
-
/// <author> Toshiro Nakayoshi (MSJ)
|
|
6108
|
-
/// </author>
|
|
6109
5082
|
class UtilImeJpn {
|
|
6110
5083
|
constructor() {
|
|
6111
5084
|
this.ImeAutoOff = false;
|
|
6112
5085
|
this.StrImeRead = null;
|
|
6113
5086
|
}
|
|
6114
|
-
/// <summary> check if the IME mode is within valid range
|
|
6115
|
-
/// </summary>
|
|
6116
|
-
/// <param name="imeMode">(IME mode in Magic)
|
|
6117
|
-
/// </param>
|
|
6118
|
-
/// <returns> bool
|
|
6119
|
-
/// </returns>
|
|
6120
5087
|
isValid(imeMode) {
|
|
6121
5088
|
return (0 <= imeMode && imeMode <= 9) || imeMode === 15 || imeMode === 10;
|
|
6122
5089
|
}
|
|
6123
|
-
/// <summary> convert the input method editor mode
|
|
6124
|
-
/// </summary>
|
|
6125
|
-
/// <param name="imeMode">(IME mode in Magic)
|
|
6126
|
-
/// </param>
|
|
6127
|
-
/// <returns> imeConvMode (IME conversion mode in imm32.lib)
|
|
6128
|
-
/// </returns>
|
|
6129
5090
|
static imeMode2imeConvMode(imeMode) {
|
|
6130
5091
|
let result;
|
|
6131
5092
|
switch (imeMode) {
|
|
6132
|
-
// IME_ZEN_HIRAGANA_ROMAN
|
|
6133
5093
|
case 1:
|
|
6134
5094
|
result = 25;
|
|
6135
5095
|
break;
|
|
6136
|
-
// IME_ZEN_HIRAGANA
|
|
6137
5096
|
case 2:
|
|
6138
5097
|
result = 9;
|
|
6139
5098
|
break;
|
|
6140
|
-
// IME_ZEN_KATAKANA_ROMAN
|
|
6141
5099
|
case 3:
|
|
6142
5100
|
result = 27;
|
|
6143
5101
|
break;
|
|
6144
|
-
// IME_ZEN_KATAKANA
|
|
6145
5102
|
case 4:
|
|
6146
5103
|
result = 11;
|
|
6147
5104
|
break;
|
|
6148
|
-
// IME_HAN_KATAKANA_ROMAN
|
|
6149
5105
|
case 5:
|
|
6150
5106
|
result = 19;
|
|
6151
5107
|
break;
|
|
6152
|
-
// IME_HAN_KATAKANA
|
|
6153
5108
|
case 6:
|
|
6154
5109
|
result = 3;
|
|
6155
5110
|
break;
|
|
6156
|
-
// IME_ZEN_ALPHANUMERIC
|
|
6157
5111
|
case 7:
|
|
6158
5112
|
result = 8;
|
|
6159
5113
|
break;
|
|
6160
|
-
// IME_HAN_ALPHANUMERIC
|
|
6161
5114
|
case 8:
|
|
6162
5115
|
case 9:
|
|
6163
5116
|
result = 0;
|
|
6164
5117
|
break;
|
|
6165
|
-
// case 0:
|
|
6166
|
-
// case IME_DISABLE:
|
|
6167
|
-
// case IME_FORCE_OFF:
|
|
6168
5118
|
default:
|
|
6169
5119
|
result = 256;
|
|
6170
5120
|
break;
|
|
@@ -6180,28 +5130,17 @@ UtilImeJpn.IME_CMODE_ROMAN = 16;
|
|
|
6180
5130
|
UtilImeJpn.IME_CMODE_NOCONVERSION = 256;
|
|
6181
5131
|
UtilImeJpn.IME_NOT_INITIALIZED = -1;
|
|
6182
5132
|
UtilImeJpn.IME_ZEN_HIRAGANA_ROMAN = 1;
|
|
6183
|
-
UtilImeJpn.IME_FORCE_OFF = 15;
|
|
6184
|
-
|
|
6185
|
-
UtilImeJpn.IME_DISABLE = 10; // to completely disable IME (even not allowing to change the mode)
|
|
5133
|
+
UtilImeJpn.IME_FORCE_OFF = 15;
|
|
5134
|
+
UtilImeJpn.IME_DISABLE = 10;
|
|
6186
5135
|
|
|
6187
|
-
/// <summary> a helper class for the parsing of the XML</summary>
|
|
6188
5136
|
class XmlParser {
|
|
6189
|
-
/// <summary>
|
|
6190
|
-
///
|
|
6191
|
-
/// </summary>
|
|
6192
|
-
/// <param name="data"></param>
|
|
6193
5137
|
constructor(data = NString.Empty) {
|
|
6194
5138
|
this._currIndex = 0;
|
|
6195
5139
|
this._xmLdata = "";
|
|
6196
|
-
this._history = new List();
|
|
5140
|
+
this._history = new List();
|
|
6197
5141
|
this.setXMLdata(data);
|
|
6198
5142
|
this.setCurrIndex(0);
|
|
6199
5143
|
}
|
|
6200
|
-
/// <summary> parse a string according to a set of delimiters and return the result in a vector</summary>
|
|
6201
|
-
/// <param name="str">the String which need be parted </param>
|
|
6202
|
-
/// <param name="delimiter">the delimiter which part different parts of str </param>
|
|
6203
|
-
/// <param name="isMagicXML">is needed tokenizer working on Magic XML, so the "=" sign will be delited in the end of every first token </param>
|
|
6204
|
-
/// <returns> tmpVector dynamically array, which consist tokens in every element, every token is String </returns>
|
|
6205
5144
|
static getTokens(str, delimiter, isMagicXML = true) {
|
|
6206
5145
|
let tokensVec = new List();
|
|
6207
5146
|
let token = null;
|
|
@@ -6210,22 +5149,17 @@ class XmlParser {
|
|
|
6210
5149
|
}
|
|
6211
5150
|
let strTok = str.split(delimiter.charAt(0));
|
|
6212
5151
|
for (let i = 0; i < strTok.length; i = i + 1) {
|
|
6213
|
-
// Split in C# creates a last empty string token if the source string ends with
|
|
6214
|
-
// the delimiter or if the string is empty (as opposed to Java that will ignore it)
|
|
6215
|
-
// therefore we have to break this loop if such case occurs.
|
|
6216
5152
|
if (isMagicXML && i === strTok.length - 1 && strTok.length % 2 === 1) {
|
|
6217
5153
|
break;
|
|
6218
5154
|
}
|
|
6219
5155
|
token = strTok[i];
|
|
6220
5156
|
if (isMagicXML) {
|
|
6221
|
-
// the 1st token in the pair comes with "=", remove it.
|
|
6222
5157
|
if (i % 2 === 0) {
|
|
6223
5158
|
token = token.trim();
|
|
6224
5159
|
if (token.endsWith("=")) {
|
|
6225
5160
|
token = token.substr(0, token.length - 1);
|
|
6226
5161
|
}
|
|
6227
5162
|
}
|
|
6228
|
-
// 2nd token in the pair can be an empty string, in that case set it to " ".
|
|
6229
5163
|
else if (token === "")
|
|
6230
5164
|
token = " ";
|
|
6231
5165
|
}
|
|
@@ -6235,11 +5169,6 @@ class XmlParser {
|
|
|
6235
5169
|
}
|
|
6236
5170
|
return tokensVec;
|
|
6237
5171
|
}
|
|
6238
|
-
/// <summary>unscape from:
|
|
6239
|
-
/// {"&",\\, \q, \o, \l, \g, \e, \\r, \\n}, to:
|
|
6240
|
-
/// {"&", \, ", ', <, >, =, \r, \n}
|
|
6241
|
-
/// <param name="str">String to be converted</param>
|
|
6242
|
-
/// <returns>unescaped string</returns>
|
|
6243
5172
|
static unescape(str) {
|
|
6244
5173
|
let unescapedString = new StringBuilder(str.length);
|
|
6245
5174
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -6276,11 +5205,6 @@ class XmlParser {
|
|
|
6276
5205
|
}
|
|
6277
5206
|
return (unescapedString.ToString());
|
|
6278
5207
|
}
|
|
6279
|
-
/// <summary>escape from:
|
|
6280
|
-
/// {\, ", ', <, >, =, \r, \n}, to:
|
|
6281
|
-
/// {\\, \q, \0, \l, \g, \e, \\r, \\n}
|
|
6282
|
-
/// <param name="str">String to be converted</param>
|
|
6283
|
-
/// <returns>escaped string</returns>
|
|
6284
5208
|
static escape(str) {
|
|
6285
5209
|
let escapedString = new StringBuilder(str.length * 2);
|
|
6286
5210
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -6316,23 +5240,15 @@ class XmlParser {
|
|
|
6316
5240
|
}
|
|
6317
5241
|
return (escapedString.ToString());
|
|
6318
5242
|
}
|
|
6319
|
-
/// <summary>
|
|
6320
|
-
/// here we only need to take care of "&" so that Sax parser will be able to handle url
|
|
6321
|
-
/// </summary>
|
|
6322
|
-
/// <param name="str"></param>
|
|
6323
|
-
/// <returns></returns>
|
|
6324
5243
|
static escapeUrl(str) {
|
|
6325
5244
|
return NString.Replace(str, "&", "&");
|
|
6326
5245
|
}
|
|
6327
|
-
/// <summary>get next tag name from current index in XML string</summary>
|
|
6328
|
-
/// <returns> next tag name </returns>
|
|
6329
5246
|
getNextTag() {
|
|
6330
5247
|
if (this._xmLdata.length - this._currIndex <= 1) {
|
|
6331
|
-
return null;
|
|
5248
|
+
return null;
|
|
6332
5249
|
}
|
|
6333
5250
|
for (let tmpIndx = this._currIndex + 1; tmpIndx < this._xmLdata.length; tmpIndx++) {
|
|
6334
5251
|
let tmpChar = this._xmLdata[tmpIndx];
|
|
6335
|
-
// a letter starts an element and ends with " ". "/" starts an element closing and ends with '>'.
|
|
6336
5252
|
if (NChar.IsLetter(tmpChar) || tmpChar === '/') {
|
|
6337
5253
|
let endOfTag = NString.IndexOfAny(this._xmLdata, XmlParser.endOfNameChar, tmpIndx, this._xmLdata.length - tmpIndx);
|
|
6338
5254
|
if (endOfTag === -1)
|
|
@@ -6343,34 +5259,25 @@ class XmlParser {
|
|
|
6343
5259
|
}
|
|
6344
5260
|
return null;
|
|
6345
5261
|
}
|
|
6346
|
-
/// <summary>Substring of XMLstring</summary>
|
|
6347
|
-
/// <returns> substring of XML string -from currIndex to endContext </returns>
|
|
6348
5262
|
getXMLsubstring(endContext) {
|
|
6349
5263
|
return this._xmLdata.substr(this._currIndex, endContext - this._currIndex);
|
|
6350
5264
|
}
|
|
6351
|
-
/// <summary>get current element value</summary>
|
|
6352
|
-
/// <returns> element's value </returns>
|
|
6353
5265
|
GetCurrentElementValue() {
|
|
6354
5266
|
this.setCurrIndex2EndOfTag();
|
|
6355
5267
|
let endContext = this.getXMLdata().indexOf(XMLConstants.TAG_OPEN, this.getCurrIndex());
|
|
6356
|
-
// read value of xml element
|
|
6357
5268
|
let value = this.getXMLsubstring(endContext);
|
|
6358
5269
|
this.setCurrIndex2EndOfTag();
|
|
6359
5270
|
return value;
|
|
6360
5271
|
}
|
|
6361
|
-
/// <summary>set current index (on parsing time) to the end of current tag</summary>
|
|
6362
5272
|
setCurrIndex2EndOfTag() {
|
|
6363
5273
|
this._currIndex = this._xmLdata.indexOf(XMLConstants.TAG_CLOSE, this._currIndex) + 1;
|
|
6364
5274
|
}
|
|
6365
|
-
/// <summary>get int from string at parsing time</summary>
|
|
6366
5275
|
static getInt(valueStr) {
|
|
6367
5276
|
return NNumber.Parse(valueStr.trim());
|
|
6368
5277
|
}
|
|
6369
|
-
/// <summary>get boolean from string at parsing time</summary>
|
|
6370
5278
|
static getBoolean(valueStr) {
|
|
6371
5279
|
return valueStr[0] === '1';
|
|
6372
5280
|
}
|
|
6373
|
-
/// <summary>get/set functions 4 XMLstring & currIndex, for parser</summary>
|
|
6374
5281
|
getCurrIndex() {
|
|
6375
5282
|
return this._currIndex;
|
|
6376
5283
|
}
|
|
@@ -6391,81 +5298,46 @@ class XmlParser {
|
|
|
6391
5298
|
this.setCurrIndex(0);
|
|
6392
5299
|
}
|
|
6393
5300
|
}
|
|
6394
|
-
/// <summary>
|
|
6395
|
-
/// prepare the parser to read from the newXmlString
|
|
6396
|
-
/// </summary>
|
|
6397
|
-
/// <param name="newXmlString"></param>
|
|
6398
5301
|
PrepareFormReadString(newXmlString) {
|
|
6399
5302
|
this.setXMLdata(newXmlString);
|
|
6400
5303
|
this.setCurrIndex(0);
|
|
6401
5304
|
}
|
|
6402
|
-
/// <summary> push the current parsing information into the history stack</summary>
|
|
6403
5305
|
push() {
|
|
6404
5306
|
this._history.push(this._currIndex);
|
|
6405
5307
|
this._history.push(this._xmLdata);
|
|
6406
5308
|
}
|
|
6407
|
-
/// <summary> restore the previous parsing information from the history stack</summary>
|
|
6408
5309
|
pop() {
|
|
6409
5310
|
let count = this._history.length;
|
|
6410
5311
|
this._xmLdata = this._history.get_Item(count - 1);
|
|
6411
5312
|
this._currIndex = this._history.get_Item(count - 2);
|
|
6412
5313
|
this._history.SetSize(count - 2);
|
|
6413
5314
|
}
|
|
6414
|
-
/// <summary>gets a table cache xml and set the xmlparser data and index accordingly</summary>
|
|
6415
5315
|
loadTableCacheData(data) {
|
|
6416
5316
|
this.setXMLdata(data);
|
|
6417
5317
|
this.setCurrIndex(0);
|
|
6418
5318
|
}
|
|
6419
|
-
/// <summary>
|
|
6420
|
-
/// Reads the XML from the element at the current position until the end of
|
|
6421
|
-
/// the element, returning the contents as a string. This allows deferring the
|
|
6422
|
-
/// processing of an element until the time is right to do so.<br/>
|
|
6423
|
-
/// The returned string contains the element tag itself. For example:<br/>
|
|
6424
|
-
/// - Assuming that the current element is 'element1', with 2 'innerElement' elements, the
|
|
6425
|
-
/// resulting string will look like this:<br/>
|
|
6426
|
-
/// <element1>
|
|
6427
|
-
/// <innerelement/>
|
|
6428
|
-
/// <innerelement/>
|
|
6429
|
-
/// </element1>
|
|
6430
|
-
///
|
|
6431
|
-
/// This makes the result valid for processing by this XML parser.
|
|
6432
|
-
/// </summary>
|
|
6433
|
-
/// <returns></returns>
|
|
6434
5319
|
ReadToEndOfCurrentElement() {
|
|
6435
|
-
// Get the current tag according to the value of _currIndex.
|
|
6436
5320
|
let currentTag = this.getNextTag();
|
|
6437
5321
|
let currentTagIndex = this._xmLdata.indexOf(XMLConstants.TAG_OPEN + currentTag, this.getCurrIndex());
|
|
6438
|
-
// Find the end of the element's block in the XML.
|
|
6439
|
-
// find next open tag
|
|
6440
5322
|
let nextOpenTagIndex = this._xmLdata.indexOf(XMLConstants.TAG_OPEN, currentTagIndex + 1);
|
|
6441
5323
|
if (nextOpenTagIndex === -1)
|
|
6442
5324
|
nextOpenTagIndex = this._xmLdata.length;
|
|
6443
|
-
// find a close tag BEFORE the next open tag
|
|
6444
5325
|
let elementEndIndex = NString.IndexOf(this._xmLdata, XMLConstants.TAG_TERM, this.getCurrIndex(), nextOpenTagIndex - this.getCurrIndex());
|
|
6445
5326
|
if (elementEndIndex === -1)
|
|
6446
|
-
// close tag was not found in range - we have inner elements, look for the full close tag
|
|
6447
5327
|
elementEndIndex = this._xmLdata.indexOf("/" + currentTag, this.getCurrIndex()) + currentTag.length + XMLConstants.TAG_TERM.length;
|
|
6448
5328
|
else
|
|
6449
5329
|
elementEndIndex = elementEndIndex + XMLConstants.TAG_TERM.length;
|
|
6450
|
-
// Copy the element data so it can be returned.
|
|
6451
5330
|
let elementBlock = this.getXMLsubstring(elementEndIndex);
|
|
6452
|
-
// Move the parser to the end of the element block.
|
|
6453
5331
|
this.setCurrIndex(elementEndIndex);
|
|
6454
5332
|
return elementBlock;
|
|
6455
5333
|
}
|
|
6456
5334
|
ReadContentOfCurrentElement() {
|
|
6457
|
-
// Get the current tag according to the value of _currIndex.
|
|
6458
5335
|
let currentTag = this.getNextTag();
|
|
6459
|
-
// Find the end of the element's block in the XML.
|
|
6460
5336
|
let elementEndIndex = this._xmLdata.indexOf("</" + currentTag + ">", this.getCurrIndex());
|
|
6461
5337
|
if (elementEndIndex === -1)
|
|
6462
|
-
// Can't find the end of the current element - either XML is faulty or the element is empty.
|
|
6463
5338
|
return NString.Empty;
|
|
6464
|
-
// Move to the end of the opening tag
|
|
6465
5339
|
this.setCurrIndex2EndOfTag();
|
|
6466
|
-
// Copy the content of the element (from the end of the opening tag to the beginning of the closing tag).
|
|
6467
5340
|
let elementBlock = this.getXMLsubstring(elementEndIndex);
|
|
6468
|
-
// Move the parser to the end of the element block.
|
|
6469
5341
|
this.setCurrIndex(elementEndIndex);
|
|
6470
5342
|
this.setCurrIndex2EndOfTag();
|
|
6471
5343
|
return elementBlock;
|
|
@@ -6476,29 +5348,9 @@ class XmlParser {
|
|
|
6476
5348
|
}
|
|
6477
5349
|
return this.ToString_1(headCharCount, tailCharCount);
|
|
6478
5350
|
}
|
|
6479
|
-
/// <summary>
|
|
6480
|
-
/// Generates a string that visualizes the XML parser state (e.g. for debug watch list.)<br/>
|
|
6481
|
-
/// The method will show the XML data, trimming it to 20 characters before the
|
|
6482
|
-
/// current position (_currIndex) and up to 50 characters after the current position.
|
|
6483
|
-
/// The current position itself will be marked with a marker that looks like:
|
|
6484
|
-
/// |-{current index}-| <br/>
|
|
6485
|
-
/// The marker will be placed immediately before _xmlData[_currIndex].
|
|
6486
|
-
/// </summary>
|
|
6487
|
-
/// <returns></returns>
|
|
6488
5351
|
ToString_0() {
|
|
6489
5352
|
return this.toString(20, 50);
|
|
6490
5353
|
}
|
|
6491
|
-
/// <summary>
|
|
6492
|
-
/// Generates a string that visualizes the XML parser state (e.g. for debug watch list.)<br/>
|
|
6493
|
-
/// The method will show the XML data, trimming it to headCharCount characters before the
|
|
6494
|
-
/// current position (_currIndex) and up to tailCharCount characters after the current position.
|
|
6495
|
-
/// The current position itself will be marked with a marker that looks like:
|
|
6496
|
-
/// |-{current index}-| <br/>
|
|
6497
|
-
/// The marker will be placed immediately before _xmlData[_currIndex].
|
|
6498
|
-
/// </summary>
|
|
6499
|
-
/// <param name="headCharCount">Number of characters to show before the current position marker.</param>
|
|
6500
|
-
/// <param name="tailCharCount">Number of characters to show after the current position marker.</param>
|
|
6501
|
-
/// <returns></returns>
|
|
6502
5354
|
ToString_1(headCharCount, tailCharCount) {
|
|
6503
5355
|
let markerPosition = Math.min(this._currIndex, this._xmLdata.length);
|
|
6504
5356
|
let segmentStartIndex = Math.max(0, markerPosition - headCharCount);
|
|
@@ -6526,9 +5378,5 @@ class XmlParser {
|
|
|
6526
5378
|
}
|
|
6527
5379
|
XmlParser.endOfNameChar = [' ', '>'];
|
|
6528
5380
|
|
|
6529
|
-
/**
|
|
6530
|
-
* Generated bundle index. Do not edit.
|
|
6531
|
-
*/
|
|
6532
|
-
|
|
6533
5381
|
export { APGDisplayMode, APGFormSize, APGInvokedFrom, APGMode, APGOption, APGType, Access, AlignmentTypeHori, AlignmentTypeVert, AllowedDirectionType, Area, AutoFit, Axis, Base64, BindingLevel, BlobContent, BlockTypes, BorderType, BottomPositionInterval, BoxDir, BrkLevel, BrkScope, BrkType, CacheStrategy, CallComOption, CallOperationMode, CallOsShow, CallUDPType, CallUdpConvention, CallWsStyle, CallbackType, CharacterSet, CheckExist, CheckboxMainStyle, ChoiceControlStyle, ChoiceUtils, ColumnUpdateStyle, CompTypes, ComponentItemType, Constants, ControlStyle, CtrlButtonType, CtrlButtonTypeGui, CtrlHotspotType, CtrlImageStyle, CtrlLineDirection, CtrlLineType, CtrlOleDisplayType, CtrlOleStoreType, CtrlTextType, DBHCache, DBHRowIdentifier, DataTranslation, DataViewHeaderType, DataViewOperationType, DataViewOutputType, DatabaseDataType, DatabaseDefinitionType, DatabaseFilters, DatabaseOperations, DataviewType, DateTimeUtils, DateUtil, DbDelUpdMode, DbOpen, DbShare, DbhKeyDirection, DbhKeyIndexType, DbhKeyMode, DbhKeyRangeMode, DbhSegmentDirection, DefaultMsgDetails, DisplayTextType, DitAttribute, DitType, DriverDB, DspInterface, EndMode, EngineDirect, EnterAnimation, ErrStrategy, ErrorClassific, ExeState, ExecOn, ExitAnimation, ExportType, FieldComAlloc, FieldComType, FieldViewModelType, FldStorage, FldStyle, FlowDirection, FlwMode, ForceExit, FormDelimiter, FormExpandType, FormOperationType, FormPage, FrameLayoutTypes, GradientStyle, HTML_2_STR, HelpCommand, HelpType, HtmlAlignmentType, HttpStatusCode, ImageEffects, InitialMode, InternalInterface, ItemMasks, JSON_Utils, KeyMode, KeyboardReturnKeys, KeyboardTypes, LDir, LineDirection, LineManipulationType, ListboxSelectionMode, LnkEval_Cond, LnkMode, LoadedValues, LockingStrategy, LogType, Logger, Logger_LogLevels, Logger_MessageDirection, LogicHeaderAction, LogicHeaderType, LogicLevel, LogicOperationType, LogicUnit, MagicProperties, MediaAccess, MediaFormat, MediaOrientation, MediaType, MgControlType, MgModelType, Misc, ModelAttGuiFrame, ModelAttMerge, ModelAttRichClientFrameSet, ModelAttrBrowser, ModelAttrField, ModelAttrFramesetForm, ModelAttrGui0, ModelAttrGui1, ModelAttrHelp, ModelAttrRichClient, ModelAttrText, ModelClass, MsgInterface, NotifyCollectionChangedAction, NullArithmetic, OSEnvironment, OSType, OpenEditDialog, Opr, Order, OrientationLock, PICInterface, PaperSize, PaperSizePdfDisabled, PaperSizePdfEnabled, PositionUsage, PrgExecPlace, Priority, Queue, RaiseAt, Randomizer, RangeMode, RbAppearance, Recursion, RemarkType, RequestInfo, Resident, RowType, Rtf, Rtf_ACTN, Rtf_ErrorRtf, Rtf_IDEST, Rtf_IPFN, Rtf_IPROP, Rtf_KWD, Rtf_PROP, Rtf_PROPTYPE, Rtf_RDS, Rtf_RIS, Rtf_RtfChar, Rtf_SYMBOL, SEQ_2_HTML, SEQ_2_STR, ScrollBarThumbType, SelprgMode, SideType, SliderType, SourceContextType, SplitPrimaryDisplay, SplitWindowType, StartupMode, Storage, StorageAttribute, StorageAttributeCheck, StorageAttributeType, StrUtil, SubformType, SyncExecutionHelper, TabControlTabsWidth, TabbingCycleType, TabbingOrderType, TableBehaviour, TableType, TaskFlow, TransBegin, TransMode, TriggerType, TrueFalseValues, UndoRedoAction, UniqueTskSort, UpdateMode, UseSQLCursor, UtilDateJpn, UtilImeJpn, UtilStrByteMode, ValType, VeeDiffUpdate, VeeMode, VeePartOfDataview, VerifyButtons, VerifyDisplay, VerifyImage, VerifyMode, ViewRefreshMode, ViewSelectType, WinCptn, WinHtmlType, WinUom, WindowPosition, WindowType, XMLConstants, XmlParser, YesNoValues };
|
|
6534
5382
|
//# sourceMappingURL=magic-xpa-utils.js.map
|