Skip to content

Commit

Permalink
Fix detact installed state
Browse files Browse the repository at this point in the history
  • Loading branch information
Laeng committed Oct 12, 2023
1 parent 80becb0 commit 8be23f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,8 @@ public InstallStatus Install(string zipFileName, string destinationFolder)
}

var userConifgPath = Path.Combine(destinationFolder, "user.cfg");
var userConfig = GetConfig(userConifgPath);

userConfig.SetValue("Localization", "g_language", "korean_(south_korea)"); //FIXME - 추후 다국어 지원을 위해서는 편집이 필요하다.
userConfig.Save();

SetLanguage(GetConfig(userConifgPath), "korean_(south_korea)"); //FIXME - 추후 다국어 지원을 위해서는 수정이 필요하다.
}
catch (CryptographicException e)
{
Expand Down Expand Up @@ -109,16 +106,11 @@ public UninstallStatus Uninstall(string destinationFolder)

var userConifgPath = Path.Combine(destinationFolder, "user.cfg");

if (!File.Exists(userConifgPath))
if (File.Exists(userConifgPath))
{
return UninstallStatus.Failed;
SetLanguage(GetConfig(userConifgPath), "english"); //FIXME - 추후 다국어 지원을 위해서는 수정이 필요하다.
}

var userConfig = GetConfig(userConifgPath);

userConfig.SetValue("Localization", "g_language", "english");
userConfig.Save();

var result = UninstallStatus.Success;
var dataPathDir = new DirectoryInfo(GameConstants.GetDataFolderPath(destinationFolder));

Expand Down Expand Up @@ -170,15 +162,13 @@ public LocalizationInstallationType RevertLocalization(string destinationFolder)

if (userConfig.GetValue("Localization", "g_language") == "english")
{
userConfig.SetValue("Localization", "g_language", "korean_(south_korea)"); //FIXME - 추후 다국어 지원을 위해서는 편집이 필요하다.
userConfig.Save();
SetLanguage(userConfig, "korean_(south_korea)"); //FIXME - 추후 다국어 지원을 위해서는 수정이 필요하다.

return LocalizationInstallationType.Enabled;
}
else
{
userConfig.SetValue("Localization", "g_language", "english");
userConfig.Save();
SetLanguage(userConfig, "english"); //FIXME - 추후 다국어 지원을 위해서는 수정이 필요하다.

return LocalizationInstallationType.Disabled;
}
Expand All @@ -192,6 +182,14 @@ private ConfigParser GetConfig(string path)
return new ConfigParser(path, setting);
}

private bool SetLanguage(ConfigParser config, string language)
{
config.SetValue("Localization", "g_languageAudio", "english");
config.SetValue("Localization", "g_language", language);

return config.Save();
}

private static bool Unpack(string zipFileName, string destinationFolder)
{
using var archive = ZipFile.OpenRead(zipFileName);
Expand Down
6 changes: 4 additions & 2 deletions SCTools/SCTool_Redesigned/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public MainWindow()

if (!App.IsGameInstalled())
{
MessageBox.Show(SCTool_Redesigned.Properties.Resources.MSG_Decs_NoInstall, SCTool_Redesigned.Properties.Resources.MSG_Title_NoInstall);
MessageBox.Show(Properties.Resources.MSG_Decs_NoInstall, Properties.Resources.MSG_Title_NoInstall);
App.Logger.Info("Installation infomation directory does not exist!");
}

Expand Down Expand Up @@ -347,8 +347,10 @@ private void set_link(string language)
}));
}

private void Update_ToggleBtn() =>
private void Update_ToggleBtn()
{
DisableBtn.Content = RepositoryManager.TargetInstallation.IsEnabled ? Properties.Resources.UI_Button_DisableLocalization : Properties.Resources.UI_Button_EnableLocalization;
}

private void NextBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
Expand Down

0 comments on commit 8be23f1

Please sign in to comment.