private bool LocateMpqHeader()
        {
            BinaryReader br = new BinaryReader(this.BaseStream);

            for (long i = 0L; i < (this.BaseStream.Length - MpqHeader.Size); i += 0x200L)
            {
                this.BaseStream.Seek(i, SeekOrigin.Begin);
                this._mpqHeader = MpqHeader.FromReader(br);
                if (this._mpqHeader != null)
                {
                    this._headerOffset = i;
                    this._mpqHeader.SetHeaderOffset(this._headerOffset);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
        private bool LocateMpqHeader()
        {
            BinaryReader br = new BinaryReader(BaseStream);

            // In .mpq files the header will be at the start of the file
            // In .exe files, it will be at a multiple of 0x200
            for (long i = 0; i < BaseStream.Length - MpqHeader.Size; i += 0x200)
            {
                BaseStream.Seek(i, SeekOrigin.Begin);
                _mpqHeader = MpqHeader.FromReader(br);
                if (_mpqHeader != null)
                {
                    _headerOffset = i;
                    _mpqHeader.SetHeaderOffset(_headerOffset);
                    return(true);
                }
            }
            return(false);
        }