Skip to content

Commit

Permalink
Fix install infomation mismatch check
Browse files Browse the repository at this point in the history
  • Loading branch information
Laeng committed Oct 24, 2023
1 parent c8a6808 commit 5db0447
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions SCTools/SCTool_Redesigned/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ private void SetInstallbtnLabel()
{
var installed = 0;
var isNewVersion = 0;
var mismatch = 0;
var release = RepositoryManager.GetInfos(false);

foreach (GameMode mode in Enum.GetValues(typeof(GameMode)))
Expand All @@ -557,32 +558,38 @@ private void SetInstallbtnLabel()

var userConfigPath = Path.Combine(App.Settings.GameFolder, mode.ToString(), "user.cfg");

if (patch.IsEnabled && PatchLanguageManager.IsEnabled(userConfigPath))
if (patch.IsEnabled == PatchLanguageManager.IsEnabled(userConfigPath))
{
installed++;
}
else
{
mismatch++;
}
}
}

_MainBtnState = MainBtnMode.install;

if (isNewVersion > 0)
if (installed > 0)
{
_MainBtnState = MainBtnMode.update;
}
else
{
if (installed > 0)
if (isNewVersion > 0)
{
_MainBtnState = MainBtnMode.launch;
_MainBtnState = MainBtnMode.update;
}
else
{
_MainBtnState = MainBtnMode.launch;
}
}
else
{
if (mismatch > 0)
{
_MainBtnState = MainBtnMode.reinstall;
}
}


Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(delegate
{
switch (_MainBtnState)
Expand Down

0 comments on commit 5db0447

Please sign in to comment.