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

◆ GetBytes() [7/10]

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

Definition at line 43 of file RestrictedAsciiStringEncoding.cs.

44 {
45 if (chars.IsEmpty)
46 {
47 return 0;
48 }
49 for (int i = 0; i < chars.Length; i++)
50 {
51 char c = chars[i];
52 if ((uint)c >= (uint)_isAllowed.Length || !_isAllowed[(uint)c])
53 {
54 base.EncoderFallback.CreateFallbackBuffer().Fallback(c, i);
55 throw new InvalidOperationException();
56 }
57 if (write)
58 {
59 bytes[i] = (byte)c;
60 }
61 }
62 return chars.Length;
63 }

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