diff --git a/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs b/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs index 4e8a4a693..68ef01a93 100644 --- a/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs +++ b/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs @@ -76,13 +76,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection List keys = new List(); KeyMapping LastKey { - get { - KeyMapping last = keys.LastOrDefault(); - if (last == null) - keys.Add(last = new KeyMapping()); - - return last; - } + get { return keys.LastOrDefault(); } } void LayerPop() @@ -398,6 +392,8 @@ namespace Ricciolo.StylesExplorer.MarkupReflection break; case BamlRecordType.DeferableContentStart: Current.IsDeferred = true; + keys = new List(); + currentKey = 0; reader.ReadInt32(); break; case BamlRecordType.DefAttribute: @@ -1033,6 +1029,8 @@ namespace Ricciolo.StylesExplorer.MarkupReflection void ReadElementEnd() { CloseElement(); + if (Current.IsDeferred) + keys = null; LayerPop(); } @@ -1600,26 +1598,18 @@ namespace Ricciolo.StylesExplorer.MarkupReflection return this.assemblyTable[identifier]; } - XmlBamlNode CurrentNode - { - get - { - return _currentNode; - } + XmlBamlNode CurrentNode { + get { return _currentNode; } } /// ///When overridden in a derived class, gets the namespace URI (as defined in the W3C Namespace specification) of the node on which the reader is positioned. /// - /// /// ///The namespace URI of the current node; otherwise an empty string. /// - /// - public override string NamespaceURI - { - get - { + public override string NamespaceURI { + get { if (intoAttribute) return String.Empty; TypeDeclaration declaration; @@ -1657,11 +1647,9 @@ namespace Ricciolo.StylesExplorer.MarkupReflection /// ///When overridden in a derived class, gets the namespace prefix associated with the current node. /// - /// /// ///The namespace prefix associated with the current node. /// - /// public override string Prefix { get @@ -1675,11 +1663,9 @@ namespace Ricciolo.StylesExplorer.MarkupReflection /// ///When overridden in a derived class, gets a value indicating whether the current node can have a . /// - /// /// ///true if the node on which the reader is currently positioned can have a Value; otherwise, false. If false, the node has a value of String.Empty. /// - /// public override bool HasValue { get { return this.Value != null; } @@ -1696,11 +1682,9 @@ namespace Ricciolo.StylesExplorer.MarkupReflection /// ///When overridden in a derived class, gets the text value of the current node. /// - /// /// ///The value returned depends on the of the node. The following table lists node types that have a value to return. All other node types return String.Empty.Node type Value AttributeThe value of the attribute. CDATAThe content of the CDATA section. CommentThe content of the comment. DocumentTypeThe internal subset. ProcessingInstructionThe entire content, excluding the target. SignificantWhitespaceThe white space between markup in a mixed content model. TextThe content of the text node. WhitespaceThe white space between markup. XmlDeclarationThe content of the declaration. /// - /// public override string Value { get @@ -1730,11 +1714,9 @@ namespace Ricciolo.StylesExplorer.MarkupReflection /// ///When overridden in a derived class, gets the depth of the current node in the XML document. /// - /// /// ///The depth of the current node in the XML document. /// - /// public override int Depth { get { return this.readingElements.Count; } @@ -1743,11 +1725,9 @@ namespace Ricciolo.StylesExplorer.MarkupReflection /// ///When overridden in a derived class, gets the base URI of the current node. /// - /// /// ///The base URI of the current node. /// - /// public override string BaseURI { get { return String.Empty; } @@ -1756,62 +1736,42 @@ namespace Ricciolo.StylesExplorer.MarkupReflection /// ///When overridden in a derived class, gets a value indicating whether the current node is an empty element (for example, <MyElement/>). /// - /// /// ///true if the current node is an element ( equals XmlNodeType.Element) that ends with />; otherwise, false. /// - /// public override bool IsEmptyElement { get { return false; } } - //public override bool IsDefault - //{ - // get - // { - // return this.NamespaceURI == null; - // } - //} - /// ///When overridden in a derived class, gets the number of attributes on the current node. /// - /// /// ///The number of attributes on the current node. /// - /// - public override int AttributeCount - { + public override int AttributeCount { get { throw new NotImplementedException(); } } /// ///When overridden in a derived class, gets a value indicating whether the reader is positioned at the end of the stream. /// - /// /// ///true if the reader is positioned at the end of the stream; otherwise, false. /// - /// - public override bool EOF - { + public override bool EOF { get { return _eof; } } /// ///When overridden in a derived class, gets the state of the reader. /// - /// /// ///One of the values. /// - /// - public override ReadState ReadState - { - get - { + public override ReadState ReadState { + get { if (!initialized) return ReadState.Initial; else if (reader == null) @@ -1831,11 +1791,9 @@ namespace Ricciolo.StylesExplorer.MarkupReflection /// ///When overridden in a derived class, gets the associated with this implementation. /// - /// /// ///The XmlNameTable enabling you to get the atomized version of a string within the node. /// - /// public override XmlNameTable NameTable { get { return _nameTable; }