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

◆ TryParseByteN()

static bool System.Buffers.Text.Utf8Parser.TryParseByteN ( ReadOnlySpan< byte > source,
out byte value,
out int bytesConsumed )
inlinestaticprivate

Definition at line 2726 of file Utf8Parser.cs.

2727 {
2728 int num;
2729 int num3;
2730 int num2;
2731 if (source.Length >= 1)
2732 {
2733 num = 0;
2734 num2 = source[num];
2735 if (num2 == 43)
2736 {
2737 num++;
2738 if ((uint)num >= (uint)source.Length)
2739 {
2740 goto IL_00ce;
2741 }
2742 num2 = source[num];
2743 }
2744 if (num2 != 46)
2745 {
2746 if (ParserHelpers.IsDigit(num2))
2747 {
2748 num3 = num2 - 48;
2749 while (true)
2750 {
2751 num++;
2752 if ((uint)num >= (uint)source.Length)
2753 {
2754 break;
2755 }
2756 num2 = source[num];
2757 if (num2 == 44)
2758 {
2759 continue;
2760 }
2761 if (num2 == 46)
2762 {
2763 goto IL_00a9;
2764 }
2765 if (!ParserHelpers.IsDigit(num2))
2766 {
2767 break;
2768 }
2769 num3 = num3 * 10 + num2 - 48;
2770 if (num3 <= 255)
2771 {
2772 continue;
2773 }
2774 goto IL_00ce;
2775 }
2776 goto IL_00d6;
2777 }
2778 }
2779 else
2780 {
2781 num3 = 0;
2782 num++;
2783 if ((uint)num < (uint)source.Length && source[num] == 48)
2784 {
2785 goto IL_00a9;
2786 }
2787 }
2788 }
2789 goto IL_00ce;
2790 IL_00c6:
2791 if (ParserHelpers.IsDigit(num2))
2792 {
2793 goto IL_00ce;
2794 }
2795 goto IL_00d6;
2796 IL_00a9:
2797 while (true)
2798 {
2799 num++;
2800 if ((uint)num >= (uint)source.Length)
2801 {
2802 break;
2803 }
2804 num2 = source[num];
2805 if (num2 == 48)
2806 {
2807 continue;
2808 }
2809 goto IL_00c6;
2810 }
2811 goto IL_00d6;
2812 IL_00d6:
2813 bytesConsumed = num;
2814 value = (byte)num3;
2815 return true;
2816 IL_00ce:
2817 bytesConsumed = 0;
2818 value = 0;
2819 return false;
2820 }

References System.Buffers.Text.ParserHelpers.IsDigit(), System.source, and System.value.

Referenced by System.Buffers.Text.Utf8Parser.TryParse().