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

◆ ProcessTerminal_HM()

static bool System.Globalization.TimeSpanParse.ProcessTerminal_HM ( ref TimeSpanRawInfo raw,
TimeSpanStandardStyles style,
ref TimeSpanResult result )
inlinestaticprivate

Definition at line 1100 of file TimeSpanParse.cs.

1101 {
1102 if (raw._sepCount != 3 || (style & TimeSpanStandardStyles.RequireFull) != 0)
1103 {
1104 return result.SetBadTimeSpanFailure();
1105 }
1106 bool flag = (style & TimeSpanStandardStyles.Invariant) != 0;
1107 bool flag2 = (style & TimeSpanStandardStyles.Localized) != 0;
1108 bool flag3 = false;
1109 bool flag4 = false;
1110 if (flag)
1111 {
1112 if (raw.FullHMMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
1113 {
1114 flag4 = true;
1115 flag3 = true;
1116 }
1117 if (!flag4 && raw.FullHMMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
1118 {
1119 flag4 = true;
1120 flag3 = false;
1121 }
1122 }
1123 if (flag2)
1124 {
1125 if (!flag4 && raw.FullHMMatch(raw.PositiveLocalized))
1126 {
1127 flag4 = true;
1128 flag3 = true;
1129 }
1130 if (!flag4 && raw.FullHMMatch(raw.NegativeLocalized))
1131 {
1132 flag4 = true;
1133 flag3 = false;
1134 }
1135 }
1136 if (flag4)
1137 {
1138 TimeSpanToken timeSpanToken = new TimeSpanToken(0);
1139 if (!TryTimeToTicks(flag3, timeSpanToken, raw._numbers0, raw._numbers1, timeSpanToken, timeSpanToken, out var result2))
1140 {
1141 return result.SetOverflowFailure();
1142 }
1143 if (!flag3)
1144 {
1145 result2 = -result2;
1146 if (result2 > 0)
1147 {
1148 return result.SetOverflowFailure();
1149 }
1150 }
1151 result.parsedTimeSpan = new TimeSpan(result2);
1152 return true;
1153 }
1154 return result.SetBadTimeSpanFailure();
1155 }
static bool TryTimeToTicks(bool positive, TimeSpanToken days, TimeSpanToken hours, TimeSpanToken minutes, TimeSpanToken seconds, TimeSpanToken fraction, out long result)

References System.Globalization.TimeSpanFormat.NegativeInvariantFormatLiterals, System.Globalization.TimeSpanFormat.PositiveInvariantFormatLiterals, and System.Globalization.TimeSpanParse.TryTimeToTicks().

Referenced by System.Globalization.TimeSpanParse.ProcessTerminalState().