public override bool Read() { this.ThrowIfDisposed(); Label_0006: if (this._nodeStream.MoveNext()) { this._current = this._nodeStream.Current; if (this._current.NodeType != XamlNodeType.None) { goto Label_006E; } if (this._current.LineInfo != null) { this._currentLineInfo = this._current.LineInfo; goto Label_006E; } if (!this._current.IsEof) { goto Label_006E; } } else { this._current = this._endOfStreamNode; } goto Label_007B; Label_006E: if (this._current.NodeType == XamlNodeType.None) { goto Label_0006; } Label_007B: return(!this.IsEof); }
public XamlNode(System.Xaml.LineInfo lineInfo) { this._nodeType = XamlNodeType.None; this._internalNodeType = InternalNodeType.LineInfo; this._data = lineInfo; }
private void Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings) { XmlReader reader; this._mergedSettings = (settings == null) ? new XamlXmlReaderSettings() : new XamlXmlReaderSettings(settings); if (!this._mergedSettings.SkipXmlCompatibilityProcessing) { XmlCompatibilityReader reader2 = new XmlCompatibilityReader(givenXmlReader, new IsXmlNamespaceSupportedCallback(this.IsXmlNamespaceSupported)) { Normalization = true }; reader = reader2; } else { reader = givenXmlReader; } if (!string.IsNullOrEmpty(reader.BaseURI)) { this._mergedSettings.BaseUri = new Uri(reader.BaseURI); } if (reader.XmlSpace == XmlSpace.Preserve) { this._mergedSettings.XmlSpacePreserve = true; } if (!string.IsNullOrEmpty(reader.XmlLang)) { this._mergedSettings.XmlLang = reader.XmlLang; } IXmlNamespaceResolver resolver = reader as IXmlNamespaceResolver; Dictionary <string, string> xmlnsDictionary = null; if (resolver != null) { IDictionary <string, string> namespacesInScope = resolver.GetNamespacesInScope(XmlNamespaceScope.Local); if (namespacesInScope != null) { foreach (KeyValuePair <string, string> pair in namespacesInScope) { if (xmlnsDictionary == null) { xmlnsDictionary = new Dictionary <string, string>(); } xmlnsDictionary[pair.Key] = pair.Value; } } } if (schemaContext == null) { schemaContext = new XamlSchemaContext(); } this._endOfStreamNode = new XamlNode(XamlNode.InternalNodeType.EndOfStream); this._context = new XamlParserContext(schemaContext, this._mergedSettings.LocalAssembly); this._context.AllowProtectedMembersOnRoot = this._mergedSettings.AllowProtectedMembersOnRoot; this._context.AddNamespacePrefix("xml", "http://www.w3.org/XML/1998/namespace"); Func <string, string> func = new Func <string, string>(reader.LookupNamespace); this._context.XmlNamespaceResolver = func; XamlScanner scanner = new XamlScanner(this._context, reader, this._mergedSettings); XamlPullParser parser = new XamlPullParser(this._context, scanner, this._mergedSettings); this._nodeStream = new NodeStreamSorter(this._context, parser, this._mergedSettings, xmlnsDictionary); this._current = new XamlNode(XamlNode.InternalNodeType.StartOfStream); this._currentLineInfo = new System.Xaml.LineInfo(0, 0); }