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

◆ TryParseUInt32HexNumberStyle()

static ParsingStatus System.Number.TryParseUInt32HexNumberStyle ( ReadOnlySpan< char > value,
NumberStyles styles,
out uint result )
inlinestaticpackage

Definition at line 4972 of file Number.cs.

4973 {
4974 int i;
4975 int num;
4976 if (!value.IsEmpty)
4977 {
4978 i = 0;
4979 num = value[0];
4980 if ((styles & NumberStyles.AllowLeadingWhite) == 0 || !IsWhite(num))
4981 {
4982 goto IL_0048;
4983 }
4984 while (true)
4985 {
4986 i++;
4987 if ((uint)i >= (uint)value.Length)
4988 {
4989 break;
4990 }
4991 num = value[i];
4992 if (IsWhite(num))
4993 {
4994 continue;
4995 }
4996 goto IL_0048;
4997 }
4998 }
4999 goto IL_011f;
5000 IL_0087:
5001 uint num2 = (uint)HexConverter.FromChar(num);
5002 i++;
5003 int num3 = 0;
5004 while (num3 < 7)
5005 {
5006 if ((uint)i >= (uint)value.Length)
5007 {
5008 goto IL_0116;
5009 }
5010 num = value[i];
5011 uint num4 = (uint)HexConverter.FromChar(num);
5012 if (num4 != 255)
5013 {
5014 i++;
5015 num2 = 16 * num2 + num4;
5016 num3++;
5017 continue;
5018 }
5019 goto IL_012f;
5020 }
5021 if ((uint)i >= (uint)value.Length)
5022 {
5023 goto IL_0116;
5024 }
5025 num = value[i];
5026 if (HexConverter.IsHexChar(num))
5027 {
5028 while (true)
5029 {
5030 i++;
5031 if ((uint)i >= (uint)value.Length)
5032 {
5033 break;
5034 }
5035 num = value[i];
5036 if (HexConverter.IsHexChar(num))
5037 {
5038 continue;
5039 }
5040 goto IL_010f;
5041 }
5042 goto IL_0127;
5043 }
5044 goto IL_012f;
5045 IL_0127:
5046 result = 0u;
5047 return ParsingStatus.Overflow;
5048 IL_0113:
5049 bool flag;
5050 if (!flag)
5051 {
5052 goto IL_0116;
5053 }
5054 goto IL_0127;
5055 IL_011f:
5056 result = 0u;
5057 return ParsingStatus.Failed;
5058 IL_0048:
5059 flag = false;
5060 num2 = 0u;
5061 if (HexConverter.IsHexChar(num))
5062 {
5063 if (num != 48)
5064 {
5065 goto IL_0087;
5066 }
5067 while (true)
5068 {
5069 i++;
5070 if ((uint)i >= (uint)value.Length)
5071 {
5072 break;
5073 }
5074 num = value[i];
5075 if (num == 48)
5076 {
5077 continue;
5078 }
5079 goto IL_007c;
5080 }
5081 goto IL_0116;
5082 }
5083 goto IL_011f;
5084 IL_010f:
5085 flag = true;
5086 goto IL_012f;
5087 IL_012f:
5088 if (IsWhite(num))
5089 {
5090 if ((styles & NumberStyles.AllowTrailingWhite) == 0)
5091 {
5092 goto IL_011f;
5093 }
5094 for (i++; i < value.Length && IsWhite(value[i]); i++)
5095 {
5096 }
5097 if ((uint)i >= (uint)value.Length)
5098 {
5099 goto IL_0113;
5100 }
5101 }
5102 if (TrailingZeros(value, i))
5103 {
5104 goto IL_0113;
5105 }
5106 goto IL_011f;
5107 IL_0116:
5108 result = num2;
5109 return ParsingStatus.OK;
5110 IL_007c:
5111 if (HexConverter.IsHexChar(num))
5112 {
5113 goto IL_0087;
5114 }
5115 goto IL_012f;
5116 }
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.Guid.TryParseExactD(), System.Number.TryParseInt32(), and System.Number.TryParseUInt32().