public AboutBox() { InitializeComponent(); this.Text = String.Format("About {0}", AssemblyTitle); this.labelProductName.Text = AssemblyProduct; string ver = "Code Build"; UpdaterLib.Version v = UpdaterLib.Updater.GetCurrentVersion(); if (v != null) { ver = "[" + v.Channel.ToString() + "] " + v.Name; } this.labelVersion.Text = String.Format("Version: {0}", ver); this.labelCopyright.Text = AssemblyCopyright; this.labelCompanyName.Text = AssemblyCompany; Assembly asm = Assembly.GetExecutingAssembly(); string resName = "WorldSmith.Resources.WorldsmithAbout.rtf"; string[] resources = asm.GetManifestResourceNames(); using (System.IO.Stream s = asm.GetManifestResourceStream(resName)) { this.richTextBox1.LoadFile(s, RichTextBoxStreamType.RichText); } }
public static void Check(bool Silently = false) { try { //Check for a version file. if (!File.Exists("version.txt")) { Console.WriteLine("[UpdateChecker] There is no Version.txt in the worldsmith directory"); Console.WriteLine("[UpdateChecker] This means you probably built Worldsmith from source."); Console.WriteLine("[UpdateChecker] If you didn't, Redownload Worldsmith from www.worldsmith.net"); return; } //Get the version file UpdaterLib.Version v = UpdaterLib.Updater.GetCurrentVersion(); Console.WriteLine("[UpdateChecker] You are running Worldsmith " + v.Channel.ToString() + " - " + v.Name); //Check for an update with our version bool update = UpdaterLib.Updater.CheckForUpdate(v.Channel, v.BuildDate, UpdateURL); if (!update) { Console.WriteLine("[UpdateChecker] You are running the latest version of Worldsmith!"); return; } if (!Silently && MessageBox.Show("There is an update to Worldsmith! Would you like to download it?", "Update Available", MessageBoxButtons.YesNo) == DialogResult.Yes) { //Close worldsmith //TODO: Close the project cleanly //Launch the updater ProcessStartInfo p = new ProcessStartInfo(); p.FileName = "WorldsmithUpdater.exe"; p.Arguments = "update -c " + v.Channel.ToString() + " -u " + UpdateURL + " -l"; p.UseShellExecute = true; Process.Start(p); Environment.Exit(0); } else { var builds = UpdaterLib.Updater.GetBuildsForChannel(v.Channel, UpdateURL); var b = builds.OrderByDescending(x => x.Date).FirstOrDefault(); Console.WriteLine("[UpdateChecker] There is an update to worldsmith! "); Console.WriteLine("[UpdateChecker] " + b.Version + " released on " + b.Date.ToShortDateString() + ". Build notes: " + b.Notes); } } catch (Exception e) { Console.WriteLine("[UpdateChecker] There was an error checking for an update"); Console.WriteLine(e.ToString()); return; } }