예제 #1
0
        public bool FileExists(int fileDataID)
        {
            if (RootHandler == null)
            {
                return(false);
            }

            return(FileExists(RootHandler.GetHashByFileDataId(fileDataID)));
        }
예제 #2
0
파일: CASCEngine.cs 프로젝트: Kruithne/W3DT
        private CASCEngine(CASCConfig config)
        {
            Config = config;

            Log.Write("CASC: Loading indexes...");
            CDNIndex = CDNIndexHandler.Initialize(config);

            Log.Write("CASC: Loaded {0} indexes", CDNIndex.Count);

            if (!Program.Settings.UseRemote)
            {
                CDNIndexHandler.Cache.Enabled = false;

                Log.Write("CASC: Loading indexes from local storage...");
                LocalIndex = LocalIndexHandler.Initialize(config);

                Log.Write("CASC: Loaded {0} indexes from local storage", LocalIndex.Count);
            }

            EventManager.Trigger_LoadStepDone();

            Log.Write("CASC: Loading encoding data...");
            using (var stream = OpenEncodingFile(this))
                EncodingHandler = new EncodingHandler(stream);

            Log.Write("CASC: Loaded {0} encoding data entries", EncodingHandler.Count);

            if ((CASCConfig.LoadFlags & LoadFlags.Download) != 0)
            {
                Log.Write("CASC: Loading download data...");

                using (var stream = OpenDownloadFile(EncodingHandler, this))
                    DownloadHandler = new DownloadHandler(stream);

                Log.Write("CASC: Loaded {0} download data entries", EncodingHandler.Count);
            }

            EventManager.Trigger_LoadStepDone();
            Log.Write("CASC: Loading root data...");

            using (var stream = OpenRootFile(EncodingHandler, this))
                RootHandler = new RootHandler(stream);

            Log.Write("CASC: Loaded {0} root data entries", RootHandler.Count);

            if ((CASCConfig.LoadFlags & LoadFlags.Install) != 0)
            {
                Log.Write("CASC: Loading install data...");

                using (var stream = OpenInstallFile(EncodingHandler, this))
                    InstallHandler = new InstallHandler(stream);

                Log.Write("CASC: Loaded {0} install data entries", InstallHandler.Count);
            }
            EventManager.Trigger_LoadStepDone();
        }
예제 #3
0
        private CASCEngine(CASCConfig config)
        {
            Config = config;

            Log.Write("CASC: Loading indexes...");
            CDNIndex = CDNIndexHandler.Initialize(config);

            Log.Write("CASC: Loaded {0} indexes", CDNIndex.Count);

            if (!Program.Settings.UseRemote)
            {
                CDNIndexHandler.Cache.Enabled = false;

                Log.Write("CASC: Loading indexes from local storage...");
                LocalIndex = LocalIndexHandler.Initialize(config);

                Log.Write("CASC: Loaded {0} indexes from local storage", LocalIndex.Count);
            }

            EventManager.Trigger_LoadStepDone();

            Log.Write("CASC: Loading encoding data...");
            using (var stream = OpenEncodingFile(this))
                EncodingHandler = new EncodingHandler(stream);

            Log.Write("CASC: Loaded {0} encoding data entries", EncodingHandler.Count);

            if ((CASCConfig.LoadFlags & LoadFlags.Download) != 0)
            {
                Log.Write("CASC: Loading download data...");

                using (var stream = OpenDownloadFile(EncodingHandler, this))
                    DownloadHandler = new DownloadHandler(stream);

                Log.Write("CASC: Loaded {0} download data entries", EncodingHandler.Count);
            }

            EventManager.Trigger_LoadStepDone();
            Log.Write("CASC: Loading root data...");

            using (var stream = OpenRootFile(EncodingHandler, this))
                RootHandler = new RootHandler(stream);

            Log.Write("CASC: Loaded {0} root data entries", RootHandler.Count);

            if ((CASCConfig.LoadFlags & LoadFlags.Install) != 0)
            {
                Log.Write("CASC: Loading install data...");

                using (var stream = OpenInstallFile(EncodingHandler, this))
                    InstallHandler = new InstallHandler(stream);

                Log.Write("CASC: Loaded {0} install data entries", InstallHandler.Count);
            }
            EventManager.Trigger_LoadStepDone();
        }
예제 #4
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);
        }
예제 #5
0
 public bool FileExists(ulong hash) => RootHandler.GetAllEntries(hash).Any();