Example #1
0
        /// <summary>
        /// Finds a valid entry for a given filename.
        /// </summary>
        /// <returns>The entry.</returns>
        /// <param name="fileName">File name.</param>
        public HashTableEntry FindEntry(string fileName)
        {
            uint entryHomeIndex = MPQCrypt.Hash(fileName, HashType.FileHashTableOffset) & (uint)this.Entries.Count - 1;
            uint hashA          = MPQCrypt.Hash(fileName, HashType.FilePathA);
            uint hashB          = MPQCrypt.Hash(fileName, HashType.FilePathB);

            return(FindEntry(hashA, hashB, entryHomeIndex));
        }
Example #2
0
        public bool TryFindEntry([NotNull] string fileName, out HashTableEntry tableEntry)
        {
            var entryHomeIndex = MPQCrypt.Hash(fileName, HashType.FileHashTableOffset) & (uint)_entries.Count - 1;
            var hashA          = MPQCrypt.Hash(fileName, HashType.FilePathA);
            var hashB          = MPQCrypt.Hash(fileName, HashType.FilePathB);

            if (!TryFindEntry(hashA, hashB, entryHomeIndex, out tableEntry))
            {
                return(false);
            }

            return(true);
        }