Exemplo n.º 1
0
        public void DownloadDependencies()
        {
            var succeeded = new List <bool>();

            Program.InitializingLogger.Info("DownloadDep", "依存関係のダウンロード開始");
            using (var downloader = new DownloaderWithLogger(Program.InitializingLogger)) {
                succeeded.Add(downloader.TryDownload(IC2, IC2Jar));
                succeeded.Add(downloader.TryDownload(BCCore, BCCoreJar));
                succeeded.Add(downloader.TryDownload(TF, TFJar));
                succeeded.Add(downloader.TryDownload(TiC, TiCJar));
                succeeded.Add(downloader.TryDownload(FFM, FFMJar));
            }

            Program.InitializingLogger.Info("DownloadDep", "依存関係のダウンロード完了");

            this.HasError = succeeded.Any(item => item == false);
        }
Exemplo n.º 2
0
        public VersionEntryJson CheckForUpdate()
        {
            string file = "tmp/versions.json".GetAbsolutePath();

            if (File.Exists(file))
            {
                File.Delete(file);
            }

            bool succeeded;

            using (var downloader = new DownloaderWithLogger(new LoggerDummy())) {
                succeeded = downloader.TryDownload(this.candidate, file);
            }

            if (!succeeded)
            {
                this.HasError = true;
                return(null);
            }

            VersionsJson json;

            using (var reader = new StreamReader(file, Encoding.UTF8)) {
                json = JsonConvert.DeserializeObject <VersionsJson>(reader.ReadToEnd());
            }

            var currentVer  = Version.Parse(Program.Version);
            var versionJson = json.Versions.Max();
            var ver         = Version.Parse(versionJson.Version);

            if (ver > currentVer)
            {
                return(versionJson);
            }

            return(null);
        }