Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UrlEncodeNonAscii() [1/2]

static byte[] System.Web.Util.HttpEncoder.UrlEncodeNonAscii ( byte[] bytes,
int offset,
int count )
inlinestaticprivate

Definition at line 521 of file HttpEncoder.cs.

522 {
523 int num = 0;
524 for (int i = 0; i < count; i++)
525 {
526 if (IsNonAsciiByte(bytes[offset + i]))
527 {
528 num++;
529 }
530 }
531 if (num == 0)
532 {
533 return bytes;
534 }
535 byte[] array = new byte[count + num * 2];
536 int num2 = 0;
537 for (int j = 0; j < count; j++)
538 {
539 byte b = bytes[offset + j];
540 if (IsNonAsciiByte(b))
541 {
542 array[num2++] = 37;
543 array[num2++] = (byte)System.HexConverter.ToCharLower(b >> 4);
544 array[num2++] = (byte)System.HexConverter.ToCharLower(b);
545 }
546 else
547 {
548 array[num2++] = b;
549 }
550 }
551 return array;
552 }
static char ToCharLower(int value)
static bool IsNonAsciiByte(byte b)

References System.array, System.bytes, System.count, System.Web.Util.HttpEncoder.IsNonAsciiByte(), System.offset, and System.HexConverter.ToCharLower().