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

◆ Parse()

bool System.Xml.Schema.XsdDateTime.Parser.Parse ( string text,
XsdDateTimeFlags kinds )
inline

Definition at line 58 of file XsdDateTime.cs.

59 {
60 _text = text;
61 _length = text.Length;
62 int i;
63 for (i = 0; i < _length && char.IsWhiteSpace(text[i]); i++)
64 {
65 }
66 if (Test(kinds, XsdDateTimeFlags.DateTime | XsdDateTimeFlags.Date | XsdDateTimeFlags.XdrDateTimeNoTz | XsdDateTimeFlags.XdrDateTime) && ParseDate(i))
67 {
69 {
70 typeCode = DateTimeTypeCode.DateTime;
71 return true;
72 }
74 {
75 typeCode = DateTimeTypeCode.Date;
76 return true;
77 }
79 {
80 typeCode = DateTimeTypeCode.XdrDateTime;
81 return true;
82 }
83 if (Test(kinds, XsdDateTimeFlags.XdrDateTimeNoTz))
84 {
85 if (!ParseChar(i + s_lzyyyy_MM_dd, 'T'))
86 {
87 typeCode = DateTimeTypeCode.XdrDateTime;
88 return true;
89 }
91 {
92 typeCode = DateTimeTypeCode.XdrDateTime;
93 return true;
94 }
95 }
96 }
98 {
99 year = 1904;
100 month = 1;
101 day = 1;
102 typeCode = DateTimeTypeCode.Time;
103 return true;
104 }
105 if (Test(kinds, XsdDateTimeFlags.XdrTimeNoTz) && ParseTimeAndWhitespace(i))
106 {
107 year = 1904;
108 month = 1;
109 day = 1;
110 typeCode = DateTimeTypeCode.Time;
111 return true;
112 }
113 if (Test(kinds, XsdDateTimeFlags.GYearMonth | XsdDateTimeFlags.GYear) && Parse4Dig(i, ref year) && 1 <= year)
114 {
115 if (Test(kinds, XsdDateTimeFlags.GYearMonth) && ParseChar(i + s_lzyyyy, '-') && Parse2Dig(i + s_lzyyyy_, ref month) && 1 <= month && month <= 12 && ParseZoneAndWhitespace(i + s_lzyyyy_MM))
116 {
117 day = 1;
118 typeCode = DateTimeTypeCode.GYearMonth;
119 return true;
120 }
122 {
123 month = 1;
124 day = 1;
125 typeCode = DateTimeTypeCode.GYear;
126 return true;
127 }
128 }
129 if (Test(kinds, XsdDateTimeFlags.GMonthDay | XsdDateTimeFlags.GMonth) && ParseChar(i, '-') && ParseChar(i + s_Lz_, '-') && Parse2Dig(i + s_Lz__, ref month) && 1 <= month && month <= 12)
130 {
131 if (Test(kinds, XsdDateTimeFlags.GMonthDay) && ParseChar(i + s_lz__mm, '-') && Parse2Dig(i + s_lz__mm_, ref day) && 1 <= day && day <= DateTime.DaysInMonth(1904, month) && ParseZoneAndWhitespace(i + s_lz__mm_dd))
132 {
133 year = 1904;
134 typeCode = DateTimeTypeCode.GMonthDay;
135 return true;
136 }
138 {
139 year = 1904;
140 day = 1;
141 typeCode = DateTimeTypeCode.GMonth;
142 return true;
143 }
144 }
145 if (Test(kinds, XsdDateTimeFlags.GDay) && ParseChar(i, '-') && ParseChar(i + s_Lz_, '-') && ParseChar(i + s_Lz__, '-') && Parse2Dig(i + s_Lz___, ref day) && 1 <= day && day <= DateTime.DaysInMonth(1904, 1) && ParseZoneAndWhitespace(i + s_lz___dd))
146 {
147 year = 1904;
148 month = 1;
149 typeCode = DateTimeTypeCode.GDay;
150 return true;
151 }
152 return false;
153 }
bool ParseChar(int start, char ch)
bool ParseTimeAndZoneAndWhitespace(int start)
bool Parse4Dig(int start, ref int num)
static bool Test(XsdDateTimeFlags left, XsdDateTimeFlags right)
bool Parse2Dig(int start, ref int num)
static readonly int s_lz__mm
static readonly int s_lzyyyy_MM_dd
static readonly int s_lz__mm__
static readonly int s_lz__mm_
static readonly int s_lz__mm_dd
static readonly int s_lzyyyy_MM
static readonly int s_lzyyyy_
static readonly int s_Lz_
static readonly int s_Lz___
static readonly int s_lz___dd
static readonly int s_Lz__
static readonly int s_lzyyyy_MM_ddT
static readonly int s_lzyyyy

References System.Xml.Schema.XsdDateTime.Parser._length, System.Xml.Schema.XsdDateTime.Parser._text, System.Xml.Schema.XsdDateTime.Parser.day, System.DateTime.DaysInMonth(), System.Xml.Dictionary, System.Xml.Schema.XsdDateTime.Parser.month, System.Xml.Schema.XsdDateTime.Parser.Parse2Dig(), System.Xml.Schema.XsdDateTime.Parser.Parse4Dig(), System.Xml.Schema.XsdDateTime.Parser.ParseChar(), System.Xml.Schema.XsdDateTime.Parser.ParseDate(), System.Xml.Schema.XsdDateTime.Parser.ParseTimeAndWhitespace(), System.Xml.Schema.XsdDateTime.Parser.ParseTimeAndZoneAndWhitespace(), System.Xml.Schema.XsdDateTime.Parser.ParseZoneAndWhitespace(), System.Xml.Schema.XsdDateTime.s_Lz_, System.Xml.Schema.XsdDateTime.s_Lz__, System.Xml.Schema.XsdDateTime.s_Lz___, System.Xml.Schema.XsdDateTime.s_lz___dd, System.Xml.Schema.XsdDateTime.s_lz__mm, System.Xml.Schema.XsdDateTime.s_lz__mm_, System.Xml.Schema.XsdDateTime.s_lz__mm__, System.Xml.Schema.XsdDateTime.s_lz__mm_dd, System.Xml.Schema.XsdDateTime.s_lzyyyy, System.Xml.Schema.XsdDateTime.s_lzyyyy_, System.Xml.Schema.XsdDateTime.s_lzyyyy_MM, System.Xml.Schema.XsdDateTime.s_lzyyyy_MM_dd, System.Xml.Schema.XsdDateTime.s_lzyyyy_MM_ddT, System.Xml.Schema.XsdDateTime.Parser.Test(), System.text, System.Xml.Schema.XsdDateTime.Parser.typeCode, and System.Xml.Schema.XsdDateTime.Parser.year.