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

◆ WriteNodeAsync_CallAsyncReader()

async Task System.Xml.XmlWriter.WriteNodeAsync_CallAsyncReader ( XmlReader reader,
bool defattr )
inlinepackageinherited

Definition at line 854 of file XmlWriter.cs.

855 {
856 bool canReadChunk = reader.CanReadValueChunk;
857 int d = ((reader.NodeType == XmlNodeType.None) ? (-1) : reader.Depth);
858 do
859 {
860 switch (reader.NodeType)
861 {
862 case XmlNodeType.Element:
863 await WriteStartElementAsync(reader.Prefix, reader.LocalName, reader.NamespaceURI).ConfigureAwait(continueOnCapturedContext: false);
865 if (reader.IsEmptyElement)
866 {
868 }
869 break;
870 case XmlNodeType.Text:
871 if (canReadChunk)
872 {
873 if (_writeNodeBuffer == null)
874 {
875 _writeNodeBuffer = new char[1024];
876 }
877 int count;
878 while ((count = await reader.ReadValueChunkAsync(_writeNodeBuffer, 0, 1024).ConfigureAwait(continueOnCapturedContext: false)) > 0)
879 {
881 }
882 }
883 else
884 {
885 await WriteStringAsync(await reader.GetValueAsync().ConfigureAwait(continueOnCapturedContext: false)).ConfigureAwait(continueOnCapturedContext: false);
886 }
887 break;
888 case XmlNodeType.Whitespace:
889 case XmlNodeType.SignificantWhitespace:
890 await WriteWhitespaceAsync(await reader.GetValueAsync().ConfigureAwait(continueOnCapturedContext: false)).ConfigureAwait(continueOnCapturedContext: false);
891 break;
892 case XmlNodeType.CDATA:
894 break;
895 case XmlNodeType.EntityReference:
897 break;
898 case XmlNodeType.ProcessingInstruction:
899 case XmlNodeType.XmlDeclaration:
901 break;
902 case XmlNodeType.DocumentType:
903 await WriteDocTypeAsync(reader.Name, reader.GetAttribute("PUBLIC"), reader.GetAttribute("SYSTEM"), reader.Value).ConfigureAwait(continueOnCapturedContext: false);
904 break;
905 case XmlNodeType.Comment:
907 break;
908 case XmlNodeType.EndElement:
910 break;
911 }
912 }
913 while (await reader.ReadAsync().ConfigureAwait(continueOnCapturedContext: false) && (d < reader.Depth || (d == reader.Depth && reader.NodeType == XmlNodeType.EndElement)));
914 }
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
Definition Task.cs:226
virtual Task WriteProcessingInstructionAsync(string name, string? text)
Definition XmlWriter.cs:648
virtual async Task WriteAttributesAsync(XmlReader reader, bool defattr)
Definition XmlWriter.cs:737
virtual Task WriteWhitespaceAsync(string? ws)
Definition XmlWriter.cs:663
virtual Task WriteEntityRefAsync(string name)
Definition XmlWriter.cs:653
virtual Task WriteStringAsync(string? text)
Definition XmlWriter.cs:668
virtual Task WriteCommentAsync(string? text)
Definition XmlWriter.cs:643
virtual Task WriteFullEndElementAsync()
Definition XmlWriter.cs:606
virtual Task WriteCDataAsync(string? text)
Definition XmlWriter.cs:638
virtual Task WriteCharsAsync(char[] buffer, int index, int count)
Definition XmlWriter.cs:678
virtual Task WriteEndElementAsync()
Definition XmlWriter.cs:601
virtual Task WriteStartElementAsync(string? prefix, string localName, string? ns)
Definition XmlWriter.cs:596
virtual Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
Definition XmlWriter.cs:591

References System.Xml.XmlWriter._writeNodeBuffer, System.Xml.XmlReader.CanReadValueChunk, System.Threading.Tasks.Task< TResult >.ConfigureAwait(), System.count, System.Xml.XmlReader.Depth, System.Xml.Dictionary, System.Xml.XmlReader.GetAttribute(), System.Xml.XmlReader.GetValueAsync(), System.Xml.XmlReader.IsEmptyElement, System.Xml.XmlReader.LocalName, System.Xml.XmlReader.Name, System.Xml.XmlReader.NamespaceURI, System.Xml.XmlReader.NodeType, System.Xml.XmlReader.Prefix, System.Xml.XmlReader.ReadAsync(), System.Xml.XmlReader.ReadValueChunkAsync(), System.Xml.XmlReader.Value, System.Xml.XmlWriter.WriteAttributesAsync(), System.Xml.XmlWriter.WriteCDataAsync(), System.Xml.XmlWriter.WriteCharsAsync(), System.Xml.XmlWriter.WriteCommentAsync(), System.Xml.XmlWriter.WriteDocTypeAsync(), System.Xml.XmlWriter.WriteEndElementAsync(), System.Xml.XmlWriter.WriteEntityRefAsync(), System.Xml.XmlWriter.WriteFullEndElementAsync(), System.Xml.XmlWriter.WriteProcessingInstructionAsync(), System.Xml.XmlWriter.WriteStartElementAsync(), System.Xml.XmlWriter.WriteStringAsync(), and System.Xml.XmlWriter.WriteWhitespaceAsync().

Referenced by System.Xml.XmlWriter.WriteNodeAsync().