Browse Source

move NodesCollection to a separate file

pull/252/head
Siegfried Pammer 14 years ago
parent
commit
f4504ab36e
  1. 1
      ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj
  2. 68
      ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/NodesCollection.cs
  3. 63
      ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs

1
ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj

@ -87,6 +87,7 @@ @@ -87,6 +87,7 @@
<Compile Include="Ricciolo.StylesExplorer.MarkupReflection\ITypeResolver.cs" />
<Compile Include="Ricciolo.StylesExplorer.MarkupReflection\KeyMapping.cs" />
<Compile Include="Ricciolo.StylesExplorer.MarkupReflection\KnownInfo.cs" />
<Compile Include="Ricciolo.StylesExplorer.MarkupReflection\NodesCollection.cs" />
<Compile Include="Ricciolo.StylesExplorer.MarkupReflection\PropertyDeclaration.cs" />
<Compile Include="Ricciolo.StylesExplorer.MarkupReflection\ResourceName.cs" />
<Compile Include="Ricciolo.StylesExplorer.MarkupReflection\TypeDeclaration.cs" />

68
ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/NodesCollection.cs

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
// Copyright (c) Cristian Civera (cristian@aspitalia.com)
// This code is distributed under the MS-PL (for details please see \doc\MS-PL.txt)
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Xml;
using System.Windows.Media;
namespace Ricciolo.StylesExplorer.MarkupReflection
{
class NodesCollection : List<XmlBamlNode>
{
public XmlBamlNode Last
{
get
{
if (this.Count > 0)
{
int i = this.Count - 1;
return this[i];
}
return null;
}
}
public void RemoveLast()
{
if (this.Count > 0)
this.Remove(this.Last);
}
public XmlBamlNode Dequeue()
{
return DequeueInternal(true);
}
public XmlBamlNode Peek()
{
return DequeueInternal(false);
}
XmlBamlNode DequeueInternal(bool remove)
{
if (this.Count > 0)
{
XmlBamlNode node = this[0];
if (remove)
this.RemoveAt(0);
return node;
}
else
return null;
}
public void Enqueue(XmlBamlNode node)
{
this.Add(node);
}
}
}

63
ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs

@ -1334,9 +1334,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection @@ -1334,9 +1334,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
CloseElement();
complexPropertyOpened--;
if (complexPropertyOpened == 0)
{
if (complexPropertyOpened == 0) {
int start = nodes.IndexOf(propertyElement);
StringBuilder sb = new StringBuilder();
@ -1465,8 +1463,6 @@ namespace Ricciolo.StylesExplorer.MarkupReflection @@ -1465,8 +1463,6 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
return String.Format("{0}:{1}", prefix, name);
}
string FormatPropertyDeclaration(PropertyDeclaration propertyDeclaration, bool withPrefix, bool useReading, bool checkType)
{
StringBuilder sb = new StringBuilder();
@ -1522,7 +1518,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection @@ -1522,7 +1518,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
if (identifier < keys[currentKey - 1].StaticResources.Count)
return keys[currentKey - 1].StaticResources[(int)identifier];
// return "???" + identifier +"???";
// return "???" + identifier + "???";
throw new ArgumentException("Cannot find StaticResource", "identifier");
}
@ -1889,60 +1885,5 @@ namespace Ricciolo.StylesExplorer.MarkupReflection @@ -1889,60 +1885,5 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
}
#endregion
#region NodesCollection
internal class NodesCollection : List<XmlBamlNode>
{
public XmlBamlNode Last
{
get
{
if (this.Count > 0)
{
int i = this.Count - 1;
return this[i];
}
return null;
}
}
public void RemoveLast()
{
if (this.Count > 0)
this.Remove(this.Last);
}
public XmlBamlNode Dequeue()
{
return DequeueInternal(true);
}
public XmlBamlNode Peek()
{
return DequeueInternal(false);
}
XmlBamlNode DequeueInternal(bool remove)
{
if (this.Count > 0)
{
XmlBamlNode node = this[0];
if (remove)
this.RemoveAt(0);
return node;
}
else
return null;
}
public void Enqueue(XmlBamlNode node)
{
this.Add(node);
}
}
#endregion
}
}
Loading…
Cancel
Save