示例#1
0
        public void SingleDownload()
        {
            // Force log4net on.
            // BasicConfigurator.Configure();
            // LogManager.GetRepository().Threshold = Level.Debug;
            log.Info("Performing single download test.");

            // We know kOS is in the TestKAN data, and hosted in KS. Let's get it.

            var modules = new List <CkanModule>();

            CkanModule kOS = registry.LatestAvailable("kOS", null);

            Assert.IsNotNull(kOS);

            modules.Add(kOS);

            // Make sure we don't alread have kOS somehow.
            Assert.IsFalse(cache.IsCached(kOS.download));

            //
            log.InfoFormat("Downloading kOS from {0}", kOS.download);

            // Download our module.
            async.DownloadModules(
                ksp.KSP.Cache,
                modules
                );

            // Assert that we have it, and it passes zip validation.
            Assert.IsTrue(cache.IsCachedZip(kOS.download));
        }
示例#2
0
        /// <summary>
        /// Makes sure all the specified mods are downloaded.
        /// </summary>
        private void DownloadModules(IEnumerable <CkanModule> mods, NetAsyncDownloader downloader)
        {
            List <CkanModule> downloads = mods.Where(module => !ksp.Cache.IsCachedZip(module.download)).ToList();

            if (downloads.Count > 0)
            {
                downloader.DownloadModules(ksp.Cache, downloads);
            }
        }
示例#3
0
        private void CacheMod(object sender, DoWorkEventArgs e)
        {
            ResetProgress();
            ClearLog();

            NetAsyncDownloader dowloader = new NetAsyncDownloader(m_User);

            dowloader.DownloadModules(CurrentInstance.Cache, new List <CkanModule> {
                (CkanModule)e.Argument
            });
            e.Result = e.Argument;
        }
示例#4
0
        private void CacheMod(object sender, DoWorkEventArgs e)
        {
            ResetProgress();
            ClearLog();

            NetAsyncDownloader dowloader = new NetAsyncDownloader(m_User);
            
            dowloader.DownloadModules(CurrentInstance.Cache, new List<CkanModule> { (CkanModule)e.Argument });
            e.Result = e.Argument;
        }
示例#5
0
        /// <summary>
        /// Makes sure all the specified mods are downloaded.
        /// </summary>
        private void DownloadModules(IEnumerable<CkanModule> mods, NetAsyncDownloader downloader)
        {
            List<CkanModule> downloads = mods.Where(module => !ksp.Cache.IsCachedZip(module.download)).ToList();

            if (downloads.Count > 0)
            {
                downloader.DownloadModules(ksp.Cache, downloads);
            }
        }