Exemple #1
0
        public void Read(Stream stream)
        {
            using (BigBinaryReader reader = new BigBinaryReader(EndianBitConverter.Little, stream))
            {
                this._version = reader.ReadUInt32();
                this._unknown = reader.ReadByte();

                string magic = reader.ReadString();
                if (magic != "WAR-BUILDER")
                {
                    throw new Exception("This is not a Big file!");
                }

                int depCount = reader.ReadInt32();
                if (depCount > 0)
                {
                    reader.ReadInt32(); // fC2
                    this._depFlags = reader.ReadBytes(3);

                    this.Dependencies = new List<BigDependency>(depCount);
                    for (int i = 0; i < depCount; i++)
                    {
                        BigDependency dep = new BigDependency();
                        dep.Read(reader);
                        this.Dependencies.Add(dep);
                    }
                }

                int entryCount = reader.ReadInt32();
                if (entryCount > 0)
                {
                    reader.ReadInt32(); // fC2
                    this._entryFlags = reader.ReadBytes(3);

                    this.Entries = new List<BigEntry>(entryCount);
                    for (int i = 0; i < entryCount; i++)
                    {
                        BigEntry entry = new BigEntry();
                        entry.Read(reader);
                        this.Entries.Add(entry);
                    }
                }
            }
        }
Exemple #2
0
        public void Read(BigBinaryReader reader)
        {
            this.FileName = reader.ReadString();

            reader.Seek(8, SeekOrigin.Current); // skip padding?

            this._offset = reader.ReadInt32();
            this.Size = reader.ReadUInt32();
            reader.Seek(4, SeekOrigin.Current); // skip padding?
            this.TimeStamp = reader.ReadDateTime();

            this.Type = reader.ReadString();
            this.Type2 = reader.ReadUInt16();

            int pos = (int)reader.BaseStream.Position;
            reader.Seek(this._offset, SeekOrigin.Begin);
            this.CompressedSize = reader.ReadUInt32();
            this.Data = reader.ReadBytes((int)this.CompressedSize);
            reader.Seek(pos, SeekOrigin.Begin);
        }