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

◆ WriteSpan()

unsafe void System.IO.StreamWriter.WriteSpan ( ReadOnlySpan< char > buffer,
bool appendNewLine )
inlineprivate

Definition at line 369 of file StreamWriter.cs.

370 {
372 if (buffer.Length <= 4 && buffer.Length <= _charLen - _charPos)
373 {
374 for (int i = 0; i < buffer.Length; i++)
375 {
377 }
378 }
379 else
380 {
382 char[] charBuffer = _charBuffer;
383 fixed (char* ptr = &MemoryMarshal.GetReference(buffer))
384 {
385 fixed (char* ptr3 = &charBuffer[0])
386 {
387 char* ptr2 = ptr;
388 int num = buffer.Length;
389 int num2 = _charPos;
390 while (num > 0)
391 {
392 if (num2 == charBuffer.Length)
393 {
394 Flush(flushStream: false, flushEncoder: false);
395 num2 = 0;
396 }
397 int num3 = Math.Min(charBuffer.Length - num2, num);
398 int num4 = num3 * 2;
399 Buffer.MemoryCopy(ptr2, ptr3 + num2, num4, num4);
400 _charPos += num3;
401 num2 += num3;
402 ptr2 += num3;
403 num -= num3;
404 }
405 }
406 }
407 }
408 if (appendNewLine)
409 {
410 char[] coreNewLine = CoreNewLine;
411 for (int j = 0; j < coreNewLine.Length; j++)
412 {
413 if (_charPos == _charLen)
414 {
415 Flush(flushStream: false, flushEncoder: false);
416 }
417 _charBuffer[_charPos] = coreNewLine[j];
418 _charPos++;
419 }
420 }
421 if (_autoFlush)
422 {
423 Flush(flushStream: true, flushEncoder: false);
424 }
425 }
readonly char[] _charBuffer
override void Flush()

References System.IO.StreamWriter._autoFlush, System.IO.StreamWriter._charBuffer, System.IO.StreamWriter._charLen, System.IO.StreamWriter._charPos, System.buffer, System.IO.StreamWriter.CheckAsyncTaskInProgress(), System.IO.TextWriter.CoreNewLine, System.IO.StreamWriter.Flush(), System.Buffer.MemoryCopy(), System.Math.Min(), and System.IO.StreamWriter.ThrowIfDisposed().

Referenced by System.IO.StreamWriter.Write(), System.IO.StreamWriter.Write(), System.IO.StreamWriter.Write(), System.IO.StreamWriter.Write(), System.IO.StreamWriter.WriteFormatHelper(), System.IO.StreamWriter.WriteLine(), and System.IO.StreamWriter.WriteLine().