Beispiel #1
0
 public string GetInfo()
 {
     return(this.Path + '\n'
            + "Compression Type: " + this.Entry.Type.ToString() + '\n'
            + "Compressed Size: " + this.Entry.CompressedSize + '\n'
            + "Uncompressed Size: " + this.Entry.UncompressedSize + '\n'
            + "Checksum: " + UtilitiesFantome.ByteArrayToHex(this.Entry.Checksum));
 }
Beispiel #2
0
        public static Dictionary <ulong, string> Generate(Wad wad)
        {
            Dictionary <ulong, string> hashtable = new Dictionary <ulong, string>();
            List <string> strings = new List <string>();

            foreach (WadEntry entry in wad.Entries.Values.Where(x => x.Type != WadEntryType.FileRedirection))
            {
                using Stream entryStream = entry.GetDataHandle().GetDecompressedStream();
                LeagueFileType fileType = LeagueUtilities.GetExtensionType(entryStream);

                if (fileType == LeagueFileType.BIN)
                {
                    BinTree bin = null;
                    try
                    {
                        bin = new BinTree(entryStream);
                    }
                    catch (Exception)
                    {
                    }

                    if (bin != null)
                    {
                        strings.AddRange(ProcessBinDependencies(bin.Dependencies));
                        strings.AddRange(ProcessBinTree(bin));
                    }
                }
                else if (IsLegacyDirList(entry.XXHash))
                {
                    strings.AddRange(ProcessLegacyDirList(entry));
                }
            }

            using (XXHash64 xxHash = XXHash64.Create())
            {
                foreach (string fetchedString in strings.Distinct())
                {
                    if (!string.IsNullOrEmpty(fetchedString))
                    {
                        ulong hash = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(fetchedString.ToLower())), 0);

                        if (!hashtable.ContainsKey(hash))
                        {
                            hashtable.Add(hash, fetchedString);
                        }
                    }
                }
            }

            return(hashtable);
        }
Beispiel #3
0
        public static string Get(WadEntry entry)
        {
            if (_hashtable.ContainsKey(entry.XXHash))
            {
                return(_hashtable[entry.XXHash]);
            }
            else
            {
                Stream decompressedStream = entry.GetDataHandle().GetDecompressedStream();
                string extension          = LeagueUtilities.GetExtension(LeagueUtilities.GetExtensionType(decompressedStream));

                return(string.Format("{0}.{1}", entry.XXHash.ToString("x16"), extension));
            }
        }