private void DownloadComplete(object sender, DownloadStringCompletedEventArgs e) { if (e.Error != null) { MessageBox.Show("Error downloading version information. Check your " + "internet connection and make sure the installer is allowed to " + "access the internet."); Application.Exit(); } var versions = new List <ModLoaderVersion>(); try { var releases = JSON.Parse(e.Result); for (int i = 0; i < releases.AsArray.Count; i++) { var version = new ModLoaderVersion(); version.Name = releases[i]["tag_name"]; version.ID = releases[i]["id"]; string[] downloads = { releases[i]["assets"][0]["browser_download_url"], releases[i]["assets"][1]["browser_download_url"] }; if (downloads[0].Contains("Developer")) { version.DeveloperDownload = downloads[0]; version.NormalDownload = downloads[1]; } else { version.DeveloperDownload = downloads[1]; version.NormalDownload = downloads[0]; } versions.Add(version); } } catch (Exception) { MessageBox.Show("Error parsing version information. Exiting."); Application.Exit(); } var form = new FormInstaller(); form.SetVersionList(versions); form.Show(); Close(); }
private void DownloadComplete(object sender, DownloadStringCompletedEventArgs e) { if (e.Error != null) { MessageBox.Show("Error downloading version information. Check your " + "internet connection and make sure the installer is allowed to " + "access the internet."); Application.Exit(); } var versions = new List<ModLoaderVersion>(); try { var releases = JSON.Parse(e.Result); for (int i = 0; i < releases.AsArray.Count; i++) { var version = new ModLoaderVersion(); version.Name = releases[i]["tag_name"]; version.ID = releases[i]["id"]; string[] downloads = { releases[i]["assets"][0]["browser_download_url"], releases[i]["assets"][1]["browser_download_url"] }; if (downloads[0].Contains("Developer")) { version.DeveloperDownload = downloads[0]; version.NormalDownload = downloads[1]; } else { version.DeveloperDownload = downloads[1]; version.NormalDownload = downloads[0]; } versions.Add(version); } } catch (Exception) { MessageBox.Show("Error parsing version information. Exiting."); Application.Exit(); } var form = new FormInstaller(); form.SetVersionList(versions); form.Show(); Close(); }