Пример #1
0
        private void Build()
        {
            const uint Magic                     = 0x46485845; // EXHF
            const int  MinimumLength             = 0x2E;
            const int  FixedSizeDataLengthOffset = 0x06;
            const int  VariantOffset             = 0x10;
            const int  DataOffset                = 0x20;

            byte[] buffer = File.GetData();

            if (buffer.Length < MinimumLength)
            {
                throw new InvalidDataException("EXH file is too short");
            }
            if (OrderedBitConverter.ToUInt32(buffer, 0, false) != Magic)
            {
                throw new InvalidDataException("File not a EX header");
            }


            FixedSizeDataLength = OrderedBitConverter.ToUInt16(buffer, FixedSizeDataLengthOffset, true);
            Variant             = OrderedBitConverter.ToUInt16(buffer, VariantOffset, true);
            if (Variant != 1 && Variant != 2)
            {
                throw new NotSupportedException();
            }

            int currentPosition = DataOffset;

            ReadColumns(buffer, ref currentPosition);
            ReadPartialFiles(buffer, ref currentPosition);
            ReadSuffixes(buffer, ref currentPosition);
        }
Пример #2
0
        public Header(ExCollection collection, string name, File file)
        {
            Collection = collection;
            Name       = name;
            File       = file;

            Build();
        }
Пример #3
0
        public Header(ExCollection collection, string name, File file)
        {
            Collection = collection;
            Name = name;
            File = file;

            Build();
        }