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

◆ GetChars() [7/7]

override int System.Formats.Asn1.RestrictedAsciiStringEncoding.GetChars ( ReadOnlySpan< byte > bytes,
Span< char > chars,
bool write )
inlineprotectedinherited

Definition at line 65 of file RestrictedAsciiStringEncoding.cs.

66 {
67 if (bytes.IsEmpty)
68 {
69 return 0;
70 }
71 for (int i = 0; i < bytes.Length; i++)
72 {
73 byte b = bytes[i];
74 if ((uint)b >= (uint)_isAllowed.Length || !_isAllowed[b])
75 {
76 base.DecoderFallback.CreateFallbackBuffer().Fallback(new byte[1] { b }, i);
77 throw new InvalidOperationException();
78 }
79 if (write)
80 {
81 chars[i] = (char)b;
82 }
83 }
84 return bytes.Length;
85 }

References System.Formats.Asn1.RestrictedAsciiStringEncoding._isAllowed, System.bytes, and System.chars.