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

◆ GetBytes() [4/9]

unsafe override int System.Text.EncodingNLS.GetBytes ( char[] chars,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex )
inlineinherited

Definition at line 171 of file EncodingNLS.cs.

172 {
173 if (chars == null || bytes == null)
174 {
175 throw new ArgumentNullException((chars == null) ? "chars" : "bytes", System.SR.ArgumentNull_Array);
176 }
177 if (charIndex < 0 || charCount < 0)
178 {
179 throw new ArgumentOutOfRangeException((charIndex < 0) ? "charIndex" : "charCount", System.SR.ArgumentOutOfRange_NeedNonNegNum);
180 }
181 if (chars.Length - charIndex < charCount)
182 {
183 throw new ArgumentOutOfRangeException("chars", System.SR.ArgumentOutOfRange_IndexCountBuffer);
184 }
185 if (byteIndex < 0 || byteIndex > bytes.Length)
186 {
187 throw new ArgumentOutOfRangeException("byteIndex", System.SR.ArgumentOutOfRange_Index);
188 }
189 if (chars.Length == 0)
190 {
191 return 0;
192 }
193 int byteCount = bytes.Length - byteIndex;
194 if (bytes.Length == 0)
195 {
196 bytes = new byte[1];
197 }
198 fixed (char* ptr = &chars[0])
199 {
200 fixed (byte* ptr2 = &bytes[0])
201 {
202 return GetBytes(ptr + charIndex, charCount, ptr2 + byteIndex, byteCount, null);
203 }
204 }
205 }
static string ArgumentOutOfRange_Index
Definition SR.cs:30
static string ArgumentOutOfRange_IndexCountBuffer
Definition SR.cs:78
Definition SR.cs:7
unsafe int GetBytes(char *chars, int charCount, byte *bytes, int byteCount, System.Text.EncoderNLS encoder)

References System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_Index, System.SR.ArgumentOutOfRange_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, and System.Text.EncodingNLS.GetBytes().