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

◆ ProcessTerminal_D()

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

Definition at line 1157 of file TimeSpanParse.cs.

1158 {
1159 if (raw._sepCount != 2 || (style & TimeSpanStandardStyles.RequireFull) != 0)
1160 {
1161 return result.SetBadTimeSpanFailure();
1162 }
1163 bool flag = (style & TimeSpanStandardStyles.Invariant) != 0;
1164 bool flag2 = (style & TimeSpanStandardStyles.Localized) != 0;
1165 bool flag3 = false;
1166 bool flag4 = false;
1167 if (flag)
1168 {
1169 if (raw.FullDMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
1170 {
1171 flag4 = true;
1172 flag3 = true;
1173 }
1174 if (!flag4 && raw.FullDMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
1175 {
1176 flag4 = true;
1177 flag3 = false;
1178 }
1179 }
1180 if (flag2)
1181 {
1182 if (!flag4 && raw.FullDMatch(raw.PositiveLocalized))
1183 {
1184 flag4 = true;
1185 flag3 = true;
1186 }
1187 if (!flag4 && raw.FullDMatch(raw.NegativeLocalized))
1188 {
1189 flag4 = true;
1190 flag3 = false;
1191 }
1192 }
1193 if (flag4)
1194 {
1195 TimeSpanToken timeSpanToken = new TimeSpanToken(0);
1196 if (!TryTimeToTicks(flag3, raw._numbers0, timeSpanToken, timeSpanToken, timeSpanToken, timeSpanToken, out var result2))
1197 {
1198 return result.SetOverflowFailure();
1199 }
1200 if (!flag3)
1201 {
1202 result2 = -result2;
1203 if (result2 > 0)
1204 {
1205 return result.SetOverflowFailure();
1206 }
1207 }
1208 result.parsedTimeSpan = new TimeSpan(result2);
1209 return true;
1210 }
1211 return result.SetBadTimeSpanFailure();
1212 }
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().