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

◆ GetBytes() [8/9]

unsafe override int System.Text.Latin1Encoding.GetBytes ( string s,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex )
inlinevirtualinherited

Reimplemented from System.Text.Encoding.

Definition at line 187 of file Latin1Encoding.cs.

188 {
189 if (s == null || bytes == null)
190 {
191 ThrowHelper.ThrowArgumentNullException((s == null) ? ExceptionArgument.s : ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
192 }
193 if ((charIndex | charCount) < 0)
194 {
195 ThrowHelper.ThrowArgumentOutOfRangeException((charIndex < 0) ? ExceptionArgument.charIndex : ExceptionArgument.charCount, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
196 }
197 if (s.Length - charIndex < charCount)
198 {
199 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.s, ExceptionResource.ArgumentOutOfRange_IndexCount);
200 }
201 if ((uint)byteIndex > bytes.Length)
202 {
203 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index);
204 }
205 fixed (char* ptr2 = s)
206 {
207 fixed (byte[] array = bytes)
208 {
209 byte* ptr = (byte*)((bytes != null && array.Length != 0) ? System.Runtime.CompilerServices.Unsafe.AsPointer(ref array[0]) : null);
210 return GetBytesCommon(ptr2 + charIndex, charCount, ptr + byteIndex, bytes.Length - byteIndex);
211 }
212 }
213 }
unsafe int GetBytesCommon(char *pChars, int charCount, byte *pBytes, int byteCount)

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