示例#1
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();
        }
示例#2
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();
        }
示例#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)));
        }
示例#4
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));
        }
示例#5
0
 private BinaryReader OpenRootFile(EncodingHandler encoding, CASCEngine casc)
 {
     return OpenInstallationFile(encoding, casc, casc.Config.RootMD5, "root");
 }
示例#6
0
 private BinaryReader OpenDownloadFile(EncodingHandler encoding, CASCEngine casc)
 {
     return OpenInstallationFile(encoding, casc, casc.Config.DownloadMD5, "download");
 }
示例#7
0
 private BinaryReader OpenInstallFile(EncodingHandler encoding, CASCEngine casc)
 {
     return OpenInstallationFile(encoding, casc, casc.Config.InstallMD5, "install");
 }
示例#8
0
 private BinaryReader OpenRootFile(EncodingHandler encoding, CASCEngine casc)
 {
     return(OpenInstallationFile(encoding, casc, casc.Config.RootMD5, "root"));
 }
示例#9
0
 private BinaryReader OpenDownloadFile(EncodingHandler encoding, CASCEngine casc)
 {
     return(OpenInstallationFile(encoding, casc, casc.Config.DownloadMD5, "download"));
 }
示例#10
0
 private BinaryReader OpenInstallFile(EncodingHandler encoding, CASCEngine casc)
 {
     return(OpenInstallationFile(encoding, casc, casc.Config.InstallMD5, "install"));
 }