// Check Current version on Server public static void checkVersion(Scarlet ScarletForm) { var versionURL = "https://" + ScarletForm.scarletAgentURL + "/api/"; string versionNo = ""; try { JsonObject verGet = JsonObject.readFrom((new WebClient()).DownloadString(versionURL)); versionNo = verGet.get("Version").asString(); } catch (System.Net.WebException) { } if (versionNo == "Maintenance Mode") { System.Windows.Forms.MessageBox.Show("Scarlet is currently under maintainance. Please poke Omega to fix it."); Environment.Exit(0); } else if (versionNo != ScarletForm.Version) { System.Windows.Forms.MessageBox.Show("This version is out of date, please download the updated version."); Process.Start("http://mods.australianarmedforces.org/?update"); Environment.Exit(0); } }
// Check Current version on Server public static void testConnection(Scarlet ScarletForm) { try { ScarletAPI.Request(""); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message.ToString(), "No connection to Scarlet Servers."); Environment.Exit(1); } }