Пример #1
0
        /// <summary>
        /// Finds all elements with the given hash, then compares path.
        /// </summary>
        public RAFFileListEntry GetFileEntryByHash(uint hash, string path)
        {
            List <RAFFileListEntry> matches = new List <RAFFileListEntry>();
            uint pathHash = RAFHashUtil.GetHash(path);

            foreach (RAFFileListEntry entry in fileEntries)
            {
                //Console.WriteLine("A " + entry.FileName);
                //Console.WriteLine("B " + path);
                if (entry.StringNameHash == pathHash)
                {
                    //Console.WriteLine("HASH MATCH");
                    matches.Add(entry); //There are collisison, iirc.
                }
            }
            foreach (RAFFileListEntry entry in matches)
            {
                if (entry.FileName.Equals(path, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(entry);
                }
            }
            return(null);
        }
Пример #2
0
 private UInt32 GetStringHash(String s)
 {
     return(RAFHashUtil.GetHash(s.ToLower()));
 }