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

◆ GetBytes() [4/9]

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

Definition at line 149 of file Latin1Encoding.cs.

150 {
151 if (chars == null || bytes == null)
152 {
153 ThrowHelper.ThrowArgumentNullException((chars == null) ? ExceptionArgument.chars : ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
154 }
155 if ((charIndex | charCount) < 0)
156 {
157 ThrowHelper.ThrowArgumentOutOfRangeException((charIndex < 0) ? ExceptionArgument.charIndex : ExceptionArgument.charCount, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
158 }
159 if (chars.Length - charIndex < charCount)
160 {
161 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCount);
162 }
163 if ((uint)byteIndex > bytes.Length)
164 {
165 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index);
166 }
167 fixed (char* ptr = chars)
168 {
169 fixed (byte* ptr2 = bytes)
170 {
171 return GetBytesCommon(ptr + charIndex, charCount, ptr2 + byteIndex, bytes.Length - byteIndex);
172 }
173 }
174 }
unsafe int GetBytesCommon(char *pChars, int charCount, byte *pBytes, int byteCount)

References System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, System.Text.Latin1Encoding.GetBytesCommon(), System.ThrowHelper.ThrowArgumentNullException(), and System.ThrowHelper.ThrowArgumentOutOfRangeException().