Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BinHexEncoder.cs
Go to the documentation of this file.
2
3namespace System.Xml;
4
5internal static class BinHexEncoder
6{
7 internal static void Encode(byte[] buffer, int index, int count, XmlWriter writer)
8 {
9 if (buffer == null)
10 {
11 throw new ArgumentNullException("buffer");
12 }
13 if (index < 0)
14 {
15 throw new ArgumentOutOfRangeException("index");
16 }
17 if (count < 0)
18 {
19 throw new ArgumentOutOfRangeException("count");
20 }
21 if (count > buffer.Length - index)
22 {
23 throw new ArgumentOutOfRangeException("count");
24 }
25 char[] array = new char[(count * 2 < 128) ? (count * 2) : 128];
26 int num = index + count;
27 while (index < num)
28 {
29 int num2 = ((count < 64) ? count : 64);
31 writer.WriteRaw(array, 0, num2 * 2);
32 index += num2;
33 count -= num2;
34 }
35 }
36
37 internal static string Encode(byte[] inArray, int offsetIn, int count)
38 {
40 }
41
42 internal static async Task EncodeAsync(byte[] buffer, int index, int count, XmlWriter writer)
43 {
44 if (buffer == null)
45 {
46 throw new ArgumentNullException("buffer");
47 }
48 if (index < 0)
49 {
50 throw new ArgumentOutOfRangeException("index");
51 }
52 if (count < 0)
53 {
54 throw new ArgumentOutOfRangeException("count");
55 }
56 if (count > buffer.Length - index)
57 {
58 throw new ArgumentOutOfRangeException("count");
59 }
60 char[] chars = new char[(count * 2 < 128) ? (count * 2) : 128];
61 int endIndex = index + count;
62 while (index < endIndex)
63 {
64 int cnt = ((count < 64) ? count : 64);
66 await writer.WriteRawAsync(chars, 0, cnt * 2).ConfigureAwait(continueOnCapturedContext: false);
67 index += cnt;
68 count -= cnt;
69 }
70 }
71}
static string ToHexString(byte[] inArray)
Definition Convert.cs:3159
static void EncodeToUtf16(ReadOnlySpan< byte > bytes, Span< char > chars, Casing casing=Casing.Upper)
static void Encode(byte[] buffer, int index, int count, XmlWriter writer)
static async Task EncodeAsync(byte[] buffer, int index, int count, XmlWriter writer)
static string Encode(byte[] inArray, int offsetIn, int count)