public override void Read(BamlBinaryReader reader) { AttributeId = reader.ReadUInt16(); }
public override void Read(BamlBinaryReader reader) { }
public override void Read(BamlBinaryReader reader) { ConnectionId = reader.ReadUInt32(); }
public override void Read(BamlBinaryReader reader) { base.Read(reader); pos = reader.ReadUInt32(); Shared = reader.ReadBoolean(); SharedSet = reader.ReadBoolean(); }
protected override void ReadData(BamlBinaryReader reader, int size) { ValueId = reader.ReadUInt16(); }
protected override void ReadData(BamlBinaryReader reader, int size) { AttributeId = reader.ReadUInt16(); Value = reader.ReadString(); }
public override void Read(BamlBinaryReader reader) { Flags = reader.ReadByte(); ValueId = reader.ReadUInt16(); }
protected override void ReadData(BamlBinaryReader reader, int size) { Value = reader.ReadString(); }
public override void Read(BamlBinaryReader reader) { size = reader.ReadUInt32(); pos = reader.BaseStream.Position; }
public override void Read(BamlBinaryReader reader) { StaticResourceId = reader.ReadUInt16(); }
public override void Read(BamlBinaryReader reader) => TypeId = reader.ReadUInt16();
public override void Read(BamlBinaryReader reader) => AttributeId = reader.ReadUInt16();
public static BamlDocument ReadDocument(Stream str, CancellationToken token) { var ret = new BamlDocument(); var reader = new BamlBinaryReader(str); ret.Signature = ReadSignature(str); if (ret.Signature != MSBAML_SIG) { throw new NotSupportedException(); } ret.ReaderVersion = new BamlDocument.BamlVersion { Major = reader.ReadUInt16(), Minor = reader.ReadUInt16() }; ret.UpdaterVersion = new BamlDocument.BamlVersion { Major = reader.ReadUInt16(), Minor = reader.ReadUInt16() }; ret.WriterVersion = new BamlDocument.BamlVersion { Major = reader.ReadUInt16(), Minor = reader.ReadUInt16() }; if (ret.ReaderVersion.Major != 0 || ret.ReaderVersion.Minor != 0x60 || ret.UpdaterVersion.Major != 0 || ret.UpdaterVersion.Minor != 0x60 || ret.WriterVersion.Major != 0 || ret.WriterVersion.Minor != 0x60) { throw new NotSupportedException(); } var recs = new Dictionary <long, BamlRecord>(); while (str.Position < str.Length) { token.ThrowIfCancellationRequested(); long pos = str.Position; var type = (BamlRecordType)reader.ReadByte(); BamlRecord rec = null; switch (type) { case BamlRecordType.AssemblyInfo: rec = new AssemblyInfoRecord(); break; case BamlRecordType.AttributeInfo: rec = new AttributeInfoRecord(); break; case BamlRecordType.ConstructorParametersStart: rec = new ConstructorParametersStartRecord(); break; case BamlRecordType.ConstructorParametersEnd: rec = new ConstructorParametersEndRecord(); break; case BamlRecordType.ConstructorParameterType: rec = new ConstructorParameterTypeRecord(); break; case BamlRecordType.ConnectionId: rec = new ConnectionIdRecord(); break; case BamlRecordType.ContentProperty: rec = new ContentPropertyRecord(); break; case BamlRecordType.DefAttribute: rec = new DefAttributeRecord(); break; case BamlRecordType.DefAttributeKeyString: rec = new DefAttributeKeyStringRecord(); break; case BamlRecordType.DefAttributeKeyType: rec = new DefAttributeKeyTypeRecord(); break; case BamlRecordType.DeferableContentStart: rec = new DeferableContentStartRecord(); break; case BamlRecordType.DocumentEnd: rec = new DocumentEndRecord(); break; case BamlRecordType.DocumentStart: rec = new DocumentStartRecord(); break; case BamlRecordType.ElementEnd: rec = new ElementEndRecord(); break; case BamlRecordType.ElementStart: rec = new ElementStartRecord(); break; case BamlRecordType.KeyElementEnd: rec = new KeyElementEndRecord(); break; case BamlRecordType.KeyElementStart: rec = new KeyElementStartRecord(); break; case BamlRecordType.LineNumberAndPosition: rec = new LineNumberAndPositionRecord(); break; case BamlRecordType.LinePosition: rec = new LinePositionRecord(); break; case BamlRecordType.LiteralContent: rec = new LiteralContentRecord(); break; case BamlRecordType.NamedElementStart: rec = new NamedElementStartRecord(); break; case BamlRecordType.OptimizedStaticResource: rec = new OptimizedStaticResourceRecord(); break; case BamlRecordType.PIMapping: rec = new PIMappingRecord(); break; case BamlRecordType.PresentationOptionsAttribute: rec = new PresentationOptionsAttributeRecord(); break; case BamlRecordType.Property: rec = new PropertyRecord(); break; case BamlRecordType.PropertyArrayEnd: rec = new PropertyArrayEndRecord(); break; case BamlRecordType.PropertyArrayStart: rec = new PropertyArrayStartRecord(); break; case BamlRecordType.PropertyComplexEnd: rec = new PropertyComplexEndRecord(); break; case BamlRecordType.PropertyComplexStart: rec = new PropertyComplexStartRecord(); break; case BamlRecordType.PropertyCustom: rec = new PropertyCustomRecord(); break; case BamlRecordType.PropertyDictionaryEnd: rec = new PropertyDictionaryEndRecord(); break; case BamlRecordType.PropertyDictionaryStart: rec = new PropertyDictionaryStartRecord(); break; case BamlRecordType.PropertyListEnd: rec = new PropertyListEndRecord(); break; case BamlRecordType.PropertyListStart: rec = new PropertyListStartRecord(); break; case BamlRecordType.PropertyStringReference: rec = new PropertyStringReferenceRecord(); break; case BamlRecordType.PropertyTypeReference: rec = new PropertyTypeReferenceRecord(); break; case BamlRecordType.PropertyWithConverter: rec = new PropertyWithConverterRecord(); break; case BamlRecordType.PropertyWithExtension: rec = new PropertyWithExtensionRecord(); break; case BamlRecordType.PropertyWithStaticResourceId: rec = new PropertyWithStaticResourceIdRecord(); break; case BamlRecordType.RoutedEvent: rec = new RoutedEventRecord(); break; case BamlRecordType.StaticResourceEnd: rec = new StaticResourceEndRecord(); break; case BamlRecordType.StaticResourceId: rec = new StaticResourceIdRecord(); break; case BamlRecordType.StaticResourceStart: rec = new StaticResourceStartRecord(); break; case BamlRecordType.StringInfo: rec = new StringInfoRecord(); break; case BamlRecordType.Text: rec = new TextRecord(); break; case BamlRecordType.TextWithConverter: rec = new TextWithConverterRecord(); break; case BamlRecordType.TextWithId: rec = new TextWithIdRecord(); break; case BamlRecordType.TypeInfo: rec = new TypeInfoRecord(); break; case BamlRecordType.TypeSerializerInfo: rec = new TypeSerializerInfoRecord(); break; case BamlRecordType.XmlnsProperty: rec = new XmlnsPropertyRecord(); break; case BamlRecordType.XmlAttribute: case BamlRecordType.ProcessingInstruction: case BamlRecordType.LastRecordType: case BamlRecordType.EndAttributes: case BamlRecordType.DefTag: case BamlRecordType.ClrEvent: case BamlRecordType.Comment: default: throw new NotSupportedException(); } rec.Position = pos; rec.Read(reader); ret.Add(rec); recs.Add(pos, rec); } for (int i = 0; i < ret.Count; i++) { if (ret[i] is IBamlDeferRecord defer) { defer.ReadDefer(ret, i, _ => recs[_]); } } return(ret); }
public override void Read(BamlBinaryReader reader) { LinePosition = reader.ReadUInt32(); }
protected override void ReadData(BamlBinaryReader reader, int size) { AttributeId = reader.ReadUInt16(); OwnerTypeId = reader.ReadUInt16(); AttributeUsage = reader.ReadByte(); Name = reader.ReadString(); }
public override void Read(BamlBinaryReader reader) { TypeId = reader.ReadUInt16(); RuntimeName = reader.ReadString(); }
protected override void ReadData(BamlBinaryReader reader, int size) { base.ReadData(reader, size); ConverterTypeId = reader.ReadUInt16(); }
protected abstract void ReadData(BamlBinaryReader reader, int size);
protected override void ReadData(BamlBinaryReader reader, int size) { Value = reader.ReadString(); Reserved0 = reader.ReadUInt32(); Reserved1 = reader.ReadUInt32(); }
protected override void ReadData(BamlBinaryReader reader, int size) { Prefix = reader.ReadString(); XmlNamespace = reader.ReadString(); AssemblyIds = new ushort[reader.ReadUInt16()]; for (int i = 0; i < AssemblyIds.Length; i++) AssemblyIds[i] = reader.ReadUInt16(); }
public override void Read(BamlBinaryReader reader) { LoadAsync = reader.ReadBoolean(); MaxAsyncRecords = reader.ReadUInt32(); DebugBaml = reader.ReadBoolean(); }
protected override void ReadData(BamlBinaryReader reader, int size) { XmlNamespace = reader.ReadString(); ClrNamespace = reader.ReadString(); AssemblyId = reader.ReadUInt16(); }
public override void Read(BamlBinaryReader reader) { base.Read(reader); StringId = reader.ReadUInt16(); }
protected override void ReadData(BamlBinaryReader reader, int size) { long pos = reader.BaseStream.Position; AttributeId = reader.ReadUInt16(); SerializerTypeId = reader.ReadUInt16(); Data = reader.ReadBytes(size - (int)(reader.BaseStream.Position - pos)); }
public abstract void Read(BamlBinaryReader reader);
protected override void ReadData(BamlBinaryReader reader, int size) { ValueId = reader.ReadUInt16(); pos = reader.ReadUInt32(); Shared = reader.ReadBoolean(); SharedSet = reader.ReadBoolean(); }
public override void Read(BamlBinaryReader reader) { long pos = reader.BaseStream.Position; int size = reader.ReadEncodedInt(); ReadData(reader, size - (int)(reader.BaseStream.Position - pos)); Debug.Assert(reader.BaseStream.Position - pos == size); }
protected override void ReadData(BamlBinaryReader reader, int size) { TypeId = reader.ReadUInt16(); AssemblyId = reader.ReadUInt16(); TypeFullName = reader.ReadString(); }
public override void Read(BamlBinaryReader reader) { TypeId = reader.ReadUInt16(); }
public static BamlDocument ReadDocument(Stream str, CancellationToken token) { var ret = new BamlDocument(); var reader = new BamlBinaryReader(str); ret.Signature = ReadSignature(str); if (ret.Signature != MSBAML_SIG) throw new NotSupportedException(); ret.ReaderVersion = new BamlDocument.BamlVersion { Major = reader.ReadUInt16(), Minor = reader.ReadUInt16() }; ret.UpdaterVersion = new BamlDocument.BamlVersion { Major = reader.ReadUInt16(), Minor = reader.ReadUInt16() }; ret.WriterVersion = new BamlDocument.BamlVersion { Major = reader.ReadUInt16(), Minor = reader.ReadUInt16() }; if (ret.ReaderVersion.Major != 0 || ret.ReaderVersion.Minor != 0x60 || ret.UpdaterVersion.Major != 0 || ret.UpdaterVersion.Minor != 0x60 || ret.WriterVersion.Major != 0 || ret.WriterVersion.Minor != 0x60) throw new NotSupportedException(); var recs = new Dictionary<long, BamlRecord>(); while (str.Position < str.Length) { token.ThrowIfCancellationRequested(); long pos = str.Position; var type = (BamlRecordType)reader.ReadByte(); BamlRecord rec = null; switch (type) { case BamlRecordType.AssemblyInfo: rec = new AssemblyInfoRecord(); break; case BamlRecordType.AttributeInfo: rec = new AttributeInfoRecord(); break; case BamlRecordType.ConstructorParametersStart: rec = new ConstructorParametersStartRecord(); break; case BamlRecordType.ConstructorParametersEnd: rec = new ConstructorParametersEndRecord(); break; case BamlRecordType.ConstructorParameterType: rec = new ConstructorParameterTypeRecord(); break; case BamlRecordType.ConnectionId: rec = new ConnectionIdRecord(); break; case BamlRecordType.ContentProperty: rec = new ContentPropertyRecord(); break; case BamlRecordType.DefAttribute: rec = new DefAttributeRecord(); break; case BamlRecordType.DefAttributeKeyString: rec = new DefAttributeKeyStringRecord(); break; case BamlRecordType.DefAttributeKeyType: rec = new DefAttributeKeyTypeRecord(); break; case BamlRecordType.DeferableContentStart: rec = new DeferableContentStartRecord(); break; case BamlRecordType.DocumentEnd: rec = new DocumentEndRecord(); break; case BamlRecordType.DocumentStart: rec = new DocumentStartRecord(); break; case BamlRecordType.ElementEnd: rec = new ElementEndRecord(); break; case BamlRecordType.ElementStart: rec = new ElementStartRecord(); break; case BamlRecordType.KeyElementEnd: rec = new KeyElementEndRecord(); break; case BamlRecordType.KeyElementStart: rec = new KeyElementStartRecord(); break; case BamlRecordType.LineNumberAndPosition: rec = new LineNumberAndPositionRecord(); break; case BamlRecordType.LinePosition: rec = new LinePositionRecord(); break; case BamlRecordType.LiteralContent: rec = new LiteralContentRecord(); break; case BamlRecordType.NamedElementStart: rec = new NamedElementStartRecord(); break; case BamlRecordType.OptimizedStaticResource: rec = new OptimizedStaticResourceRecord(); break; case BamlRecordType.PIMapping: rec = new PIMappingRecord(); break; case BamlRecordType.PresentationOptionsAttribute: rec = new PresentationOptionsAttributeRecord(); break; case BamlRecordType.Property: rec = new PropertyRecord(); break; case BamlRecordType.PropertyArrayEnd: rec = new PropertyArrayEndRecord(); break; case BamlRecordType.PropertyArrayStart: rec = new PropertyArrayStartRecord(); break; case BamlRecordType.PropertyComplexEnd: rec = new PropertyComplexEndRecord(); break; case BamlRecordType.PropertyComplexStart: rec = new PropertyComplexStartRecord(); break; case BamlRecordType.PropertyCustom: rec = new PropertyCustomRecord(); break; case BamlRecordType.PropertyDictionaryEnd: rec = new PropertyDictionaryEndRecord(); break; case BamlRecordType.PropertyDictionaryStart: rec = new PropertyDictionaryStartRecord(); break; case BamlRecordType.PropertyListEnd: rec = new PropertyListEndRecord(); break; case BamlRecordType.PropertyListStart: rec = new PropertyListStartRecord(); break; case BamlRecordType.PropertyStringReference: rec = new PropertyStringReferenceRecord(); break; case BamlRecordType.PropertyTypeReference: rec = new PropertyTypeReferenceRecord(); break; case BamlRecordType.PropertyWithConverter: rec = new PropertyWithConverterRecord(); break; case BamlRecordType.PropertyWithExtension: rec = new PropertyWithExtensionRecord(); break; case BamlRecordType.PropertyWithStaticResourceId: rec = new PropertyWithStaticResourceIdRecord(); break; case BamlRecordType.RoutedEvent: rec = new RoutedEventRecord(); break; case BamlRecordType.StaticResourceEnd: rec = new StaticResourceEndRecord(); break; case BamlRecordType.StaticResourceId: rec = new StaticResourceIdRecord(); break; case BamlRecordType.StaticResourceStart: rec = new StaticResourceStartRecord(); break; case BamlRecordType.StringInfo: rec = new StringInfoRecord(); break; case BamlRecordType.Text: rec = new TextRecord(); break; case BamlRecordType.TextWithConverter: rec = new TextWithConverterRecord(); break; case BamlRecordType.TextWithId: rec = new TextWithIdRecord(); break; case BamlRecordType.TypeInfo: rec = new TypeInfoRecord(); break; case BamlRecordType.TypeSerializerInfo: rec = new TypeSerializerInfoRecord(); break; case BamlRecordType.XmlnsProperty: rec = new XmlnsPropertyRecord(); break; case BamlRecordType.XmlAttribute: case BamlRecordType.ProcessingInstruction: case BamlRecordType.LastRecordType: case BamlRecordType.EndAttributes: case BamlRecordType.DefTag: case BamlRecordType.ClrEvent: case BamlRecordType.Comment: default: throw new NotSupportedException(); } rec.Position = pos; rec.Read(reader); ret.Add(rec); recs.Add(pos, rec); } for (int i = 0; i < ret.Count; i++) { var defer = ret[i] as IBamlDeferRecord; if (defer != null) defer.ReadDefer(ret, i, _ => recs[_]); } return ret; }