Skip to content

Commit

Permalink
Fixed #6
Browse files Browse the repository at this point in the history
Also actually added Update Checking lol.
  • Loading branch information
SuperHackio committed Mar 15, 2024
1 parent 2bd256f commit 7696219
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
11 changes: 11 additions & 0 deletions Scenaristar/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// The main entry point for the application.
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions Scenaristar/Scenaristar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<Copyright>Copyright © Super Hackio Incorporated 2019-2024</Copyright>
<PackageProjectUrl>https://github.com/SuperHackio/Scenaristar</PackageProjectUrl>
<RepositoryUrl>https://github.com/SuperHackio/Scenaristar</RepositoryUrl>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<FileVersion>1.5.0.0</FileVersion>
<AssemblyVersion>1.5.0.1</AssemblyVersion>
<FileVersion>1.5.0.1</FileVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<Version>1.5.0.0</Version>
<Version>1.5.0.1</Version>
<ApplicationIcon>Assets\_Icon.ico</ApplicationIcon>
</PropertyGroup>

Expand Down
9 changes: 6 additions & 3 deletions Scenaristar/UI/ScenarioEditorForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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 += " ";
Expand Down

0 comments on commit 7696219

Please sign in to comment.