Example #1
0
        public bool GetEncodingEntry(ulong hash, out EncodingEntry enc)
        {
            var rootInfos = RootHandler.GetEntries(hash);

            if (rootInfos.Any())
            {
                return(EncodingHandler.GetEntry(rootInfos.First().MD5, out enc));
            }

            if ((CASCConfig.LoadFlags & LoadFlags.Install) != 0)
            {
                var installInfos = Install.GetEntries().Where(e => Hasher.ComputeHash(e.Name) == hash && e.Tags.Any(t => t.Type == 1 && t.Name == RootHandler.Locale.ToString()));
                if (installInfos.Any())
                {
                    return(EncodingHandler.GetEntry(installInfos.First().MD5, out enc));
                }

                installInfos = Install.GetEntries().Where(e => Hasher.ComputeHash(e.Name) == hash);
                if (installInfos.Any())
                {
                    return(EncodingHandler.GetEntry(installInfos.First().MD5, out enc));
                }
            }

            enc = default(EncodingEntry);
            return(false);
        }
Example #2
0
        private bool GetCKeyForHash(ulong hash, out MD5Hash cKey)
        {
            var rootInfos = RootHandler.GetEntries(hash);

            if (rootInfos.Any())
            {
                cKey = rootInfos.First().cKey;
                return(true);
            }

            if ((CASCConfig.LoadFlags & LoadFlags.Install) != 0)
            {
                var installInfos = Install.GetEntries().Where(e => Hasher.ComputeHash(e.Name) == hash && e.Tags.Any(t => t.Type == 1 && t.Name == RootHandler.Locale.ToString()));
                if (installInfos.Any())
                {
                    cKey = installInfos.First().MD5;
                    return(true);
                }

                installInfos = Install.GetEntries().Where(e => Hasher.ComputeHash(e.Name) == hash);
                if (installInfos.Any())
                {
                    cKey = installInfos.First().MD5;
                    return(true);
                }
            }

            cKey = default;
            return(false);
        }