Пример #1
0
        // public MpqArchive Archive => _archive;

        /*public void AddToArchive( MpqArchive archive )
         * {
         *  if ( _archive != null )
         *  {
         *      throw new InvalidOperationException();
         *  }
         *
         *  _archive = archive;
         *  _entry.SetPos( 0 );
         * }*/

        public void AddToArchive(uint headerOffset, uint index, uint filePos, MpqLocale locale, uint mask)
        {
            _entry.SetPos(headerOffset, filePos);

            // This file came from another archive, and has an unknown filename.
            if (_hash.HasValue)
            {
                // Overwrite blockIndex from old archive.
                var hash = _hash.Value;
                _hash = new MpqHash(hash.Name1, hash.Name2, hash.Locale, index, hash.Mask);
            }
            else
            {
                _hash      = new MpqHash(_fileName, mask, locale, index);
                _hashIndex = MpqHash.GetIndex(_fileName, mask);
            }
        }
Пример #2
0
        public void AddToArchive(uint headerOffset, uint index, uint filePos, MpqLocale locale, uint mask)
        {
            // TODO: verify that blocksize of mpqfile and mpqarchive to which it gets added are the same, otherwise throw an exception

            _entry.SetPos(headerOffset, filePos);

            // This file came from another archive, and has an unknown filename.
            if (_hash.HasValue)
            {
                // Overwrite blockIndex from old archive.
                var hash = _hash.Value;
                _hash = new MpqHash(hash.Name1, hash.Name2, hash.Locale, index, hash.Mask);
            }
            else
            {
                _hash      = new MpqHash(_fileName, mask, locale, index);
                _hashIndex = MpqHash.GetIndex(_fileName, mask);
            }
        }