Skip to content

Commit

Permalink
Merge pull request #946 from shananas/LuaBackendIntegration
Browse files Browse the repository at this point in the history
Lua backend integration
  • Loading branch information
Vladabdf authored Dec 6, 2023
2 parents 052702d + bff49be commit 85a055b
Show file tree
Hide file tree
Showing 4 changed files with 255 additions and 71 deletions.
32 changes: 16 additions & 16 deletions OpenKh.Tools.ModsManager/Services/ConfigurationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ 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 kh1 { get; internal set; }
public bool kh2 { get; internal set; } = true;
public bool bbs { get; internal set; }
public bool recom { get; internal set; }
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 string LaunchGame { get; internal set; } = "kh2";

public void Save(string fileName)
Expand Down Expand Up @@ -334,39 +334,39 @@ public static bool IsEGSVersion
_config.Save(ConfigPath);
}
}
public static bool kh1
public static bool Extractkh1
{
get => _config.kh1;
get => _config.Extractkh1;
set
{
_config.kh1 = value;
_config.Extractkh1 = value;
_config.Save(ConfigPath);
}
}
public static bool kh2
public static bool Extractkh2
{
get => _config.kh2;
get => _config.Extractkh2;
set
{
_config.kh2 = value;
_config.Extractkh2 = value;
_config.Save(ConfigPath);
}
}
public static bool bbs
public static bool Extractbbs
{
get => _config.bbs;
get => _config.Extractbbs;
set
{
_config.bbs = value;
_config.Extractbbs = value;
_config.Save(ConfigPath);
}
}
public static bool recom
public static bool Extractrecom
{
get => _config.recom;
get => _config.Extractrecom;
set
{
_config.recom = value;
_config.Extractrecom = value;
_config.Save(ConfigPath);
}
}
Expand Down
26 changes: 13 additions & 13 deletions OpenKh.Tools.ModsManager/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
using OpenKh.Tools.Common.Wpf;
using OpenKh.Tools.ModsManager.Models;
using OpenKh.Tools.ModsManager.Services;
using OpenKh.Tools.ModsManager.Views;
using OpenKh.Tools.ModsManager.Views;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
Expand All @@ -28,7 +28,7 @@ public class MainViewModel : BaseNotifyPropertyChanged, IChangeModEnableState
private static Version _version = Assembly.GetEntryAssembly()?.GetName()?.Version;
private static string ApplicationName = Utilities.GetApplicationName();
private static string ApplicationVersion = Utilities.GetApplicationVersion();
private Window Window => Application.Current.Windows.OfType<Window>().FirstOrDefault(x => x.IsActive);
private Window Window => Application.Current.Windows.OfType<Window>().FirstOrDefault(x => x.IsActive);

private DebuggingWindow _debuggingWindow = new DebuggingWindow();
private ModViewModel _selectedValue;
Expand Down Expand Up @@ -67,7 +67,7 @@ public class MainViewModel : BaseNotifyPropertyChanged, IChangeModEnableState

public static bool overwriteMod = false;
public string Title => ApplicationName;
public string CurrentVersion => ApplicationVersion;
public string CurrentVersion => ApplicationVersion;
public ObservableCollection<ModViewModel> ModsList { get; set; }
public ObservableCollection<string> PresetList { get; set; }
public RelayCommand ExitCommand { get; set; }
Expand Down Expand Up @@ -267,7 +267,7 @@ public bool IsBuilding
set
{
_isBuilding = value;
Application.Current.Dispatcher.Invoke(() =>
Application.Current.Dispatcher.Invoke(() =>
{
OnPropertyChanged(nameof(BuildCommand));
OnPropertyChanged(nameof(BuildAndRunCommand));
Expand Down Expand Up @@ -360,7 +360,7 @@ await ModsService.InstallMod(name, isZipFile, isLuaFile, progress =>
}
finally
{
Application.Current.Dispatcher.Invoke(() => progressWindow?.Close());
Application.Current.Dispatcher.Invoke(() => progressWindow?.Close());
}
});
}, _ => true);
Expand Down Expand Up @@ -446,7 +446,7 @@ await ModsService.InstallMod(name, isZipFile, isLuaFile, progress =>
ConfigPcReleaseLanguage = ConfigurationService.PcReleaseLanguage,
ConfigRegionId = ConfigurationService.RegionId,
ConfigPanaceaInstalled = ConfigurationService.PanaceaInstalled,
ConfigIsEGSVersion = ConfigurationService.IsEGSVersion,
ConfigIsEGSVersion = ConfigurationService.IsEGSVersion,
};
if (dialog.ShowDialog() == true)
{
Expand All @@ -459,7 +459,7 @@ await ModsService.InstallMod(name, isZipFile, isLuaFile, progress =>
ConfigurationService.RegionId = dialog.ConfigRegionId;
ConfigurationService.PanaceaInstalled = dialog.ConfigPanaceaInstalled;
ConfigurationService.IsEGSVersion = dialog.ConfigIsEGSVersion;
ConfigurationService.WizardVersionNumber = _wizardVersionNumber;
ConfigurationService.WizardVersionNumber = _wizardVersionNumber;

const int EpicGamesPC = 2;
if (ConfigurationService.GameEdition == EpicGamesPC &&
Expand Down Expand Up @@ -512,7 +512,7 @@ await ModsService.InstallMod(name, isZipFile, isLuaFile, progress =>
public void CloseAllWindows()
{
CloseRunningProcess();
Application.Current.Dispatcher.Invoke(_debuggingWindow.Close);
Application.Current.Dispatcher.Invoke(_debuggingWindow.Close);
}

public void CloseRunningProcess()
Expand All @@ -531,9 +531,9 @@ public void CloseRunningProcess()
private void ResetLogWindow()
{
if (_debuggingWindow != null)
Application.Current.Dispatcher.Invoke(_debuggingWindow.Close);
Application.Current.Dispatcher.Invoke(_debuggingWindow.Close);
_debuggingWindow = new DebuggingWindow();
Application.Current.Dispatcher.Invoke(_debuggingWindow.Show);
Application.Current.Dispatcher.Invoke(_debuggingWindow.Show);
_debuggingWindow.ClearLogs();
}

Expand Down Expand Up @@ -612,7 +612,7 @@ private Task RunGame()
}
}
Process.Start(processStartInfo);
CloseAllWindows();
CloseAllWindows();
return Task.CompletedTask;
default:
return Task.CompletedTask;
Expand Down Expand Up @@ -934,7 +934,7 @@ private async Task FetchUpdates()
if (mod == null)
continue;

Application.Current.Dispatcher.Invoke(() =>
Application.Current.Dispatcher.Invoke(() =>
mod.UpdateCount = modUpdate.UpdateCount);
}
if (AutoUpdateMods)
Expand Down
Loading

0 comments on commit 85a055b

Please sign in to comment.