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

◆ InitStreamInputAsync() [2/2]

async Task System.Xml.XmlTextReaderImpl.InitStreamInputAsync ( Uri baseUri,
string baseUriStr,
Stream stream,
byte[] bytes,
int byteCount,
Encoding encoding )
inlineprivate

Definition at line 9303 of file XmlTextReaderImpl.cs.

9304 {
9306 _ps.baseUri = baseUri;
9307 _ps.baseUriStr = baseUriStr;
9308 int num;
9309 if (bytes != null)
9310 {
9311 _ps.bytes = bytes;
9313 num = _ps.bytes.Length;
9314 }
9315 else
9316 {
9317 num = ((_laterInitParam == null || !_laterInitParam.useAsync) ? XmlReader.CalcBufferSize(stream) : 65536);
9318 if (_ps.bytes == null || _ps.bytes.Length < num)
9319 {
9320 _ps.bytes = new byte[num];
9321 }
9322 }
9323 if (_ps.chars == null || _ps.chars.Length < num + 1)
9324 {
9325 _ps.chars = new char[num + 1];
9326 }
9327 _ps.bytePos = 0;
9328 while (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0)
9329 {
9330 int num2 = await stream.ReadAsync(_ps.bytes.AsMemory(_ps.bytesUsed)).ConfigureAwait(continueOnCapturedContext: false);
9331 if (num2 == 0)
9332 {
9333 _ps.isStreamEof = true;
9334 break;
9335 }
9337 }
9338 if (encoding == null)
9339 {
9340 encoding = DetectEncoding();
9341 }
9342 SetupEncoding(encoding);
9343 EatPreamble();
9346 _ps.appendMode = true;
9348 }
void SetupEncoding(Encoding encoding)

References System.Xml.XmlTextReaderImpl._documentStartBytePos, System.Xml.XmlTextReaderImpl._laterInitParam, System.Xml.XmlTextReaderImpl._normalize, System.Xml.XmlTextReaderImpl._ps, System.byteCount, System.Xml.XmlTextReaderImpl.ParsingState.bytePos, System.bytes, System.Xml.XmlTextReaderImpl.ParsingState.bytes, System.Xml.XmlTextReaderImpl.ParsingState.bytesUsed, System.Xml.XmlReader.CalcBufferSize(), System.Xml.XmlTextReaderImpl.ParsingState.chars, System.Xml.XmlTextReaderImpl.DetectEncoding(), System.Xml.Dictionary, System.Xml.XmlTextReaderImpl.EatPreamble(), System.Xml.XmlTextReaderImpl.ReadDataAsync(), System.Xml.XmlTextReaderImpl.SetupEncoding(), System.stream, and System.Xml.XmlTextReaderImpl.LaterInitParam.useAsync.