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

◆ GetBytes() [7/9]

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

Reimplemented from System.Text.Encoding.

Definition at line 117 of file ASCIIEncoding.cs.

118 {
119 if (chars == null || bytes == null)
120 {
121 ThrowHelper.ThrowArgumentNullException((chars == null) ? ExceptionArgument.chars : ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
122 }
123 if ((charIndex | charCount) < 0)
124 {
125 ThrowHelper.ThrowArgumentOutOfRangeException((charIndex < 0) ? ExceptionArgument.charIndex : ExceptionArgument.charCount, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
126 }
127 if (chars.Length - charIndex < charCount)
128 {
129 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCount);
130 }
131 if ((uint)byteIndex > bytes.Length)
132 {
133 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index);
134 }
135 fixed (char* ptr2 = chars)
136 {
137 fixed (byte[] array = bytes)
138 {
139 byte* ptr = (byte*)((bytes != null && array.Length != 0) ? System.Runtime.CompilerServices.Unsafe.AsPointer(ref array[0]) : null);
140 return GetBytesCommon(ptr2 + charIndex, charCount, ptr + byteIndex, bytes.Length - byteIndex);
141 }
142 }
143 }
unsafe int GetBytesCommon(char *pChars, int charCount, byte *pBytes, int byteCount)

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