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

◆ TryParseAddress() [1/2]

static bool System.Net.Mail.MailAddressParser.TryParseAddress ( string data,
bool expectMultipleAddresses,
ref int index,
out ParseAddressInfo parseAddressInfo,
bool throwExceptionIfFail )
inlinestaticprivate

Definition at line 27 of file MailAddressParser.cs.

28 {
30 {
31 parseAddressInfo = default(ParseAddressInfo);
32 return false;
33 }
34 bool flag = false;
35 if (data[index] == '>')
36 {
37 flag = true;
38 index--;
39 }
41 {
42 parseAddressInfo = default(ParseAddressInfo);
43 return false;
44 }
45 if (data[index] != '@')
46 {
48 {
49 throw new FormatException(System.SR.MailAddressInvalidFormat);
50 }
51 parseAddressInfo = default(ParseAddressInfo);
52 return false;
53 }
54 index--;
56 {
57 parseAddressInfo = default(ParseAddressInfo);
58 return false;
59 }
60 if (flag)
61 {
62 if (index < 0 || data[index] != '<')
63 {
65 {
66 throw new FormatException(System.SR.Format(System.SR.MailHeaderFieldInvalidCharacter, (index >= 0) ? data[index] : '>'));
67 }
68 parseAddressInfo = default(ParseAddressInfo);
69 return false;
70 }
71 index--;
72 if (!WhitespaceReader.TryReadFwsReverse(data, index, out index, throwExceptionIfFail))
73 {
74 parseAddressInfo = default(ParseAddressInfo);
75 return false;
76 }
77 }
78 string displayName;
79 if (index >= 0 && (!expectMultipleAddresses || data[index] != ','))
80 {
82 {
83 parseAddressInfo = default(ParseAddressInfo);
84 return false;
85 }
86 }
87 else
88 {
89 displayName = string.Empty;
90 }
91 parseAddressInfo = new ParseAddressInfo(displayName, localPart, domain);
92 return true;
93 }
static bool TryParseDisplayName(string data, ref int index, bool expectMultipleAddresses, [NotNullWhen(true)] out string displayName, bool throwExceptionIfFail)
static bool TryParseDomain(string data, ref int index, [NotNullWhen(true)] out string domain, bool throwExceptionIfFail)
static bool TryReadCfwsAndThrowIfIncomplete(string data, int index, out int outIndex, bool throwExceptionIfFail)
static bool TryParseLocalPart(string data, ref int index, bool expectAngleBracket, bool expectMultipleAddresses, [NotNullWhen(true)] out string localPart, bool throwExceptionIfFail)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string MailHeaderFieldInvalidCharacter
Definition SR.cs:140
static string MailAddressInvalidFormat
Definition SR.cs:148
Definition SR.cs:7

References System.SR.Format(), System.index, System.SR.MailAddressInvalidFormat, System.SR.MailHeaderFieldInvalidCharacter, System.Net.Mail.MailAddressParser.TryParseDisplayName(), System.Net.Mail.MailAddressParser.TryParseDomain(), System.Net.Mail.MailAddressParser.TryParseLocalPart(), System.Net.Mail.MailAddressParser.TryReadCfwsAndThrowIfIncomplete(), and System.Net.Mail.WhitespaceReader.TryReadFwsReverse().