Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
- Fixed a bug that allowed users to install server files with an unsupported game version
  • Loading branch information
Eavilaswayce committed Jan 19, 2023
1 parent 5feb009 commit 0e5a1df
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 23 deletions.
6 changes: 3 additions & 3 deletions H1EmuLauncher/H1EmuLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>Icon.ico</ApplicationIcon>
<AssemblyVersion>2.5.9</AssemblyVersion>
<FileVersion>2.5.9</FileVersion>
<AssemblyVersion>2.6.0</AssemblyVersion>
<FileVersion>2.6.0</FileVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Authors>H1Emu</Authors>
<Version>2.5.9</Version>
<Version>2.6.0</Version>
<AssemblyName>H1EmuLauncher</AssemblyName>
<SignAssembly>false</SignAssembly>
<Copyright>© H1Emu</Copyright>
Expand Down
55 changes: 38 additions & 17 deletions H1EmuLauncher/Windows/Settings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public void InstallPatch(object sender, RoutedEventArgs e)
if (!CheckDirectory())
return;

CheckGameVersion();

switch (gameVersion)
{
case "15jan2015":
Expand Down Expand Up @@ -199,6 +197,29 @@ public void InstallServer(object sender, RoutedEventArgs e)
if (!CheckDirectory())
return;

if (gameVersion == "processBeingUsed")
{
Dispatcher.Invoke(new Action(delegate
{
EnableButtons();

CustomMessageBox.Show(FindResource("item121").ToString().Replace("\\n\\n", Environment.NewLine + Environment.NewLine), this);
}));

return;
}
else if (string.IsNullOrEmpty(gameVersion))
{
Dispatcher.Invoke(new Action(delegate
{
EnableButtons();

CustomMessageBox.Show(FindResource("item58").ToString().Replace("\\n\\n", Environment.NewLine + Environment.NewLine), this);
}));

return;
}

Button button = (Button)sender;

if (button.Name == "latestButton")
Expand Down Expand Up @@ -515,6 +536,8 @@ public void CheckGameVersion()
{
Launcher.launcherInstance.taskbarIcon.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;
}));

EnableButtons();
}

public void SettingsLoaded(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -563,7 +586,6 @@ public void SettingsLoaded(object sender, RoutedEventArgs e)
}));

CheckGameVersion();
EnableButtons();

if (gameVersion == "processBeingUsed")
{
Expand Down Expand Up @@ -613,7 +635,6 @@ public void SelectDirectory(object sender, RoutedEventArgs e)
return;

CheckGameVersion();
EnableButtons();

switch (gameVersion)
{
Expand Down Expand Up @@ -683,19 +704,6 @@ public bool CheckDirectory()
return true;
}

public void DisableButtons()
{
Dispatcher.Invoke(new Action(delegate
{
Launcher.launcherInstance.taskbarIcon.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Indeterminate;
directoryButton.IsEnabled = false;
patchButton.IsEnabled = false;
latestButton.IsEnabled = false;
stableButton.IsEnabled = false;
settingsProgressRow.Visibility = Visibility.Visible;
}));
}

public void EnableButtons()
{
Dispatcher.Invoke(new Action(delegate
Expand All @@ -709,6 +717,19 @@ public void EnableButtons()
}));
}

public void DisableButtons()
{
Dispatcher.Invoke(new Action(delegate
{
Launcher.launcherInstance.taskbarIcon.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Indeterminate;
directoryButton.IsEnabled = false;
patchButton.IsEnabled = false;
latestButton.IsEnabled = false;
stableButton.IsEnabled = false;
settingsProgressRow.Visibility = Visibility.Visible;
}));
}

private void AccountKeyClick(object sender, RoutedEventArgs e)
{
AccountKey ak = new();
Expand Down
6 changes: 3 additions & 3 deletions H1EmuLauncherSetup/H1EmuLauncherSetup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:H1Emu Launcher"
"ProductCode" = "8:{CD897C27-20D9-4251-8FEC-8C6074CD1235}"
"PackageCode" = "8:{EAE41D03-2DC7-4D52-BBEF-473F97C6A737}"
"ProductCode" = "8:{846C007D-24AE-4C4E-ADEB-861ADC1CAB82}"
"PackageCode" = "8:{D03ED396-C041-4CCA-929D-791244416EBA}"
"UpgradeCode" = "8:{4E679270-65C8-4021-83BE-3B8EC3EC7AFE}"
"AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:2.5.9"
"ProductVersion" = "8:2.6.0"
"Manufacturer" = "8:H1Emu © 2022"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:https://discord.com/invite/RM6jNkj"
Expand Down

0 comments on commit 0e5a1df

Please sign in to comment.