private async Task checkUpdate() { FileDownload fw = new FileDownload(launcherInfoURL, launcherInfoFile); fw.DownloadCompleted += checkUpdateFinished; await fw.Start(); }
public async Task loadData() { if (!CustomGame) { FileDownload fw = new FileDownload(CSVFileURL, CSVFile); fw.DownloadCompleted += CSVDownloadComplete; await fw.Start(); } }
private void downloadGame() { if (!string.IsNullOrEmpty(DownloadURL)) { if (!Utils.hasWriteAccessToFolder(Path.GetFullPath(Utils.GamesFolder))) { Utils.StartApplicationInAdminMode(); } Downloading = true; btnMain.Enabled = false; btnSecond.Enabled = false; btnNext.Enabled = false; btnPrevious.Enabled = false; FileDownload fw = new FileDownload(DownloadURL, ZipFile); fw.ProgressChanged += downloadProgressChanged; fw.DownloadCompleted += downloadCompleted; startdownloadtime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); Timer t = new Timer(); t.Tick += T_Tick; t.Interval = 100; t.Start(); fw.Start(); } }
private void checkUpdateFinished(object sender, EventArgs e) { Dictionary <string, string> values = new Dictionary <string, string>(); String[] lines = File.ReadAllLines(launcherInfoFile); foreach (string line in lines) { var lineValues = line.Split(','); values.Add(lineValues[0], lineValues[1]); } File.Delete(launcherInfoFile); string os = ""; OperatingSystem os_info = Environment.OSVersion; PlatformID pid = os_info.Platform; switch (pid) { case PlatformID.Unix: os = "lin"; break; case PlatformID.MacOSX: os = "mac"; break; case PlatformID.Win32NT: os = "win"; if (Utils.Is64BitOperatingSystem) { os += ".64"; } else { os += ".32"; } break; default: break; } string newVersion = ""; string newVersionURL = ""; foreach (KeyValuePair <string, string> item in values) { if (item.Key == "curVerNum." + os) { newVersion = item.Value; values.TryGetValue("URL." + os, out newVersionURL); } if (item.Key == "doc.changelog") { ChangeLogURL = item.Value; } } launcherSetupFile += newVersion + ".exe"; if (ChangeLogURL != "") { btnChangelog.Enabled = true; } Version newVersionV = Version.CreateFromString(newVersion); string[] versionsS = newVersion.Split('.'); int[] versions = new int[] { int.Parse(versionsS[0]), int.Parse(versionsS[1]), int.Parse(versionsS[2]), int.Parse(versionsS[3]) }; if (newVersionV > launcherVersion) { if (MessageBox.Show("Theres an update for Jeremie Launcher, Do you want to download it?", "Update Available", MessageBoxButtons.OKCancel) == DialogResult.OK) { FileDownload fw = new FileDownload(newVersionURL, launcherSetupFile); fw.DownloadCompleted += setupFinishDownload; fw.ProgressChanged += setupProgressChanged; Updating = true; fw.Start(); } } }