@magic-xpa/mscorelib 4.1200.0-dev4120.21 → 4.1200.0-dev4120.212
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/fesm2022/magic-xpa-mscorelib.mjs +166 -50
- package/fesm2022/magic-xpa-mscorelib.mjs.map +1 -1
- package/index.d.ts +3 -0
- package/package.json +1 -3
- package/esm2022/index.mjs +0 -32
- package/esm2022/magic-xpa-mscorelib.mjs +0 -2
- package/esm2022/src/ApplicationException.mjs +0 -12
- package/esm2022/src/ArrayEnumerator.mjs +0 -17
- package/esm2022/src/BitArray.mjs +0 -16
- package/esm2022/src/Char.mjs +0 -5
- package/esm2022/src/CultureInfo.mjs +0 -4
- package/esm2022/src/DateTime.mjs +0 -75
- package/esm2022/src/Debug.mjs +0 -10
- package/esm2022/src/Dictionary.mjs +0 -39
- package/esm2022/src/Encoding.mjs +0 -114
- package/esm2022/src/Exception.mjs +0 -32
- package/esm2022/src/HashTable.mjs +0 -157
- package/esm2022/src/IComparable.mjs +0 -2
- package/esm2022/src/ISO_8859_1_Encoding.mjs +0 -38
- package/esm2022/src/Int32.mjs +0 -5
- package/esm2022/src/Int64.mjs +0 -4
- package/esm2022/src/List.mjs +0 -87
- package/esm2022/src/NChar.mjs +0 -25
- package/esm2022/src/NNumber.mjs +0 -28
- package/esm2022/src/NString.mjs +0 -149
- package/esm2022/src/NotImplementedException.mjs +0 -7
- package/esm2022/src/NumberFormatInfo.mjs +0 -8
- package/esm2022/src/RefParam.mjs +0 -7
- package/esm2022/src/Stack.mjs +0 -35
- package/esm2022/src/StackFrame.mjs +0 -14
- package/esm2022/src/StackTrace.mjs +0 -7
- package/esm2022/src/StringBuilder.mjs +0 -112
- package/esm2022/src/StringUtils.mjs +0 -77
- package/esm2022/src/Thread.mjs +0 -16
- package/esm2022/src/Utils.mjs +0 -7
- package/esm2022/src/WebException.mjs +0 -10
- package/esm2022/src/XmlConvert.mjs +0 -7
|
@@ -10,6 +10,9 @@ function isUndefined(object) {
|
|
|
10
10
|
return object == undefined;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// The base class of all exceptions
|
|
15
|
+
/// </summary>
|
|
13
16
|
class Exception {
|
|
14
17
|
name = "Exception";
|
|
15
18
|
message = "";
|
|
@@ -27,15 +30,25 @@ class Exception {
|
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
}
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// get the message of exception
|
|
35
|
+
/// </summary>
|
|
30
36
|
get Message() {
|
|
31
37
|
return this.message;
|
|
32
38
|
}
|
|
39
|
+
/// <summary>
|
|
40
|
+
/// get the stack trace of exception
|
|
41
|
+
/// </summary>
|
|
33
42
|
get StackTrace() {
|
|
34
43
|
let stackTrace = this.stack || '';
|
|
35
44
|
let stackLines = stackTrace.split("\n").map(function (line) { return line.trim(); });
|
|
45
|
+
// On some browsers (e.g. Chrome), the statck includes a title as "Error", so remove it.
|
|
36
46
|
stackTrace = stackLines.splice(stackLines[0] === 'Error' ? this.errorLevel + 1 : this.errorLevel).join("\n");
|
|
37
47
|
return "\n" + stackTrace;
|
|
38
48
|
}
|
|
49
|
+
/// <summary>
|
|
50
|
+
/// get the type of exception
|
|
51
|
+
/// </summary>
|
|
39
52
|
GetType() {
|
|
40
53
|
return this.name;
|
|
41
54
|
}
|
|
@@ -68,17 +81,33 @@ class Array_Enumerator {
|
|
|
68
81
|
}
|
|
69
82
|
}
|
|
70
83
|
|
|
84
|
+
/// <summary>
|
|
85
|
+
/// Manages a compact array of bit values,
|
|
86
|
+
// which are represented as Booleans, where true indicates that the bit is on (1) and false indicates the bit is off (0).
|
|
87
|
+
/// </summary>
|
|
71
88
|
class BitArray {
|
|
72
|
-
array = null;
|
|
89
|
+
array = null; // array of boolean values
|
|
90
|
+
/// <summary>
|
|
91
|
+
/// returns the length of array
|
|
92
|
+
/// </summary>
|
|
93
|
+
/// <returns></returns>
|
|
73
94
|
get Length() {
|
|
74
95
|
return this.array.length;
|
|
75
96
|
}
|
|
76
97
|
constructor(length) {
|
|
77
98
|
this.array = new Array(length).fill(false);
|
|
78
99
|
}
|
|
100
|
+
/// <summary>
|
|
101
|
+
/// get the value of flag at specified index
|
|
102
|
+
/// </summary>
|
|
103
|
+
/// <returns></returns>
|
|
79
104
|
Get(index) {
|
|
80
105
|
return this.array[index];
|
|
81
106
|
}
|
|
107
|
+
/// <summary>
|
|
108
|
+
/// set the value of flag at specified index
|
|
109
|
+
/// </summary>
|
|
110
|
+
/// <returns></returns>
|
|
82
111
|
Set(index, value) {
|
|
83
112
|
this.array[index] = value;
|
|
84
113
|
}
|
|
@@ -98,12 +127,17 @@ var DateTimeKind;
|
|
|
98
127
|
DateTimeKind[DateTimeKind["Local"] = 0] = "Local";
|
|
99
128
|
DateTimeKind[DateTimeKind["Utc"] = 1] = "Utc";
|
|
100
129
|
})(DateTimeKind || (DateTimeKind = {}));
|
|
130
|
+
// @dynamic
|
|
101
131
|
class DateTime {
|
|
102
132
|
dt = null;
|
|
103
133
|
kind = null;
|
|
134
|
+
// the number of .net ticks at the unix epoch
|
|
104
135
|
epochTicks = 621355968000000000;
|
|
136
|
+
// there are 10000 .net ticks per millisecond
|
|
105
137
|
ticksPerMillisecond = 10000;
|
|
106
138
|
get Ticks() {
|
|
139
|
+
// https://stackoverflow.com/questions/7966559/how-to-convert-javascript-date-object-to-ticks
|
|
140
|
+
// TODO - check if we need this or to use Misc.getSystemMilliseconds()
|
|
107
141
|
return ((this.dt.getTime() * this.ticksPerMillisecond) + this.epochTicks) - (this.dt.getTimezoneOffset() * 600000000);
|
|
108
142
|
}
|
|
109
143
|
get Year() {
|
|
@@ -236,6 +270,11 @@ class Encoding {
|
|
|
236
270
|
bytes = this.textEncoder.encode(str);
|
|
237
271
|
}
|
|
238
272
|
catch (ex) {
|
|
273
|
+
// In C#, if any character is not within the range of specified charset, it is replaced by '?'.
|
|
274
|
+
// TextEncoder.encode() throws an error in such a case.
|
|
275
|
+
// We can modify the implementation of TextEncoder.encode() to put '?' instead of throwing error.
|
|
276
|
+
// But, it can be problematic if we change the library version.
|
|
277
|
+
// So, we will catch this error and handle the encoding ourselves.
|
|
239
278
|
bytes = new Uint8Array(str.length * 3);
|
|
240
279
|
let bytesCount = 0;
|
|
241
280
|
let tmpBytes;
|
|
@@ -254,6 +293,7 @@ class Encoding {
|
|
|
254
293
|
return bytes;
|
|
255
294
|
}
|
|
256
295
|
GetByteCount(str) {
|
|
296
|
+
// TODO: this is not the best way.
|
|
257
297
|
return this.GetBytes(str).length;
|
|
258
298
|
}
|
|
259
299
|
GetString(bytes, index, count) {
|
|
@@ -278,57 +318,62 @@ class Encoding {
|
|
|
278
318
|
}
|
|
279
319
|
static PopulateCodePageToEncodingMap() {
|
|
280
320
|
let hashTable = new Object;
|
|
281
|
-
|
|
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
|
-
hashTable[
|
|
321
|
-
hashTable[
|
|
322
|
-
hashTable[
|
|
323
|
-
hashTable[
|
|
321
|
+
// These map is similar to enc_map_table of exp_xml.cpp
|
|
322
|
+
hashTable[20106] = "DIN_66003"; // IA5 (German)
|
|
323
|
+
hashTable[20107] = "SEN_850200_B"; // IA5 (Swedish)
|
|
324
|
+
hashTable[50932] = "_autodetect"; // Japanese (Auto Select)
|
|
325
|
+
hashTable[20108] = "NS_4551-1"; // IA5 (Norwegian)
|
|
326
|
+
hashTable[50949] = "_autodetect_kr"; // Korean (Auto Select)
|
|
327
|
+
hashTable[950] = "big5"; // Chinese Traditional (Big5)
|
|
328
|
+
hashTable[50221] = "csISO2022JP"; // Japanese (JIS-Allow 1 byte Kana)
|
|
329
|
+
hashTable[51949] = "euc-kr"; // Korean (EUC)
|
|
330
|
+
hashTable[936] = "gb2312"; // Chinese Simplified (GB2312)
|
|
331
|
+
hashTable[52936] = "hz-gb-2312"; // Chinese Simplified (HZ)
|
|
332
|
+
hashTable[852] = "ibm852"; // Central European (DOS)
|
|
333
|
+
hashTable[866] = "ibm866"; // Cyrillic Alphabet (DOS)
|
|
334
|
+
hashTable[20105] = "irv"; // IA5 (IRV)
|
|
335
|
+
hashTable[50220] = "iso-2022-jp"; // Japanese (JIS)
|
|
336
|
+
hashTable[50222] = "iso-2022-jp"; // Japanese (JIS-Allow 1 byte Kana)
|
|
337
|
+
hashTable[50225] = "iso-2022-kr"; // Korean (ISO)
|
|
338
|
+
hashTable[28591] = "iso-8859-1"; // Western Alphabet (ISO)
|
|
339
|
+
hashTable[28592] = "iso-8859-2"; // Central European Alphabet (ISO)
|
|
340
|
+
hashTable[28593] = "iso-8859-3"; // Latin 3 Alphabet (ISO)
|
|
341
|
+
hashTable[28594] = "iso-8859-4"; // Baltic Alphabet (ISO)
|
|
342
|
+
hashTable[28595] = "iso-8859-5"; // Cyrillic Alphabet (ISO)
|
|
343
|
+
hashTable[28596] = "iso-8859-6"; // Arabic Alphabet (ISO)
|
|
344
|
+
hashTable[28597] = "iso-8859-7"; // Greek Alphabet (ISO)
|
|
345
|
+
hashTable[28598] = "iso-8859-8"; // Hebrew Alphabet (ISO)
|
|
346
|
+
hashTable[20866] = "koi8-r"; // Cyrillic Alphabet (KOI8-R)
|
|
347
|
+
hashTable[949] = "ks_c_5601"; // Korean
|
|
348
|
+
hashTable[932] = "shift-jis"; // Japanese (Shift-JIS)
|
|
349
|
+
hashTable[1200] = "unicode"; // Universal Alphabet
|
|
350
|
+
hashTable[1201] = "unicodeFEFF"; // Universal Alphabet (Big-Endian)
|
|
351
|
+
hashTable[65000] = "utf-7"; // Universal Alphabet (UTF-7)
|
|
352
|
+
hashTable[65001] = "utf-8"; // Universal Alphabet (UTF-8)
|
|
353
|
+
hashTable[1250] = "windows-1250"; // Central European Alphabet (Windows)
|
|
354
|
+
hashTable[1251] = "windows-1251"; // Cyrillic Alphabet (Windows)
|
|
355
|
+
hashTable[1252] = "windows-1252"; // Western Alphabet (Windows)
|
|
356
|
+
hashTable[1253] = "windows-1253"; // Greek Alphabet (Windows)
|
|
357
|
+
hashTable[1254] = "windows-1254"; // Turkish Alphabet
|
|
358
|
+
hashTable[1255] = "windows-1255"; // Hebrew Alphabet (Windows)
|
|
359
|
+
hashTable[1256] = "windows-1256"; // Arabic Alphabet (Windows)
|
|
360
|
+
hashTable[1257] = "windows-1257"; // Baltic Alphabet (Windows)
|
|
361
|
+
hashTable[1258] = "windows-1258"; // Vietnamese Alphabet (Windows)
|
|
362
|
+
hashTable[874] = "windows-874"; // Thai (Windows)
|
|
363
|
+
hashTable[20127] = "US-ASCII"; // us-ascii
|
|
364
|
+
hashTable[51932] = "x-euc"; // Japanese (EUC)
|
|
324
365
|
return hashTable;
|
|
325
366
|
}
|
|
367
|
+
// return the name of encoding used
|
|
326
368
|
toString() {
|
|
327
369
|
return this.label;
|
|
328
370
|
}
|
|
329
371
|
}
|
|
330
372
|
|
|
373
|
+
// Reference: https://github.com/rkostrzewski/hashtable-ts/blob/master/src/hashtable.ts
|
|
331
374
|
class HashUtils {
|
|
375
|
+
// Pay attention that in server there is the same function and it must
|
|
376
|
+
// return the same hash value.
|
|
332
377
|
static GetHashCode(str) {
|
|
333
378
|
let bytes = null;
|
|
334
379
|
bytes = Encoding.UTF8.GetBytes(str);
|
|
@@ -355,9 +400,10 @@ class HashUtils {
|
|
|
355
400
|
}
|
|
356
401
|
}
|
|
357
402
|
const HashTableLoadFactor = 0.75;
|
|
403
|
+
// Hashtable implementation for key TKey and Value TValue
|
|
358
404
|
class Hashtable {
|
|
359
|
-
_buckets = [];
|
|
360
|
-
_elementsCount = 0;
|
|
405
|
+
_buckets = []; // total no. of buckets
|
|
406
|
+
_elementsCount = 0; // total elements
|
|
361
407
|
_bucketCount = 0;
|
|
362
408
|
_loadFactor = 0;
|
|
363
409
|
constructor(bucketCount = 8, loadFactor = HashTableLoadFactor) {
|
|
@@ -367,6 +413,7 @@ class Hashtable {
|
|
|
367
413
|
throw new Exception('Bucket count must be a positive number and be multiple of 2.');
|
|
368
414
|
}
|
|
369
415
|
}
|
|
416
|
+
// Generic Hash funtion
|
|
370
417
|
HashFunction(key) {
|
|
371
418
|
if (typeof key.GetHashCode === 'function') {
|
|
372
419
|
return key.GetHashCode();
|
|
@@ -379,9 +426,11 @@ class Hashtable {
|
|
|
379
426
|
}
|
|
380
427
|
return 0;
|
|
381
428
|
}
|
|
429
|
+
// returns elementCount
|
|
382
430
|
get Count() {
|
|
383
431
|
return this._elementsCount;
|
|
384
432
|
}
|
|
433
|
+
// returns ValueCollection (Array Enumerator)
|
|
385
434
|
get Values() {
|
|
386
435
|
let array = [];
|
|
387
436
|
this._buckets.forEach(b => b.forEach(item => {
|
|
@@ -389,6 +438,7 @@ class Hashtable {
|
|
|
389
438
|
}));
|
|
390
439
|
return new Array_Enumerator(array);
|
|
391
440
|
}
|
|
441
|
+
// returns KeyCollection (Array Enumerator)
|
|
392
442
|
get Keys() {
|
|
393
443
|
let array = [];
|
|
394
444
|
this._buckets.forEach(b => b.forEach(item => {
|
|
@@ -396,12 +446,15 @@ class Hashtable {
|
|
|
396
446
|
}));
|
|
397
447
|
return new Array_Enumerator(array);
|
|
398
448
|
}
|
|
449
|
+
// adds item to Hashtable
|
|
399
450
|
Add(key, value) {
|
|
400
451
|
this.Insert(key, value, true);
|
|
401
452
|
}
|
|
453
|
+
// sets item in Hashtable
|
|
402
454
|
set_Item(key, value) {
|
|
403
455
|
this.Insert(key, value, false);
|
|
404
456
|
}
|
|
457
|
+
// Insert element in Hashtable
|
|
405
458
|
Insert(key, value, add) {
|
|
406
459
|
let bucketIndex = this.GetBucketIndex(key);
|
|
407
460
|
if (typeof this._buckets[bucketIndex] === "undefined") {
|
|
@@ -422,6 +475,7 @@ class Hashtable {
|
|
|
422
475
|
this.Resize(this._bucketCount * 2);
|
|
423
476
|
}
|
|
424
477
|
}
|
|
478
|
+
// Gets value for key TKey
|
|
425
479
|
get_Item(key) {
|
|
426
480
|
let bucketIndex = this.GetBucketIndex(key);
|
|
427
481
|
let bucket = this._buckets[bucketIndex];
|
|
@@ -434,6 +488,7 @@ class Hashtable {
|
|
|
434
488
|
}
|
|
435
489
|
return null;
|
|
436
490
|
}
|
|
491
|
+
// Returns if key TKey is present in Hashtable
|
|
437
492
|
ContainsKey(key) {
|
|
438
493
|
let bucketIndex = this.GetBucketIndex(key);
|
|
439
494
|
let bucket = this._buckets[bucketIndex];
|
|
@@ -443,6 +498,7 @@ class Hashtable {
|
|
|
443
498
|
let itemIndex = bucket.findIndex(x => x.key === key);
|
|
444
499
|
return (itemIndex > -1);
|
|
445
500
|
}
|
|
501
|
+
// Removes item with key TKey from Hashtable
|
|
446
502
|
Remove(key) {
|
|
447
503
|
let bucketIndex = this.GetBucketIndex(key);
|
|
448
504
|
let bucket = this._buckets[bucketIndex];
|
|
@@ -458,6 +514,7 @@ class Hashtable {
|
|
|
458
514
|
}
|
|
459
515
|
}
|
|
460
516
|
}
|
|
517
|
+
// Resize bucket (Hashtable)
|
|
461
518
|
Resize(newBucketCount) {
|
|
462
519
|
let _oldBuckets = this._buckets;
|
|
463
520
|
this._elementsCount = 0;
|
|
@@ -465,6 +522,7 @@ class Hashtable {
|
|
|
465
522
|
this._bucketCount = newBucketCount;
|
|
466
523
|
_oldBuckets.forEach(b => b.forEach(item => this.Add(item.key, item.value)));
|
|
467
524
|
}
|
|
525
|
+
// returns bucketIndex for key
|
|
468
526
|
GetBucketIndex(key) {
|
|
469
527
|
let hash = this.HashFunction(key);
|
|
470
528
|
if (hash % 1 !== 0) {
|
|
@@ -476,6 +534,7 @@ class Hashtable {
|
|
|
476
534
|
}
|
|
477
535
|
return index;
|
|
478
536
|
}
|
|
537
|
+
// Clears Hashtable
|
|
479
538
|
Clear() {
|
|
480
539
|
this._elementsCount = 0;
|
|
481
540
|
this._buckets = [];
|
|
@@ -577,7 +636,7 @@ class List extends Array {
|
|
|
577
636
|
Insert(index, item) {
|
|
578
637
|
if (index >= 0 && index < this.length)
|
|
579
638
|
this.splice(index, 0, item);
|
|
580
|
-
else if (index === this.length)
|
|
639
|
+
else if (index === this.length) // inserting at end means append
|
|
581
640
|
this.push(item);
|
|
582
641
|
else
|
|
583
642
|
throw new Error("index out of bounds");
|
|
@@ -604,6 +663,10 @@ class List extends Array {
|
|
|
604
663
|
foundItem = null;
|
|
605
664
|
return foundItem;
|
|
606
665
|
}
|
|
666
|
+
/// <summary>
|
|
667
|
+
/// add null cells up to 'size' cells.
|
|
668
|
+
/// </summary>
|
|
669
|
+
/// <param name="size"></param>
|
|
607
670
|
SetSize(size) {
|
|
608
671
|
if (this.length > size) {
|
|
609
672
|
this.RemoveRange(size, this.length - size);
|
|
@@ -725,6 +788,11 @@ var NumberStyles;
|
|
|
725
788
|
NumberStyles[NumberStyles["HexNumber"] = 0] = "HexNumber";
|
|
726
789
|
})(NumberStyles || (NumberStyles = {}));
|
|
727
790
|
class NNumber {
|
|
791
|
+
/// <summary>
|
|
792
|
+
/// convert a string to number
|
|
793
|
+
/// for blank string , it will return 0
|
|
794
|
+
/// for incorrect format it will return NaN
|
|
795
|
+
/// <summary>
|
|
728
796
|
static Parse(text, style) {
|
|
729
797
|
if (arguments.length === 2) {
|
|
730
798
|
if (style === NumberStyles.HexNumber)
|
|
@@ -732,12 +800,20 @@ class NNumber {
|
|
|
732
800
|
else
|
|
733
801
|
throw new NotImplementedException();
|
|
734
802
|
}
|
|
735
|
-
return +text;
|
|
803
|
+
return +text; // use unary + operator to convert string to number.
|
|
736
804
|
}
|
|
805
|
+
/// <summary>
|
|
806
|
+
/// convert a string to number
|
|
807
|
+
/// return true if string is correctly parsed i.e pvalue.value is number
|
|
808
|
+
/// for incorrect format it will return false
|
|
809
|
+
/// <summary>
|
|
737
810
|
static TryParse(str, pvalue) {
|
|
738
811
|
pvalue.value = +str;
|
|
739
812
|
return !isNaN(pvalue.value);
|
|
740
813
|
}
|
|
814
|
+
/// <summary>
|
|
815
|
+
/// convert a number to string with specified format
|
|
816
|
+
/// <summary>
|
|
741
817
|
static ToString(num, format) {
|
|
742
818
|
if (format === 'X2') {
|
|
743
819
|
let res = num.toString(16);
|
|
@@ -747,6 +823,7 @@ class NNumber {
|
|
|
747
823
|
}
|
|
748
824
|
}
|
|
749
825
|
|
|
826
|
+
// @dynamic
|
|
750
827
|
class NString {
|
|
751
828
|
static Empty = "";
|
|
752
829
|
static IndexOf(str, searchStr, startIndex, count) {
|
|
@@ -796,7 +873,7 @@ class NString {
|
|
|
796
873
|
for (i = 0, l = str.length; i < l; i++) {
|
|
797
874
|
ch = str.charCodeAt(i);
|
|
798
875
|
hash = ((hash << 5) - hash) + ch;
|
|
799
|
-
hash |= 0;
|
|
876
|
+
hash |= 0; // Convert to 32bit integer
|
|
800
877
|
}
|
|
801
878
|
return hash;
|
|
802
879
|
}
|
|
@@ -851,14 +928,17 @@ class NString {
|
|
|
851
928
|
let lenA = strA.length;
|
|
852
929
|
let lenB = strB.length;
|
|
853
930
|
let len = Math.min(lenA, lenB);
|
|
931
|
+
// compare character by character
|
|
854
932
|
for (let i = 0; i < len; i++) {
|
|
855
933
|
if (strA[i].charCodeAt(0) !== strB[i].charCodeAt(0)) {
|
|
856
934
|
return strA[i].charCodeAt(0) - strB[i].charCodeAt(0);
|
|
857
935
|
}
|
|
858
936
|
}
|
|
937
|
+
// if all characters are same , but length is different return the difference of length
|
|
859
938
|
if (lenA !== lenB) {
|
|
860
939
|
return lenA - lenB;
|
|
861
940
|
}
|
|
941
|
+
// all chars are same , so strings are equal
|
|
862
942
|
return 0;
|
|
863
943
|
}
|
|
864
944
|
static PadRight(source, maxLength, fillString) {
|
|
@@ -874,6 +954,8 @@ class NString {
|
|
|
874
954
|
}
|
|
875
955
|
static Replace(str, orgSubStr, newSubStr) {
|
|
876
956
|
let resultStr = '';
|
|
957
|
+
// fixed defect 151810: replace "*" with "\*" before we update the string so * will be as char and not reg exp
|
|
958
|
+
// also for special chars $ ^ . ? + , [
|
|
877
959
|
orgSubStr = orgSubStr.replace(new RegExp("\\\\", 'g'), "\\\\");
|
|
878
960
|
orgSubStr = orgSubStr.replace(new RegExp("\\*", 'g'), "\\\*");
|
|
879
961
|
orgSubStr = orgSubStr.replace(new RegExp("\\$", 'g'), "\\\$");
|
|
@@ -898,7 +980,7 @@ class NumberFormatInfo {
|
|
|
898
980
|
static NegativeSign = '-';
|
|
899
981
|
static NumberDecimalSeparator = NumberFormatInfo.GetLocaleDecimalSeperator();
|
|
900
982
|
static GetLocaleDecimalSeperator() {
|
|
901
|
-
return (1.1).toLocaleString()[1];
|
|
983
|
+
return (1.1).toLocaleString()[1]; // get the decimal seperator of current locale
|
|
902
984
|
}
|
|
903
985
|
}
|
|
904
986
|
|
|
@@ -944,6 +1026,8 @@ class Stack {
|
|
|
944
1026
|
}
|
|
945
1027
|
}
|
|
946
1028
|
|
|
1029
|
+
// StackFrame uses StackTrace utility using stacktrace-js utility from npm
|
|
1030
|
+
// https://www.npmjs.com/package/stacktrace-js
|
|
947
1031
|
class StackFrame {
|
|
948
1032
|
stackFrame = null;
|
|
949
1033
|
constructor(skipFrames) {
|
|
@@ -957,20 +1041,35 @@ class StackFrame {
|
|
|
957
1041
|
}
|
|
958
1042
|
}
|
|
959
1043
|
|
|
1044
|
+
// This uses StackTrace utility using stacktrace-js utility from npm. Use this in package.json
|
|
1045
|
+
// https://www.npmjs.com/package/stacktrace-js
|
|
960
1046
|
class StackTrace {
|
|
961
1047
|
GetFrames() {
|
|
1048
|
+
// Using getSync() method, it returns references of callstack ethod from the javascript files bindled and not typeScript file from sources.
|
|
1049
|
+
// However, if aSync method would have used, it overcomes above problems but the call to log would have been async and we would not have
|
|
1050
|
+
// received synchronous logs which would be confusing.
|
|
962
1051
|
return StackTrace$1.getSync();
|
|
963
1052
|
}
|
|
964
1053
|
}
|
|
965
1054
|
|
|
1055
|
+
// StringBuilder class. Its Implementation currently uses string object. It could have been string[], but it has issues when inserting string.
|
|
1056
|
+
// It would not have served purpose while inserting a string. Other could be to use string[] with one chraracter per string. Even its utility
|
|
1057
|
+
// is doubtful as while manipulation, it would be creting new objects instead pointers. So for now we have used only string and see if we have
|
|
1058
|
+
// any performance issues.
|
|
966
1059
|
class StringBuilder {
|
|
967
1060
|
part = "";
|
|
968
1061
|
constructor(valueOrLength, length) {
|
|
969
1062
|
if (arguments.length > 0) {
|
|
970
1063
|
if (valueOrLength != null && valueOrLength.constructor === Number) {
|
|
1064
|
+
// TODO: Very low priority performance improvement - Implement this.
|
|
1065
|
+
// Debug.Assert(false, "StringBuilder: NotImplemented constructor with initial length/capacity");
|
|
1066
|
+
// throw new Error("NotImplemented constructor with initial length/capacity");
|
|
971
1067
|
}
|
|
972
1068
|
else if (valueOrLength != null && valueOrLength.constructor === String) {
|
|
973
1069
|
this.part = valueOrLength.toString();
|
|
1070
|
+
// TODO: Very low priority performance improvement - Implement this.
|
|
1071
|
+
// if (arguments.length === 2)
|
|
1072
|
+
// Debug.Assert(false, "NotImplemented constructor with initial length/capacity");
|
|
974
1073
|
}
|
|
975
1074
|
}
|
|
976
1075
|
}
|
|
@@ -991,14 +1090,17 @@ class StringBuilder {
|
|
|
991
1090
|
this.AppendNumber(textOrNum, startIndexOrNumberOfCharacters);
|
|
992
1091
|
return this;
|
|
993
1092
|
}
|
|
1093
|
+
// Append string
|
|
994
1094
|
AppendString(text, startIndex = 0, charCount = text.length) {
|
|
995
1095
|
this.part = this.part + text.substr(startIndex, charCount);
|
|
996
1096
|
}
|
|
1097
|
+
// Append Number
|
|
997
1098
|
AppendNumber(num, numberOfCharacters = 1) {
|
|
998
1099
|
if (numberOfCharacters <= 0)
|
|
999
1100
|
throw new Error("numberOfCharacters cannot be less than or equal to zero");
|
|
1000
1101
|
this.part = this.part + num.toString().repeat(numberOfCharacters);
|
|
1001
1102
|
}
|
|
1103
|
+
// Append Line
|
|
1002
1104
|
AppendLine(text = null) {
|
|
1003
1105
|
if (text !== null)
|
|
1004
1106
|
this.part = this.part + text;
|
|
@@ -1068,6 +1170,7 @@ class StringBuilder {
|
|
|
1068
1170
|
}
|
|
1069
1171
|
return this;
|
|
1070
1172
|
}
|
|
1173
|
+
// return the string
|
|
1071
1174
|
toString() {
|
|
1072
1175
|
return this.ToString();
|
|
1073
1176
|
}
|
|
@@ -1080,6 +1183,10 @@ class Thread {
|
|
|
1080
1183
|
constructor() {
|
|
1081
1184
|
this.ManagedThreadId = Thread.nextId++;
|
|
1082
1185
|
}
|
|
1186
|
+
/// <summary>
|
|
1187
|
+
/// Free the thread so it will be able to do other work, like gui events
|
|
1188
|
+
/// </summary>
|
|
1189
|
+
/// <param name = "millisecondsTimeout"> timeout in milliseconds</param>
|
|
1083
1190
|
static async Sleep(millisecondsTimeout) {
|
|
1084
1191
|
await new Promise((resolve) => {
|
|
1085
1192
|
let timer = interval(millisecondsTimeout);
|
|
@@ -1098,10 +1205,19 @@ class WebException extends Exception {
|
|
|
1098
1205
|
}
|
|
1099
1206
|
|
|
1100
1207
|
class XmlConvert {
|
|
1208
|
+
// TODO : Implement
|
|
1101
1209
|
static EncodeName(name) {
|
|
1102
1210
|
throw new NotImplementedException();
|
|
1103
1211
|
}
|
|
1104
1212
|
}
|
|
1105
1213
|
|
|
1214
|
+
/**
|
|
1215
|
+
* @file Automatically generated by barrelsby.
|
|
1216
|
+
*/
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Generated bundle index. Do not edit.
|
|
1220
|
+
*/
|
|
1221
|
+
|
|
1106
1222
|
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 };
|
|
1107
1223
|
//# sourceMappingURL=magic-xpa-mscorelib.mjs.map
|