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

◆ ProcessTerminal_DHMSF()

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

Definition at line 822 of file TimeSpanParse.cs.

823 {
824 if (raw._sepCount != 6)
825 {
826 return result.SetBadTimeSpanFailure();
827 }
828 bool flag = (style & TimeSpanStandardStyles.Invariant) != 0;
829 bool flag2 = (style & TimeSpanStandardStyles.Localized) != 0;
830 bool flag3 = false;
831 bool flag4 = false;
832 if (flag)
833 {
834 if (raw.FullMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
835 {
836 flag4 = true;
837 flag3 = true;
838 }
839 if (!flag4 && raw.FullMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
840 {
841 flag4 = true;
842 flag3 = false;
843 }
844 }
845 if (flag2)
846 {
847 if (!flag4 && raw.FullMatch(raw.PositiveLocalized))
848 {
849 flag4 = true;
850 flag3 = true;
851 }
852 if (!flag4 && raw.FullMatch(raw.NegativeLocalized))
853 {
854 flag4 = true;
855 flag3 = false;
856 }
857 }
858 if (flag4)
859 {
860 if (!TryTimeToTicks(flag3, raw._numbers0, raw._numbers1, raw._numbers2, raw._numbers3, raw._numbers4, out var result2))
861 {
862 return result.SetOverflowFailure();
863 }
864 if (!flag3)
865 {
866 result2 = -result2;
867 if (result2 > 0)
868 {
869 return result.SetOverflowFailure();
870 }
871 }
872 result.parsedTimeSpan = new TimeSpan(result2);
873 return true;
874 }
875 return result.SetBadTimeSpanFailure();
876 }
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().