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

◆ GetByteCount() [4/5]

unsafe override int System.Text.OSEncoder.GetByteCount ( char[] chars,
int index,
int count,
bool flush )
inline

Definition at line 22 of file OSEncoder.cs.

23 {
24 if (chars == null)
25 {
26 throw new ArgumentNullException("chars", System.SR.ArgumentNull_Array);
27 }
28 if (index < 0 || count < 0)
29 {
30 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", System.SR.ArgumentOutOfRange_NeedNonNegNum);
31 }
32 if (chars.Length - index < count)
33 {
34 throw new ArgumentOutOfRangeException("chars", System.SR.ArgumentOutOfRange_IndexCountBuffer);
35 }
36 if (chars.Length == 0 && (_charLeftOver == '\0' || !flush))
37 {
38 return 0;
39 }
40 fixed (char* ptr = chars)
41 {
42 Unsafe.SkipInit(out char c);
43 char* chars2 = ((ptr == null) ? (&c) : (ptr + index));
44 return GetByteCount(chars2, count, flush);
45 }
46 }
static string ArgumentOutOfRange_IndexCountBuffer
Definition SR.cs:78
static string ArgumentNull_Array
Definition SR.cs:24
Definition SR.cs:7
unsafe override int GetByteCount(char[] chars, int index, int count, bool flush)
Definition OSEncoder.cs:22

References System.Text.OSEncoder._charLeftOver, System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.chars, System.count, System.Text.OSEncoder.GetByteCount(), and System.index.