internal ArrayInfo(IParsingContext context)
        {
            ObjectId = context.ReadInt32();
            Length = context.ReadInt32();

            Check.That(Length >= 0, "Expected Length >=0, got " + Length);
        }
 public SerializationHeaderRecord(IParsingContext context)
 {
     RootId = context.ReadInt32();
     HeaderId = context.ReadInt32();
     MajorVersion = context.ReadInt32();
     MinorVersion = context.ReadInt32();
 }
        public ClassInfo(IParsingContext context)
        {
            ObjectId = context.ReadInt32();
            Name = context.ReadString();

            var memberCount = context.ReadInt32();
            Check.That(memberCount >= 0, "MemberCount MUST be 0 or a positive integer.");

            Members = new String[memberCount];
            for (var i = 0; i < memberCount; ++i) {
                Members[i] = context.ReadString();
            }
        }
 public BinaryObjectString(IParsingContext context)
 {
     ObjectId = context.ReadInt32();
     Value = context.ReadString();
 }
 public MemberReference(IParsingContext context)
 {
     IdRef = context.ReadInt32(); ;
 }
 public ClassTypeInfo(IParsingContext context)
 {
     TypeName = context.ReadString();
     LibraryId = context.ReadInt32();
 }
 public BinaryLibrary(IParsingContext context)
 {
     LibraryId = context.ReadInt32();
     LibraryName = context.ReadString();
 }
        protected internal static Object ReadPrimitiveValue(IParsingContext context, PrimitiveTypeEnumeration type)
        {
            switch (type) {
                case PrimitiveTypeEnumeration.Boolean:
                    return context.ReadBoolean();
                case PrimitiveTypeEnumeration.Byte:
                    return context.ReadByte();
                case PrimitiveTypeEnumeration.Char:
                    return context.ReadChar();
                case PrimitiveTypeEnumeration.DateTime:
                    var data = context.ReadInt64();
                    var dt = DateTime.FromBinary(data);
                    var dtUtc = dt.ToUniversalTime();
                    return new DateTime(dtUtc.Ticks, dt.Kind);
                case PrimitiveTypeEnumeration.Decimal:
                    return Decimal.Parse(context.ReadString(), CultureInfo.InvariantCulture);
                case PrimitiveTypeEnumeration.Double:
                    return context.ReadDouble();
                case PrimitiveTypeEnumeration.Int16:
                    return context.ReadInt16();
                case PrimitiveTypeEnumeration.Int32:
                    return context.ReadInt32();
                case PrimitiveTypeEnumeration.Int64:
                    return context.ReadInt64();
                case PrimitiveTypeEnumeration.Null:
                    return null;
                case PrimitiveTypeEnumeration.SByte:
                    return context.ReadSByte();
                case PrimitiveTypeEnumeration.Single:
                    return context.ReadSingle();
                case PrimitiveTypeEnumeration.String:
                    return context.ReadString();
                case PrimitiveTypeEnumeration.TimeSpan:
                    return TimeSpan.FromTicks(context.ReadInt64());
                case PrimitiveTypeEnumeration.UInt16:
                    return context.ReadUInt16();
                case PrimitiveTypeEnumeration.UInt32:
                    return context.ReadUInt32();
                case PrimitiveTypeEnumeration.UInt64:
                    return context.ReadUInt64();

                default:
                    throw new NotSupportedException("Unsupported primitive type " + type);
            }
        }
 public ClassWithMembersAndTypes(IParsingContext context)
     : base(context)
 {
     LibraryId = context.ReadInt32();
     Values = ReadValues(context, MemberTypeInfo);
 }
 public ClassWithId(IParsingContext context)
 {
     ObjectId = context.ReadInt32();
     MetadataId = context.ReadInt32();
     Values = ReadValues(context, GetMetadataObject(context).MemberTypeInfo);
 }