Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ GetBytes() [1/3]

virtual unsafe int System.Text.Encoder.GetBytes ( char * chars,
int charCount,
byte * bytes,
int byteCount,
bool flush )
inlinevirtual

Reimplemented in System.Text.OSEncoder, System.Text.OSEncoder, System.Text.EncoderNLS, System.Text.Encoding.DefaultEncoder, and System.Text.EncoderNLS.

Definition at line 96 of file Encoder.cs.

97 {
98 if (bytes == null || chars == null)
99 {
100 throw new ArgumentNullException((bytes == null) ? "bytes" : "chars", SR.ArgumentNull_Array);
101 }
102 if (charCount < 0 || byteCount < 0)
103 {
104 throw new ArgumentOutOfRangeException((charCount < 0) ? "charCount" : "byteCount", SR.ArgumentOutOfRange_NeedNonNegNum);
105 }
106 char[] array = new char[charCount];
107 for (int i = 0; i < charCount; i++)
108 {
109 array[i] = chars[i];
110 }
111 byte[] array2 = new byte[byteCount];
112 int bytes2 = GetBytes(array, 0, charCount, array2, 0, flush);
113 if (bytes2 < byteCount)
114 {
115 byteCount = bytes2;
116 }
117 for (int i = 0; i < byteCount; i++)
118 {
119 bytes[i] = array2[i];
120 }
121 return byteCount;
122 }
int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush)

References System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.array, System.byteCount, System.bytes, System.charCount, System.chars, and System.Text.Encoder.GetBytes().