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

◆ GetCharCount() [5/6]

unsafe override int System.Text.OSEncoding.GetCharCount ( byte[] bytes,
int index,
int count )
inline

Definition at line 139 of file OSEncoding.cs.

140 {
141 if (bytes == null)
142 {
143 throw new ArgumentNullException("bytes", System.SR.ArgumentNull_Array);
144 }
145 if (index < 0 || count < 0)
146 {
147 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", System.SR.ArgumentOutOfRange_NeedNonNegNum);
148 }
149 if (bytes.Length - index < count)
150 {
151 throw new ArgumentOutOfRangeException("bytes", System.SR.ArgumentOutOfRange_IndexCountBuffer);
152 }
153 if (count == 0)
154 {
155 return 0;
156 }
157 fixed (byte* ptr = bytes)
158 {
159 return MultiByteToWideChar(_codePage, ptr + index, count, null, 0);
160 }
161 }
static string ArgumentOutOfRange_IndexCountBuffer
Definition SR.cs:78
static string ArgumentNull_Array
Definition SR.cs:24
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.ArgumentNull_Array, System.SR.ArgumentOutOfRange_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.bytes, System.count, System.index, and System.Text.OSEncoding.MultiByteToWideChar().