Skip to content

Commit

Permalink
- Random fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
agilbert1412 committed Apr 19, 2023
1 parent 2195fb8 commit 4a1312a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
9 changes: 5 additions & 4 deletions DLCQuestipelago/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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);
Expand Down
18 changes: 18 additions & 0 deletions DLCQuestipelagoInstaller/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 4a1312a

Please sign in to comment.