@magic-xpa/mscorelib 4.1100.0-dev4110.98 → 4.1100.0
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/README.md +7 -7
- package/{esm2020 → esm2022}/index.mjs +32 -32
- package/{esm2020 → esm2022}/magic-xpa-mscorelib.mjs +1 -1
- package/esm2022/src/ApplicationException.mjs +12 -0
- package/esm2022/src/ArrayEnumerator.mjs +17 -0
- package/esm2022/src/BitArray.mjs +16 -0
- package/esm2022/src/Char.mjs +5 -0
- package/esm2022/src/CultureInfo.mjs +4 -0
- package/esm2022/src/DateTime.mjs +75 -0
- package/{esm2020 → esm2022}/src/Debug.mjs +9 -9
- package/esm2022/src/Dictionary.mjs +39 -0
- package/esm2022/src/Encoding.mjs +114 -0
- package/{esm2020 → esm2022}/src/Exception.mjs +32 -32
- package/esm2022/src/HashTable.mjs +157 -0
- package/{esm2020 → esm2022}/src/IComparable.mjs +1 -1
- package/esm2022/src/ISO_8859_1_Encoding.mjs +38 -0
- package/esm2022/src/Int32.mjs +5 -0
- package/esm2022/src/Int64.mjs +4 -0
- package/{esm2020 → esm2022}/src/List.mjs +86 -86
- package/{esm2020 → esm2022}/src/NChar.mjs +24 -24
- package/{esm2020 → esm2022}/src/NNumber.mjs +27 -27
- package/esm2022/src/NString.mjs +149 -0
- package/{esm2020 → esm2022}/src/NotImplementedException.mjs +6 -6
- package/esm2022/src/NumberFormatInfo.mjs +8 -0
- package/{esm2020 → esm2022}/src/RefParam.mjs +7 -6
- package/esm2022/src/Stack.mjs +35 -0
- package/esm2022/src/StackFrame.mjs +14 -0
- package/{esm2020 → esm2022}/src/StackTrace.mjs +6 -6
- package/{esm2020 → esm2022}/src/StringBuilder.mjs +112 -112
- package/{esm2020 → esm2022}/src/StringUtils.mjs +76 -76
- package/esm2022/src/Thread.mjs +16 -0
- package/{esm2020 → esm2022}/src/Utils.mjs +6 -6
- package/{esm2020 → esm2022}/src/WebException.mjs +9 -9
- package/{esm2020 → esm2022}/src/XmlConvert.mjs +6 -6
- package/{fesm2020 → fesm2022}/magic-xpa-mscorelib.mjs +1049 -1047
- package/{fesm2020 → fesm2022}/magic-xpa-mscorelib.mjs.map +1 -1
- package/index.d.ts +31 -31
- package/package.json +6 -12
- package/src/ApplicationException.d.ts +5 -5
- package/src/ArrayEnumerator.d.ts +11 -11
- package/src/BitArray.d.ts +7 -7
- package/src/Char.d.ts +4 -4
- package/src/CultureInfo.d.ts +3 -3
- package/src/DateTime.d.ts +26 -26
- package/src/Debug.d.ts +4 -4
- package/src/Dictionary.d.ts +11 -11
- package/src/Encoding.d.ts +16 -16
- package/src/Exception.d.ts +11 -11
- package/src/HashTable.d.ts +28 -28
- package/src/IComparable.d.ts +3 -3
- package/src/ISO_8859_1_Encoding.d.ts +7 -7
- package/src/Int32.d.ts +4 -4
- package/src/Int64.d.ts +3 -3
- package/src/List.d.ts +19 -19
- package/src/NChar.d.ts +8 -8
- package/src/NNumber.d.ts +9 -9
- package/src/NString.d.ts +23 -23
- package/src/NotImplementedException.d.ts +4 -4
- package/src/NumberFormatInfo.d.ts +5 -5
- package/src/RefParam.d.ts +4 -4
- package/src/Stack.d.ts +11 -11
- package/src/StackFrame.d.ts +5 -5
- package/src/StackTrace.d.ts +5 -5
- package/src/StringBuilder.d.ts +25 -25
- package/src/StringUtils.d.ts +64 -64
- package/src/Thread.d.ts +7 -7
- package/src/Utils.d.ts +2 -2
- package/src/WebException.d.ts +4 -4
- package/src/XmlConvert.d.ts +3 -3
- package/esm2020/src/ApplicationException.mjs +0 -12
- package/esm2020/src/ArrayEnumerator.mjs +0 -16
- package/esm2020/src/BitArray.mjs +0 -16
- package/esm2020/src/Char.mjs +0 -5
- package/esm2020/src/CultureInfo.mjs +0 -4
- package/esm2020/src/DateTime.mjs +0 -75
- package/esm2020/src/Dictionary.mjs +0 -41
- package/esm2020/src/Encoding.mjs +0 -113
- package/esm2020/src/HashTable.mjs +0 -157
- package/esm2020/src/ISO_8859_1_Encoding.mjs +0 -38
- package/esm2020/src/Int32.mjs +0 -5
- package/esm2020/src/Int64.mjs +0 -4
- package/esm2020/src/NString.mjs +0 -149
- package/esm2020/src/NumberFormatInfo.mjs +0 -8
- package/esm2020/src/Stack.mjs +0 -34
- package/esm2020/src/StackFrame.mjs +0 -14
- package/esm2020/src/Thread.mjs +0 -16
- package/fesm2015/magic-xpa-mscorelib.mjs +0 -1108
- package/fesm2015/magic-xpa-mscorelib.mjs.map +0 -1
|
@@ -3,1102 +3,1104 @@ import { TextEncoder, TextDecoder } from 'text-encoding';
|
|
|
3
3
|
import * as StackTrace$1 from 'stacktrace-js';
|
|
4
4
|
import { interval } from 'rxjs';
|
|
5
5
|
|
|
6
|
-
function isNullOrUndefined(object) {
|
|
7
|
-
return object == undefined || object == null;
|
|
8
|
-
}
|
|
9
|
-
function isUndefined(object) {
|
|
10
|
-
return object == undefined;
|
|
6
|
+
function isNullOrUndefined(object) {
|
|
7
|
+
return object == undefined || object == null;
|
|
8
|
+
}
|
|
9
|
+
function isUndefined(object) {
|
|
10
|
+
return object == undefined;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
class Exception {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (!isNullOrUndefined(messageOrError)) {
|
|
20
|
-
if (messageOrError instanceof Error) {
|
|
21
|
-
this.stack = messageOrError.stack;
|
|
22
|
-
this.message = messageOrError.message;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
this.message = messageOrError;
|
|
26
|
-
this.stack = new Error().stack;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
get Message() {
|
|
31
|
-
return this.message;
|
|
32
|
-
}
|
|
33
|
-
get StackTrace() {
|
|
34
|
-
let stackTrace = this.stack || '';
|
|
35
|
-
let stackLines = stackTrace.split("\n").map(function (line) { return line.trim(); });
|
|
36
|
-
stackTrace = stackLines.splice(stackLines[0] === 'Error' ? this.errorLevel + 1 : this.errorLevel).join("\n");
|
|
37
|
-
return "\n" + stackTrace;
|
|
38
|
-
}
|
|
39
|
-
GetType() {
|
|
40
|
-
return this.name;
|
|
41
|
-
}
|
|
13
|
+
class Exception {
|
|
14
|
+
name = "Exception";
|
|
15
|
+
message = "";
|
|
16
|
+
stack = "";
|
|
17
|
+
errorLevel = 1;
|
|
18
|
+
constructor(messageOrError) {
|
|
19
|
+
if (!isNullOrUndefined(messageOrError)) {
|
|
20
|
+
if (messageOrError instanceof Error) {
|
|
21
|
+
this.stack = messageOrError.stack;
|
|
22
|
+
this.message = messageOrError.message;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.message = messageOrError;
|
|
26
|
+
this.stack = new Error().stack;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
get Message() {
|
|
31
|
+
return this.message;
|
|
32
|
+
}
|
|
33
|
+
get StackTrace() {
|
|
34
|
+
let stackTrace = this.stack || '';
|
|
35
|
+
let stackLines = stackTrace.split("\n").map(function (line) { return line.trim(); });
|
|
36
|
+
stackTrace = stackLines.splice(stackLines[0] === 'Error' ? this.errorLevel + 1 : this.errorLevel).join("\n");
|
|
37
|
+
return "\n" + stackTrace;
|
|
38
|
+
}
|
|
39
|
+
GetType() {
|
|
40
|
+
return this.name;
|
|
41
|
+
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
class ApplicationException extends Exception {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.name = 'ApplicationException';
|
|
49
|
-
this.InnerException = (isUndefined(innerException) ? null : innerException);
|
|
50
|
-
this.errorLevel = 2;
|
|
51
|
-
}
|
|
44
|
+
class ApplicationException extends Exception {
|
|
45
|
+
InnerException = null;
|
|
46
|
+
constructor(message = "", innerException) {
|
|
47
|
+
super(message);
|
|
48
|
+
this.name = 'ApplicationException';
|
|
49
|
+
this.InnerException = (isUndefined(innerException) ? null : innerException);
|
|
50
|
+
this.errorLevel = 2;
|
|
51
|
+
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
class Array_Enumerator {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
class Array_Enumerator {
|
|
55
|
+
array;
|
|
56
|
+
index = -1;
|
|
57
|
+
constructor(array) {
|
|
58
|
+
this.array = array;
|
|
59
|
+
}
|
|
60
|
+
MoveNext() {
|
|
61
|
+
this.index++;
|
|
62
|
+
return this.index < this.array.length;
|
|
63
|
+
}
|
|
64
|
+
get Current() {
|
|
65
|
+
return this.array[this.index];
|
|
66
|
+
}
|
|
67
|
+
Dispose() {
|
|
68
|
+
}
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
class BitArray {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.array = new Array(length).fill(false);
|
|
77
|
-
}
|
|
78
|
-
Get(index) {
|
|
79
|
-
return this.array[index];
|
|
80
|
-
}
|
|
81
|
-
Set(index, value) {
|
|
82
|
-
this.array[index] = value;
|
|
83
|
-
}
|
|
71
|
+
class BitArray {
|
|
72
|
+
array = null;
|
|
73
|
+
get Length() {
|
|
74
|
+
return this.array.length;
|
|
75
|
+
}
|
|
76
|
+
constructor(length) {
|
|
77
|
+
this.array = new Array(length).fill(false);
|
|
78
|
+
}
|
|
79
|
+
Get(index) {
|
|
80
|
+
return this.array[index];
|
|
81
|
+
}
|
|
82
|
+
Set(index, value) {
|
|
83
|
+
this.array[index] = value;
|
|
84
|
+
}
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
class Char {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
class Char {
|
|
88
|
+
static MinValue = '\0';
|
|
89
|
+
static MaxValue = String.fromCharCode(0xFFFF);
|
|
90
|
+
}
|
|
90
91
|
|
|
91
|
-
class CultureInfo {
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
class CultureInfo {
|
|
93
|
+
static InvariantCulture = new CultureInfo();
|
|
94
|
+
}
|
|
94
95
|
|
|
95
|
-
var DateTimeKind;
|
|
96
|
-
(function (DateTimeKind) {
|
|
97
|
-
DateTimeKind[DateTimeKind["Local"] = 0] = "Local";
|
|
98
|
-
DateTimeKind[DateTimeKind["Utc"] = 1] = "Utc";
|
|
99
|
-
})(DateTimeKind || (DateTimeKind = {}));
|
|
100
|
-
class DateTime {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.kind
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (arguments.length === 1) {
|
|
131
|
-
this.dt = yearOrDate;
|
|
132
|
-
}
|
|
133
|
-
if (arguments.length === 3) {
|
|
134
|
-
this.dt = new Date(yearOrDate, month - 1, day);
|
|
135
|
-
}
|
|
136
|
-
if (arguments.length === 6) {
|
|
137
|
-
this.dt = new Date(yearOrDate, month - 1, day, hour, minute, second);
|
|
138
|
-
}
|
|
139
|
-
this.kind = DateTimeKind.Local;
|
|
140
|
-
}
|
|
141
|
-
Format(formatString) {
|
|
142
|
-
return moment(this.dt).format(formatString);
|
|
143
|
-
}
|
|
144
|
-
static get UtcNow() {
|
|
145
|
-
let d = new DateTime(new Date());
|
|
146
|
-
d.kind = DateTimeKind.Utc;
|
|
147
|
-
return d;
|
|
148
|
-
}
|
|
149
|
-
static get Now() {
|
|
150
|
-
let d = new DateTime(new Date());
|
|
151
|
-
d.kind = DateTimeKind.Local;
|
|
152
|
-
return d;
|
|
153
|
-
}
|
|
154
|
-
static GetTotalSecondsFromMidnight(utcTime, date) {
|
|
155
|
-
let hh = utcTime ? date.getUTCHours() : date.getHours();
|
|
156
|
-
let mm = utcTime ? date.getUTCMinutes() : date.getMinutes();
|
|
157
|
-
let ss = utcTime ? date.getUTCSeconds() : date.getSeconds();
|
|
158
|
-
return hh * 60 * 60 + mm * 60 + ss;
|
|
159
|
-
}
|
|
160
|
-
static GetTotalMilliSecondsFromMidnight(utcTime, date) {
|
|
161
|
-
let hh = utcTime ? date.getUTCHours() : date.getHours();
|
|
162
|
-
let mm = utcTime ? date.getUTCMinutes() : date.getMinutes();
|
|
163
|
-
let ss = utcTime ? date.getUTCSeconds() : date.getSeconds();
|
|
164
|
-
let ms = utcTime ? date.getUTCSeconds() : date.getMilliseconds();
|
|
165
|
-
return (hh * 60 * 60 + mm * 60 + ss) * 1000 + ms;
|
|
166
|
-
}
|
|
96
|
+
var DateTimeKind;
|
|
97
|
+
(function (DateTimeKind) {
|
|
98
|
+
DateTimeKind[DateTimeKind["Local"] = 0] = "Local";
|
|
99
|
+
DateTimeKind[DateTimeKind["Utc"] = 1] = "Utc";
|
|
100
|
+
})(DateTimeKind || (DateTimeKind = {}));
|
|
101
|
+
class DateTime {
|
|
102
|
+
dt = null;
|
|
103
|
+
kind = null;
|
|
104
|
+
epochTicks = 621355968000000000;
|
|
105
|
+
ticksPerMillisecond = 10000;
|
|
106
|
+
get Ticks() {
|
|
107
|
+
return ((this.dt.getTime() * this.ticksPerMillisecond) + this.epochTicks) - (this.dt.getTimezoneOffset() * 600000000);
|
|
108
|
+
}
|
|
109
|
+
get Year() {
|
|
110
|
+
return this.kind === DateTimeKind.Utc ? this.dt.getUTCFullYear() : this.dt.getFullYear();
|
|
111
|
+
}
|
|
112
|
+
get Month() {
|
|
113
|
+
return this.kind === DateTimeKind.Utc ? this.dt.getUTCMonth() + 1 : this.dt.getMonth() + 1;
|
|
114
|
+
}
|
|
115
|
+
get Day() {
|
|
116
|
+
return this.kind === DateTimeKind.Utc ? this.dt.getUTCDate() : this.dt.getDate();
|
|
117
|
+
}
|
|
118
|
+
get Hour() {
|
|
119
|
+
return this.kind === DateTimeKind.Utc ? this.dt.getUTCHours() : this.dt.getHours();
|
|
120
|
+
}
|
|
121
|
+
get Minute() {
|
|
122
|
+
return this.kind === DateTimeKind.Utc ? this.dt.getUTCMinutes() : this.dt.getMinutes();
|
|
123
|
+
}
|
|
124
|
+
get Second() {
|
|
125
|
+
return this.kind === DateTimeKind.Utc ? this.dt.getUTCSeconds() : this.dt.getSeconds();
|
|
126
|
+
}
|
|
127
|
+
get Millisecond() {
|
|
128
|
+
return this.kind === DateTimeKind.Utc ? this.dt.getUTCMilliseconds() : this.dt.getMilliseconds();
|
|
129
|
+
}
|
|
130
|
+
constructor(yearOrDate, month, day, hour, minute, second) {
|
|
131
|
+
if (arguments.length === 1) {
|
|
132
|
+
this.dt = yearOrDate;
|
|
133
|
+
}
|
|
134
|
+
if (arguments.length === 3) {
|
|
135
|
+
this.dt = new Date(yearOrDate, month - 1, day);
|
|
136
|
+
}
|
|
137
|
+
if (arguments.length === 6) {
|
|
138
|
+
this.dt = new Date(yearOrDate, month - 1, day, hour, minute, second);
|
|
139
|
+
}
|
|
140
|
+
this.kind = DateTimeKind.Local;
|
|
141
|
+
}
|
|
142
|
+
Format(formatString) {
|
|
143
|
+
return moment(this.dt).format(formatString);
|
|
144
|
+
}
|
|
145
|
+
static get UtcNow() {
|
|
146
|
+
let d = new DateTime(new Date());
|
|
147
|
+
d.kind = DateTimeKind.Utc;
|
|
148
|
+
return d;
|
|
149
|
+
}
|
|
150
|
+
static get Now() {
|
|
151
|
+
let d = new DateTime(new Date());
|
|
152
|
+
d.kind = DateTimeKind.Local;
|
|
153
|
+
return d;
|
|
154
|
+
}
|
|
155
|
+
static GetTotalSecondsFromMidnight(utcTime, date) {
|
|
156
|
+
let hh = utcTime ? date.getUTCHours() : date.getHours();
|
|
157
|
+
let mm = utcTime ? date.getUTCMinutes() : date.getMinutes();
|
|
158
|
+
let ss = utcTime ? date.getUTCSeconds() : date.getSeconds();
|
|
159
|
+
return hh * 60 * 60 + mm * 60 + ss;
|
|
160
|
+
}
|
|
161
|
+
static GetTotalMilliSecondsFromMidnight(utcTime, date) {
|
|
162
|
+
let hh = utcTime ? date.getUTCHours() : date.getHours();
|
|
163
|
+
let mm = utcTime ? date.getUTCMinutes() : date.getMinutes();
|
|
164
|
+
let ss = utcTime ? date.getUTCSeconds() : date.getSeconds();
|
|
165
|
+
let ms = utcTime ? date.getUTCSeconds() : date.getMilliseconds();
|
|
166
|
+
return (hh * 60 * 60 + mm * 60 + ss) * 1000 + ms;
|
|
167
|
+
}
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
class Debug {
|
|
170
|
-
static WriteLine(text) {
|
|
171
|
-
console.log(text);
|
|
172
|
-
}
|
|
173
|
-
static Assert(assertCondtion, message) {
|
|
174
|
-
if (!assertCondtion)
|
|
175
|
-
alert(message);
|
|
176
|
-
}
|
|
170
|
+
class Debug {
|
|
171
|
+
static WriteLine(text) {
|
|
172
|
+
console.log(text);
|
|
173
|
+
}
|
|
174
|
+
static Assert(assertCondtion, message) {
|
|
175
|
+
if (!assertCondtion)
|
|
176
|
+
alert(message);
|
|
177
|
+
}
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
class Dictionary {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return Object.keys(this.values);
|
|
216
|
-
}
|
|
180
|
+
class Dictionary {
|
|
181
|
+
values = new Array();
|
|
182
|
+
get_Item(key) {
|
|
183
|
+
if (this.values.hasOwnProperty(key))
|
|
184
|
+
return this.values[key];
|
|
185
|
+
else
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
set_Item(key, value) {
|
|
189
|
+
this.values[key] = value;
|
|
190
|
+
}
|
|
191
|
+
Add(key, value) {
|
|
192
|
+
if (this.values.hasOwnProperty(key))
|
|
193
|
+
throw new Exception("An item with the same key has already been added");
|
|
194
|
+
else
|
|
195
|
+
this.values[key] = value;
|
|
196
|
+
}
|
|
197
|
+
ContainsKey(key) {
|
|
198
|
+
return this.values.hasOwnProperty(key);
|
|
199
|
+
}
|
|
200
|
+
TryGetValue(key, pvalue) {
|
|
201
|
+
if (this.values.hasOwnProperty(key)) {
|
|
202
|
+
pvalue.value = this.values[key];
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
pvalue.value = null;
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
Remove(key) {
|
|
211
|
+
delete this.values[key];
|
|
212
|
+
}
|
|
213
|
+
get Keys() {
|
|
214
|
+
return Object.keys(this.values);
|
|
215
|
+
}
|
|
217
216
|
}
|
|
218
217
|
|
|
219
|
-
class Encoding {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
hashTable
|
|
282
|
-
hashTable[
|
|
283
|
-
hashTable[
|
|
284
|
-
hashTable[
|
|
285
|
-
hashTable[
|
|
286
|
-
hashTable[
|
|
287
|
-
hashTable[
|
|
288
|
-
hashTable[
|
|
289
|
-
hashTable[
|
|
290
|
-
hashTable[
|
|
291
|
-
hashTable[
|
|
292
|
-
hashTable[
|
|
293
|
-
hashTable[
|
|
294
|
-
hashTable[
|
|
295
|
-
hashTable[
|
|
296
|
-
hashTable[
|
|
297
|
-
hashTable[
|
|
298
|
-
hashTable[
|
|
299
|
-
hashTable[
|
|
300
|
-
hashTable[
|
|
301
|
-
hashTable[
|
|
302
|
-
hashTable[
|
|
303
|
-
hashTable[
|
|
304
|
-
hashTable[
|
|
305
|
-
hashTable[
|
|
306
|
-
hashTable[
|
|
307
|
-
hashTable[
|
|
308
|
-
hashTable[
|
|
309
|
-
hashTable[
|
|
310
|
-
hashTable[
|
|
311
|
-
hashTable[
|
|
312
|
-
hashTable[
|
|
313
|
-
hashTable[
|
|
314
|
-
hashTable[
|
|
315
|
-
hashTable[
|
|
316
|
-
hashTable[
|
|
317
|
-
hashTable[
|
|
318
|
-
hashTable[
|
|
319
|
-
hashTable[
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
218
|
+
class Encoding {
|
|
219
|
+
label;
|
|
220
|
+
static ASCII = new Encoding("ascii");
|
|
221
|
+
static UTF8 = new Encoding("utf-8");
|
|
222
|
+
static Unicode = new Encoding("utf-16le");
|
|
223
|
+
static CodePageToEncodingMap = Encoding.PopulateCodePageToEncodingMap();
|
|
224
|
+
textEncoder = null;
|
|
225
|
+
textDecoder = null;
|
|
226
|
+
constructor(label) {
|
|
227
|
+
this.label = label;
|
|
228
|
+
this.textEncoder = new TextEncoder(label, { NONSTANDARD_allowLegacyEncoding: true });
|
|
229
|
+
this.textDecoder = new TextDecoder(label, { NONSTANDARD_allowLegacyEncoding: true });
|
|
230
|
+
}
|
|
231
|
+
GetBytes(str) {
|
|
232
|
+
if (str === null)
|
|
233
|
+
throw new Error("Argument is null");
|
|
234
|
+
let bytes = null;
|
|
235
|
+
try {
|
|
236
|
+
bytes = this.textEncoder.encode(str);
|
|
237
|
+
}
|
|
238
|
+
catch (ex) {
|
|
239
|
+
bytes = new Uint8Array(str.length * 3);
|
|
240
|
+
let bytesCount = 0;
|
|
241
|
+
let tmpBytes;
|
|
242
|
+
for (let i = 0; i < str.length; i++) {
|
|
243
|
+
try {
|
|
244
|
+
tmpBytes = this.textEncoder.encode(str[i]);
|
|
245
|
+
bytes.set(tmpBytes, bytesCount);
|
|
246
|
+
bytesCount += tmpBytes.length;
|
|
247
|
+
}
|
|
248
|
+
catch (ex) {
|
|
249
|
+
bytes[bytesCount++] = "?".charCodeAt(0);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
bytes = bytes.subarray(0, 0 + bytesCount);
|
|
253
|
+
}
|
|
254
|
+
return bytes;
|
|
255
|
+
}
|
|
256
|
+
GetByteCount(str) {
|
|
257
|
+
return this.GetBytes(str).length;
|
|
258
|
+
}
|
|
259
|
+
GetString(bytes, index, count) {
|
|
260
|
+
let str = null;
|
|
261
|
+
if (bytes === null)
|
|
262
|
+
throw new Error("Argument is null");
|
|
263
|
+
if (index < 0 || count < 0 || (index + count) > bytes.length)
|
|
264
|
+
throw new Error("Argument out of range");
|
|
265
|
+
bytes = bytes.subarray(index, index + count);
|
|
266
|
+
try {
|
|
267
|
+
str = this.textDecoder.decode(bytes);
|
|
268
|
+
}
|
|
269
|
+
catch (ex) {
|
|
270
|
+
}
|
|
271
|
+
return str;
|
|
272
|
+
}
|
|
273
|
+
static GetEncoding(codepage) {
|
|
274
|
+
let label = Encoding.CodePageToEncodingMap[codepage];
|
|
275
|
+
if (label == null)
|
|
276
|
+
throw new Error("Invalid codepage.");
|
|
277
|
+
return new Encoding(label);
|
|
278
|
+
}
|
|
279
|
+
static PopulateCodePageToEncodingMap() {
|
|
280
|
+
let hashTable = new Object;
|
|
281
|
+
hashTable[20106] = "DIN_66003";
|
|
282
|
+
hashTable[20107] = "SEN_850200_B";
|
|
283
|
+
hashTable[50932] = "_autodetect";
|
|
284
|
+
hashTable[20108] = "NS_4551-1";
|
|
285
|
+
hashTable[50949] = "_autodetect_kr";
|
|
286
|
+
hashTable[950] = "big5";
|
|
287
|
+
hashTable[50221] = "csISO2022JP";
|
|
288
|
+
hashTable[51949] = "euc-kr";
|
|
289
|
+
hashTable[936] = "gb2312";
|
|
290
|
+
hashTable[52936] = "hz-gb-2312";
|
|
291
|
+
hashTable[852] = "ibm852";
|
|
292
|
+
hashTable[866] = "ibm866";
|
|
293
|
+
hashTable[20105] = "irv";
|
|
294
|
+
hashTable[50220] = "iso-2022-jp";
|
|
295
|
+
hashTable[50222] = "iso-2022-jp";
|
|
296
|
+
hashTable[50225] = "iso-2022-kr";
|
|
297
|
+
hashTable[28591] = "iso-8859-1";
|
|
298
|
+
hashTable[28592] = "iso-8859-2";
|
|
299
|
+
hashTable[28593] = "iso-8859-3";
|
|
300
|
+
hashTable[28594] = "iso-8859-4";
|
|
301
|
+
hashTable[28595] = "iso-8859-5";
|
|
302
|
+
hashTable[28596] = "iso-8859-6";
|
|
303
|
+
hashTable[28597] = "iso-8859-7";
|
|
304
|
+
hashTable[28598] = "iso-8859-8";
|
|
305
|
+
hashTable[20866] = "koi8-r";
|
|
306
|
+
hashTable[949] = "ks_c_5601";
|
|
307
|
+
hashTable[932] = "shift-jis";
|
|
308
|
+
hashTable[1200] = "unicode";
|
|
309
|
+
hashTable[1201] = "unicodeFEFF";
|
|
310
|
+
hashTable[65000] = "utf-7";
|
|
311
|
+
hashTable[65001] = "utf-8";
|
|
312
|
+
hashTable[1250] = "windows-1250";
|
|
313
|
+
hashTable[1251] = "windows-1251";
|
|
314
|
+
hashTable[1252] = "windows-1252";
|
|
315
|
+
hashTable[1253] = "windows-1253";
|
|
316
|
+
hashTable[1254] = "windows-1254";
|
|
317
|
+
hashTable[1255] = "windows-1255";
|
|
318
|
+
hashTable[1256] = "windows-1256";
|
|
319
|
+
hashTable[1257] = "windows-1257";
|
|
320
|
+
hashTable[1258] = "windows-1258";
|
|
321
|
+
hashTable[874] = "windows-874";
|
|
322
|
+
hashTable[20127] = "US-ASCII";
|
|
323
|
+
hashTable[51932] = "x-euc";
|
|
324
|
+
return hashTable;
|
|
325
|
+
}
|
|
326
|
+
toString() {
|
|
327
|
+
return this.label;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
330
|
|
|
331
|
-
class HashUtils {
|
|
332
|
-
static GetHashCode(str) {
|
|
333
|
-
let bytes = null;
|
|
334
|
-
bytes = Encoding.UTF8.GetBytes(str);
|
|
335
|
-
return HashUtils.getHashCode(bytes);
|
|
336
|
-
}
|
|
337
|
-
static getHashCode(byteArray) {
|
|
338
|
-
let hashval;
|
|
339
|
-
let hash1 = 5381;
|
|
340
|
-
let hash2 = hash1;
|
|
341
|
-
let c;
|
|
342
|
-
for (let i = 0; i < byteArray.length; i += 2) {
|
|
343
|
-
c = byteArray[i];
|
|
344
|
-
hash1 = ((hash1 << 5) + hash1) ^ c;
|
|
345
|
-
if ((i + 1) === byteArray.length)
|
|
346
|
-
break;
|
|
347
|
-
c = byteArray[i + 1];
|
|
348
|
-
hash2 = ((hash2 << 5) + hash2) ^ c;
|
|
349
|
-
hash1 = hash1 & 0xffff;
|
|
350
|
-
hash2 = hash2 & 0xffff;
|
|
351
|
-
}
|
|
352
|
-
let hash3 = (hash2 * 13577);
|
|
353
|
-
hashval = (hash1 + hash3);
|
|
354
|
-
return (hashval);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
const HashTableLoadFactor = 0.75;
|
|
358
|
-
class Hashtable {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
this._bucketCount = bucketCount;
|
|
365
|
-
this._loadFactor = loadFactor;
|
|
366
|
-
if (this._bucketCount % 2 !== 0) {
|
|
367
|
-
throw new Exception('Bucket count must be a positive number and be multiple of 2.');
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
HashFunction(key) {
|
|
371
|
-
if (typeof key.GetHashCode === 'function') {
|
|
372
|
-
return key.GetHashCode();
|
|
373
|
-
}
|
|
374
|
-
else if (key.constructor === String) {
|
|
375
|
-
return HashUtils.GetHashCode(key.toString());
|
|
376
|
-
}
|
|
377
|
-
else if (key.constructor === Number) {
|
|
378
|
-
return +key;
|
|
379
|
-
}
|
|
380
|
-
return 0;
|
|
381
|
-
}
|
|
382
|
-
get Count() {
|
|
383
|
-
return this._elementsCount;
|
|
384
|
-
}
|
|
385
|
-
get Values() {
|
|
386
|
-
let array = [];
|
|
387
|
-
this._buckets.forEach(b => b.forEach(item => {
|
|
388
|
-
array.push(item.value);
|
|
389
|
-
}));
|
|
390
|
-
return new Array_Enumerator(array);
|
|
391
|
-
}
|
|
392
|
-
get Keys() {
|
|
393
|
-
let array = [];
|
|
394
|
-
this._buckets.forEach(b => b.forEach(item => {
|
|
395
|
-
array.push(item.key);
|
|
396
|
-
}));
|
|
397
|
-
return new Array_Enumerator(array);
|
|
398
|
-
}
|
|
399
|
-
Add(key, value) {
|
|
400
|
-
this.Insert(key, value, true);
|
|
401
|
-
}
|
|
402
|
-
set_Item(key, value) {
|
|
403
|
-
this.Insert(key, value, false);
|
|
404
|
-
}
|
|
405
|
-
Insert(key, value, add) {
|
|
406
|
-
let bucketIndex = this.GetBucketIndex(key);
|
|
407
|
-
if (typeof this._buckets[bucketIndex] === "undefined") {
|
|
408
|
-
this._buckets[bucketIndex] = [];
|
|
409
|
-
}
|
|
410
|
-
if (this._buckets[bucketIndex].find(x => x.key === key)) {
|
|
411
|
-
if (add) {
|
|
412
|
-
throw new Exception('Item with provided key already exists!');
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
this.Remove(key);
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
this._buckets[bucketIndex].push({ key: key, value: value });
|
|
420
|
-
this._elementsCount++;
|
|
421
|
-
if (this._elementsCount > this._bucketCount * this._loadFactor) {
|
|
422
|
-
this.Resize(this._bucketCount * 2);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
get_Item(key) {
|
|
426
|
-
let bucketIndex = this.GetBucketIndex(key);
|
|
427
|
-
let bucket = this._buckets[bucketIndex];
|
|
428
|
-
if (!bucket) {
|
|
429
|
-
return null;
|
|
430
|
-
}
|
|
431
|
-
let item = bucket.find(x => x.key === key);
|
|
432
|
-
if (item) {
|
|
433
|
-
return item.value;
|
|
434
|
-
}
|
|
435
|
-
return null;
|
|
436
|
-
}
|
|
437
|
-
ContainsKey(key) {
|
|
438
|
-
let bucketIndex = this.GetBucketIndex(key);
|
|
439
|
-
let bucket = this._buckets[bucketIndex];
|
|
440
|
-
if (!bucket) {
|
|
441
|
-
return false;
|
|
442
|
-
}
|
|
443
|
-
let itemIndex = bucket.findIndex(x => x.key === key);
|
|
444
|
-
return (itemIndex > -1);
|
|
445
|
-
}
|
|
446
|
-
Remove(key) {
|
|
447
|
-
let bucketIndex = this.GetBucketIndex(key);
|
|
448
|
-
let bucket = this._buckets[bucketIndex];
|
|
449
|
-
if (!bucket) {
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
let itemIndex = bucket.findIndex(x => x.key === key);
|
|
453
|
-
if (itemIndex > -1) {
|
|
454
|
-
bucket.splice(itemIndex, 1);
|
|
455
|
-
this._elementsCount--;
|
|
456
|
-
if (this._elementsCount <= this._bucketCount * (1 - this._loadFactor)) {
|
|
457
|
-
this.Resize(this._bucketCount / 2);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
Resize(newBucketCount) {
|
|
462
|
-
let _oldBuckets = this._buckets;
|
|
463
|
-
this._elementsCount = 0;
|
|
464
|
-
this._buckets = [];
|
|
465
|
-
this._bucketCount = newBucketCount;
|
|
466
|
-
_oldBuckets.forEach(b => b.forEach(item => this.Add(item.key, item.value)));
|
|
467
|
-
}
|
|
468
|
-
GetBucketIndex(key) {
|
|
469
|
-
let hash = this.HashFunction(key);
|
|
470
|
-
if (hash % 1 !== 0) {
|
|
471
|
-
throw new Exception('Key\'s hash must be an integer!');
|
|
472
|
-
}
|
|
473
|
-
let index = Math.abs(hash) % this._bucketCount;
|
|
474
|
-
if (index < 0 || index >= this._bucketCount) {
|
|
475
|
-
throw new Exception('Index exceeds bucket boundaries');
|
|
476
|
-
}
|
|
477
|
-
return index;
|
|
478
|
-
}
|
|
479
|
-
Clear() {
|
|
480
|
-
this._elementsCount = 0;
|
|
481
|
-
this._buckets = [];
|
|
482
|
-
}
|
|
331
|
+
class HashUtils {
|
|
332
|
+
static GetHashCode(str) {
|
|
333
|
+
let bytes = null;
|
|
334
|
+
bytes = Encoding.UTF8.GetBytes(str);
|
|
335
|
+
return HashUtils.getHashCode(bytes);
|
|
336
|
+
}
|
|
337
|
+
static getHashCode(byteArray) {
|
|
338
|
+
let hashval;
|
|
339
|
+
let hash1 = 5381;
|
|
340
|
+
let hash2 = hash1;
|
|
341
|
+
let c;
|
|
342
|
+
for (let i = 0; i < byteArray.length; i += 2) {
|
|
343
|
+
c = byteArray[i];
|
|
344
|
+
hash1 = ((hash1 << 5) + hash1) ^ c;
|
|
345
|
+
if ((i + 1) === byteArray.length)
|
|
346
|
+
break;
|
|
347
|
+
c = byteArray[i + 1];
|
|
348
|
+
hash2 = ((hash2 << 5) + hash2) ^ c;
|
|
349
|
+
hash1 = hash1 & 0xffff;
|
|
350
|
+
hash2 = hash2 & 0xffff;
|
|
351
|
+
}
|
|
352
|
+
let hash3 = (hash2 * 13577);
|
|
353
|
+
hashval = (hash1 + hash3);
|
|
354
|
+
return (hashval);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const HashTableLoadFactor = 0.75;
|
|
358
|
+
class Hashtable {
|
|
359
|
+
_buckets = [];
|
|
360
|
+
_elementsCount = 0;
|
|
361
|
+
_bucketCount = 0;
|
|
362
|
+
_loadFactor = 0;
|
|
363
|
+
constructor(bucketCount = 8, loadFactor = HashTableLoadFactor) {
|
|
364
|
+
this._bucketCount = bucketCount;
|
|
365
|
+
this._loadFactor = loadFactor;
|
|
366
|
+
if (this._bucketCount % 2 !== 0) {
|
|
367
|
+
throw new Exception('Bucket count must be a positive number and be multiple of 2.');
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
HashFunction(key) {
|
|
371
|
+
if (typeof key.GetHashCode === 'function') {
|
|
372
|
+
return key.GetHashCode();
|
|
373
|
+
}
|
|
374
|
+
else if (key.constructor === String) {
|
|
375
|
+
return HashUtils.GetHashCode(key.toString());
|
|
376
|
+
}
|
|
377
|
+
else if (key.constructor === Number) {
|
|
378
|
+
return +key;
|
|
379
|
+
}
|
|
380
|
+
return 0;
|
|
381
|
+
}
|
|
382
|
+
get Count() {
|
|
383
|
+
return this._elementsCount;
|
|
384
|
+
}
|
|
385
|
+
get Values() {
|
|
386
|
+
let array = [];
|
|
387
|
+
this._buckets.forEach(b => b.forEach(item => {
|
|
388
|
+
array.push(item.value);
|
|
389
|
+
}));
|
|
390
|
+
return new Array_Enumerator(array);
|
|
391
|
+
}
|
|
392
|
+
get Keys() {
|
|
393
|
+
let array = [];
|
|
394
|
+
this._buckets.forEach(b => b.forEach(item => {
|
|
395
|
+
array.push(item.key);
|
|
396
|
+
}));
|
|
397
|
+
return new Array_Enumerator(array);
|
|
398
|
+
}
|
|
399
|
+
Add(key, value) {
|
|
400
|
+
this.Insert(key, value, true);
|
|
401
|
+
}
|
|
402
|
+
set_Item(key, value) {
|
|
403
|
+
this.Insert(key, value, false);
|
|
404
|
+
}
|
|
405
|
+
Insert(key, value, add) {
|
|
406
|
+
let bucketIndex = this.GetBucketIndex(key);
|
|
407
|
+
if (typeof this._buckets[bucketIndex] === "undefined") {
|
|
408
|
+
this._buckets[bucketIndex] = [];
|
|
409
|
+
}
|
|
410
|
+
if (this._buckets[bucketIndex].find(x => x.key === key)) {
|
|
411
|
+
if (add) {
|
|
412
|
+
throw new Exception('Item with provided key already exists!');
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
this.Remove(key);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
this._buckets[bucketIndex].push({ key: key, value: value });
|
|
420
|
+
this._elementsCount++;
|
|
421
|
+
if (this._elementsCount > this._bucketCount * this._loadFactor) {
|
|
422
|
+
this.Resize(this._bucketCount * 2);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
get_Item(key) {
|
|
426
|
+
let bucketIndex = this.GetBucketIndex(key);
|
|
427
|
+
let bucket = this._buckets[bucketIndex];
|
|
428
|
+
if (!bucket) {
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
let item = bucket.find(x => x.key === key);
|
|
432
|
+
if (item) {
|
|
433
|
+
return item.value;
|
|
434
|
+
}
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
ContainsKey(key) {
|
|
438
|
+
let bucketIndex = this.GetBucketIndex(key);
|
|
439
|
+
let bucket = this._buckets[bucketIndex];
|
|
440
|
+
if (!bucket) {
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
let itemIndex = bucket.findIndex(x => x.key === key);
|
|
444
|
+
return (itemIndex > -1);
|
|
445
|
+
}
|
|
446
|
+
Remove(key) {
|
|
447
|
+
let bucketIndex = this.GetBucketIndex(key);
|
|
448
|
+
let bucket = this._buckets[bucketIndex];
|
|
449
|
+
if (!bucket) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
let itemIndex = bucket.findIndex(x => x.key === key);
|
|
453
|
+
if (itemIndex > -1) {
|
|
454
|
+
bucket.splice(itemIndex, 1);
|
|
455
|
+
this._elementsCount--;
|
|
456
|
+
if (this._elementsCount <= this._bucketCount * (1 - this._loadFactor)) {
|
|
457
|
+
this.Resize(this._bucketCount / 2);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
Resize(newBucketCount) {
|
|
462
|
+
let _oldBuckets = this._buckets;
|
|
463
|
+
this._elementsCount = 0;
|
|
464
|
+
this._buckets = [];
|
|
465
|
+
this._bucketCount = newBucketCount;
|
|
466
|
+
_oldBuckets.forEach(b => b.forEach(item => this.Add(item.key, item.value)));
|
|
467
|
+
}
|
|
468
|
+
GetBucketIndex(key) {
|
|
469
|
+
let hash = this.HashFunction(key);
|
|
470
|
+
if (hash % 1 !== 0) {
|
|
471
|
+
throw new Exception('Key\'s hash must be an integer!');
|
|
472
|
+
}
|
|
473
|
+
let index = Math.abs(hash) % this._bucketCount;
|
|
474
|
+
if (index < 0 || index >= this._bucketCount) {
|
|
475
|
+
throw new Exception('Index exceeds bucket boundaries');
|
|
476
|
+
}
|
|
477
|
+
return index;
|
|
478
|
+
}
|
|
479
|
+
Clear() {
|
|
480
|
+
this._elementsCount = 0;
|
|
481
|
+
this._buckets = [];
|
|
482
|
+
}
|
|
483
483
|
}
|
|
484
484
|
|
|
485
|
-
class Int32 {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
485
|
+
class Int32 {
|
|
486
|
+
static MinValue = -2147483648;
|
|
487
|
+
static MaxValue = 2147483647;
|
|
488
|
+
}
|
|
489
489
|
|
|
490
|
-
class Int64 {
|
|
491
|
-
|
|
492
|
-
|
|
490
|
+
class Int64 {
|
|
491
|
+
static MinValue = -9223372036854775808;
|
|
492
|
+
}
|
|
493
493
|
|
|
494
|
-
class ISO_8859_1_Encoding extends Encoding {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
bytes =
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
|
|
494
|
+
class ISO_8859_1_Encoding extends Encoding {
|
|
495
|
+
static ISO_8859_1 = new ISO_8859_1_Encoding("iso_8859-1");
|
|
496
|
+
constructor(label) {
|
|
497
|
+
super(label);
|
|
498
|
+
}
|
|
499
|
+
GetBytes(str) {
|
|
500
|
+
if (str === null)
|
|
501
|
+
throw new Error("Argument is null");
|
|
502
|
+
let bytes = null;
|
|
503
|
+
bytes = new Uint8Array(str.length * 3);
|
|
504
|
+
let bytesCount = 0;
|
|
505
|
+
for (let i = 0; i < str.length; i++) {
|
|
506
|
+
bytes[bytesCount++] = str[i].charCodeAt(0);
|
|
507
|
+
}
|
|
508
|
+
bytes = bytes.subarray(0, 0 + bytesCount);
|
|
509
|
+
return bytes;
|
|
510
|
+
}
|
|
511
|
+
GetString(bytes, index, count) {
|
|
512
|
+
let str = null;
|
|
513
|
+
if (bytes === null)
|
|
514
|
+
throw new Error("Argument is null");
|
|
515
|
+
if (index < 0 || count < 0 || (index + count) > bytes.length)
|
|
516
|
+
throw new Error("Argument out of range");
|
|
517
|
+
bytes = bytes.subarray(index, index + count);
|
|
518
|
+
try {
|
|
519
|
+
str = '';
|
|
520
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
521
|
+
str += String.fromCharCode(bytes[i]);
|
|
522
|
+
}
|
|
523
|
+
;
|
|
524
|
+
}
|
|
525
|
+
catch (ex) {
|
|
526
|
+
}
|
|
527
|
+
return str;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
530
|
|
|
531
|
-
class List extends Array {
|
|
532
|
-
constructor(arrayEnumerator) {
|
|
533
|
-
super();
|
|
534
|
-
Object.setPrototypeOf(this, List.prototype);
|
|
535
|
-
if (arguments.length === 1 && arrayEnumerator.constructor === Array_Enumerator) {
|
|
536
|
-
this.AddRange(arrayEnumerator);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
AddRange(arrayEnumeratorOrArray) {
|
|
540
|
-
if (arrayEnumeratorOrArray.constructor === Array) {
|
|
541
|
-
arrayEnumeratorOrArray.forEach((item) => {
|
|
542
|
-
this.push(item);
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
let e = arrayEnumeratorOrArray;
|
|
547
|
-
while (e.MoveNext()) {
|
|
548
|
-
this.push(e.Current);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
get_Item(index) {
|
|
553
|
-
if (isUndefined(this[index]))
|
|
554
|
-
this[index] = null;
|
|
555
|
-
return this[index];
|
|
556
|
-
}
|
|
557
|
-
set_Item(index, value) {
|
|
558
|
-
if (index >= 0 && index < this.length)
|
|
559
|
-
this[index] = value;
|
|
560
|
-
else
|
|
561
|
-
throw new Error("index out of bounds");
|
|
562
|
-
}
|
|
563
|
-
GetEnumerator() {
|
|
564
|
-
return new Array_Enumerator(this);
|
|
565
|
-
}
|
|
566
|
-
Remove(object) {
|
|
567
|
-
let index = this.indexOf(object);
|
|
568
|
-
if (index > -1)
|
|
569
|
-
this.RemoveAt(index);
|
|
570
|
-
}
|
|
571
|
-
RemoveAt(index) {
|
|
572
|
-
this.RemoveRange(index, 1);
|
|
573
|
-
}
|
|
574
|
-
RemoveRange(index, count) {
|
|
575
|
-
this.splice(index, count);
|
|
576
|
-
}
|
|
577
|
-
Insert(index, item) {
|
|
578
|
-
if (index >= 0 && index < this.length)
|
|
579
|
-
this.splice(index, 0, item);
|
|
580
|
-
else if (index === this.length)
|
|
581
|
-
this.push(item);
|
|
582
|
-
else
|
|
583
|
-
throw new Error("index out of bounds");
|
|
584
|
-
}
|
|
585
|
-
InsertRange(items) {
|
|
586
|
-
let idx = 0;
|
|
587
|
-
while (idx < items.length) {
|
|
588
|
-
this.Insert(idx, items[idx]);
|
|
589
|
-
idx++;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
Clear() {
|
|
593
|
-
this.splice(0, this.length);
|
|
594
|
-
}
|
|
595
|
-
ToArray() {
|
|
596
|
-
return this.slice(0);
|
|
597
|
-
}
|
|
598
|
-
Contains(object) {
|
|
599
|
-
return this.indexOf(object) > -1;
|
|
600
|
-
}
|
|
601
|
-
find(predicate) {
|
|
602
|
-
let foundItem = super.find(predicate);
|
|
603
|
-
if (isUndefined(foundItem))
|
|
604
|
-
foundItem = null;
|
|
605
|
-
return foundItem;
|
|
606
|
-
}
|
|
607
|
-
SetSize(size) {
|
|
608
|
-
if (this.length > size) {
|
|
609
|
-
this.RemoveRange(size, this.length - size);
|
|
610
|
-
}
|
|
611
|
-
else
|
|
612
|
-
this.length = size;
|
|
613
|
-
}
|
|
531
|
+
class List extends Array {
|
|
532
|
+
constructor(arrayEnumerator) {
|
|
533
|
+
super();
|
|
534
|
+
Object.setPrototypeOf(this, List.prototype);
|
|
535
|
+
if (arguments.length === 1 && arrayEnumerator.constructor === Array_Enumerator) {
|
|
536
|
+
this.AddRange(arrayEnumerator);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
AddRange(arrayEnumeratorOrArray) {
|
|
540
|
+
if (arrayEnumeratorOrArray.constructor === Array) {
|
|
541
|
+
arrayEnumeratorOrArray.forEach((item) => {
|
|
542
|
+
this.push(item);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
let e = arrayEnumeratorOrArray;
|
|
547
|
+
while (e.MoveNext()) {
|
|
548
|
+
this.push(e.Current);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
get_Item(index) {
|
|
553
|
+
if (isUndefined(this[index]))
|
|
554
|
+
this[index] = null;
|
|
555
|
+
return this[index];
|
|
556
|
+
}
|
|
557
|
+
set_Item(index, value) {
|
|
558
|
+
if (index >= 0 && index < this.length)
|
|
559
|
+
this[index] = value;
|
|
560
|
+
else
|
|
561
|
+
throw new Error("index out of bounds");
|
|
562
|
+
}
|
|
563
|
+
GetEnumerator() {
|
|
564
|
+
return new Array_Enumerator(this);
|
|
565
|
+
}
|
|
566
|
+
Remove(object) {
|
|
567
|
+
let index = this.indexOf(object);
|
|
568
|
+
if (index > -1)
|
|
569
|
+
this.RemoveAt(index);
|
|
570
|
+
}
|
|
571
|
+
RemoveAt(index) {
|
|
572
|
+
this.RemoveRange(index, 1);
|
|
573
|
+
}
|
|
574
|
+
RemoveRange(index, count) {
|
|
575
|
+
this.splice(index, count);
|
|
576
|
+
}
|
|
577
|
+
Insert(index, item) {
|
|
578
|
+
if (index >= 0 && index < this.length)
|
|
579
|
+
this.splice(index, 0, item);
|
|
580
|
+
else if (index === this.length)
|
|
581
|
+
this.push(item);
|
|
582
|
+
else
|
|
583
|
+
throw new Error("index out of bounds");
|
|
584
|
+
}
|
|
585
|
+
InsertRange(items) {
|
|
586
|
+
let idx = 0;
|
|
587
|
+
while (idx < items.length) {
|
|
588
|
+
this.Insert(idx, items[idx]);
|
|
589
|
+
idx++;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
Clear() {
|
|
593
|
+
this.splice(0, this.length);
|
|
594
|
+
}
|
|
595
|
+
ToArray() {
|
|
596
|
+
return this.slice(0);
|
|
597
|
+
}
|
|
598
|
+
Contains(object) {
|
|
599
|
+
return this.indexOf(object) > -1;
|
|
600
|
+
}
|
|
601
|
+
find(predicate) {
|
|
602
|
+
let foundItem = super.find(predicate);
|
|
603
|
+
if (isUndefined(foundItem))
|
|
604
|
+
foundItem = null;
|
|
605
|
+
return foundItem;
|
|
606
|
+
}
|
|
607
|
+
SetSize(size) {
|
|
608
|
+
if (this.length > size) {
|
|
609
|
+
this.RemoveRange(size, this.length - size);
|
|
610
|
+
}
|
|
611
|
+
else
|
|
612
|
+
this.length = size;
|
|
613
|
+
}
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
-
const $EOF = 0;
|
|
617
|
-
const $TAB = 9;
|
|
618
|
-
const $LF = 10;
|
|
619
|
-
const $VTAB = 11;
|
|
620
|
-
const $FF = 12;
|
|
621
|
-
const $CR = 13;
|
|
622
|
-
const $SPACE = 32;
|
|
623
|
-
const $BANG = 33;
|
|
624
|
-
const $DQ = 34;
|
|
625
|
-
const $HASH = 35;
|
|
626
|
-
const $$ = 36;
|
|
627
|
-
const $PERCENT = 37;
|
|
628
|
-
const $AMPERSAND = 38;
|
|
629
|
-
const $SQ = 39;
|
|
630
|
-
const $LPAREN = 40;
|
|
631
|
-
const $RPAREN = 41;
|
|
632
|
-
const $STAR = 42;
|
|
633
|
-
const $PLUS = 43;
|
|
634
|
-
const $COMMA = 44;
|
|
635
|
-
const $MINUS = 45;
|
|
636
|
-
const $PERIOD = 46;
|
|
637
|
-
const $SLASH = 47;
|
|
638
|
-
const $COLON = 58;
|
|
639
|
-
const $SEMICOLON = 59;
|
|
640
|
-
const $LT = 60;
|
|
641
|
-
const $EQ = 61;
|
|
642
|
-
const $GT = 62;
|
|
643
|
-
const $QUESTION = 63;
|
|
644
|
-
const $0 = 48;
|
|
645
|
-
const $9 = 57;
|
|
646
|
-
const $A = 65;
|
|
647
|
-
const $E = 69;
|
|
648
|
-
const $F = 70;
|
|
649
|
-
const $X = 88;
|
|
650
|
-
const $Z = 90;
|
|
651
|
-
const $LBRACKET = 91;
|
|
652
|
-
const $BACKSLASH = 92;
|
|
653
|
-
const $RBRACKET = 93;
|
|
654
|
-
const $CARET = 94;
|
|
655
|
-
const $_ = 95;
|
|
656
|
-
const $a = 97;
|
|
657
|
-
const $e = 101;
|
|
658
|
-
const $f = 102;
|
|
659
|
-
const $n = 110;
|
|
660
|
-
const $r = 114;
|
|
661
|
-
const $t = 116;
|
|
662
|
-
const $u = 117;
|
|
663
|
-
const $v = 118;
|
|
664
|
-
const $x = 120;
|
|
665
|
-
const $z = 122;
|
|
666
|
-
const $LBRACE = 123;
|
|
667
|
-
const $BAR = 124;
|
|
668
|
-
const $RBRACE = 125;
|
|
669
|
-
const $NBSP = 160;
|
|
670
|
-
const $PIPE = 124;
|
|
671
|
-
const $TILDA = 126;
|
|
672
|
-
const $AT = 64;
|
|
673
|
-
const $BT = 96;
|
|
674
|
-
function isWhitespace(code) {
|
|
675
|
-
return (code >= $TAB && code <= $SPACE) || code === $NBSP;
|
|
676
|
-
}
|
|
677
|
-
function isDigit(code) {
|
|
678
|
-
return $0 <= code && code <= $9;
|
|
679
|
-
}
|
|
680
|
-
function isAsciiLetter(code) {
|
|
681
|
-
return (code >= $a && code <= $z) || (code >= $A && code <= $Z);
|
|
682
|
-
}
|
|
683
|
-
function isAsciiHexDigit(code) {
|
|
684
|
-
return (code >= $a && code <= $f) || (code >= $A && code <= $F) || isDigit(code);
|
|
685
|
-
}
|
|
686
|
-
function isLowerCase(str) {
|
|
687
|
-
return str === str.toLowerCase();
|
|
688
|
-
}
|
|
689
|
-
function isUpperCase(str) {
|
|
690
|
-
return str === str.toUpperCase();
|
|
616
|
+
const $EOF = 0;
|
|
617
|
+
const $TAB = 9;
|
|
618
|
+
const $LF = 10;
|
|
619
|
+
const $VTAB = 11;
|
|
620
|
+
const $FF = 12;
|
|
621
|
+
const $CR = 13;
|
|
622
|
+
const $SPACE = 32;
|
|
623
|
+
const $BANG = 33;
|
|
624
|
+
const $DQ = 34;
|
|
625
|
+
const $HASH = 35;
|
|
626
|
+
const $$ = 36;
|
|
627
|
+
const $PERCENT = 37;
|
|
628
|
+
const $AMPERSAND = 38;
|
|
629
|
+
const $SQ = 39;
|
|
630
|
+
const $LPAREN = 40;
|
|
631
|
+
const $RPAREN = 41;
|
|
632
|
+
const $STAR = 42;
|
|
633
|
+
const $PLUS = 43;
|
|
634
|
+
const $COMMA = 44;
|
|
635
|
+
const $MINUS = 45;
|
|
636
|
+
const $PERIOD = 46;
|
|
637
|
+
const $SLASH = 47;
|
|
638
|
+
const $COLON = 58;
|
|
639
|
+
const $SEMICOLON = 59;
|
|
640
|
+
const $LT = 60;
|
|
641
|
+
const $EQ = 61;
|
|
642
|
+
const $GT = 62;
|
|
643
|
+
const $QUESTION = 63;
|
|
644
|
+
const $0 = 48;
|
|
645
|
+
const $9 = 57;
|
|
646
|
+
const $A = 65;
|
|
647
|
+
const $E = 69;
|
|
648
|
+
const $F = 70;
|
|
649
|
+
const $X = 88;
|
|
650
|
+
const $Z = 90;
|
|
651
|
+
const $LBRACKET = 91;
|
|
652
|
+
const $BACKSLASH = 92;
|
|
653
|
+
const $RBRACKET = 93;
|
|
654
|
+
const $CARET = 94;
|
|
655
|
+
const $_ = 95;
|
|
656
|
+
const $a = 97;
|
|
657
|
+
const $e = 101;
|
|
658
|
+
const $f = 102;
|
|
659
|
+
const $n = 110;
|
|
660
|
+
const $r = 114;
|
|
661
|
+
const $t = 116;
|
|
662
|
+
const $u = 117;
|
|
663
|
+
const $v = 118;
|
|
664
|
+
const $x = 120;
|
|
665
|
+
const $z = 122;
|
|
666
|
+
const $LBRACE = 123;
|
|
667
|
+
const $BAR = 124;
|
|
668
|
+
const $RBRACE = 125;
|
|
669
|
+
const $NBSP = 160;
|
|
670
|
+
const $PIPE = 124;
|
|
671
|
+
const $TILDA = 126;
|
|
672
|
+
const $AT = 64;
|
|
673
|
+
const $BT = 96;
|
|
674
|
+
function isWhitespace(code) {
|
|
675
|
+
return (code >= $TAB && code <= $SPACE) || code === $NBSP;
|
|
676
|
+
}
|
|
677
|
+
function isDigit(code) {
|
|
678
|
+
return $0 <= code && code <= $9;
|
|
679
|
+
}
|
|
680
|
+
function isAsciiLetter(code) {
|
|
681
|
+
return (code >= $a && code <= $z) || (code >= $A && code <= $Z);
|
|
682
|
+
}
|
|
683
|
+
function isAsciiHexDigit(code) {
|
|
684
|
+
return (code >= $a && code <= $f) || (code >= $A && code <= $F) || isDigit(code);
|
|
685
|
+
}
|
|
686
|
+
function isLowerCase(str) {
|
|
687
|
+
return str === str.toLowerCase();
|
|
688
|
+
}
|
|
689
|
+
function isUpperCase(str) {
|
|
690
|
+
return str === str.toUpperCase();
|
|
691
691
|
}
|
|
692
692
|
|
|
693
|
-
class NChar {
|
|
694
|
-
static IsWhiteSpace(str) {
|
|
695
|
-
let ch = str.charCodeAt(0);
|
|
696
|
-
return isWhitespace(ch);
|
|
697
|
-
}
|
|
698
|
-
static IsLetterOrDigit(str) {
|
|
699
|
-
let ch = str.charCodeAt(0);
|
|
700
|
-
return isDigit(ch) || isAsciiLetter(ch);
|
|
701
|
-
}
|
|
702
|
-
static IsDigit(str) {
|
|
703
|
-
let ch = str.charCodeAt(0);
|
|
704
|
-
return isDigit(ch);
|
|
705
|
-
}
|
|
706
|
-
static IsLetter(ltr) {
|
|
707
|
-
return isAsciiLetter(ltr.charCodeAt(0));
|
|
708
|
-
}
|
|
709
|
-
static IsLower(ch) {
|
|
710
|
-
return isLowerCase(ch);
|
|
711
|
-
}
|
|
712
|
-
static IsUpper(ch) {
|
|
713
|
-
return isUpperCase(ch);
|
|
714
|
-
}
|
|
693
|
+
class NChar {
|
|
694
|
+
static IsWhiteSpace(str) {
|
|
695
|
+
let ch = str.charCodeAt(0);
|
|
696
|
+
return isWhitespace(ch);
|
|
697
|
+
}
|
|
698
|
+
static IsLetterOrDigit(str) {
|
|
699
|
+
let ch = str.charCodeAt(0);
|
|
700
|
+
return isDigit(ch) || isAsciiLetter(ch);
|
|
701
|
+
}
|
|
702
|
+
static IsDigit(str) {
|
|
703
|
+
let ch = str.charCodeAt(0);
|
|
704
|
+
return isDigit(ch);
|
|
705
|
+
}
|
|
706
|
+
static IsLetter(ltr) {
|
|
707
|
+
return isAsciiLetter(ltr.charCodeAt(0));
|
|
708
|
+
}
|
|
709
|
+
static IsLower(ch) {
|
|
710
|
+
return isLowerCase(ch);
|
|
711
|
+
}
|
|
712
|
+
static IsUpper(ch) {
|
|
713
|
+
return isUpperCase(ch);
|
|
714
|
+
}
|
|
715
715
|
}
|
|
716
716
|
|
|
717
|
-
class NotImplementedException extends Exception {
|
|
718
|
-
constructor(message = "Not implemented") {
|
|
719
|
-
super(message);
|
|
720
|
-
}
|
|
717
|
+
class NotImplementedException extends Exception {
|
|
718
|
+
constructor(message = "Not implemented") {
|
|
719
|
+
super(message);
|
|
720
|
+
}
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
-
var NumberStyles;
|
|
724
|
-
(function (NumberStyles) {
|
|
725
|
-
NumberStyles[NumberStyles["HexNumber"] = 0] = "HexNumber";
|
|
726
|
-
})(NumberStyles || (NumberStyles = {}));
|
|
727
|
-
class NNumber {
|
|
728
|
-
static Parse(text, style) {
|
|
729
|
-
if (arguments.length === 2) {
|
|
730
|
-
if (style === NumberStyles.HexNumber)
|
|
731
|
-
return parseInt(text, 16);
|
|
732
|
-
else
|
|
733
|
-
throw new NotImplementedException();
|
|
734
|
-
}
|
|
735
|
-
return +text;
|
|
736
|
-
}
|
|
737
|
-
static TryParse(str, pvalue) {
|
|
738
|
-
pvalue.value = +str;
|
|
739
|
-
return !isNaN(pvalue.value);
|
|
740
|
-
}
|
|
741
|
-
static ToString(num, format) {
|
|
742
|
-
if (format === 'X2') {
|
|
743
|
-
let res = num.toString(16);
|
|
744
|
-
return res.length === 1 ? '0' + res : res;
|
|
745
|
-
}
|
|
746
|
-
throw new NotImplementedException();
|
|
747
|
-
}
|
|
723
|
+
var NumberStyles;
|
|
724
|
+
(function (NumberStyles) {
|
|
725
|
+
NumberStyles[NumberStyles["HexNumber"] = 0] = "HexNumber";
|
|
726
|
+
})(NumberStyles || (NumberStyles = {}));
|
|
727
|
+
class NNumber {
|
|
728
|
+
static Parse(text, style) {
|
|
729
|
+
if (arguments.length === 2) {
|
|
730
|
+
if (style === NumberStyles.HexNumber)
|
|
731
|
+
return parseInt(text, 16);
|
|
732
|
+
else
|
|
733
|
+
throw new NotImplementedException();
|
|
734
|
+
}
|
|
735
|
+
return +text;
|
|
736
|
+
}
|
|
737
|
+
static TryParse(str, pvalue) {
|
|
738
|
+
pvalue.value = +str;
|
|
739
|
+
return !isNaN(pvalue.value);
|
|
740
|
+
}
|
|
741
|
+
static ToString(num, format) {
|
|
742
|
+
if (format === 'X2') {
|
|
743
|
+
let res = num.toString(16);
|
|
744
|
+
return res.length === 1 ? '0' + res : res;
|
|
745
|
+
}
|
|
746
|
+
throw new NotImplementedException();
|
|
747
|
+
}
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
-
class NString {
|
|
751
|
-
static
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
hash
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
let
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
let
|
|
852
|
-
let
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
let
|
|
868
|
-
let
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
orgSubStr = orgSubStr.replace(new RegExp("
|
|
878
|
-
orgSubStr = orgSubStr.replace(new RegExp("
|
|
879
|
-
orgSubStr = orgSubStr.replace(new RegExp("
|
|
880
|
-
orgSubStr = orgSubStr.replace(new RegExp("
|
|
881
|
-
orgSubStr = orgSubStr.replace(new RegExp("
|
|
882
|
-
orgSubStr = orgSubStr.replace(new RegExp("
|
|
883
|
-
orgSubStr = orgSubStr.replace(new RegExp("
|
|
884
|
-
orgSubStr = orgSubStr.replace(new RegExp("
|
|
885
|
-
orgSubStr = orgSubStr.replace(new RegExp("
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
}
|
|
895
|
-
|
|
750
|
+
class NString {
|
|
751
|
+
static Empty = "";
|
|
752
|
+
static IndexOf(str, searchStr, startIndex, count) {
|
|
753
|
+
let index = str.substr(startIndex, count).indexOf(searchStr);
|
|
754
|
+
return index > -1 ? startIndex + index : index;
|
|
755
|
+
}
|
|
756
|
+
static IndexOfAny(str, subs, startIndex, count) {
|
|
757
|
+
for (let i = 0; i < count; ++i) {
|
|
758
|
+
let c = str.charAt(startIndex + i);
|
|
759
|
+
for (let j = 0; j < subs.length; ++j) {
|
|
760
|
+
if (c === subs[j])
|
|
761
|
+
return (startIndex + i);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
return -1;
|
|
765
|
+
}
|
|
766
|
+
static CopyTo(source, sourceIndex, destination, destinationIndex, count) {
|
|
767
|
+
for (let i = 0; i < count; i++) {
|
|
768
|
+
destination[destinationIndex + i] = source[sourceIndex + i];
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
static Compare(strA, strB, ignoreCase, indexA, indexB, length) {
|
|
772
|
+
if (arguments.length = 6) {
|
|
773
|
+
strA = strA.substr(indexA, length);
|
|
774
|
+
strB = strB.substr(indexB, length);
|
|
775
|
+
}
|
|
776
|
+
if (ignoreCase) {
|
|
777
|
+
strA = strA.toLowerCase();
|
|
778
|
+
strB = strB.toLowerCase();
|
|
779
|
+
}
|
|
780
|
+
return strA.localeCompare(strB);
|
|
781
|
+
}
|
|
782
|
+
static Equals(strA, strB, ignoreCase) {
|
|
783
|
+
if (!NString.IsNullOrEmpty(strA) && !NString.IsNullOrEmpty(strB)) {
|
|
784
|
+
if (ignoreCase) {
|
|
785
|
+
strA = strA.toLowerCase();
|
|
786
|
+
strB = strB.toLowerCase();
|
|
787
|
+
}
|
|
788
|
+
return strA === strB;
|
|
789
|
+
}
|
|
790
|
+
return false;
|
|
791
|
+
}
|
|
792
|
+
static GetHashCode(str) {
|
|
793
|
+
var hash = 0, i, l, ch;
|
|
794
|
+
if (str.length === 0)
|
|
795
|
+
return hash;
|
|
796
|
+
for (i = 0, l = str.length; i < l; i++) {
|
|
797
|
+
ch = str.charCodeAt(i);
|
|
798
|
+
hash = ((hash << 5) - hash) + ch;
|
|
799
|
+
hash |= 0;
|
|
800
|
+
}
|
|
801
|
+
return hash;
|
|
802
|
+
}
|
|
803
|
+
static Remove(str, startIndex, length) {
|
|
804
|
+
return str.substr(0, startIndex - 1) + str.substr(startIndex + length - 1);
|
|
805
|
+
}
|
|
806
|
+
static TrimStart(str) {
|
|
807
|
+
return str.replace(/^\s\s*/, '');
|
|
808
|
+
}
|
|
809
|
+
static TrimEnd(string, trimChars) {
|
|
810
|
+
if (arguments.length === 1)
|
|
811
|
+
return string.replace(/\s\s*$/, '');
|
|
812
|
+
for (let j = 0; j < trimChars.length; j++) {
|
|
813
|
+
let trimChar = trimChars[j];
|
|
814
|
+
let i = string.length - 1;
|
|
815
|
+
while (!isNullOrUndefined(string[i]) && string[i].endsWith(trimChar)) {
|
|
816
|
+
string = NString.Remove(string, string.length, 1);
|
|
817
|
+
i--;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
return string;
|
|
821
|
+
}
|
|
822
|
+
static Format(format, arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
823
|
+
if (!isNullOrUndefined(arg0) && arg0.constructor === Array) {
|
|
824
|
+
var s = format, i = arg0.length;
|
|
825
|
+
while (i--) {
|
|
826
|
+
s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arg0[i]);
|
|
827
|
+
}
|
|
828
|
+
return s;
|
|
829
|
+
}
|
|
830
|
+
else {
|
|
831
|
+
var args = [arg0, arg1, arg2, arg3, arg4, arg5];
|
|
832
|
+
return NString.Format(format, args);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
static IsNullOrEmpty(str1) {
|
|
836
|
+
return !str1;
|
|
837
|
+
}
|
|
838
|
+
static FromChars(chOrChars, startIndex, len) {
|
|
839
|
+
let str = chOrChars.join('');
|
|
840
|
+
if (arguments.length === 3)
|
|
841
|
+
return str.substr(startIndex, len);
|
|
842
|
+
return str;
|
|
843
|
+
}
|
|
844
|
+
static FromChar(ch, count) {
|
|
845
|
+
return (new Array(count).fill(ch)).join('');
|
|
846
|
+
}
|
|
847
|
+
static ToCharArray(str) {
|
|
848
|
+
return Array.from(str);
|
|
849
|
+
}
|
|
850
|
+
static CompareOrdinal(strA, strB) {
|
|
851
|
+
let lenA = strA.length;
|
|
852
|
+
let lenB = strB.length;
|
|
853
|
+
let len = Math.min(lenA, lenB);
|
|
854
|
+
for (let i = 0; i < len; i++) {
|
|
855
|
+
if (strA[i].charCodeAt(0) !== strB[i].charCodeAt(0)) {
|
|
856
|
+
return strA[i].charCodeAt(0) - strB[i].charCodeAt(0);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
if (lenA !== lenB) {
|
|
860
|
+
return lenA - lenB;
|
|
861
|
+
}
|
|
862
|
+
return 0;
|
|
863
|
+
}
|
|
864
|
+
static PadRight(source, maxLength, fillString) {
|
|
865
|
+
if (source.length >= maxLength)
|
|
866
|
+
return source;
|
|
867
|
+
let fillLen = maxLength - source.length;
|
|
868
|
+
let timesToRepeat = Math.ceil(fillLen / fillString.length);
|
|
869
|
+
let truncatedStringFiller = fillString.repeat(timesToRepeat).slice(0, fillLen);
|
|
870
|
+
return source + truncatedStringFiller;
|
|
871
|
+
}
|
|
872
|
+
static Insert(str, index, ch) {
|
|
873
|
+
return str.substr(0, index) + ch + str.substr(index, str.length - index);
|
|
874
|
+
}
|
|
875
|
+
static Replace(str, orgSubStr, newSubStr) {
|
|
876
|
+
let resultStr = '';
|
|
877
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\\\", 'g'), "\\\\");
|
|
878
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\*", 'g'), "\\\*");
|
|
879
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\$", 'g'), "\\\$");
|
|
880
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\^", 'g'), "\\\^");
|
|
881
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\.", 'g'), "\\\.");
|
|
882
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\?", 'g'), "\\\?");
|
|
883
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\+", 'g'), "\\\+");
|
|
884
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\,", 'g'), "\\\,");
|
|
885
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\[", 'g'), "\\\[");
|
|
886
|
+
orgSubStr = orgSubStr.replace(new RegExp("\\|", 'g'), "\\\|");
|
|
887
|
+
try {
|
|
888
|
+
resultStr = str.replace(new RegExp(orgSubStr, 'g'), newSubStr);
|
|
889
|
+
}
|
|
890
|
+
catch (e) {
|
|
891
|
+
throw new Exception(e.message);
|
|
892
|
+
}
|
|
893
|
+
return resultStr;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
896
|
|
|
897
|
-
class NumberFormatInfo {
|
|
898
|
-
static
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
897
|
+
class NumberFormatInfo {
|
|
898
|
+
static NegativeSign = '-';
|
|
899
|
+
static NumberDecimalSeparator = NumberFormatInfo.GetLocaleDecimalSeperator();
|
|
900
|
+
static GetLocaleDecimalSeperator() {
|
|
901
|
+
return (1.1).toLocaleString()[1];
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
904
|
|
|
905
|
-
class RefParam {
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
905
|
+
class RefParam {
|
|
906
|
+
value;
|
|
907
|
+
constructor(value) {
|
|
908
|
+
this.value = value;
|
|
909
|
+
}
|
|
909
910
|
}
|
|
910
911
|
|
|
911
|
-
class Stack {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
clone
|
|
941
|
-
|
|
942
|
-
|
|
912
|
+
class Stack {
|
|
913
|
+
_array;
|
|
914
|
+
constructor() {
|
|
915
|
+
this._array = new Array();
|
|
916
|
+
}
|
|
917
|
+
count() {
|
|
918
|
+
return this._array.length;
|
|
919
|
+
}
|
|
920
|
+
isEmpty() {
|
|
921
|
+
return this._array.length === 0;
|
|
922
|
+
}
|
|
923
|
+
push(value) {
|
|
924
|
+
this._array.push(value);
|
|
925
|
+
}
|
|
926
|
+
pop() {
|
|
927
|
+
return this._array.pop();
|
|
928
|
+
}
|
|
929
|
+
peek() {
|
|
930
|
+
if (this._array.length > 0) {
|
|
931
|
+
return this._array[this._array.length - 1];
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
return null;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
Clear() {
|
|
938
|
+
this._array.splice(0, this._array.length);
|
|
939
|
+
}
|
|
940
|
+
Clone() {
|
|
941
|
+
let clone = new Stack();
|
|
942
|
+
clone._array = this._array.slice();
|
|
943
|
+
return clone;
|
|
944
|
+
}
|
|
943
945
|
}
|
|
944
946
|
|
|
945
|
-
class StackFrame {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
let stackFrames = StackTrace$1.getSync();
|
|
949
|
-
if (skipFrames < 0 || skipFrames >= stackFrames.length)
|
|
950
|
-
throw new Error("Argument out of range");
|
|
951
|
-
this.stackFrame = stackFrames[skipFrames];
|
|
952
|
-
}
|
|
953
|
-
GetFileName() {
|
|
954
|
-
return this.stackFrame.fileName;
|
|
955
|
-
}
|
|
947
|
+
class StackFrame {
|
|
948
|
+
stackFrame = null;
|
|
949
|
+
constructor(skipFrames) {
|
|
950
|
+
let stackFrames = StackTrace$1.getSync();
|
|
951
|
+
if (skipFrames < 0 || skipFrames >= stackFrames.length)
|
|
952
|
+
throw new Error("Argument out of range");
|
|
953
|
+
this.stackFrame = stackFrames[skipFrames];
|
|
954
|
+
}
|
|
955
|
+
GetFileName() {
|
|
956
|
+
return this.stackFrame.fileName;
|
|
957
|
+
}
|
|
956
958
|
}
|
|
957
959
|
|
|
958
|
-
class StackTrace {
|
|
959
|
-
GetFrames() {
|
|
960
|
-
return StackTrace$1.getSync();
|
|
961
|
-
}
|
|
960
|
+
class StackTrace {
|
|
961
|
+
GetFrames() {
|
|
962
|
+
return StackTrace$1.getSync();
|
|
963
|
+
}
|
|
962
964
|
}
|
|
963
965
|
|
|
964
|
-
class StringBuilder {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
if (arguments.length > 0) {
|
|
968
|
-
if (valueOrLength != null && valueOrLength.constructor === Number) {
|
|
969
|
-
}
|
|
970
|
-
else if (valueOrLength != null && valueOrLength.constructor === String) {
|
|
971
|
-
this.part = valueOrLength.toString();
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
Append(textOrNum, startIndexOrNumberOfCharacters, charCount) {
|
|
976
|
-
if (textOrNum === null)
|
|
977
|
-
return this;
|
|
978
|
-
if (textOrNum.constructor === String) {
|
|
979
|
-
if (arguments.length === 1)
|
|
980
|
-
this.AppendString(textOrNum.toString());
|
|
981
|
-
else if (arguments.length === 2) {
|
|
982
|
-
Debug.Assert(textOrNum.length === 1, "character is expected not string");
|
|
983
|
-
this.AppendString(textOrNum.charAt(0).repeat(startIndexOrNumberOfCharacters));
|
|
984
|
-
}
|
|
985
|
-
else
|
|
986
|
-
this.AppendString(textOrNum.toString(), startIndexOrNumberOfCharacters, charCount);
|
|
987
|
-
}
|
|
988
|
-
else
|
|
989
|
-
this.AppendNumber(textOrNum, startIndexOrNumberOfCharacters);
|
|
990
|
-
return this;
|
|
991
|
-
}
|
|
992
|
-
AppendString(text, startIndex = 0, charCount = text.length) {
|
|
993
|
-
this.part = this.part + text.substr(startIndex, charCount);
|
|
994
|
-
}
|
|
995
|
-
AppendNumber(num, numberOfCharacters = 1) {
|
|
996
|
-
if (numberOfCharacters <= 0)
|
|
997
|
-
throw new Error("numberOfCharacters cannot be less than or equal to zero");
|
|
998
|
-
this.part = this.part + num.toString().repeat(numberOfCharacters);
|
|
999
|
-
}
|
|
1000
|
-
AppendLine(text = null) {
|
|
1001
|
-
if (text !== null)
|
|
1002
|
-
this.part = this.part + text;
|
|
1003
|
-
this.part = this.part + '\n';
|
|
1004
|
-
}
|
|
1005
|
-
AppendFormat(format, arg0, arg1, arg2) {
|
|
1006
|
-
this.part = this.part + NString.Format(format, arg0, arg1, arg2);
|
|
1007
|
-
return this;
|
|
1008
|
-
}
|
|
1009
|
-
ToString(startIndex, length) {
|
|
1010
|
-
if (arguments.length === 2) {
|
|
1011
|
-
if (startIndex < 0 || length < 0 || (startIndex + length) > this.part.length)
|
|
1012
|
-
throw new Error("Argument out of range");
|
|
1013
|
-
return this.part.substr(startIndex, length);
|
|
1014
|
-
}
|
|
1015
|
-
return this.part;
|
|
1016
|
-
}
|
|
1017
|
-
get Length() {
|
|
1018
|
-
return this.part.length;
|
|
1019
|
-
}
|
|
1020
|
-
get_Item(index) {
|
|
1021
|
-
if (index < 0 || index >= this.part.length)
|
|
1022
|
-
throw new Error("Index out of range");
|
|
1023
|
-
return this.part.charAt(index);
|
|
1024
|
-
}
|
|
1025
|
-
set_Item(index, value) {
|
|
1026
|
-
if (index < 0 || index >= this.part.length)
|
|
1027
|
-
throw new Error("Index out of range");
|
|
1028
|
-
Debug.Assert(value.length <= 1, "Length of string cannot be more than 1. Only character is expected");
|
|
1029
|
-
let leftPart = this.part.substring(0, index);
|
|
1030
|
-
let rightPart = this.part.substring(index + 1, this.part.length);
|
|
1031
|
-
this.part = leftPart + value.charAt(0) + rightPart;
|
|
1032
|
-
}
|
|
1033
|
-
Insert(index, value) {
|
|
1034
|
-
if (index < 0 || index > this.part.length)
|
|
1035
|
-
throw new Error("Argument out of range");
|
|
1036
|
-
let leftPart = this.part.substring(0, index);
|
|
1037
|
-
let rightPart = this.part.substring(index, this.part.length);
|
|
1038
|
-
this.part = leftPart + value + rightPart;
|
|
1039
|
-
return this;
|
|
1040
|
-
}
|
|
1041
|
-
Remove(startIndex, length) {
|
|
1042
|
-
if (startIndex < 0 || length < 0 || (startIndex + length) > this.part.length)
|
|
1043
|
-
throw new Error("Argument out of range");
|
|
1044
|
-
let leftPart = this.part.substring(0, startIndex);
|
|
1045
|
-
let rightPart = this.part.substring(startIndex + length, this.part.length);
|
|
1046
|
-
this.part = leftPart + rightPart;
|
|
1047
|
-
return this;
|
|
1048
|
-
}
|
|
1049
|
-
Replace(oldValue, newValue, startIndex, count) {
|
|
1050
|
-
if (oldValue === null)
|
|
1051
|
-
throw new Error("oldValue cannot be null");
|
|
1052
|
-
else if (oldValue.length === 0)
|
|
1053
|
-
throw new Error("Length of oldValue cannot be 0");
|
|
1054
|
-
if (arguments.length === 4) {
|
|
1055
|
-
if (startIndex < 0 || count < 0 || (startIndex + count) > this.part.length)
|
|
1056
|
-
throw new Error("Argument out of range");
|
|
1057
|
-
}
|
|
1058
|
-
if (arguments.length === 2)
|
|
1059
|
-
this.part = this.part.replace(new RegExp(oldValue, 'g'), newValue);
|
|
1060
|
-
else if (arguments.length === 4) {
|
|
1061
|
-
let substr = this.part.substring(startIndex, startIndex + count);
|
|
1062
|
-
substr = substr.replace(new RegExp(oldValue, 'g'), newValue);
|
|
1063
|
-
let leftPart = this.part.substring(0, startIndex);
|
|
1064
|
-
let rightPart = this.part.substring(startIndex + count, this.part.length);
|
|
1065
|
-
this.part = leftPart + substr + rightPart;
|
|
1066
|
-
}
|
|
1067
|
-
return this;
|
|
1068
|
-
}
|
|
1069
|
-
toString() {
|
|
1070
|
-
return this.ToString();
|
|
1071
|
-
}
|
|
966
|
+
class StringBuilder {
|
|
967
|
+
part = "";
|
|
968
|
+
constructor(valueOrLength, length) {
|
|
969
|
+
if (arguments.length > 0) {
|
|
970
|
+
if (valueOrLength != null && valueOrLength.constructor === Number) {
|
|
971
|
+
}
|
|
972
|
+
else if (valueOrLength != null && valueOrLength.constructor === String) {
|
|
973
|
+
this.part = valueOrLength.toString();
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
Append(textOrNum, startIndexOrNumberOfCharacters, charCount) {
|
|
978
|
+
if (textOrNum === null)
|
|
979
|
+
return this;
|
|
980
|
+
if (textOrNum.constructor === String) {
|
|
981
|
+
if (arguments.length === 1)
|
|
982
|
+
this.AppendString(textOrNum.toString());
|
|
983
|
+
else if (arguments.length === 2) {
|
|
984
|
+
Debug.Assert(textOrNum.length === 1, "character is expected not string");
|
|
985
|
+
this.AppendString(textOrNum.charAt(0).repeat(startIndexOrNumberOfCharacters));
|
|
986
|
+
}
|
|
987
|
+
else
|
|
988
|
+
this.AppendString(textOrNum.toString(), startIndexOrNumberOfCharacters, charCount);
|
|
989
|
+
}
|
|
990
|
+
else
|
|
991
|
+
this.AppendNumber(textOrNum, startIndexOrNumberOfCharacters);
|
|
992
|
+
return this;
|
|
993
|
+
}
|
|
994
|
+
AppendString(text, startIndex = 0, charCount = text.length) {
|
|
995
|
+
this.part = this.part + text.substr(startIndex, charCount);
|
|
996
|
+
}
|
|
997
|
+
AppendNumber(num, numberOfCharacters = 1) {
|
|
998
|
+
if (numberOfCharacters <= 0)
|
|
999
|
+
throw new Error("numberOfCharacters cannot be less than or equal to zero");
|
|
1000
|
+
this.part = this.part + num.toString().repeat(numberOfCharacters);
|
|
1001
|
+
}
|
|
1002
|
+
AppendLine(text = null) {
|
|
1003
|
+
if (text !== null)
|
|
1004
|
+
this.part = this.part + text;
|
|
1005
|
+
this.part = this.part + '\n';
|
|
1006
|
+
}
|
|
1007
|
+
AppendFormat(format, arg0, arg1, arg2) {
|
|
1008
|
+
this.part = this.part + NString.Format(format, arg0, arg1, arg2);
|
|
1009
|
+
return this;
|
|
1010
|
+
}
|
|
1011
|
+
ToString(startIndex, length) {
|
|
1012
|
+
if (arguments.length === 2) {
|
|
1013
|
+
if (startIndex < 0 || length < 0 || (startIndex + length) > this.part.length)
|
|
1014
|
+
throw new Error("Argument out of range");
|
|
1015
|
+
return this.part.substr(startIndex, length);
|
|
1016
|
+
}
|
|
1017
|
+
return this.part;
|
|
1018
|
+
}
|
|
1019
|
+
get Length() {
|
|
1020
|
+
return this.part.length;
|
|
1021
|
+
}
|
|
1022
|
+
get_Item(index) {
|
|
1023
|
+
if (index < 0 || index >= this.part.length)
|
|
1024
|
+
throw new Error("Index out of range");
|
|
1025
|
+
return this.part.charAt(index);
|
|
1026
|
+
}
|
|
1027
|
+
set_Item(index, value) {
|
|
1028
|
+
if (index < 0 || index >= this.part.length)
|
|
1029
|
+
throw new Error("Index out of range");
|
|
1030
|
+
Debug.Assert(value.length <= 1, "Length of string cannot be more than 1. Only character is expected");
|
|
1031
|
+
let leftPart = this.part.substring(0, index);
|
|
1032
|
+
let rightPart = this.part.substring(index + 1, this.part.length);
|
|
1033
|
+
this.part = leftPart + value.charAt(0) + rightPart;
|
|
1034
|
+
}
|
|
1035
|
+
Insert(index, value) {
|
|
1036
|
+
if (index < 0 || index > this.part.length)
|
|
1037
|
+
throw new Error("Argument out of range");
|
|
1038
|
+
let leftPart = this.part.substring(0, index);
|
|
1039
|
+
let rightPart = this.part.substring(index, this.part.length);
|
|
1040
|
+
this.part = leftPart + value + rightPart;
|
|
1041
|
+
return this;
|
|
1042
|
+
}
|
|
1043
|
+
Remove(startIndex, length) {
|
|
1044
|
+
if (startIndex < 0 || length < 0 || (startIndex + length) > this.part.length)
|
|
1045
|
+
throw new Error("Argument out of range");
|
|
1046
|
+
let leftPart = this.part.substring(0, startIndex);
|
|
1047
|
+
let rightPart = this.part.substring(startIndex + length, this.part.length);
|
|
1048
|
+
this.part = leftPart + rightPart;
|
|
1049
|
+
return this;
|
|
1050
|
+
}
|
|
1051
|
+
Replace(oldValue, newValue, startIndex, count) {
|
|
1052
|
+
if (oldValue === null)
|
|
1053
|
+
throw new Error("oldValue cannot be null");
|
|
1054
|
+
else if (oldValue.length === 0)
|
|
1055
|
+
throw new Error("Length of oldValue cannot be 0");
|
|
1056
|
+
if (arguments.length === 4) {
|
|
1057
|
+
if (startIndex < 0 || count < 0 || (startIndex + count) > this.part.length)
|
|
1058
|
+
throw new Error("Argument out of range");
|
|
1059
|
+
}
|
|
1060
|
+
if (arguments.length === 2)
|
|
1061
|
+
this.part = this.part.replace(new RegExp(oldValue, 'g'), newValue);
|
|
1062
|
+
else if (arguments.length === 4) {
|
|
1063
|
+
let substr = this.part.substring(startIndex, startIndex + count);
|
|
1064
|
+
substr = substr.replace(new RegExp(oldValue, 'g'), newValue);
|
|
1065
|
+
let leftPart = this.part.substring(0, startIndex);
|
|
1066
|
+
let rightPart = this.part.substring(startIndex + count, this.part.length);
|
|
1067
|
+
this.part = leftPart + substr + rightPart;
|
|
1068
|
+
}
|
|
1069
|
+
return this;
|
|
1070
|
+
}
|
|
1071
|
+
toString() {
|
|
1072
|
+
return this.ToString();
|
|
1073
|
+
}
|
|
1072
1074
|
}
|
|
1073
1075
|
|
|
1074
|
-
class Thread {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1076
|
+
class Thread {
|
|
1077
|
+
static nextId = 1;
|
|
1078
|
+
static CurrentThread = new Thread();
|
|
1079
|
+
ManagedThreadId = 0;
|
|
1080
|
+
constructor() {
|
|
1081
|
+
this.ManagedThreadId = Thread.nextId++;
|
|
1082
|
+
}
|
|
1083
|
+
static async Sleep(millisecondsTimeout) {
|
|
1084
|
+
await new Promise((resolve) => {
|
|
1085
|
+
let timer = interval(millisecondsTimeout);
|
|
1086
|
+
let subscription = timer.subscribe(() => { subscription.unsubscribe(); resolve(); });
|
|
1087
|
+
}).then();
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1088
1090
|
|
|
1089
|
-
class WebException extends Exception {
|
|
1090
|
-
constructor(error) {
|
|
1091
|
-
super();
|
|
1092
|
-
this.name = "WebException";
|
|
1093
|
-
this.stack = error.stack;
|
|
1094
|
-
this.message = error.message;
|
|
1095
|
-
}
|
|
1091
|
+
class WebException extends Exception {
|
|
1092
|
+
constructor(error) {
|
|
1093
|
+
super();
|
|
1094
|
+
this.name = "WebException";
|
|
1095
|
+
this.stack = error.stack;
|
|
1096
|
+
this.message = error.message;
|
|
1097
|
+
}
|
|
1096
1098
|
}
|
|
1097
1099
|
|
|
1098
|
-
class XmlConvert {
|
|
1099
|
-
static EncodeName(name) {
|
|
1100
|
-
throw new NotImplementedException();
|
|
1101
|
-
}
|
|
1100
|
+
class XmlConvert {
|
|
1101
|
+
static EncodeName(name) {
|
|
1102
|
+
throw new NotImplementedException();
|
|
1103
|
+
}
|
|
1102
1104
|
}
|
|
1103
1105
|
|
|
1104
1106
|
export { $$, $0, $9, $A, $AMPERSAND, $AT, $BACKSLASH, $BANG, $BAR, $BT, $CARET, $COLON, $COMMA, $CR, $DQ, $E, $EOF, $EQ, $F, $FF, $GT, $HASH, $LBRACE, $LBRACKET, $LF, $LPAREN, $LT, $MINUS, $NBSP, $PERCENT, $PERIOD, $PIPE, $PLUS, $QUESTION, $RBRACE, $RBRACKET, $RPAREN, $SEMICOLON, $SLASH, $SPACE, $SQ, $STAR, $TAB, $TILDA, $VTAB, $X, $Z, $_, $a, $e, $f, $n, $r, $t, $u, $v, $x, $z, ApplicationException, Array_Enumerator, BitArray, Char, CultureInfo, DateTime, DateTimeKind, Debug, Dictionary, Encoding, Exception, HashUtils, Hashtable, ISO_8859_1_Encoding, Int32, Int64, List, NChar, NNumber, NString, NotImplementedException, NumberFormatInfo, NumberStyles, RefParam, Stack, StackFrame, StackTrace, StringBuilder, Thread, WebException, XmlConvert, isAsciiHexDigit, isAsciiLetter, isDigit, isLowerCase, isNullOrUndefined, isUndefined, isUpperCase, isWhitespace };
|