diff --git a/mRemoteNGTests/Tree/ConnectionTreeModelTests.cs b/mRemoteNGTests/Tree/ConnectionTreeModelTests.cs index 76d475fe..f8d0d168 100644 --- a/mRemoteNGTests/Tree/ConnectionTreeModelTests.cs +++ b/mRemoteNGTests/Tree/ConnectionTreeModelTests.cs @@ -33,7 +33,7 @@ namespace mRemoteNGTests.Tree folder1.Add(folder2); root.Add(con1); _connectionTreeModel.AddRootNode(root); - var connectionList = _connectionTreeModel.GetChildList(root); + var connectionList = _connectionTreeModel.GetRecursiveChildList(root); Assert.That(connectionList, Is.EquivalentTo(new[] {folder1,folder2,con1})); } } diff --git a/mRemoteV1/Container/ContainerInfo.cs b/mRemoteV1/Container/ContainerInfo.cs index 31b0b451..e7ae83b3 100644 --- a/mRemoteV1/Container/ContainerInfo.cs +++ b/mRemoteV1/Container/ContainerInfo.cs @@ -62,5 +62,31 @@ namespace mRemoteNG.Container { IsExpanded = true; } - } + + public IEnumerable GetRecursiveChildList() + { + var childList = new List(); + foreach (var child in Children) + { + childList.Add(child); + var childContainer = child as ContainerInfo; + if (childContainer != null) + childList.AddRange(GetRecursiveChildList(childContainer)); + } + return childList; + } + + private IEnumerable GetRecursiveChildList(ContainerInfo container) + { + var childList = new List(); + foreach (var child in container.Children) + { + childList.Add(child); + var childContainer = child as ContainerInfo; + if (childContainer != null) + childList.AddRange(GetRecursiveChildList(childContainer)); + } + return childList; + } + } } \ No newline at end of file diff --git a/mRemoteV1/Tree/ConnectionTreeModel.cs b/mRemoteV1/Tree/ConnectionTreeModel.cs index 5ac94e6d..fc4562fd 100644 --- a/mRemoteV1/Tree/ConnectionTreeModel.cs +++ b/mRemoteV1/Tree/ConnectionTreeModel.cs @@ -14,17 +14,9 @@ namespace mRemoteNG.Tree RootNodes.Add(rootNode); } - public IEnumerable GetChildList(ContainerInfo container) + public IEnumerable GetRecursiveChildList(ContainerInfo container) { - var childList = new List(); - foreach (var child in container.Children) - { - childList.Add(child); - var childContainer = child as ContainerInfo; - if (childContainer != null) - childList.AddRange(GetChildList(childContainer)); - } - return childList; + return container.GetRecursiveChildList(); } } } \ No newline at end of file diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs index 1294e134..ad955013 100644 --- a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs @@ -151,7 +151,7 @@ namespace mRemoteNG.UI.Window public void ExpandPreviouslyOpenedFolders() { - var containerList = ConnectionTreeModel.GetChildList(GetRootConnectionNode()).OfType(); + var containerList = ConnectionTreeModel.GetRecursiveChildList(GetRootConnectionNode()).OfType(); var previouslyExpandedNodes = containerList.Where(container => container.IsExpanded); olvConnections.ExpandedObjects = previouslyExpandedNodes; olvConnections.RebuildAll(true);