Browse Source

implement support for TextWithId records and add some safety checks

pull/182/merge
Siegfried Pammer 14 years ago
parent
commit
02e6cf6dd8
  1. 19
      ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs

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

@ -419,6 +419,9 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
case BamlRecordType.TextWithConverter: case BamlRecordType.TextWithConverter:
this.ReadTextWithConverter(); this.ReadTextWithConverter();
break; break;
case BamlRecordType.TextWithId:
this.ReadTextWithId();
break;
case BamlRecordType.PropertyWithStaticResourceId: case BamlRecordType.PropertyWithStaticResourceId:
this.ReadPropertyWithStaticResourceIdentifier(); this.ReadPropertyWithStaticResourceIdentifier();
break; break;
@ -447,9 +450,17 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
this.ReadPresentationOptionsAttribute(); this.ReadPresentationOptionsAttribute();
break; break;
default: default:
throw new NotImplementedException("UnsupportedNode: " + currentType);
break; break;
} }
} }
void ReadTextWithId()
{
short textId = reader.ReadInt16();
string text = stringTable[textId];
nodes.Enqueue(new XmlBamlText(text));
}
private void ComputeBytesToSkip() private void ComputeBytesToSkip()
{ {
@ -462,6 +473,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
case BamlRecordType.Property: case BamlRecordType.Property:
case BamlRecordType.PropertyCustom: case BamlRecordType.PropertyCustom:
case BamlRecordType.Text: case BamlRecordType.Text:
case BamlRecordType.TextWithId:
case BamlRecordType.TextWithConverter: case BamlRecordType.TextWithConverter:
case BamlRecordType.XmlnsProperty: case BamlRecordType.XmlnsProperty:
case BamlRecordType.DefAttribute: case BamlRecordType.DefAttribute:
@ -783,8 +795,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
case IntegerCollectionType.Integer: case IntegerCollectionType.Integer:
for (int k = 0; k < capacity; k++) for (int k = 0; k < capacity; k++)
{ {
int num7 = reader.ReadInt32(); ints.Add(reader.ReadInt32());
ints.Add(num7);
} }
return ints; return ints;
@ -1172,7 +1183,9 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
private void ReadElementStart() private void ReadElementStart()
{ {
short identifier = reader.ReadInt16(); short identifier = reader.ReadInt16();
reader.ReadByte(); sbyte flags = reader.ReadSByte();
if (flags < 0 || flags > 3)
throw new NotImplementedException();
TypeDeclaration declaration = GetTypeDeclaration(identifier); TypeDeclaration declaration = GetTypeDeclaration(identifier);
XmlBamlElement element; XmlBamlElement element;

Loading…
Cancel
Save