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

◆ Convert() [2/5]

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

Reimplemented from System.Text.Encoder.

Definition at line 212 of file OSEncoder.cs.

213 {
214 if (bytes == null || chars == null)
215 {
216 throw new ArgumentNullException((bytes == null) ? "bytes" : "chars", System.SR.ArgumentNull_Array);
217 }
218 if (charCount < 0 || byteCount < 0)
219 {
220 throw new ArgumentOutOfRangeException((charCount < 0) ? "charCount" : "byteCount", System.SR.ArgumentOutOfRange_NeedNonNegNum);
221 }
222 int num;
223 for (num = charCount; num > 0; num /= 2)
224 {
225 int byteCount2 = GetByteCount(chars, num, flush);
226 if (byteCount2 <= byteCount)
227 {
228 break;
229 }
230 }
231 if (num > 0)
232 {
233 bytesUsed = GetBytes(chars, num, bytes, byteCount, flush);
234 charsUsed = num;
235 completed = _charLeftOver == '\0' && charCount == num;
236 }
237 else
238 {
239 bytesUsed = 0;
240 charsUsed = 0;
241 completed = false;
242 }
243 }
unsafe override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush)
Definition OSEncoder.cs:96
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_NeedNonNegNum, System.byteCount, System.bytes, System.charCount, System.chars, System.Text.OSEncoder.GetByteCount(), and System.Text.OSEncoder.GetBytes().