public static CDNIndexHandler Initialize(CASCConfig config)
        {
            var handler = new CDNIndexHandler(config);

            for (int i = 0; i < config.Archives.Count; i++)
            {
                string archive = config.Archives[i];

                if (config.OnlineMode)
                {
                    handler.DownloadIndexFile(archive, i);
                }
                else
                {
                    handler.OpenIndexFile(archive, i);
                }
            }

            return(handler);
        }
示例#2
0
        public static CDNIndexHandler Initialize(CASCConfig config, BackgroundWorkerEx worker)
        {
            var handler = new CDNIndexHandler(config, worker);

            worker?.ReportProgress(0, "Loading \"CDN indexes\"...");

            for (int i = 0; i < config.Archives.Count; i++)
            {
                string archive = config.Archives[i];

                if (config.OnlineMode)
                {
                    handler.DownloadIndexFile(archive, i);
                }
                else
                {
                    handler.OpenIndexFile(archive, i);
                }

                worker?.ReportProgress((int)((i + 1) / (float)config.Archives.Count * 100));
            }

            return(handler);
        }