mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Duplicating nodes now works
This commit is contained in:
@@ -670,7 +670,8 @@ namespace mRemoteNG.Connection
|
||||
#region Public Methods
|
||||
public virtual ConnectionInfo Clone()
|
||||
{
|
||||
var newConnectionInfo = (ConnectionInfo)MemberwiseClone();
|
||||
var newConnectionInfo = new ConnectionInfo();
|
||||
newConnectionInfo.CopyFrom(this);
|
||||
newConnectionInfo.ConstantID = MiscTools.CreateConstantID();
|
||||
newConnectionInfo.SetParent(Parent);
|
||||
newConnectionInfo.OpenConnections = new ProtocolList();
|
||||
@@ -718,7 +719,7 @@ namespace mRemoteNG.Connection
|
||||
return filteredProperties;
|
||||
}
|
||||
|
||||
public void SetParent(ContainerInfo parent)
|
||||
public virtual void SetParent(ContainerInfo parent)
|
||||
{
|
||||
parent?.AddChild(this);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using mRemoteNG.Connection;
|
||||
using System.ComponentModel;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
|
||||
@@ -66,9 +67,17 @@ namespace mRemoteNG.Container
|
||||
public override ConnectionInfo Clone()
|
||||
{
|
||||
var newContainer = new ContainerInfo();
|
||||
newContainer.CopyFrom(base.Clone());
|
||||
foreach (var child in Children)
|
||||
newContainer.AddChild(child.Clone());
|
||||
newContainer.CopyFrom(this);
|
||||
newContainer.ConstantID = MiscTools.CreateConstantID();
|
||||
newContainer.SetParent(Parent);
|
||||
newContainer.OpenConnections = new ProtocolList();
|
||||
newContainer.Inheritance = Inheritance.Clone();
|
||||
foreach (var child in Children.ToArray())
|
||||
{
|
||||
var newChild = child.Clone();
|
||||
newChild.RemoveParent();
|
||||
newContainer.AddChild(newChild);
|
||||
}
|
||||
return newContainer;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@ namespace mRemoteNG.Tree
|
||||
|
||||
connectionInfo?.Dispose();
|
||||
}
|
||||
|
||||
public void CloneNode(ConnectionInfo connectionInfo)
|
||||
{
|
||||
connectionInfo.Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ namespace mRemoteNG.Tree
|
||||
{
|
||||
ContainerInfo oldContainerInfo = (ContainerInfo) oldTreeNode.Tag;
|
||||
|
||||
ContainerInfo newContainerInfo = oldContainerInfo.Clone();
|
||||
ContainerInfo newContainerInfo = (ContainerInfo)oldContainerInfo.Clone();
|
||||
ConnectionInfo newConnectionInfo = oldContainerInfo.Clone();
|
||||
newContainerInfo.CopyFrom(newConnectionInfo);
|
||||
|
||||
|
||||
@@ -654,9 +654,10 @@ namespace mRemoteNG.UI.Window
|
||||
|
||||
//TODO Fix for TreeListView
|
||||
private void cMenTreeDuplicate_Click(object sender, EventArgs e)
|
||||
{
|
||||
ConnectionTreeNode.CloneNode(tvConnections.SelectedNode);
|
||||
{
|
||||
SelectedNode.Clone();
|
||||
Runtime.SaveConnectionsBG();
|
||||
olvConnections.RebuildAll(true);
|
||||
}
|
||||
|
||||
private void cMenTreeRename_Click(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user