From 4a1312a9b6ff23188bed110f00a50341723b6c94 Mon Sep 17 00:00:00 2001 From: Alex Gilbert Date: Wed, 19 Apr 2023 17:22:32 -0400 Subject: [PATCH] - Random fixes --- DLCQuestipelago/Plugin.cs | 9 +++++---- DLCQuestipelagoInstaller/Program.cs | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/DLCQuestipelago/Plugin.cs b/DLCQuestipelago/Plugin.cs index bafc817..5424426 100644 --- a/DLCQuestipelago/Plugin.cs +++ b/DLCQuestipelago/Plugin.cs @@ -117,11 +117,11 @@ private void WritePersistentData(object data, string path) //private TimeSpan _lastTimeSentChecks; public void OnUpdateTicked(GameTime gameTime) { - _archipelago.APUpdate(); - if (!IsInGame) + if (!IsInGame || _archipelago == null) { return; } + _archipelago.APUpdate(); // DLCLib.Save.DLCSaveManager.Instance.SaveGameData(); } @@ -186,13 +186,14 @@ public void ExitGame() private void OnItemReceived() { - if (!IsInGame) + Log.LogMessage($"Item received:"); + if (!IsInGame || _archipelago == null) { return; } var lastReceivedItem = _archipelago.GetAllReceivedItems().Last().ItemName; - Log.LogMessage($"Received Item: {lastReceivedItem}"); + Log.LogMessage($" {lastReceivedItem}"); _itemManager.ReceiveAllNewItems(); _notificationHandler.AddNotification(lastReceivedItem); diff --git a/DLCQuestipelagoInstaller/Program.cs b/DLCQuestipelagoInstaller/Program.cs index 60ca5c9..7a6400f 100644 --- a/DLCQuestipelagoInstaller/Program.cs +++ b/DLCQuestipelagoInstaller/Program.cs @@ -104,6 +104,10 @@ private static string GetManualPathToDLCQuest() { Console.WriteLine("Could not Find DLC Quest install location. Please enter the full path to it:"); var manualPath = Console.ReadLine(); + if (manualPath.StartsWith("\"") && manualPath.EndsWith("\"")) + { + manualPath = manualPath.Substring(1, manualPath.Length - 2); + } dlcQuestFolder = manualPath; } @@ -144,6 +148,20 @@ private static void CopyFolderContent(string originFolder, string destinationFol Directory.CreateDirectory(destinationFolder); } + var originEndsWithSeparator = originFolder.EndsWith(Path.DirectorySeparatorChar); + var directoryEndsWithSeparator = destinationFolder.EndsWith(Path.DirectorySeparatorChar); + if (originEndsWithSeparator != directoryEndsWithSeparator) + { + if (originEndsWithSeparator) + { + originFolder = originFolder.Substring(0, originFolder.Length - 1); + } + if (directoryEndsWithSeparator) + { + destinationFolder = destinationFolder.Substring(0, originFolder.Length - 1); + } + } + var allFiles = Directory.EnumerateFiles(originFolder, "*", SearchOption.AllDirectories); foreach (var file in allFiles) {