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

◆ EncodingStreamWrapper() [1/2]

System.Xml.EncodingStreamWrapper.EncodingStreamWrapper ( Stream stream,
Encoding encoding )
inline

Definition at line 129 of file EncodingStreamWrapper.cs.

130 {
131 try
132 {
133 _isReading = true;
134 _stream = stream;
135 SupportedEncoding supportedEncoding = GetSupportedEncoding(encoding);
136 SupportedEncoding supportedEncoding2 = ReadBOMEncoding(encoding == null);
137 if (supportedEncoding != SupportedEncoding.None && supportedEncoding != supportedEncoding2)
138 {
140 }
141 if (supportedEncoding2 == SupportedEncoding.UTF8)
142 {
143 FillBuffer(2);
144 if (_bytes[_byteOffset + 1] == 63 && _bytes[_byteOffset] == 60)
145 {
146 FillBuffer(128);
148 }
149 return;
150 }
152 FillBuffer(254);
156 _byteOffset = 0;
157 _byteCount = s_validatingUTF8.GetBytes(_chars, 0, chars, _bytes, 0);
158 if (_bytes[1] == 63 && _bytes[0] == 60)
159 {
161 }
162 else if (supportedEncoding == SupportedEncoding.None)
163 {
165 }
166 }
168 {
170 }
171 }
static string XmlDeclarationRequired
Definition SR.cs:362
static string XmlInvalidBytes
Definition SR.cs:416
Definition SR.cs:7
virtual char[] GetChars(byte[] bytes)
Definition Encoding.cs:921
static void CheckUTF8DeclarationEncoding(byte[] buffer, int offset, int count, SupportedEncoding e, SupportedEncoding expectedEnc)
static void ThrowExpectedEncodingMismatch(SupportedEncoding expEnc, SupportedEncoding actualEnc)
SupportedEncoding ReadBOMEncoding(bool notOutOfBand)
void SetReadDocumentEncoding(SupportedEncoding e)
static readonly UTF8Encoding s_validatingUTF8
static SupportedEncoding GetSupportedEncoding(Encoding encoding)

References System.Xml.EncodingStreamWrapper._byteCount, System.Xml.EncodingStreamWrapper._byteOffset, System.Xml.EncodingStreamWrapper._bytes, System.Xml.EncodingStreamWrapper._chars, System.Xml.EncodingStreamWrapper._encoding, System.Xml.EncodingStreamWrapper._isReading, System.Xml.EncodingStreamWrapper._stream, System.chars, System.Xml.EncodingStreamWrapper.CheckUTF8DeclarationEncoding(), System.Xml.EncodingStreamWrapper.CleanupCharBreak(), System.Xml.Dictionary, System.Xml.EncodingStreamWrapper.EnsureBuffers(), System.Xml.EncodingStreamWrapper.FillBuffer(), System.Text.Encoding.GetChars(), System.Xml.EncodingStreamWrapper.GetSupportedEncoding(), System.Xml.EncodingStreamWrapper.ReadBOMEncoding(), System.Xml.EncodingStreamWrapper.s_validatingUTF8, System.Xml.EncodingStreamWrapper.SetReadDocumentEncoding(), System.stream, System.Xml.EncodingStreamWrapper.ThrowExpectedEncodingMismatch(), System.SR.XmlDeclarationRequired, System.Xml.XmlException, and System.SR.XmlInvalidBytes.