From f21d83cf4009c33d7cabdac895acf79dd689de64 Mon Sep 17 00:00:00 2001 From: Niek Schoemaker <32094562+niekschoemaker@users.noreply.github.com> Date: Thu, 16 Nov 2023 16:55:15 +0100 Subject: [PATCH] Don't close console when exiting form and fix opening RPF's after refresh in ExtraRootFolders Console close is already handled in application exit and since the NamedPipe opens other instances within the same instance this would close the console while codewalker is still open --- CodeWalker/ExploreForm.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/CodeWalker/ExploreForm.cs b/CodeWalker/ExploreForm.cs index 65ad228..6687061 100644 --- a/CodeWalker/ExploreForm.cs +++ b/CodeWalker/ExploreForm.cs @@ -535,13 +535,23 @@ namespace CodeWalker if ((CurrentFolder != null) && (CurrentFolder.Path.Equals(path, StringComparison.InvariantCultureIgnoreCase))) return; //already there var hierarchy = pathl.Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries); - TreeNode? n = MainTreeView.Nodes[0];// FindTreeNode("gta v", null); + TreeNode? n = null;// FindTreeNode("gta v", null); if (!string.IsNullOrEmpty(path)) { - for (int i = 0; i < hierarchy.Length; i++) + // Loop over all nodes, otherwise RPF's in other folders can't be found + foreach(var startNode in MainTreeView.Nodes) { - n = FindTreeNode(hierarchy[i], n); + n = (TreeNode?)startNode; + for (int i = 0; i < hierarchy.Length; i++) + { + n = FindTreeNode(hierarchy[i], n); + } + if (n is not null) + { + break; + } } + } if (n != null) { @@ -3888,7 +3898,6 @@ namespace CodeWalker if (m.Msg == 0x10) // WM_CLOSE { - ConsoleWindow.Close(); CancellationTokenSource.Cancel(); } }