public static OABFileProperties ReadFrom(BinaryReader reader, string elementName)
        {
            long position = reader.BaseStream.Position;
            int  num      = (int)reader.ReadUInt32(elementName + ".size");

            OABPropertyDescriptor[] headerProperties = OABFileProperties.ReadProperties(reader, elementName + ".headerProperties");
            OABPropertyDescriptor[] detailProperties = OABFileProperties.ReadProperties(reader, elementName + ".detailProperties");
            long position2 = reader.BaseStream.Position;
            int  num2      = (int)(position2 - position);

            if (num2 != num)
            {
                throw new InvalidDataException(string.Format("Unable to read element '{0}' at position {1} because number of bytes read from stream doesn't match in size in header. Size in header: {2}, bytes read from stream: {3}", new object[]
                {
                    elementName,
                    position,
                    num,
                    num2
                }));
            }
            return(new OABFileProperties
            {
                HeaderProperties = headerProperties,
                DetailProperties = detailProperties
            });
        }
 public void WriteTo(BinaryWriter writer)
 {
     writer.Write((uint)this.Size);
     OABFileProperties.WriteProperties(writer, this.HeaderProperties);
     OABFileProperties.WriteProperties(writer, this.DetailProperties);
 }