diff --git a/Classes/Game.cs b/Classes/Game.cs index 8e28b0f..cdd407e 100644 --- a/Classes/Game.cs +++ b/Classes/Game.cs @@ -31,7 +31,7 @@ public static string SetGameDir(string game) path = Steam.GetGameDir(Steam.BMCAppID); break; } - if (path == "" || path == null) + if (!Guard.IsStringValid(path)) { Log.Output("Failed to automatically find " + Settings.game.GameName); MessageBox.Show("Failed to automatically find " + Settings.game.GameName + " . Please browse for the game's .exe file to set the game directory"); diff --git a/Classes/JetReader.cs b/Classes/JetReader.cs index 04efa02..e8e52d8 100644 --- a/Classes/JetReader.cs +++ b/Classes/JetReader.cs @@ -87,11 +87,12 @@ public void DoWork() { new Thread(() => { + Thread t1; Thread t2 = new Thread(MakeMod); t2.Start(); if (MainWindow.resetGameFiles) { - Thread t1 = new Thread(Game.ResetGameFiles); + t1 = new Thread(Game.ResetGameFiles); t1.Start(); t1.Join(); } diff --git a/Classes/NKHook.cs b/Classes/NKHook.cs index fff8c46..b78984c 100644 --- a/Classes/NKHook.cs +++ b/Classes/NKHook.cs @@ -12,6 +12,7 @@ namespace TD_Loader.Classes { class NKHook { + public static bool enableNKH = false; public static string nkhDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\NKHook5"; public static string nkhEXE = nkhDir + "\\NKHook5-Injector.exe"; public static string pathTowerLoadPlugin = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\NKHook5\\Plugins\\NewTowerLoader.dll"; @@ -39,7 +40,7 @@ public static bool DoesNkhExist() } public static bool CanUseNKH() { - if (Settings.game.GameName != "BTD5" || Settings.game == null) + if (!enableNKH || Settings.game.GameName != "BTD5" || Settings.game == null) return false; if (!DoesNkhExist()) diff --git a/Classes/Settings.cs b/Classes/Settings.cs index d20fd34..aefaf14 100644 --- a/Classes/Settings.cs +++ b/Classes/Settings.cs @@ -134,7 +134,7 @@ public static void SaveGameFile() { settings.GameName = game.GameName; settings.BTD5Version = game.GameVersion; - settings.BTD5Dir = game.GameDir; + settings.BTD5Dir = game.GameDir.Replace("\\\\", "\\"); settings.BTD5BackupDir = game.GameBackupDir; settings.BTD5ModsDir = game.ModsDir; settings.BTD5LoadedMods = game.LoadedMods; @@ -143,7 +143,7 @@ public static void SaveGameFile() { settings.GameName = game.GameName; settings.BTDBVersion = game.GameVersion; - settings.BTDBDir = game.GameDir; + settings.BTDBDir = game.GameDir.Replace("\\\\", "\\"); ; settings.BTDBBackupDir = game.GameBackupDir; settings.BTDBModsDir = game.ModsDir; settings.BTDBLoadedMods = game.LoadedMods; @@ -152,7 +152,7 @@ public static void SaveGameFile() { settings.GameName = game.GameName; settings.BMCVersion = game.GameVersion; - settings.BMCDir = game.GameDir; + settings.BMCDir = game.GameDir.Replace("\\\\", "\\"); ; settings.BMCBackupDir = game.GameBackupDir; settings.BMCModsDir = game.ModsDir; settings.BMCLoadedMods = game.LoadedMods; diff --git a/Classes/log.cs b/Classes/log.cs index b73cc43..18f5f1b 100644 --- a/Classes/log.cs +++ b/Classes/log.cs @@ -23,6 +23,8 @@ public static void Print(string output, bool canRepeat, bool Notice) if (!canRepeat && output == log.lastMessage) return; + if (output == "input string is null" || output == "input string is empty") + return; MainWindow.instance.OutputLog.Dispatcher.BeginInvoke((Action)(() => { diff --git a/MainWindow.xaml b/MainWindow.xaml index 405f354..88a5753 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -126,7 +126,7 @@ VerticalAlignment="Top" Margin="-5,0,0,0" Background="{x:Null}"> - +