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

◆ GetBytes() [10/11]

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

Reimplemented from System.Text.Encoding.

Definition at line 69 of file OSEncoding.cs.

70 {
71 if (s == null || bytes == null)
72 {
73 throw new ArgumentNullException((s == null) ? "s" : "bytes", System.SR.ArgumentNull_Array);
74 }
75 if (charIndex < 0 || charCount < 0)
76 {
77 throw new ArgumentOutOfRangeException((charIndex < 0) ? "charIndex" : "charCount", System.SR.ArgumentOutOfRange_NeedNonNegNum);
78 }
79 if (s.Length - charIndex < charCount)
80 {
81 throw new ArgumentOutOfRangeException("s", System.SR.ArgumentOutOfRange_IndexCount);
82 }
83 if (byteIndex < 0 || byteIndex > bytes.Length)
84 {
85 throw new ArgumentOutOfRangeException("byteIndex", System.SR.ArgumentOutOfRange_Index);
86 }
87 if (charCount == 0)
88 {
89 return 0;
90 }
91 if (bytes.Length == 0)
92 {
93 throw new ArgumentOutOfRangeException(System.SR.Argument_EncodingConversionOverflowBytes);
94 }
95 fixed (char* ptr = s)
96 {
97 fixed (byte* ptr2 = &bytes[0])
98 {
100 }
101 }
102 }
static string ArgumentOutOfRange_Index
Definition SR.cs:30
static string Argument_EncodingConversionOverflowBytes
Definition SR.cs:84
static string ArgumentOutOfRange_IndexCount
Definition SR.cs:80
Definition SR.cs:7
readonly int _codePage
Definition OSEncoding.cs:5
static unsafe int WideCharToMultiByte(int codePage, char *pChars, int count, byte *pBytes, int byteCount)

References System.Text.OSEncoding._codePage, System.SR.Argument_EncodingConversionOverflowBytes, System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_Index, System.SR.ArgumentOutOfRange_IndexCount, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteIndex, System.bytes, System.charCount, System.charIndex, System.s, and System.Text.OSEncoding.WideCharToMultiByte().