Skip to content

Commit

Permalink
Remove leftover Lua Engine vardiables
Browse files Browse the repository at this point in the history
  • Loading branch information
shananas committed Dec 6, 2023
1 parent 5b19c3f commit 6ae9a1e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 deletions.
26 changes: 12 additions & 14 deletions OpenKh.Tools.ModsManager/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Octokit;
using OpenKh.Common;
using OpenKh.Tools.Common.Wpf;
using OpenKh.Tools.ModsManager.Models;
Expand Down Expand Up @@ -29,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 => System.Windows.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 @@ -68,8 +67,7 @@ public class MainViewModel : BaseNotifyPropertyChanged, IChangeModEnableState

public static bool overwriteMod = false;
public string Title => ApplicationName;
public string CurrentVersion => ApplicationVersion;
public static Release releases = new GitHubClient(new ProductHeaderValue("LuaEngine.exe")).Repository.Release.GetLatest(owner: "TopazTK", name: "LuaEngine").Result;
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 @@ -269,7 +267,7 @@ public bool IsBuilding
set
{
_isBuilding = value;
System.Windows.Application.Current.Dispatcher.Invoke(() =>
Application.Current.Dispatcher.Invoke(() =>
{
OnPropertyChanged(nameof(BuildCommand));
OnPropertyChanged(nameof(BuildAndRunCommand));
Expand Down Expand Up @@ -322,7 +320,7 @@ public MainViewModel()
var name = view.RepositoryName;
var isZipFile = view.IsZipFile;
var isLuaFile = view.IsLuaFile;
progressWindow = System.Windows.Application.Current.Dispatcher.Invoke(() =>
progressWindow = Application.Current.Dispatcher.Invoke(() =>
{
var progressWindow = new InstallModProgressWindow
{
Expand All @@ -335,14 +333,14 @@ public MainViewModel()
});
await ModsService.InstallMod(name, isZipFile, isLuaFile, progress =>
{
System.Windows.Application.Current.Dispatcher.Invoke(() => progressWindow.ProgressText = progress);
Application.Current.Dispatcher.Invoke(() => progressWindow.ProgressText = progress);
}, nProgress =>
{
System.Windows.Application.Current.Dispatcher.Invoke(() => progressWindow.ProgressValue = nProgress);
Application.Current.Dispatcher.Invoke(() => progressWindow.ProgressValue = nProgress);
});
var actualName = isZipFile || isLuaFile ? Path.GetFileNameWithoutExtension(name) : name;
var mod = ModsService.GetMods(new string[] { actualName }).First();
System.Windows.Application.Current.Dispatcher.Invoke(() =>
Application.Current.Dispatcher.Invoke(() =>
{
progressWindow.Close();
if (overwriteMod)
Expand All @@ -362,7 +360,7 @@ await ModsService.InstallMod(name, isZipFile, isLuaFile, progress =>
}
finally
{
System.Windows.Application.Current.Dispatcher.Invoke(() => progressWindow?.Close());
Application.Current.Dispatcher.Invoke(() => progressWindow?.Close());
}
});
}, _ => true);
Expand Down Expand Up @@ -514,7 +512,7 @@ await ModsService.InstallMod(name, isZipFile, isLuaFile, progress =>
public void CloseAllWindows()
{
CloseRunningProcess();
System.Windows.Application.Current.Dispatcher.Invoke(_debuggingWindow.Close);
Application.Current.Dispatcher.Invoke(_debuggingWindow.Close);
}

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

Expand Down Expand Up @@ -936,7 +934,7 @@ private async Task FetchUpdates()
if (mod == null)
continue;

System.Windows.Application.Current.Dispatcher.Invoke(() =>
Application.Current.Dispatcher.Invoke(() =>
mod.UpdateCount = modUpdate.UpdateCount);
}
if (AutoUpdateMods)
Expand Down
17 changes: 2 additions & 15 deletions OpenKh.Tools.ModsManager/ViewModels/SetupWizardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public class SetupWizardViewModel : BaseNotifyPropertyChanged
private string _pcReleaseLocation;
private string _pcReleaseLanguage;
private string _gameDataLocation;
private string _luaEngineLocation;
private bool _isEGSVersion;
private bool _Extractkh2 = ConfigurationService.Extractkh2;
private bool _Extractkh1 = ConfigurationService.Extractkh1;
Expand Down Expand Up @@ -77,7 +76,7 @@ private set
public Xceed.Wpf.Toolkit.WizardPage PageIsoSelection { get; internal set; }
public Xceed.Wpf.Toolkit.WizardPage PageEosInstall { get; internal set; }
public Xceed.Wpf.Toolkit.WizardPage PageEosConfig { get; internal set; }
public Xceed.Wpf.Toolkit.WizardPage PageLuaEngineInstall { get; internal set; }
public Xceed.Wpf.Toolkit.WizardPage PageLuaBackendInstall { get; internal set; }
public Xceed.Wpf.Toolkit.WizardPage PageRegion { get; internal set; }
public Xceed.Wpf.Toolkit.WizardPage PCLaunchOption { get; internal set; }
public Xceed.Wpf.Toolkit.WizardPage LastPage { get; internal set; }
Expand Down Expand Up @@ -361,18 +360,6 @@ public string GameDataLocation
public RelayCommand ExtractGameDataCommand { get; set; }
public float ExtractionProgress { get; set; }
public int RegionId { get; set; }
public RelayCommand SelectLuaEngineLocationCommand { get; }
public string LuaBackendLocation
{
get => _luaEngineLocation;
set
{
_luaEngineLocation = value;
OnPropertyChanged();
OnPropertyChanged(nameof(LuaBackendFoundVisibility));
OnPropertyChanged(nameof(LuaBackendNotFoundVisibility));
}
}
public bool IsLuaBackendInstalled
{
get => File.Exists(Path.Combine(PcReleaseLocation, "LuaBackend.dll")) &&
Expand Down Expand Up @@ -450,7 +437,7 @@ bool IsEqual(byte[] left, byte[] right)
return false;
}
}
}
}

public SetupWizardViewModel()
{
Expand Down

0 comments on commit 6ae9a1e

Please sign in to comment.