mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Compare commits
11 Commits
v1.75.7009
...
v1.75.7011
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ce8171f12 | ||
|
|
e3121cb043 | ||
|
|
99e52ab0b5 | ||
|
|
2b672dc4fc | ||
|
|
6db7adf900 | ||
|
|
65782285a3 | ||
|
|
64bd5a93ad | ||
|
|
68f052efcb | ||
|
|
4a8baf79fb | ||
|
|
499ac0295e | ||
|
|
29c422501a |
@@ -1,3 +1,18 @@
|
||||
1.75.7011 (2017-xx-xx):
|
||||
|
||||
Fixes:
|
||||
------
|
||||
#761: Connections using external tools do not start (introduced in v1.75.7009)
|
||||
Minor changes to how the connection tree column widths are calculated
|
||||
|
||||
|
||||
1.75.7010 (2017-10-29):
|
||||
|
||||
Fixes:
|
||||
------
|
||||
#756: CustomConsPath always null
|
||||
|
||||
|
||||
1.75.7009 (2017-10-28):
|
||||
|
||||
Fixes:
|
||||
|
||||
57
mRemoteNGTests/Connection/Protocol/IntegratedProgramTests.cs
Normal file
57
mRemoteNGTests/Connection/Protocol/IntegratedProgramTests.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.UI.Window;
|
||||
using NUnit.Framework;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
|
||||
namespace mRemoteNGTests.Connection.Protocol
|
||||
{
|
||||
public class IntegratedProgramTests
|
||||
{
|
||||
private readonly ExternalTool _extTool = new ExternalTool
|
||||
{
|
||||
DisplayName = "notepad",
|
||||
FileName = @"%windir%\system32\notepad.exe",
|
||||
Arguments = "",
|
||||
TryIntegrate = true
|
||||
};
|
||||
|
||||
|
||||
[Test]
|
||||
public void CanStartExternalApp()
|
||||
{
|
||||
SetExternalToolList(_extTool);
|
||||
var sut = new IntegratedProgram();
|
||||
sut.InterfaceControl = BuildInterfaceControl("notepad", sut);
|
||||
sut.Initialize();
|
||||
var appStarted = sut.Connect();
|
||||
sut.Disconnect();
|
||||
Assert.That(appStarted);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConnectingToExternalAppThatDoesntExistDoesNothing()
|
||||
{
|
||||
SetExternalToolList(_extTool);
|
||||
var sut = new IntegratedProgram();
|
||||
sut.InterfaceControl = BuildInterfaceControl("doesntExist", sut);
|
||||
var appInitialized = sut.Initialize();
|
||||
Assert.That(appInitialized, Is.False);
|
||||
}
|
||||
|
||||
private void SetExternalToolList(ExternalTool externalTool)
|
||||
{
|
||||
Runtime.ExternalTools = new ArrayList {externalTool};
|
||||
}
|
||||
|
||||
private InterfaceControl BuildInterfaceControl(string extAppName, ProtocolBase sut)
|
||||
{
|
||||
var connectionWindow = new ConnectionWindow(new DockContent());
|
||||
var connectionInfo = new ConnectionInfo {ExtApp = extAppName};
|
||||
return new InterfaceControl(connectionWindow, sut, connectionInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,6 +123,7 @@
|
||||
<Compile Include="Config\Serializers\XmlRootNodeSerializerTests.cs" />
|
||||
<Compile Include="Connection\AbstractConnectionInfoDataTests.cs" />
|
||||
<Compile Include="Connection\ConnectionInfoComparerTests.cs" />
|
||||
<Compile Include="Connection\Protocol\IntegratedProgramTests.cs" />
|
||||
<Compile Include="Connection\Protocol\ProtocolListTests.cs" />
|
||||
<Compile Include="IntegrationTests\XmlSerializationLifeCycleTests.cs" />
|
||||
<Compile Include="Security\Authentication\PasswordAuthenticatorTests.cs" />
|
||||
|
||||
@@ -308,9 +308,12 @@ namespace mRemoteNG.App
|
||||
}
|
||||
|
||||
// Handle custom connection file location
|
||||
Settings.Default.CustomConsPath = GetCustomConsPath(ConsParam);
|
||||
if (Settings.Default.CustomConsPath != null)
|
||||
var consPathFromParam = GetCustomConsPath(ConsParam);
|
||||
if (consPathFromParam != null)
|
||||
{
|
||||
Settings.Default.CustomConsPath = consPathFromParam;
|
||||
Settings.Default.LoadConsFromCustomLocation = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ResetPosParam))
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Tools;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Tools;
|
||||
|
||||
|
||||
namespace mRemoteNG.Connection.Protocol
|
||||
@@ -21,9 +21,15 @@ namespace mRemoteNG.Connection.Protocol
|
||||
#region Public Methods
|
||||
public override bool Initialize()
|
||||
{
|
||||
if (InterfaceControl.Info == null) return base.Initialize();
|
||||
if (InterfaceControl.Info == null)
|
||||
return base.Initialize();
|
||||
|
||||
_externalTool = Runtime.GetExtAppByName(InterfaceControl.Info.Name);
|
||||
_externalTool = Runtime.GetExtAppByName(InterfaceControl.Info.ExtApp);
|
||||
if (_externalTool == null)
|
||||
{
|
||||
Runtime.MessageCollector?.AddMessage(MessageClass.ErrorMsg, string.Format(Language.CouldNotFindExternalTool, InterfaceControl.Info.ExtApp));
|
||||
return false;
|
||||
}
|
||||
_externalTool.ConnectionInfo = InterfaceControl.Info;
|
||||
|
||||
return base.Initialize();
|
||||
@@ -33,7 +39,7 @@ namespace mRemoteNG.Connection.Protocol
|
||||
{
|
||||
try
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, $"Attempting to start: {_externalTool.DisplayName}", true);
|
||||
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, $"Attempting to start: {_externalTool.DisplayName}", true);
|
||||
|
||||
if (_externalTool.TryIntegrate == false)
|
||||
{
|
||||
@@ -43,7 +49,7 @@ namespace mRemoteNG.Connection.Protocol
|
||||
* will be called - which is just going to call IntegratedProgram.Close() again anyway...
|
||||
* Close();
|
||||
*/
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, $"Assuming no other errors/exceptions occurred immediately before this message regarding {_externalTool.DisplayName}, the next \"closed by user\" message can be ignored", true);
|
||||
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, $"Assuming no other errors/exceptions occurred immediately before this message regarding {_externalTool.DisplayName}, the next \"closed by user\" message can be ignored", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -80,10 +86,10 @@ namespace mRemoteNG.Connection.Protocol
|
||||
}
|
||||
|
||||
NativeMethods.SetParent(_handle, InterfaceControl.Handle);
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strIntAppStuff, true);
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppHandle, _handle), true);
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppTitle, _process.MainWindowTitle), true);
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppParentHandle, InterfaceControl.Parent.Handle), true);
|
||||
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, Language.strIntAppStuff, true);
|
||||
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppHandle, _handle), true);
|
||||
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppTitle, _process.MainWindowTitle), true);
|
||||
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppParentHandle, InterfaceControl.Parent.Handle), true);
|
||||
|
||||
Resize(this, new EventArgs());
|
||||
base.Connect();
|
||||
@@ -91,7 +97,7 @@ namespace mRemoteNG.Connection.Protocol
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppConnectionFailed, ex);
|
||||
Runtime.MessageCollector?.AddExceptionMessage(Language.strIntAppConnectionFailed, ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Tools;
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace mRemoteNG.Connection.Protocol
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace("Couldn't dispose control, probably form is already closed (Connection.Protocol.Base)", ex);
|
||||
Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't dispose control, probably form is already closed (Connection.Protocol.Base)", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,12 +172,12 @@ namespace mRemoteNG.Connection.Protocol
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace("Couldn't set InterfaceControl.Parent.Tag or Dispose Interface, probably form is already closed (Connection.Protocol.Base)", ex);
|
||||
Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't set InterfaceControl.Parent.Tag or Dispose Interface, probably form is already closed (Connection.Protocol.Base)", ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace("Couldn't Close InterfaceControl BG (Connection.Protocol.Base)", ex);
|
||||
Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't Close InterfaceControl BG (Connection.Protocol.Base)", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
[assembly: AssemblyVersion("1.75.7009.*")]
|
||||
[assembly: AssemblyVersion("1.75.7011.*")]
|
||||
|
||||
[assembly:NeutralResourcesLanguageAttribute("en")]
|
||||
|
||||
|
||||
@@ -60,6 +60,15 @@ namespace mRemoteNG {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Could not find external tool with name "{0}".
|
||||
/// </summary>
|
||||
internal static string CouldNotFindExternalTool {
|
||||
get {
|
||||
return ResourceManager.GetString("CouldNotFindExternalTool", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to About.
|
||||
/// </summary>
|
||||
|
||||
@@ -2433,4 +2433,7 @@ mRemoteNG will now quit and begin with the installation.</value>
|
||||
<data name="strPropertyNameRDPAlertIdleTimeout" xml:space="preserve">
|
||||
<value>Alert on Idle Disconnect</value>
|
||||
</data>
|
||||
<data name="CouldNotFindExternalTool" xml:space="preserve">
|
||||
<value>Could not find external tool with name "{0}"</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -105,7 +105,7 @@ namespace mRemoteNG.Tools
|
||||
private void SetConnectionInfoFields(ConnectionInfo newConnectionInfo)
|
||||
{
|
||||
newConnectionInfo.Protocol = ProtocolType.IntApp;
|
||||
newConnectionInfo.ExtApp = FileName;
|
||||
newConnectionInfo.ExtApp = DisplayName;
|
||||
newConnectionInfo.Name = DisplayName;
|
||||
newConnectionInfo.Panel = Language.strMenuExternalTools;
|
||||
}
|
||||
|
||||
@@ -15,13 +15,12 @@ using mRemoteNG.Tree.Root;
|
||||
|
||||
namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
public partial class ConnectionTree : TreeListView, IConnectionTree
|
||||
public partial class ConnectionTree : TreeListView, IConnectionTree
|
||||
{
|
||||
private ConnectionTreeModel _connectionTreeModel;
|
||||
private readonly ConnectionTreeDragAndDropHandler _dragAndDropHandler = new ConnectionTreeDragAndDropHandler();
|
||||
private readonly PuttySessionsManager _puttySessionsManager = PuttySessionsManager.Instance;
|
||||
private bool _allowEdit;
|
||||
private bool _isUpdatingColumnWidth;
|
||||
|
||||
public ConnectionInfo SelectedNode => (ConnectionInfo) SelectedObject;
|
||||
|
||||
@@ -94,16 +93,15 @@ namespace mRemoteNG.UI.Controls
|
||||
var container = args.Model as ContainerInfo;
|
||||
if (container == null) return;
|
||||
container.IsExpanded = false;
|
||||
UpdateColumnWidth();
|
||||
};
|
||||
AutoResizeColumn(Columns[0]);
|
||||
};
|
||||
Expanded += (sender, args) =>
|
||||
{
|
||||
var container = args.Model as ContainerInfo;
|
||||
if (container == null) return;
|
||||
container.IsExpanded = true;
|
||||
UpdateColumnWidth();
|
||||
};
|
||||
SizeChanged += OnSizeChanged;
|
||||
AutoResizeColumn(Columns[0]);
|
||||
};
|
||||
SelectionChanged += tvConnections_AfterSelect;
|
||||
MouseDoubleClick += OnMouse_DoubleClick;
|
||||
MouseClick += OnMouse_SingleClick;
|
||||
@@ -113,20 +111,28 @@ namespace mRemoteNG.UI.Controls
|
||||
BeforeLabelEdit += HandleCheckForValidEdit;
|
||||
}
|
||||
|
||||
private void OnSizeChanged(object o, EventArgs eventArgs)
|
||||
{
|
||||
if (_isUpdatingColumnWidth)
|
||||
return;
|
||||
UpdateColumnWidth();
|
||||
}
|
||||
/// <summary>
|
||||
/// Resizes the given column to ensure that all content is shown
|
||||
/// </summary>
|
||||
private void AutoResizeColumn(ColumnHeader column)
|
||||
{
|
||||
var longestIndentationAndTextWidth = int.MinValue;
|
||||
var horizontalScrollOffset = LowLevelScrollPosition.X;
|
||||
const int padding = 10;
|
||||
|
||||
private void UpdateColumnWidth()
|
||||
{
|
||||
_isUpdatingColumnWidth = true;
|
||||
AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
|
||||
Columns[0].Width += SmallImageSize.Width;
|
||||
_isUpdatingColumnWidth = false;
|
||||
}
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
var rowIndentation = Items[i].Position.X;
|
||||
var rowTextWidth = TextRenderer.MeasureText(Items[i].Text, Font).Width;
|
||||
|
||||
longestIndentationAndTextWidth = Math.Max(rowIndentation + rowTextWidth, longestIndentationAndTextWidth);
|
||||
}
|
||||
|
||||
column.Width = longestIndentationAndTextWidth +
|
||||
SmallImageSize.Width +
|
||||
horizontalScrollOffset +
|
||||
padding;
|
||||
}
|
||||
|
||||
private void PopulateTreeView()
|
||||
{
|
||||
@@ -135,7 +141,8 @@ namespace mRemoteNG.UI.Controls
|
||||
RegisterModelUpdateHandlers();
|
||||
NodeSearcher = new NodeSearcher(ConnectionTreeModel);
|
||||
ExecutePostSetupActions();
|
||||
}
|
||||
AutoResizeColumn(Columns[0]);
|
||||
}
|
||||
|
||||
private void RegisterModelUpdateHandlers()
|
||||
{
|
||||
@@ -167,8 +174,8 @@ namespace mRemoteNG.UI.Controls
|
||||
return;
|
||||
|
||||
RefreshObject(senderAsConnectionInfo);
|
||||
UpdateColumnWidth();
|
||||
}
|
||||
AutoResizeColumn(Columns[0]);
|
||||
}
|
||||
|
||||
private void ExecutePostSetupActions()
|
||||
{
|
||||
@@ -277,8 +284,8 @@ namespace mRemoteNG.UI.Controls
|
||||
private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
|
||||
{
|
||||
RefreshObject(sender);
|
||||
UpdateColumnWidth();
|
||||
}
|
||||
AutoResizeColumn(Columns[0]);
|
||||
}
|
||||
|
||||
private void tvConnections_AfterSelect(object sender, EventArgs e)
|
||||
{
|
||||
@@ -297,7 +304,7 @@ namespace mRemoteNG.UI.Controls
|
||||
if (mouseEventArgs.Clicks < 2) return;
|
||||
OLVColumn column;
|
||||
var listItem = GetItemAt(mouseEventArgs.X, mouseEventArgs.Y, out column);
|
||||
var clickedNode = listItem.RowObject as ConnectionInfo;
|
||||
var clickedNode = listItem?.RowObject as ConnectionInfo;
|
||||
if (clickedNode == null) return;
|
||||
DoubleClickHandler.Execute(clickedNode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user