Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SafeAsciiDecoder.cs
Go to the documentation of this file.
1using System.Text;
2
3namespace System.Xml;
4
5internal sealed class SafeAsciiDecoder : Decoder
6{
7 public override int GetCharCount(byte[] bytes, int index, int count)
8 {
9 return count;
10 }
11
12 public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
13 {
14 int num = byteIndex;
15 int num2 = charIndex;
16 while (num < byteIndex + byteCount)
17 {
18 chars[num2++] = (char)bytes[num++];
19 }
20 return byteCount;
21 }
22
23 public override void Convert(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed)
24 {
25 if (charCount < byteCount)
26 {
28 completed = false;
29 }
30 else
31 {
32 completed = true;
33 }
34 int num = byteIndex;
35 int num2 = charIndex;
36 int num3 = byteIndex + byteCount;
37 while (num < num3)
38 {
39 chars[num2++] = (char)bytes[num++];
40 }
41 charsUsed = byteCount;
42 bytesUsed = byteCount;
43 }
44}
override int GetCharCount(byte[] bytes, int index, int count)
override void Convert(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed)
override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)