Example #1
0
		public MainWindow() : base (Gtk.WindowType.Toplevel) {
			Build();
			FormatTitle();
			server = new ServerConnector(TroposphirLauncher.Settings.TroposphirServerPath);
			updater = new Updater(new Updater.Config() {
				Server = server,
				PatchFolder = TroposphirLauncher.Settings.AtmosphirExecutableFolder,
				Progress = (fraction) => {
					progressBar.Fraction = fraction;
					FormatTitle();
				},
				StepChange = (status) => {
					switch (status) {
						case Updater.UpdateStatus.NOT_STARTED:
							StatusString = "";
							break;
						case Updater.UpdateStatus.STARTING:
							StatusString = "Connecting to update server";
							break;
						case Updater.UpdateStatus.CHECKING:
							StatusString = "Verifying local files";
							break;
						case Updater.UpdateStatus.COMPARING:
							StatusString = "Looking for updates";
							break;
						case Updater.UpdateStatus.DOWNLOADING:
							StatusString = "Downloading patches";
							break;
						case Updater.UpdateStatus.APPLYING:
							StatusString = "Applying changes";
							break;
						case Updater.UpdateStatus.DONE:
							StatusString = "Finished updating";
							break;
						case Updater.UpdateStatus.FAILED:
							StatusString = "Failed updating the game";
							break;
						default:
							break;
					}
				}
			});
			LoadNews();
			if (TroposphirLauncher.Settings.AutoUpdate) {
				updater.AsyncUpdate();
			}
		}
Example #2
0
		/// <summary>
		/// Initializes a new instance of the <see cref="TroposphirLauncher.Updater"/> class using the configurations provided by the specified <see cref="Config"/>.
		/// </summary>
		/// <param name="config">The Updater Config to use.</param>
		public Updater(Config config) {
			server = config.Server;
			progressCallback = config.Progress;
			stepCallback = config.StepChange;
			patchFolder = config.PatchFolder;
			Status = UpdateStatus.NOT_STARTED;
		}