mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Send commands to quickconnect created connections too!
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -951,6 +951,7 @@ namespace mRemoteNG.UI.Forms
|
||||
}
|
||||
cmbQuickConnect.Add(connectionInfo);
|
||||
_connectionInitiator.OpenConnection(connectionInfo, ConnectionInfo.Force.DoNotJump);
|
||||
_multiSSHController.ProcessNewQuickConnect(connectionInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user