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

◆ GetChars() [5/7]

unsafe override int System.Text.OSEncoding.GetChars ( byte[] bytes,
int byteIndex,
int byteCount,
char[] chars,
int charIndex )
inline

Definition at line 163 of file OSEncoding.cs.

164 {
165 if (bytes == null || chars == null)
166 {
167 throw new ArgumentNullException((bytes == null) ? "bytes" : "chars", System.SR.ArgumentNull_Array);
168 }
169 if (byteIndex < 0 || byteCount < 0)
170 {
171 throw new ArgumentOutOfRangeException((byteIndex < 0) ? "byteIndex" : "byteCount", System.SR.ArgumentOutOfRange_NeedNonNegNum);
172 }
173 if (bytes.Length - byteIndex < byteCount)
174 {
175 throw new ArgumentOutOfRangeException("bytes", System.SR.ArgumentOutOfRange_IndexCountBuffer);
176 }
177 if (charIndex < 0 || charIndex > chars.Length)
178 {
179 throw new ArgumentOutOfRangeException("charIndex", System.SR.ArgumentOutOfRange_Index);
180 }
181 if (byteCount == 0)
182 {
183 return 0;
184 }
185 if (chars.Length == 0)
186 {
187 throw new ArgumentOutOfRangeException(System.SR.Argument_EncodingConversionOverflowChars);
188 }
189 fixed (byte* ptr = bytes)
190 {
191 fixed (char* ptr2 = &chars[0])
192 {
193 return MultiByteToWideChar(_codePage, ptr + byteIndex, byteCount, ptr2 + charIndex, chars.Length - charIndex);
194 }
195 }
196 }
static string ArgumentOutOfRange_Index
Definition SR.cs:30
static string Argument_EncodingConversionOverflowChars
Definition SR.cs:86
static string ArgumentOutOfRange_IndexCountBuffer
Definition SR.cs:78
Definition SR.cs:7
readonly int _codePage
Definition OSEncoding.cs:5
static unsafe int MultiByteToWideChar(int codePage, byte *pBytes, int byteCount, char *pChars, int count)

References System.Text.OSEncoding._codePage, System.SR.Argument_EncodingConversionOverflowChars, System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_Index, System.SR.ArgumentOutOfRange_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.byteIndex, System.bytes, System.charIndex, System.chars, and System.Text.OSEncoding.MultiByteToWideChar().