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

◆ TryParseLocalPart()

static bool System.Net.Mail.MailAddressParser.TryParseLocalPart ( string data,
ref int index,
bool expectAngleBracket,
bool expectMultipleAddresses,
[NotNullWhen(true)] out string localPart,
bool throwExceptionIfFail )
inlinestaticprivate

Definition at line 148 of file MailAddressParser.cs.

149 {
151 {
152 localPart = null;
153 return false;
154 }
155 int num = index;
156 if (data[index] == '"')
157 {
158 if (!QuotedStringFormatReader.TryReadReverseQuoted(data, index, permitUnicode: true, out index, throwExceptionIfFail))
159 {
160 localPart = null;
161 return false;
162 }
163 }
164 else
165 {
166 if (!DotAtomReader.TryReadReverse(data, index, out index, throwExceptionIfFail))
167 {
168 localPart = null;
169 return false;
170 }
171 if (index >= 0 && !MailBnfHelper.IsAllowedWhiteSpace(data[index]) && data[index] != ')' && (!expectAngleBracket || data[index] != '<') && (!expectMultipleAddresses || data[index] != ',') && data[index] != '"')
172 {
174 {
175 throw new FormatException(System.SR.Format(System.SR.MailHeaderFieldInvalidCharacter, data[index]));
176 }
177 localPart = null;
178 return false;
179 }
180 }
181 localPart = data.Substring(index + 1, num - index);
182 if (!WhitespaceReader.TryReadCfwsReverse(data, index, out index, throwExceptionIfFail))
183 {
184 return false;
185 }
187 {
188 return false;
189 }
190 return true;
191 }
static bool TryReadCfwsAndThrowIfIncomplete(string data, int index, out int outIndex, bool throwExceptionIfFail)
static bool TryNormalizeOrThrow(string input, [NotNullWhen(true)] out string normalizedString, bool throwExceptionIfFail)
static bool IsAllowedWhiteSpace(char c)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string MailHeaderFieldInvalidCharacter
Definition SR.cs:140
Definition SR.cs:7

References System.SR.Format(), System.index, System.Net.Mime.MailBnfHelper.IsAllowedWhiteSpace(), System.SR.MailHeaderFieldInvalidCharacter, System.Net.Mail.MailAddressParser.TryNormalizeOrThrow(), System.Net.Mail.MailAddressParser.TryReadCfwsAndThrowIfIncomplete(), System.Net.Mail.WhitespaceReader.TryReadCfwsReverse(), System.Net.Mail.DotAtomReader.TryReadReverse(), and System.Net.Mail.QuotedStringFormatReader.TryReadReverseQuoted().

Referenced by System.Net.Mail.MailAddressParser.TryParseAddress().