Send commands to quickconnect created connections too!

This commit is contained in:
Brandon Wulf
2017-07-24 17:41:39 -07:00
parent 1c4b5d1ca5
commit 0807e7fec1
2 changed files with 31 additions and 10 deletions

View File

@@ -13,6 +13,7 @@ namespace mRemoteNG.Tools
class MultiSSHController
{
private ArrayList processHandlers = new ArrayList();
private ArrayList quickConnectConnections = new ArrayList();
private ArrayList previousCommands = new ArrayList();
private int previousCommandIndex = 0;
@@ -28,6 +29,11 @@ namespace mRemoteNG.Tools
DecorateTextBox(txtBox.TextBox);
}
public void ProcessNewQuickConnect(ConnectionInfo connection)
{
quickConnectConnections.Add(connection);
}
private void DecorateTextBox(TextBox toBeDecorated)
{
toBeDecorated.Enter += refreshActiveConnections;
@@ -35,6 +41,21 @@ namespace mRemoteNG.Tools
toBeDecorated.KeyUp += processKeyRelease;
}
private ArrayList ProcessOpenConnections(ConnectionInfo connection)
{
ArrayList handlers = new ArrayList();
foreach (ProtocolBase _base in connection.OpenConnections)
{
if (_base.GetType().IsSubclassOf(typeof(PuttyBase)))
{
handlers.Add((PuttyBase)_base);
}
}
return handlers;
}
private void SendAllKeystrokes(int keyType, int keyData)
{
if (processHandlers.Count == 0)
@@ -50,18 +71,17 @@ namespace mRemoteNG.Tools
#region Event Processors
private void refreshActiveConnections(object sender, EventArgs e)
{
var previouslyOpenedConnections = Runtime.ConnectionTreeModel.GetRecursiveChildList().Where(item => item.OpenConnections.Count > 0);
processHandlers.Clear();
foreach (ConnectionInfo connection in previouslyOpenedConnections)
foreach (ConnectionInfo connection in quickConnectConnections)
{
foreach (ProtocolBase _base in connection.OpenConnections)
{
if (_base.GetType().IsSubclassOf(typeof(PuttyBase)))
{
processHandlers.Add((PuttyBase)_base);
}
}
processHandlers.AddRange(ProcessOpenConnections(connection));
}
var connectionTreeConnections = Runtime.ConnectionTreeModel.GetRecursiveChildList().Where(item => item.OpenConnections.Count > 0);
foreach (ConnectionInfo connection in connectionTreeConnections)
{
processHandlers.AddRange(ProcessOpenConnections(connection));
}
}

View File

@@ -951,6 +951,7 @@ namespace mRemoteNG.UI.Forms
}
cmbQuickConnect.Add(connectionInfo);
_connectionInitiator.OpenConnection(connectionInfo, ConnectionInfo.Force.DoNotJump);
_multiSSHController.ProcessNewQuickConnect(connectionInfo);
}
catch (Exception ex)
{