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

◆ TryParseDisplayName()

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

Definition at line 193 of file MailAddressParser.cs.

194 {
195 if (!WhitespaceReader.TryReadCfwsReverse(data, index, out var outIndex, throwExceptionIfFail))
196 {
197 displayName = null;
198 return false;
199 }
200 if (outIndex >= 0 && data[outIndex] == '"')
201 {
202 if (!QuotedStringFormatReader.TryReadReverseQuoted(data, outIndex, permitUnicode: true, out index, throwExceptionIfFail))
203 {
204 displayName = null;
205 return false;
206 }
207 int num = index + 2;
208 displayName = data.Substring(num, outIndex - num);
209 if (!WhitespaceReader.TryReadCfwsReverse(data, index, out index, throwExceptionIfFail))
210 {
211 return false;
212 }
213 if (index >= 0 && (!expectMultipleAddresses || data[index] != ','))
214 {
216 {
217 throw new FormatException(System.SR.Format(System.SR.MailHeaderFieldInvalidCharacter, data[index]));
218 }
219 return false;
220 }
221 }
222 else
223 {
224 int num2 = index;
225 if (!QuotedStringFormatReader.TryReadReverseUnQuoted(data, index, permitUnicode: true, expectMultipleAddresses, out index, throwExceptionIfFail))
226 {
227 displayName = null;
228 return false;
229 }
230 displayName = data.SubstringTrim(index + 1, num2 - index);
231 }
233 {
234 return false;
235 }
236 return true;
237 }
static bool TryNormalizeOrThrow(string input, [NotNullWhen(true)] out string normalizedString, bool throwExceptionIfFail)
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.SR.MailHeaderFieldInvalidCharacter, System.Net.Mail.MailAddressParser.TryNormalizeOrThrow(), System.Net.Mail.WhitespaceReader.TryReadCfwsReverse(), System.Net.Mail.QuotedStringFormatReader.TryReadReverseQuoted(), and System.Net.Mail.QuotedStringFormatReader.TryReadReverseUnQuoted().

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