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

◆ GetAscii() [3/3]

unsafe string System.Globalization.IdnMapping.GetAscii ( string unicode,
int index,
int count )
inline

Definition at line 58 of file IdnMapping.cs.

59 {
60 if (unicode == null)
61 {
62 throw new ArgumentNullException("unicode");
63 }
64 if (index < 0 || count < 0)
65 {
66 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
67 }
68 if (index > unicode.Length)
69 {
70 throw new ArgumentOutOfRangeException("index", SR.ArgumentOutOfRange_Index);
71 }
72 if (index > unicode.Length - count)
73 {
74 throw new ArgumentOutOfRangeException("unicode", SR.ArgumentOutOfRange_IndexCountBuffer);
75 }
76 if (count == 0)
77 {
78 throw new ArgumentException(SR.Argument_IdnBadLabelSize, "unicode");
79 }
80 if (unicode[index + count - 1] == '\0')
81 {
82 throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, index + count - 1), "unicode");
83 }
84 if (GlobalizationMode.Invariant)
85 {
86 return GetAsciiInvariant(unicode, index, count);
87 }
88 fixed (char* ptr = unicode)
89 {
90 if (!GlobalizationMode.UseNls)
91 {
92 return IcuGetAsciiCore(unicode, ptr + index, count);
93 }
94 return NlsGetAsciiCore(unicode, ptr + index, count);
95 }
96 }
unsafe string IcuGetAsciiCore(string unicodeString, char *unicode, int count)
string GetAsciiInvariant(string unicode, int index, int count)
unsafe string NlsGetAsciiCore(string unicodeString, char *unicode, int count)

References System.SR.Argument_IdnBadLabelSize, System.SR.Argument_InvalidCharSequence, System.SR.ArgumentOutOfRange_Index, System.SR.ArgumentOutOfRange_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.count, System.SR.Format(), System.Globalization.IdnMapping.GetAsciiInvariant(), System.Globalization.IdnMapping.IcuGetAsciiCore(), System.index, System.Globalization.GlobalizationMode.Invariant, System.Globalization.IdnMapping.NlsGetAsciiCore(), and System.Globalization.GlobalizationMode.UseNls.