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

◆ ReadBytes()

int System.Xml.XmlBaseReader.ReadBytes ( Encoding encoding,
int byteBlock,
int charBlock,
byte[] buffer,
int offset,
int byteCount,
bool readContent )
inlineprivateinherited

Definition at line 2520 of file XmlBaseReader.cs.

2521 {
2522 if (_trailByteCount > 0)
2523 {
2524 int num = Math.Min(_trailByteCount, byteCount);
2525 Buffer.BlockCopy(_trailBytes, 0, buffer, offset, num);
2526 _trailByteCount -= num;
2527 Buffer.BlockCopy(_trailBytes, num, _trailBytes, 0, _trailByteCount);
2528 return num;
2529 }
2530 XmlNodeType nodeType = _node.NodeType;
2531 if (nodeType == XmlNodeType.Element || nodeType == XmlNodeType.EndElement)
2532 {
2533 return 0;
2534 }
2536 char[] charBuffer = GetCharBuffer(num2);
2537 int num3 = 0;
2538 while (true)
2539 {
2540 if (_trailCharCount > 0)
2541 {
2544 _trailCharCount = 0;
2545 }
2546 while (num3 < charBlock)
2547 {
2548 int num4;
2549 if (readContent)
2550 {
2552 if (num4 == 1 && charBuffer[num3] == '\n')
2553 {
2554 continue;
2555 }
2556 }
2557 else
2558 {
2560 }
2561 if (num4 == 0)
2562 {
2563 break;
2564 }
2565 num3 += num4;
2566 }
2567 if (num3 >= charBlock)
2568 {
2570 if (_trailCharCount > 0)
2571 {
2572 if (_trailChars == null)
2573 {
2574 _trailChars = new char[4];
2575 }
2578 }
2579 }
2580 try
2581 {
2582 if (byteCount < byteBlock)
2583 {
2584 if (_trailBytes == null)
2585 {
2586 _trailBytes = new byte[3];
2587 }
2589 int num5 = Math.Min(_trailByteCount, byteCount);
2590 Buffer.BlockCopy(_trailBytes, 0, buffer, offset, num5);
2593 return num5;
2594 }
2595 return encoding.GetBytes(charBuffer, 0, num3, buffer, offset);
2596 }
2597 catch (FormatException ex)
2598 {
2599 int num6 = 0;
2600 int num7 = 0;
2601 while (true)
2602 {
2603 if (num7 < num3 && XmlConverter.IsWhitespace(charBuffer[num7]))
2604 {
2605 num7++;
2606 continue;
2607 }
2608 if (num7 == num3)
2609 {
2610 break;
2611 }
2613 }
2614 if (num6 == num3)
2615 {
2616 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(ex.Message, ex.InnerException));
2617 }
2618 num3 = num6;
2619 }
2620 }
2621 }
virtual byte[] GetBytes(char[] chars)
Definition Encoding.cs:781
char[] GetCharBuffer(int count)
override int ReadValueChunk(char[] chars, int offset, int count)
virtual int ReadContentAsChars(char[] chars, int offset, int count)

References System.Xml.XmlBaseReader._node, System.Xml.XmlBaseReader._trailByteCount, System.Xml.XmlBaseReader._trailBytes, System.Xml.XmlBaseReader._trailCharCount, System.Xml.XmlBaseReader._trailChars, System.Buffer.BlockCopy(), System.buffer, System.byteCount, System.Array.Copy(), System.Xml.Dictionary, System.Text.Encoding.GetBytes(), System.Xml.XmlBaseReader.GetCharBuffer(), System.Xml.XmlConverter.IsWhitespace(), System.Math.Min(), System.Xml.XmlBaseReader.XmlNode.NodeType, System.offset, System.Xml.XmlDictionaryReader.ReadContentAsChars(), System.Xml.XmlBaseReader.ReadValueChunk(), System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(), and System.Xml.XmlException.

Referenced by System.Xml.XmlBaseReader.ReadContentAsBase64(), System.Xml.XmlBaseReader.ReadContentAsBinHex(), and System.Xml.XmlBaseReader.ReadValueAsBase64().