diff --git a/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/KnownInfo.cs b/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/KnownInfo.cs index 4cfd70d86..76e4f56d1 100644 --- a/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/KnownInfo.cs +++ b/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/KnownInfo.cs @@ -12,7 +12,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection internal TypeDeclaration[] KnownTypeTable = null; internal PropertyDeclaration[] KnownPropertyTable = null; internal static String[] KnownAssemblyTable = null; - internal Hashtable KnownResourceTable = new Hashtable(); + internal Dictionary KnownResourceTable = new Dictionary(); #region Initialize diff --git a/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs b/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs index a8d7d8ba0..93b008c8b 100644 --- a/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs +++ b/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs @@ -689,7 +689,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection bool isNotKey = (identifier > 0xe8); if (isNotKey) identifier = (short)(identifier - 0xe8); - ResourceName resource = (ResourceName) KnownInfo.KnownResourceTable[(int)identifier]; + ResourceName resource = KnownInfo.KnownResourceTable[identifier]; if (!isNotKey) return new ResourceName(resource.Name + "Key"); return resource; @@ -1512,9 +1512,12 @@ namespace Ricciolo.StylesExplorer.MarkupReflection object GetStaticResource(short identifier) { - if (identifier < keys[currentKey - 1].StaticResources.Count) - return keys[currentKey - 1].StaticResources[(int)identifier]; - + int keyIndex = currentKey; + while (keyIndex >= 0 && !keys[keyIndex].HasStaticResources) + keyIndex--; + if (keyIndex >= 0 && identifier < keys[keyIndex].StaticResources.Count) + return keys[keyIndex].StaticResources[(int)identifier]; +// Debug.WriteLine(string.Format("Cannot find StaticResource: {0}", identifier)); // return "???" + identifier + "???"; throw new ArgumentException("Cannot find StaticResource: " + identifier, "identifier"); }