Skip to content

Commit

Permalink
Change the way the PC extract game data stores which games to extract…
Browse files Browse the repository at this point in the history
… to a list from a bool per game/checkbox
  • Loading branch information
shananas committed Dec 6, 2023
1 parent f73939a commit 8edc6e3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 40 deletions.
49 changes: 37 additions & 12 deletions OpenKh.Tools.ModsManager/Services/ConfigurationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ private class Config
public bool DevView { get; internal set; } = false;
public bool AutoUpdateMods { get; internal set; }
public bool isEGSVersion { get; internal set; } = true;
public bool Extractkh1 { get; internal set; }
public bool Extractkh2 { get; internal set; } = true;
public bool Extractbbs { get; internal set; }
public bool Extractrecom { get; internal set; }
public List<string> GamesToExtract { get; internal set; } = new List<string> { "kh2" };
public string LaunchGame { get; internal set; } = "kh2";

public void Save(string fileName)
Expand Down Expand Up @@ -336,37 +333,65 @@ public static bool IsEGSVersion
}
public static bool Extractkh1
{
get => _config.Extractkh1;
get => _config.GamesToExtract.Contains("kh1");
set
{
_config.Extractkh1 = value;
if (value)
{
_config.GamesToExtract.Add("kh1");
}
else
{
_config.GamesToExtract.Remove("kh1");
}
_config.Save(ConfigPath);
}
}
public static bool Extractkh2
{
get => _config.Extractkh2;
get => _config.GamesToExtract.Contains("kh2");
set
{
_config.Extractkh2 = value;
if (value)
{
_config.GamesToExtract.Add("kh2");
}
else
{
_config.GamesToExtract.Remove("kh2");
}
_config.Save(ConfigPath);
}
}
public static bool Extractbbs
{
get => _config.Extractbbs;
get => _config.GamesToExtract.Contains("bbs");
set
{
_config.Extractbbs = value;
if (value)
{
_config.GamesToExtract.Add("bbs");
}
else
{
_config.GamesToExtract.Remove("bbs");
}
_config.Save(ConfigPath);
}
}
public static bool Extractrecom
{
get => _config.Extractrecom;
get => _config.GamesToExtract.Contains("Recom");
set
{
_config.Extractrecom = value;
if (value)
{
_config.GamesToExtract.Add("Recom");
}
else
{
_config.GamesToExtract.Remove("Recom");
}
_config.Save(ConfigPath);
}
}
Expand Down
36 changes: 8 additions & 28 deletions OpenKh.Tools.ModsManager/ViewModels/SetupWizardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ public class SetupWizardViewModel : BaseNotifyPropertyChanged
private string _pcReleaseLanguage;
private string _gameDataLocation;
private bool _isEGSVersion;
private bool _Extractkh2 = ConfigurationService.Extractkh2;
private bool _Extractkh1 = ConfigurationService.Extractkh1;
private bool _Extractbbs = ConfigurationService.Extractbbs;
private bool _Extractrecom = ConfigurationService.Extractrecom;
private List<string> LuaScriptPaths = new List<string>();

private Xceed.Wpf.Toolkit.WizardPage _wizardPageAfterIntro;
Expand Down Expand Up @@ -223,39 +219,23 @@ public bool IsEGSVersion
}
public bool Extractkh1
{
get => _Extractkh1;
set
{
_Extractkh1 = value;
ConfigurationService.Extractkh1 = value;
}
get => ConfigurationService.Extractkh1;
set => ConfigurationService.Extractkh1 = value;
}
public bool Extractkh2
{
get => _Extractkh2;
set
{
_Extractkh2 = value;
ConfigurationService.Extractkh2 = value;
}
get => ConfigurationService.Extractkh2;
set => ConfigurationService.Extractkh2 = value;
}
public bool Extractbbs
{
get => _Extractbbs;
set
{
_Extractbbs = value;
ConfigurationService.Extractbbs = value;
}
get => ConfigurationService.Extractbbs;
set => ConfigurationService.Extractbbs = value;
}
public bool Extractrecom
{
get => _Extractrecom;
set
{
_Extractrecom = value;
ConfigurationService.Extractrecom = value;
}
get => ConfigurationService.Extractrecom;
set => ConfigurationService.Extractrecom = value;
}
public bool LuaConfigkh1
{
Expand Down

0 comments on commit 8edc6e3

Please sign in to comment.