From 7696219c11c51da966c5bf610324d60d055547e5 Mon Sep 17 00:00:00 2001 From: Super Hackio Date: Fri, 15 Mar 2024 06:23:34 -0700 Subject: [PATCH] Fixed #6 Also actually added Update Checking lol. --- Scenaristar/Program.cs | 11 +++++++++++ Scenaristar/Scenaristar.csproj | 6 +++--- Scenaristar/UI/ScenarioEditorForm.cs | 9 ++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Scenaristar/Program.cs b/Scenaristar/Program.cs index 961577e..2138bda 100644 --- a/Scenaristar/Program.cs +++ b/Scenaristar/Program.cs @@ -15,6 +15,7 @@ internal static class Program public static bool IsGameFileLittleEndian { get; set; } = false; public static bool IsUnsavedChanges { get; set; } = false; private static ScenarioEditorForm? Editor; + public static UpdateInformation? UpdateInfo; /// /// The main entry point for the application. @@ -28,6 +29,16 @@ static void Main(string[] args) // Prevents floats being written to the .dae with commas instead of periods on European systems. CultureInfo.CurrentCulture = new("", false); + UpdateInfo = UpdateInformation.IsUpdateExist(UPDATEALERT_URL); + if (UpdateInfo is not null && UpdateInfo.Value.IsNewer()) + { + if (UpdateInfo.Value.IsUpdateRequired) + { + MessageBox.Show("An update for Scenaristar is available. To continue using Scenaristar, please update to the latest version.", "Update Required", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + if (args.Any(A => A.Equals("-le"))) { IsGameFileLittleEndian = true; diff --git a/Scenaristar/Scenaristar.csproj b/Scenaristar/Scenaristar.csproj index 901b1e8..1b94cd2 100644 --- a/Scenaristar/Scenaristar.csproj +++ b/Scenaristar/Scenaristar.csproj @@ -15,10 +15,10 @@ Copyright © Super Hackio Incorporated 2019-2024 https://github.com/SuperHackio/Scenaristar https://github.com/SuperHackio/Scenaristar - 1.5.0.0 - 1.5.0.0 + 1.5.0.1 + 1.5.0.1 en-US - 1.5.0.0 + 1.5.0.1 Assets\_Icon.ico diff --git a/Scenaristar/UI/ScenarioEditorForm.cs b/Scenaristar/UI/ScenarioEditorForm.cs index a004073..86e7eaf 100644 --- a/Scenaristar/UI/ScenarioEditorForm.cs +++ b/Scenaristar/UI/ScenarioEditorForm.cs @@ -689,10 +689,10 @@ private void ScenarioListView_SelectedIndexChanged(object sender, EventArgs e) StarCheckedListBox.SetItemChecked(i, Current[i]); } + IsIgnoreChanges = false; ZonesListBox.SelectedIndex = tmp; SetAppStatus(true); ResumeLayout(); - IsIgnoreChanges = false; UpdateStatusBar(true); } @@ -1123,8 +1123,11 @@ private void UpdateStatusBar(bool Force = false) Random rng = new(); if (rng.Next(0, 100) < 100) { - InfoToolStripStatusLabel.Text = Flavour[rng.Next(0, Flavour.Length)]; - StatusResumeCountdown = 1; + if (Program.UpdateInfo is not null && Program.UpdateInfo.Value.IsNewer()) + InfoToolStripStatusLabel.Text = $"An Update is available! Scenaristar {Program.UpdateInfo.Value.Version} -- {Program.GIT_RELEASE_URL}"; + else + InfoToolStripStatusLabel.Text = Flavour[rng.Next(0, Flavour.Length)]; + StatusResumeCountdown = 2; } } InfoToolStripStatusLabel.Text += " ";