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

◆ TryReadReverse()

static bool System.Net.Mail.DomainLiteralReader.TryReadReverse ( string data,
int index,
out int outIndex,
bool throwExceptionIfFail )
inlinestaticpackage

Definition at line 7 of file DomainLiteralReader.cs.

8 {
9 index--;
10 do
11 {
12 if (!WhitespaceReader.TryReadFwsReverse(data, index, out index, throwExceptionIfFail))
13 {
14 outIndex = 0;
15 return false;
16 }
17 if (index < 0)
18 {
19 break;
20 }
21 if (!QuotedPairReader.TryCountQuotedChars(data, index, permitUnicodeEscaping: false, out var outIndex2, throwExceptionIfFail))
22 {
23 outIndex = 0;
24 return false;
25 }
26 if (outIndex2 > 0)
27 {
28 index -= outIndex2;
29 continue;
30 }
31 if (data[index] == '[')
32 {
33 outIndex = index - 1;
34 return true;
35 }
36 if (data[index] > '\u007f' || !MailBnfHelper.Dtext[(uint)data[index]])
37 {
38 if (throwExceptionIfFail)
39 {
40 throw new FormatException(System.SR.Format(System.SR.MailHeaderFieldInvalidCharacter, data[index]));
41 }
42 outIndex = 0;
43 return false;
44 }
45 index--;
46 }
47 while (index >= 0);
48 if (throwExceptionIfFail)
49 {
50 throw new FormatException(System.SR.Format(System.SR.MailHeaderFieldInvalidCharacter, ']'));
51 }
52 outIndex = 0;
53 return false;
54 }
static readonly bool[] Dtext
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string MailHeaderFieldInvalidCharacter
Definition SR.cs:140
Definition SR.cs:7

References System.Net.Mime.MailBnfHelper.Dtext, System.SR.Format(), System.index, System.SR.MailHeaderFieldInvalidCharacter, System.Net.Mail.QuotedPairReader.TryCountQuotedChars(), and System.Net.Mail.WhitespaceReader.TryReadFwsReverse().

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