internal BinaryArray(BinarySerializationStreamAnalyzer analyzer) { ObjectID = analyzer.reader.ReadInt32(); ArrayType = (BinaryArrayTypeEnumeration)analyzer.reader.ReadByte(); Rank = analyzer.reader.ReadInt32(); Lengths = new List <int>(Rank); for (int i = 0; i < Rank; i++) { Lengths.Add(analyzer.reader.ReadInt32()); } if (ArrayType == BinaryArrayTypeEnumeration.SingleOffset || ArrayType == BinaryArrayTypeEnumeration.JaggedOffset || ArrayType == BinaryArrayTypeEnumeration.RectangularOffset) { LowerBounds = new List <int>(Rank); for (int i = 0; i < Rank; i++) { LowerBounds.Add(analyzer.reader.ReadInt32()); } } BinaryType = (BinaryTypeEnumeration)analyzer.reader.ReadByte(); TypeHelper.GetTypeAdditionalInfo(this, analyzer); }
public void ReadValueInfo(BinarySerializationStreamAnalyzer analyzer) { //then get additional infos where appropriate foreach (MemberInfo member in Members) { TypeHelper.GetTypeValue(member, member, analyzer); } }
public void ReadValueInfo(BinarySerializationStreamAnalyzer analyzer) { MemberInfo junk = new MemberInfo(); for (int i = 0; i < Slots; i++) { TypeHelper.GetTypeValue(this, junk, analyzer); } }
internal ClassInfo(BinarySerializationStreamAnalyzer analyzer) { ObjectID = analyzer.reader.ReadInt32(); Name = analyzer.reader.ReadString(); Members = new List <MemberInfo>(analyzer.reader.ReadInt32()); for (int i = 0; i < Members.Capacity; i++) { Members.Add(new MemberInfo()); Members[i].Name = analyzer.reader.ReadString(); Members[i].RelevantObject = this; } }
internal void ReadTypeInfo(BinarySerializationStreamAnalyzer analyzer) { //first get binary types foreach (MemberInfo member in Members) { member.BinaryType = (BinaryTypeEnumeration)analyzer.reader.ReadByte(); } //then get additional infos where appropriate foreach (MemberInfo member in Members) { TypeHelper.GetTypeAdditionalInfo(member, analyzer); } }
internal static void GetTypeAdditionalInfo(TypeHoldingThing typeHolder, BinarySerializationStreamAnalyzer analyzer) { switch (typeHolder.BinaryType) { case BinaryTypeEnumeration.Primitive: typeHolder.PrimitiveType = (PrimitiveTypeEnumeration)analyzer.reader.ReadByte(); break; case BinaryTypeEnumeration.String: break; case BinaryTypeEnumeration.Object: break; case BinaryTypeEnumeration.SystemClass: typeHolder.TypeInfo = new ClassTypeInfo(); typeHolder.TypeInfo.TypeName = analyzer.reader.ReadString(); break; case BinaryTypeEnumeration.Class: typeHolder.TypeInfo = new ClassTypeInfo(); typeHolder.TypeInfo.TypeName = analyzer.reader.ReadString(); typeHolder.TypeInfo.LibraryID = analyzer.reader.ReadInt32(); break; case BinaryTypeEnumeration.ObjectArray: break; case BinaryTypeEnumeration.StringArray: break; case BinaryTypeEnumeration.PrimitiveArray: typeHolder.PrimitiveType = (PrimitiveTypeEnumeration)analyzer.reader.ReadByte(); break; } }
internal static void GetTypeValue(TypeHoldingThing typeHolder, ValueHoldingThing valueHolder, BinarySerializationStreamAnalyzer analyzer) { switch (typeHolder.BinaryType) { case BinaryTypeEnumeration.Primitive: switch (typeHolder.PrimitiveType) { case PrimitiveTypeEnumeration.Boolean: valueHolder.Value = analyzer.reader.ReadBoolean(); break; case PrimitiveTypeEnumeration.Byte: valueHolder.Value = analyzer.reader.ReadByte(); break; case PrimitiveTypeEnumeration.Char: valueHolder.Value = analyzer.reader.ReadChar(); break; case PrimitiveTypeEnumeration.DateTime: valueHolder.Value = DateTime.FromBinary(analyzer.reader.ReadInt64()); break; case PrimitiveTypeEnumeration.Decimal: valueHolder.Value = analyzer.reader.ReadDecimal(); break; case PrimitiveTypeEnumeration.Double: valueHolder.Value = analyzer.reader.ReadDouble(); break; case PrimitiveTypeEnumeration.Int16: valueHolder.Value = analyzer.reader.ReadInt16(); break; case PrimitiveTypeEnumeration.Int32: valueHolder.Value = analyzer.reader.ReadInt32(); break; case PrimitiveTypeEnumeration.Int64: valueHolder.Value = analyzer.reader.ReadInt64(); break; case PrimitiveTypeEnumeration.Null: valueHolder.Value = null; break; case PrimitiveTypeEnumeration.SByte: valueHolder.Value = analyzer.reader.ReadSByte(); break; case PrimitiveTypeEnumeration.Single: valueHolder.Value = analyzer.reader.ReadSingle(); break; case PrimitiveTypeEnumeration.String: valueHolder.Value = analyzer.reader.ReadString(); break; case PrimitiveTypeEnumeration.TimeSpan: valueHolder.Value = TimeSpan.FromTicks(analyzer.reader.ReadInt64()); break; case PrimitiveTypeEnumeration.UInt16: valueHolder.Value = analyzer.reader.ReadUInt16(); break; case PrimitiveTypeEnumeration.UInt32: valueHolder.Value = analyzer.reader.ReadUInt32(); break; case PrimitiveTypeEnumeration.UInt64: valueHolder.Value = analyzer.reader.ReadUInt64(); break; } break; case BinaryTypeEnumeration.String: valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject); break; case BinaryTypeEnumeration.Object: valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject); break; case BinaryTypeEnumeration.SystemClass: valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject); break; case BinaryTypeEnumeration.Class: valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject); break; case BinaryTypeEnumeration.ObjectArray: valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject); break; case BinaryTypeEnumeration.StringArray: valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject); break; case BinaryTypeEnumeration.PrimitiveArray: valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject); break; } }
public void ReadValueInfo(BinarySerializationStreamAnalyzer analyzer) { throw new NotImplementedException(); }