コード例 #1
0
ファイル: WadFileViewModel.cs プロジェクト: Aren-py/Obsidian
 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'
            + "SHA256: " + UtilitiesFantome.ByteArrayToHex(this.Entry.SHA));
 }
コード例 #2
0
        public static string Get(WADEntry entry)
        {
            if (_hashtable.ContainsKey(entry.XXHash))
            {
                return(_hashtable[entry.XXHash]);
            }
            else
            {
                string extension = LeagueUtilities.GetExtension(entry.GetContent(true));

                return(string.Format("{0}.{1}", entry.XXHash.ToString("x16"), extension));
            }
        }
コード例 #3
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)
                {
                    BINFile bin = null;
                    try
                    {
                        bin = new BINFile(entryStream);
                    }
                    catch (Exception)
                    {
                    }

                    if (bin != null)
                    {
                        strings.AddRange(ProcessBINDependencies(bin.Dependencies));
                        strings.AddRange(ProcessBINFile(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);
        }
コード例 #4
0
ファイル: Hashtable.cs プロジェクト: coman3/Obsidian
        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));
            }
        }