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

◆ Convert() [4/5]

unsafe override void System.Text.OSEncoder.Convert ( char[] chars,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex,
int byteCount,
bool flush,
out int charsUsed,
out int bytesUsed,
out bool completed )
inlinevirtual

Reimplemented from System.Text.Encoder.

Definition at line 172 of file OSEncoder.cs.

173 {
174 if (chars == null || bytes == null)
175 {
176 throw new ArgumentNullException((chars == null) ? "chars" : "bytes", System.SR.ArgumentNull_Array);
177 }
178 if (charIndex < 0 || charCount < 0)
179 {
180 throw new ArgumentOutOfRangeException((charIndex < 0) ? "charIndex" : "charCount", System.SR.ArgumentOutOfRange_NeedNonNegNum);
181 }
182 if (byteIndex < 0 || byteCount < 0)
183 {
184 throw new ArgumentOutOfRangeException((byteIndex < 0) ? "byteIndex" : "byteCount", System.SR.ArgumentOutOfRange_NeedNonNegNum);
185 }
186 if (chars.Length - charIndex < charCount)
187 {
188 throw new ArgumentOutOfRangeException("chars", System.SR.ArgumentOutOfRange_IndexCountBuffer);
189 }
190 if (bytes.Length - byteIndex < byteCount)
191 {
192 throw new ArgumentOutOfRangeException("bytes", System.SR.ArgumentOutOfRange_IndexCountBuffer);
193 }
194 if (bytes.Length == 0 || (chars.Length == 0 && (_charLeftOver == '\0' || !flush)))
195 {
196 bytesUsed = 0;
197 charsUsed = 0;
198 completed = false;
199 return;
200 }
201 fixed (char* ptr = chars)
202 {
203 fixed (byte* ptr2 = &bytes[0])
204 {
205 Unsafe.SkipInit(out char c);
206 char* chars2 = ((ptr == null) ? (&c) : (ptr + charIndex));
207 Convert(chars2, charCount, ptr2 + byteIndex, byteCount, flush, out charsUsed, out bytesUsed, out completed);
208 }
209 }
210 }
static string ArgumentOutOfRange_IndexCountBuffer
Definition SR.cs:78
Definition SR.cs:7
unsafe override void Convert(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed)
Definition OSEncoder.cs:172

References System.Text.OSEncoder._charLeftOver, System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, and System.Text.OSEncoder.Convert().