Exemplo n.º 1
0
        private BinaryReader OpenInstallationFile(EncodingHandler encoding, CASCEngine engine, MD5Hash hash, string errorName)
        {
            EncodingEntry entry;

            if (!encoding.GetEntry(hash, out entry))
            {
                throw new FileNotFoundException(string.Format("Installation missing {0} file!", errorName));
            }

            return(new BinaryReader(engine.OpenFile(entry.Key)));
        }
Exemplo n.º 2
0
        public bool GetEncodingEntry(ulong hash, out EncodingEntry entry)
        {
            var info = RootHandler.GetEntries(hash);

            if (info.Any())
            {
                return(EncodingHandler.GetEntry(info.First().MD5, out entry));
            }

            if ((CASCConfig.LoadFlags & LoadFlags.Install) != 0)
            {
                var installInfo = Install.GetEntries().Where(e => Hasher.ComputeHash(e.Name) == hash);
                if (installInfo.Any())
                {
                    return(EncodingHandler.GetEntry(installInfo.First().MD5, out entry));
                }
            }

            entry = default(EncodingEntry);
            return(false);
        }
Exemplo n.º 3
0
        private BinaryReader OpenInstallationFile(EncodingHandler encoding, CASCEngine engine, MD5Hash hash, string errorName)
        {
            EncodingEntry entry;

            if (!encoding.GetEntry(hash, out entry))
                throw new FileNotFoundException(string.Format("Installation missing {0} file!", errorName));

            return new BinaryReader(engine.OpenFile(entry.Key));
        }