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

◆ EncodeAsync()

static async Task System.Xml.BinHexEncoder.EncodeAsync ( byte[] buffer,
int index,
int count,
XmlWriter writer )
inlinestaticpackage

Definition at line 42 of file BinHexEncoder.cs.

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 }
static void EncodeToUtf16(ReadOnlySpan< byte > bytes, Span< char > chars, Casing casing=Casing.Upper)

References System.buffer, System.chars, System.count, System.Xml.Dictionary, System.HexConverter.EncodeToUtf16(), System.endIndex, System.index, and System.writer.

Referenced by System.Xml.XmlWriter.WriteBinHexAsync().