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

◆ TryParseUInt64HexNumberStyle()

static ParsingStatus System.Number.TryParseUInt64HexNumberStyle ( ReadOnlySpan< char > value,
NumberStyles styles,
out ulong result )
inlinestaticprivate

Definition at line 5356 of file Number.cs.

5357 {
5358 int i;
5359 int num;
5360 if (!value.IsEmpty)
5361 {
5362 i = 0;
5363 num = value[0];
5364 if ((styles & NumberStyles.AllowLeadingWhite) == 0 || !IsWhite(num))
5365 {
5366 goto IL_0048;
5367 }
5368 while (true)
5369 {
5370 i++;
5371 if ((uint)i >= (uint)value.Length)
5372 {
5373 break;
5374 }
5375 num = value[i];
5376 if (IsWhite(num))
5377 {
5378 continue;
5379 }
5380 goto IL_0048;
5381 }
5382 }
5383 goto IL_0124;
5384 IL_0088:
5385 ulong num2 = (uint)HexConverter.FromChar(num);
5386 i++;
5387 int num3 = 0;
5388 while (num3 < 15)
5389 {
5390 if ((uint)i >= (uint)value.Length)
5391 {
5392 goto IL_011b;
5393 }
5394 num = value[i];
5395 uint num4 = (uint)HexConverter.FromChar(num);
5396 if (num4 != 255)
5397 {
5398 i++;
5399 num2 = 16 * num2 + num4;
5400 num3++;
5401 continue;
5402 }
5403 goto IL_0136;
5404 }
5405 if ((uint)i >= (uint)value.Length)
5406 {
5407 goto IL_011b;
5408 }
5409 num = value[i];
5410 if (HexConverter.IsHexChar(num))
5411 {
5412 while (true)
5413 {
5414 i++;
5415 if ((uint)i >= (uint)value.Length)
5416 {
5417 break;
5418 }
5419 num = value[i];
5420 if (HexConverter.IsHexChar(num))
5421 {
5422 continue;
5423 }
5424 goto IL_0114;
5425 }
5426 goto IL_012d;
5427 }
5428 goto IL_0136;
5429 IL_012d:
5430 result = 0uL;
5431 return ParsingStatus.Overflow;
5432 IL_0118:
5433 bool flag;
5434 if (!flag)
5435 {
5436 goto IL_011b;
5437 }
5438 goto IL_012d;
5439 IL_0124:
5440 result = 0uL;
5441 return ParsingStatus.Failed;
5442 IL_0048:
5443 flag = false;
5444 num2 = 0uL;
5445 if (HexConverter.IsHexChar(num))
5446 {
5447 if (num != 48)
5448 {
5449 goto IL_0088;
5450 }
5451 while (true)
5452 {
5453 i++;
5454 if ((uint)i >= (uint)value.Length)
5455 {
5456 break;
5457 }
5458 num = value[i];
5459 if (num == 48)
5460 {
5461 continue;
5462 }
5463 goto IL_007d;
5464 }
5465 goto IL_011b;
5466 }
5467 goto IL_0124;
5468 IL_0114:
5469 flag = true;
5470 goto IL_0136;
5471 IL_0136:
5472 if (IsWhite(num))
5473 {
5474 if ((styles & NumberStyles.AllowTrailingWhite) == 0)
5475 {
5476 goto IL_0124;
5477 }
5478 for (i++; i < value.Length && IsWhite(value[i]); i++)
5479 {
5480 }
5481 if ((uint)i >= (uint)value.Length)
5482 {
5483 goto IL_0118;
5484 }
5485 }
5486 if (TrailingZeros(value, i))
5487 {
5488 goto IL_0118;
5489 }
5490 goto IL_0124;
5491 IL_011b:
5492 result = num2;
5493 return ParsingStatus.OK;
5494 IL_007d:
5495 if (HexConverter.IsHexChar(num))
5496 {
5497 goto IL_0088;
5498 }
5499 goto IL_0136;
5500 }
static bool IsWhite(int ch)
Definition Number.cs:5903
static bool TrailingZeros(ReadOnlySpan< char > value, int index)
Definition Number.cs:5845

References System.HexConverter.FromChar(), System.HexConverter.IsHexChar(), System.Number.IsWhite(), System.Number.TrailingZeros(), and System.value.

Referenced by System.Number.TryParseInt64(), and System.Number.TryParseUInt64().