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

◆ ReadContentFromAsync() [1/2]

async ValueTask< bool > System.Xml.Linq.XContainer.ContentReader.ReadContentFromAsync ( XContainer rootContainer,
XmlReader r )
inline

Definition at line 102 of file XContainer.cs.

103 {
104 switch (r.NodeType)
105 {
106 case XmlNodeType.Element:
107 {
108 XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName));
109 if (r.MoveToFirstAttribute())
110 {
111 do
112 {
113 XElement xElement = e;
114 XName name = _aCache.Get((r.Prefix.Length == 0) ? string.Empty : r.NamespaceURI).GetName(r.LocalName);
115 xElement.AppendAttributeSkipNotify(new XAttribute(name, await r.GetValueAsync().ConfigureAwait(continueOnCapturedContext: false)));
116 }
117 while (r.MoveToNextAttribute());
118 r.MoveToElement();
119 }
121 if (!r.IsEmptyElement)
122 {
124 }
125 break;
126 }
127 case XmlNodeType.EndElement:
128 if (_currentContainer.content == null)
129 {
130 _currentContainer.content = string.Empty;
131 }
133 {
134 return false;
135 }
137 break;
138 case XmlNodeType.Text:
139 case XmlNodeType.Whitespace:
140 case XmlNodeType.SignificantWhitespace:
141 {
143 currentContainer.AddStringSkipNotify(await r.GetValueAsync().ConfigureAwait(continueOnCapturedContext: false));
144 break;
145 }
146 case XmlNodeType.CDATA:
147 {
149 currentContainer.AddNodeSkipNotify(new XCData(await r.GetValueAsync().ConfigureAwait(continueOnCapturedContext: false)));
150 break;
151 }
152 case XmlNodeType.Comment:
153 {
155 currentContainer.AddNodeSkipNotify(new XComment(await r.GetValueAsync().ConfigureAwait(continueOnCapturedContext: false)));
156 break;
157 }
158 case XmlNodeType.ProcessingInstruction:
159 {
161 string localName = r.Name;
162 currentContainer.AddNodeSkipNotify(new XProcessingInstruction(localName, await r.GetValueAsync().ConfigureAwait(continueOnCapturedContext: false)));
163 break;
164 }
165 case XmlNodeType.DocumentType:
166 {
168 string localName = r.LocalName;
169 string attribute = r.GetAttribute("PUBLIC");
170 string attribute2 = r.GetAttribute("SYSTEM");
171 currentContainer.AddNodeSkipNotify(new XDocumentType(localName, attribute, attribute2, await r.GetValueAsync().ConfigureAwait(continueOnCapturedContext: false)));
172 break;
173 }
174 case XmlNodeType.EntityReference:
175 if (!r.CanResolveEntity)
176 {
178 }
179 r.ResolveEntity();
180 break;
181 default:
183 case XmlNodeType.EndEntity:
184 break;
185 }
186 return true;
187 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string InvalidOperation_UnresolvedEntityReference
Definition SR.cs:60
static string InvalidOperation_UnexpectedNodeType
Definition SR.cs:58
Definition SR.cs:7
void AddNodeSkipNotify(XNode n)
XName GetName(string localName)
Definition XNamespace.cs:37
XContainer parent
Definition XObject.cs:7
XNamespace Get(string namespaceName)

References System.Xml.Linq.XContainer.ContentReader._aCache, System.Xml.Linq.XContainer.ContentReader._currentContainer, System.Xml.Linq.XContainer.ContentReader._eCache, System.Xml.Linq.XContainer.AddNodeSkipNotify(), System.Xml.Linq.XContainer.content, System.Xml.Dictionary, System.SR.Format(), System.Xml.Linq.NamespaceCache.Get(), System.Xml.Linq.XNamespace.GetName(), System.SR.InvalidOperation_UnexpectedNodeType, System.SR.InvalidOperation_UnresolvedEntityReference, and System.Xml.Linq.XObject.parent.