Compare commits

...

9 Commits

Author SHA1 Message Date
David Sparer
5bd43afcd3 refactored relationship between protocol objects and interfacecontrol 2018-02-11 20:35:14 -06:00
David Sparer
d85c46930f added class for testing rdp version suppport 2018-02-10 21:13:20 -06:00
David Sparer
4614de1dea renamed event invocation methods to be more descriptive 2018-02-10 20:42:59 -06:00
David Sparer
f33102d545 simplification of protocol base class 2018-02-10 20:38:46 -06:00
David Sparer
8003f410a7 support rdp client v6 through 10 2018-02-10 20:38:28 -06:00
David Sparer
b21dc9a062 began splitting rdp implementations by version so we can dynamically support whatever is on the user's machine 2018-02-09 16:52:19 -06:00
David Sparer
36ed189177 bit more refactoring 2018-02-09 15:25:55 -06:00
David Sparer
b3b961c647 moved rdp enums out of the rdp protocol class 2018-02-09 13:14:27 -06:00
David Sparer
a212121f4a moved all rdp enums to their own files 2018-02-09 13:14:27 -06:00
59 changed files with 1587 additions and 1330 deletions

View File

@@ -16,7 +16,7 @@ using NUnit.Framework;
namespace mRemoteNGTests.Config.Serializers.MiscSerializers namespace mRemoteNGTests.Config.Serializers.MiscSerializers
{ {
public class CsvConnectionsDeserializerMremotengFormatTests public class CsvConnectionsDeserializerMremotengFormatTests
{ {
private CsvConnectionsDeserializerMremotengFormat _deserializer; private CsvConnectionsDeserializerMremotengFormat _deserializer;
private ICredentialRepositoryList _credentialRepositoryList; private ICredentialRepositoryList _credentialRepositoryList;
@@ -82,9 +82,9 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
UseCredSsp = true, UseCredSsp = true,
RenderingEngine = HTTPBase.RenderingEngine.Gecko, RenderingEngine = HTTPBase.RenderingEngine.Gecko,
ICAEncryptionStrength = IcaProtocol.EncryptionStrength.Encr40Bit, ICAEncryptionStrength = IcaProtocol.EncryptionStrength.Encr40Bit,
RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.WarnOnFailedAuth, RDPAuthenticationLevel = RdpAuthenticationLevel.WarnOnFailedAuth,
Colors = RdpProtocol.RDPColors.Colors16Bit, Colors = RdpColors.Colors16Bit,
Resolution = RdpProtocol.RDPResolutions.Res1366x768, Resolution = RdpResolutions.Res1366x768,
AutomaticResize = true, AutomaticResize = true,
DisplayWallpaper = true, DisplayWallpaper = true,
DisplayThemes = true, DisplayThemes = true,
@@ -95,7 +95,7 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
RedirectPorts = true, RedirectPorts = true,
RedirectPrinters = true, RedirectPrinters = true,
RedirectSmartCards = true, RedirectSmartCards = true,
RedirectSound = RdpProtocol.RDPSounds.LeaveAtRemoteComputer, RedirectSound = RdpSounds.LeaveAtRemoteComputer,
RedirectKeys = true, RedirectKeys = true,
VNCCompression = ProtocolVNC.Compression.Comp4, VNCCompression = ProtocolVNC.Compression.Comp4,
VNCEncoding = ProtocolVNC.Encoding.EncRRE, VNCEncoding = ProtocolVNC.Encoding.EncRRE,
@@ -105,8 +105,8 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
VNCColors = ProtocolVNC.Colors.Col8Bit, VNCColors = ProtocolVNC.Colors.Col8Bit,
VNCSmartSizeMode = ProtocolVNC.SmartSizeMode.SmartSAspect, VNCSmartSizeMode = ProtocolVNC.SmartSizeMode.SmartSAspect,
VNCViewOnly = true, VNCViewOnly = true,
RDGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Detect, RDGatewayUsageMethod = RDGatewayUsageMethod.Detect,
RDGatewayUseConnectionCredentials = RdpProtocol.RDGatewayUseConnectionCredentials.SmartCard RDGatewayUseConnectionCredentials = RDGatewayUseConnectionCredentials.SmartCard
}; };
} }

View File

@@ -8,7 +8,7 @@ using NUnit.Framework;
namespace mRemoteNGTests.Config.Serializers.MiscSerializers namespace mRemoteNGTests.Config.Serializers.MiscSerializers
{ {
public class RemoteDesktopConnectionDeserializerTests public class RemoteDesktopConnectionDeserializerTests
{ {
// .rdp file schema: https://technet.microsoft.com/en-us/library/ff393699(v=ws.10).aspx // .rdp file schema: https://technet.microsoft.com/en-us/library/ff393699(v=ws.10).aspx
private RemoteDesktopConnectionDeserializer _deserializer; private RemoteDesktopConnectionDeserializer _deserializer;
@@ -18,9 +18,9 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
private const string ExpectedDomain = "myspecialdomain"; private const string ExpectedDomain = "myspecialdomain";
private const string ExpectedGatewayHostname = "gatewayhostname.domain.com"; private const string ExpectedGatewayHostname = "gatewayhostname.domain.com";
private const int ExpectedPort = 9933; private const int ExpectedPort = 9933;
private const RdpProtocol.RDPColors ExpectedColors = RdpProtocol.RDPColors.Colors24Bit; private const RdpColors ExpectedColors = RdpColors.Colors24Bit;
private const bool ExpectedBitmapCaching = false; private const bool ExpectedBitmapCaching = false;
private const RdpProtocol.RDPResolutions ExpectedResolutionMode = RdpProtocol.RDPResolutions.FitToWindow; private const RdpResolutions ExpectedResolutionMode = RdpResolutions.FitToWindow;
private const bool ExpectedWallpaperDisplay = true; private const bool ExpectedWallpaperDisplay = true;
private const bool ExpectedThemesDisplay = true; private const bool ExpectedThemesDisplay = true;
private const bool ExpectedFontSmoothing = true; private const bool ExpectedFontSmoothing = true;
@@ -29,7 +29,7 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
private const bool ExpectedDriveRedirection = true; private const bool ExpectedDriveRedirection = true;
private const bool ExpectedPortRedirection = true; private const bool ExpectedPortRedirection = true;
private const bool ExpectedPrinterRedirection = true; private const bool ExpectedPrinterRedirection = true;
private const RdpProtocol.RDPSounds ExpectedSoundRedirection = RdpProtocol.RDPSounds.BringToThisComputer; private const RdpSounds ExpectedSoundRedirection = RdpSounds.BringToThisComputer;
[OneTimeSetUp] [OneTimeSetUp]

View File

@@ -10,7 +10,7 @@ using NUnit.Framework;
namespace mRemoteNGTests.Config.Serializers.MiscSerializers namespace mRemoteNGTests.Config.Serializers.MiscSerializers
{ {
public class RemoteDesktopConnectionManager27DeserializerTests public class RemoteDesktopConnectionManager27DeserializerTests
{ {
private string _connectionFileContents; private string _connectionFileContents;
private RemoteDesktopConnectionManagerDeserializer _deserializer; private RemoteDesktopConnectionManagerDeserializer _deserializer;
@@ -23,20 +23,20 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
private const string ExpectedPassword = "passwordHere!"; private const string ExpectedPassword = "passwordHere!";
private const bool ExpectedUseConsoleSession = true; private const bool ExpectedUseConsoleSession = true;
private const int ExpectedPort = 9933; private const int ExpectedPort = 9933;
private const RdpProtocol.RDGatewayUsageMethod ExpectedGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Always; private const RDGatewayUsageMethod ExpectedGatewayUsageMethod = RDGatewayUsageMethod.Always;
private const string ExpectedGatewayHostname = "gatewayserverhost.innerdomain.net"; private const string ExpectedGatewayHostname = "gatewayserverhost.innerdomain.net";
private const string ExpectedGatewayUsername = "gatewayusername"; private const string ExpectedGatewayUsername = "gatewayusername";
private const string ExpectedGatewayDomain = "innerdomain"; private const string ExpectedGatewayDomain = "innerdomain";
private const string ExpectedGatewayPassword = "gatewayPassword123"; private const string ExpectedGatewayPassword = "gatewayPassword123";
private const RdpProtocol.RDPResolutions ExpectedRdpResolution = RdpProtocol.RDPResolutions.FitToWindow; private const RdpResolutions ExpectedRdpResolution = RdpResolutions.FitToWindow;
private const RdpProtocol.RDPColors ExpectedRdpColorDepth = RdpProtocol.RDPColors.Colors24Bit; private const RdpColors ExpectedRdpColorDepth = RdpColors.Colors24Bit;
private const RdpProtocol.RDPSounds ExpectedAudioRedirection = RdpProtocol.RDPSounds.DoNotPlay; private const RdpSounds ExpectedAudioRedirection = RdpSounds.DoNotPlay;
private const bool ExpectedKeyRedirection = true; private const bool ExpectedKeyRedirection = true;
private const bool ExpectedSmartcardRedirection = true; private const bool ExpectedSmartcardRedirection = true;
private const bool ExpectedDriveRedirection = true; private const bool ExpectedDriveRedirection = true;
private const bool ExpectedPortRedirection = true; private const bool ExpectedPortRedirection = true;
private const bool ExpectedPrinterRedirection = true; private const bool ExpectedPrinterRedirection = true;
private const RdpProtocol.AuthenticationLevel ExpectedAuthLevel = RdpProtocol.AuthenticationLevel.WarnOnFailedAuth; private const RdpAuthenticationLevel ExpectedAuthLevel = RdpAuthenticationLevel.WarnOnFailedAuth;
[OneTimeSetUp] [OneTimeSetUp]

View File

@@ -10,7 +10,7 @@ using NUnit.Framework;
namespace mRemoteNGTests.Config.Serializers.MiscSerializers namespace mRemoteNGTests.Config.Serializers.MiscSerializers
{ {
public class RemoteDesktopConnectionManagerDeserializerTests public class RemoteDesktopConnectionManagerDeserializerTests
{ {
private string _connectionFileContents; private string _connectionFileContents;
private RemoteDesktopConnectionManagerDeserializer _deserializer; private RemoteDesktopConnectionManagerDeserializer _deserializer;
@@ -23,20 +23,20 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
private const string ExpectedPassword = "passwordHere!"; private const string ExpectedPassword = "passwordHere!";
private const bool ExpectedUseConsoleSession = true; private const bool ExpectedUseConsoleSession = true;
private const int ExpectedPort = 9933; private const int ExpectedPort = 9933;
private const RdpProtocol.RDGatewayUsageMethod ExpectedGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Always; private const RDGatewayUsageMethod ExpectedGatewayUsageMethod = RDGatewayUsageMethod.Always;
private const string ExpectedGatewayHostname = "gatewayserverhost.innerdomain.net"; private const string ExpectedGatewayHostname = "gatewayserverhost.innerdomain.net";
private const string ExpectedGatewayUsername = "gatewayusername"; private const string ExpectedGatewayUsername = "gatewayusername";
private const string ExpectedGatewayDomain = "innerdomain"; private const string ExpectedGatewayDomain = "innerdomain";
private const string ExpectedGatewayPassword = "gatewayPassword123"; private const string ExpectedGatewayPassword = "gatewayPassword123";
private const RdpProtocol.RDPResolutions ExpectedRdpResolution = RdpProtocol.RDPResolutions.FitToWindow; private const RdpResolutions ExpectedRdpResolution = RdpResolutions.FitToWindow;
private const RdpProtocol.RDPColors ExpectedRdpColorDepth = RdpProtocol.RDPColors.Colors24Bit; private const RdpColors ExpectedRdpColorDepth = RdpColors.Colors24Bit;
private const RdpProtocol.RDPSounds ExpectedAudioRedirection = RdpProtocol.RDPSounds.DoNotPlay; private const RdpSounds ExpectedAudioRedirection = RdpSounds.DoNotPlay;
private const bool ExpectedKeyRedirection = true; private const bool ExpectedKeyRedirection = true;
private const bool ExpectedSmartcardRedirection = true; private const bool ExpectedSmartcardRedirection = true;
private const bool ExpectedDriveRedirection = true; private const bool ExpectedDriveRedirection = true;
private const bool ExpectedPortRedirection = true; private const bool ExpectedPortRedirection = true;
private const bool ExpectedPrinterRedirection = true; private const bool ExpectedPrinterRedirection = true;
private const RdpProtocol.AuthenticationLevel ExpectedAuthLevel = RdpProtocol.AuthenticationLevel.AuthRequired; private const RdpAuthenticationLevel ExpectedAuthLevel = RdpAuthenticationLevel.AuthRequired;
[OneTimeSetUp] [OneTimeSetUp]

View File

@@ -9,7 +9,7 @@ using NUnit.Framework;
namespace mRemoteNGTests.Connection namespace mRemoteNGTests.Connection
{ {
public class AbstractConnectionInfoDataTests public class AbstractConnectionInfoDataTests
{ {
#pragma warning disable 618 #pragma warning disable 618
private class TestAbstractConnectionInfoData : AbstractConnectionRecord {} private class TestAbstractConnectionInfoData : AbstractConnectionRecord {}
@@ -160,7 +160,7 @@ namespace mRemoteNGTests.Connection
{ {
var wasCalled = false; var wasCalled = false;
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true; _testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
_testAbstractConnectionInfoData.RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.AuthRequired; _testAbstractConnectionInfoData.RDPAuthenticationLevel = RdpAuthenticationLevel.AuthRequired;
Assert.That(wasCalled, Is.True); Assert.That(wasCalled, Is.True);
} }
@@ -196,7 +196,7 @@ namespace mRemoteNGTests.Connection
{ {
var wasCalled = false; var wasCalled = false;
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true; _testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
_testAbstractConnectionInfoData.RDGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Always; _testAbstractConnectionInfoData.RDGatewayUsageMethod = RDGatewayUsageMethod.Always;
Assert.That(wasCalled, Is.True); Assert.That(wasCalled, Is.True);
} }
@@ -214,7 +214,7 @@ namespace mRemoteNGTests.Connection
{ {
var wasCalled = false; var wasCalled = false;
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true; _testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
_testAbstractConnectionInfoData.RDGatewayUseConnectionCredentials = RdpProtocol.RDGatewayUseConnectionCredentials.SmartCard; _testAbstractConnectionInfoData.RDGatewayUseConnectionCredentials = RDGatewayUseConnectionCredentials.SmartCard;
Assert.That(wasCalled, Is.True); Assert.That(wasCalled, Is.True);
} }
@@ -250,7 +250,7 @@ namespace mRemoteNGTests.Connection
{ {
var wasCalled = false; var wasCalled = false;
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true; _testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
_testAbstractConnectionInfoData.Resolution = RdpProtocol.RDPResolutions.Res1366x768; _testAbstractConnectionInfoData.Resolution = RdpResolutions.Res1366x768;
Assert.That(wasCalled, Is.True); Assert.That(wasCalled, Is.True);
} }
@@ -268,7 +268,7 @@ namespace mRemoteNGTests.Connection
{ {
var wasCalled = false; var wasCalled = false;
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true; _testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
_testAbstractConnectionInfoData.Colors = RdpProtocol.RDPColors.Colors16Bit; _testAbstractConnectionInfoData.Colors = RdpColors.Colors16Bit;
Assert.That(wasCalled, Is.True); Assert.That(wasCalled, Is.True);
} }
@@ -367,7 +367,7 @@ namespace mRemoteNGTests.Connection
{ {
var wasCalled = false; var wasCalled = false;
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true; _testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
_testAbstractConnectionInfoData.RedirectSound = RdpProtocol.RDPSounds.DoNotPlay; _testAbstractConnectionInfoData.RedirectSound = RdpSounds.DoNotPlay;
Assert.That(wasCalled, Is.True); Assert.That(wasCalled, Is.True);
} }

View File

@@ -81,7 +81,7 @@ namespace mRemoteNGTests.Connection
{ {
var eventWasCalled = false; var eventWasCalled = false;
_connectionInfo.PropertyChanged += (sender, args) => eventWasCalled = true; _connectionInfo.PropertyChanged += (sender, args) => eventWasCalled = true;
_connectionInfo.OpenConnections.Add(new ProtocolSSH2()); _connectionInfo.OpenConnections.Add(new ProtocolSSH2(_connectionInfo));
Assert.That(eventWasCalled); Assert.That(eventWasCalled);
} }
@@ -90,7 +90,7 @@ namespace mRemoteNGTests.Connection
{ {
var nameOfModifiedProperty = ""; var nameOfModifiedProperty = "";
_connectionInfo.PropertyChanged += (sender, args) => nameOfModifiedProperty = args.PropertyName; _connectionInfo.PropertyChanged += (sender, args) => nameOfModifiedProperty = args.PropertyName;
_connectionInfo.OpenConnections.Add(new ProtocolSSH2()); _connectionInfo.OpenConnections.Add(new ProtocolSSH2(_connectionInfo));
Assert.That(nameOfModifiedProperty, Is.EqualTo("OpenConnections")); Assert.That(nameOfModifiedProperty, Is.EqualTo("OpenConnections"));
} }

View File

@@ -1,5 +1,4 @@
using System.Collections.ObjectModel; using mRemoteNG.App;
using mRemoteNG.App;
using mRemoteNG.Connection; using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol; using mRemoteNG.Connection.Protocol;
using mRemoteNG.Tools; using mRemoteNG.Tools;
@@ -12,7 +11,7 @@ namespace mRemoteNGTests.Connection.Protocol
{ {
public class IntegratedProgramTests public class IntegratedProgramTests
{ {
private readonly ExternalTool _extTool = new ExternalTool private readonly ExternalTool _extTool = new ExternalTool
{ {
DisplayName = "notepad", DisplayName = "notepad",
FileName = @"%windir%\system32\notepad.exe", FileName = @"%windir%\system32\notepad.exe",
@@ -20,13 +19,13 @@ namespace mRemoteNGTests.Connection.Protocol
TryIntegrate = true TryIntegrate = true
}; };
[Test] [Test]
public void CanStartExternalApp() public void CanStartExternalApp()
{ {
SetExternalToolList(_extTool); SetExternalToolList(_extTool);
var sut = new IntegratedProgram(); var connectionInfo = new ConnectionInfo { ExtApp = _extTool.DisplayName };
sut.InterfaceControl = BuildInterfaceControl("notepad", sut); var sut = new IntegratedProgram(connectionInfo);
sut.InterfaceControl = BuildInterfaceControl(sut);
sut.Initialize(); sut.Initialize();
var appStarted = sut.Connect(); var appStarted = sut.Connect();
sut.Disconnect(); sut.Disconnect();
@@ -37,8 +36,9 @@ namespace mRemoteNGTests.Connection.Protocol
public void ConnectingToExternalAppThatDoesntExistDoesNothing() public void ConnectingToExternalAppThatDoesntExistDoesNothing()
{ {
SetExternalToolList(_extTool); SetExternalToolList(_extTool);
var sut = new IntegratedProgram(); var connectionInfo = new ConnectionInfo { ExtApp = "doesntExist" };
sut.InterfaceControl = BuildInterfaceControl("doesntExist", sut); var sut = new IntegratedProgram(connectionInfo);
sut.InterfaceControl = BuildInterfaceControl(sut);
var appInitialized = sut.Initialize(); var appInitialized = sut.Initialize();
Assert.That(appInitialized, Is.False); Assert.That(appInitialized, Is.False);
} }
@@ -48,11 +48,10 @@ namespace mRemoteNGTests.Connection.Protocol
Runtime.ExternalToolsService.ExternalTools = new FullyObservableCollection<ExternalTool> {externalTool}; Runtime.ExternalToolsService.ExternalTools = new FullyObservableCollection<ExternalTool> {externalTool};
} }
private InterfaceControl BuildInterfaceControl(string extAppName, ProtocolBase sut) private InterfaceControl BuildInterfaceControl(ProtocolBase sut)
{ {
var connectionWindow = new ConnectionWindow(new DockContent()); var connectionWindow = new ConnectionWindow(new DockContent());
var connectionInfo = new ConnectionInfo {ExtApp = extAppName}; return new InterfaceControl(connectionWindow, sut);
return new InterfaceControl(connectionWindow, sut, connectionInfo);
} }
} }
} }

View File

@@ -1,5 +1,6 @@
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol; using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.SSH; using mRemoteNG.Connection.Protocol.SSH;
using mRemoteNG.Connection.Protocol.Telnet; using mRemoteNG.Connection.Protocol.Telnet;
@@ -21,9 +22,9 @@ namespace mRemoteNGTests.Connection.Protocol
public void Setup() public void Setup()
{ {
_protocolList = new ProtocolList(); _protocolList = new ProtocolList();
_protocol1 = new ProtocolTelnet(); _protocol1 = new ProtocolTelnet(new ConnectionInfo());
_protocol2 = new ProtocolSSH2(); _protocol2 = new ProtocolSSH2(new ConnectionInfo());
_protocol3 = new ProtocolVNC(); _protocol3 = new ProtocolVNC(new ConnectionInfo());
} }
[TearDown] [TearDown]

View File

@@ -219,7 +219,7 @@ namespace mRemoteNG.Config.Serializers
if (_confVersion < 1.1) //1.0 - 0.1 if (_confVersion < 1.1) //1.0 - 0.1
{ {
connectionInfo.Resolution = Convert.ToBoolean(xmlnode.Attributes["Fullscreen"].Value) ? RdpProtocol.RDPResolutions.Fullscreen : RdpProtocol.RDPResolutions.FitToWindow; connectionInfo.Resolution = Convert.ToBoolean(xmlnode.Attributes["Fullscreen"].Value) ? RdpResolutions.Fullscreen : RdpResolutions.FitToWindow;
} }
if (_confVersion <= 2.6) // 0.2 - 2.6 if (_confVersion <= 2.6) // 0.2 - 2.6
@@ -249,7 +249,7 @@ namespace mRemoteNG.Config.Serializers
} }
else else
{ {
connectionInfo.Port = (int)RdpProtocol.Defaults.Port; connectionInfo.Port = (int)RdpProtocol6.Defaults.Port;
connectionInfo.Protocol = ProtocolType.RDP; connectionInfo.Protocol = ProtocolType.RDP;
} }
@@ -269,7 +269,7 @@ namespace mRemoteNG.Config.Serializers
if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value)) if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value))
connectionInfo.Port = (int)ProtocolVNC.Defaults.Port; connectionInfo.Port = (int)ProtocolVNC.Defaults.Port;
else else
connectionInfo.Port = (int)RdpProtocol.Defaults.Port; connectionInfo.Port = (int)RdpProtocol6.Defaults.Port;
} }
connectionInfo.UseConsoleSession = false; connectionInfo.UseConsoleSession = false;
} }
@@ -307,34 +307,34 @@ namespace mRemoteNG.Config.Serializers
if (_confVersion >= 1.3) if (_confVersion >= 1.3)
{ {
connectionInfo.Colors = (RdpProtocol.RDPColors)MiscTools.StringToEnum(typeof(RdpProtocol.RDPColors), xmlnode.Attributes["Colors"].Value); connectionInfo.Colors = (RdpColors)MiscTools.StringToEnum(typeof(RdpColors), xmlnode.Attributes["Colors"].Value);
connectionInfo.Resolution = (RdpProtocol.RDPResolutions)MiscTools.StringToEnum(typeof(RdpProtocol.RDPResolutions), Convert.ToString(xmlnode.Attributes["Resolution"].Value)); connectionInfo.Resolution = (RdpResolutions)MiscTools.StringToEnum(typeof(RdpResolutions), Convert.ToString(xmlnode.Attributes["Resolution"].Value));
connectionInfo.RedirectSound = (RdpProtocol.RDPSounds)MiscTools.StringToEnum(typeof(RdpProtocol.RDPSounds), Convert.ToString(xmlnode.Attributes["RedirectSound"].Value)); connectionInfo.RedirectSound = (RdpSounds)MiscTools.StringToEnum(typeof(RdpSounds), Convert.ToString(xmlnode.Attributes["RedirectSound"].Value));
} }
else else
{ {
switch (Convert.ToInt32(xmlnode.Attributes["Colors"].Value)) switch (Convert.ToInt32(xmlnode.Attributes["Colors"].Value))
{ {
case 0: case 0:
connectionInfo.Colors = RdpProtocol.RDPColors.Colors256; connectionInfo.Colors = RdpColors.Colors256;
break; break;
case 1: case 1:
connectionInfo.Colors = RdpProtocol.RDPColors.Colors16Bit; connectionInfo.Colors = RdpColors.Colors16Bit;
break; break;
case 2: case 2:
connectionInfo.Colors = RdpProtocol.RDPColors.Colors24Bit; connectionInfo.Colors = RdpColors.Colors24Bit;
break; break;
case 3: case 3:
connectionInfo.Colors = RdpProtocol.RDPColors.Colors32Bit; connectionInfo.Colors = RdpColors.Colors32Bit;
break; break;
// ReSharper disable once RedundantCaseLabel // ReSharper disable once RedundantCaseLabel
case 4: case 4:
default: default:
connectionInfo.Colors = RdpProtocol.RDPColors.Colors15Bit; connectionInfo.Colors = RdpColors.Colors15Bit;
break; break;
} }
connectionInfo.RedirectSound = (RdpProtocol.RDPSounds)Convert.ToInt32(xmlnode.Attributes["RedirectSound"].Value); connectionInfo.RedirectSound = (RdpSounds)Convert.ToInt32(xmlnode.Attributes["RedirectSound"].Value);
} }
if (_confVersion >= 1.3) if (_confVersion >= 1.3)
@@ -421,7 +421,7 @@ namespace mRemoteNG.Config.Serializers
if (_confVersion >= 1.8) if (_confVersion >= 1.8)
{ {
connectionInfo.RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel)MiscTools.StringToEnum(typeof(RdpProtocol.AuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value); connectionInfo.RDPAuthenticationLevel = (RdpAuthenticationLevel)MiscTools.StringToEnum(typeof(RdpAuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value);
connectionInfo.Inheritance.RDPAuthenticationLevel = bool.Parse(xmlnode.Attributes["InheritRDPAuthenticationLevel"].Value); connectionInfo.Inheritance.RDPAuthenticationLevel = bool.Parse(xmlnode.Attributes["InheritRDPAuthenticationLevel"].Value);
} }
@@ -448,9 +448,9 @@ namespace mRemoteNG.Config.Serializers
if (_confVersion >= 2.2) if (_confVersion >= 2.2)
{ {
// Get settings // Get settings
connectionInfo.RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod)MiscTools.StringToEnum(typeof(RdpProtocol.RDGatewayUsageMethod), Convert.ToString(xmlnode.Attributes["RDGatewayUsageMethod"].Value)); connectionInfo.RDGatewayUsageMethod = (RDGatewayUsageMethod)MiscTools.StringToEnum(typeof(RDGatewayUsageMethod), Convert.ToString(xmlnode.Attributes["RDGatewayUsageMethod"].Value));
connectionInfo.RDGatewayHostname = xmlnode.Attributes["RDGatewayHostname"].Value; connectionInfo.RDGatewayHostname = xmlnode.Attributes["RDGatewayHostname"].Value;
connectionInfo.RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials)MiscTools.StringToEnum(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), Convert.ToString(xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value)); connectionInfo.RDGatewayUseConnectionCredentials = (RDGatewayUseConnectionCredentials)MiscTools.StringToEnum(typeof(RDGatewayUseConnectionCredentials), Convert.ToString(xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value));
connectionInfo.RDGatewayUsername = xmlnode.Attributes["RDGatewayUsername"].Value; connectionInfo.RDGatewayUsername = xmlnode.Attributes["RDGatewayUsername"].Value;
connectionInfo.RDGatewayPassword = _decryptor.Decrypt(Convert.ToString(xmlnode.Attributes["RDGatewayPassword"].Value)); connectionInfo.RDGatewayPassword = _decryptor.Decrypt(Convert.ToString(xmlnode.Attributes["RDGatewayPassword"].Value));
connectionInfo.RDGatewayDomain = xmlnode.Attributes["RDGatewayDomain"].Value; connectionInfo.RDGatewayDomain = xmlnode.Attributes["RDGatewayDomain"].Value;
@@ -492,7 +492,7 @@ namespace mRemoteNG.Config.Serializers
if (_confVersion >= 2.6) if (_confVersion >= 2.6)
{ {
connectionInfo.ConstantID = xmlnode.Attributes["Id"]?.Value ?? connectionInfo.ConstantID; connectionInfo.ConstantID = xmlnode.Attributes["Id"]?.Value ?? connectionInfo.ConstantID;
connectionInfo.SoundQuality = (RdpProtocol.RDPSoundQuality)MiscTools.StringToEnum(typeof(RdpProtocol.RDPSoundQuality), Convert.ToString(xmlnode.Attributes["SoundQuality"].Value)); connectionInfo.SoundQuality = (RdpSoundQuality)MiscTools.StringToEnum(typeof(RdpSoundQuality), Convert.ToString(xmlnode.Attributes["SoundQuality"].Value));
connectionInfo.Inheritance.SoundQuality = bool.Parse(xmlnode.Attributes["InheritSoundQuality"].Value); connectionInfo.Inheritance.SoundQuality = bool.Parse(xmlnode.Attributes["InheritSoundQuality"].Value);
connectionInfo.RDPMinutesToIdleTimeout = Convert.ToInt32(xmlnode.Attributes["RDPMinutesToIdleTimeout"]?.Value ?? "0"); connectionInfo.RDPMinutesToIdleTimeout = Convert.ToInt32(xmlnode.Attributes["RDPMinutesToIdleTimeout"]?.Value ?? "0");
connectionInfo.Inheritance.RDPMinutesToIdleTimeout = bool.Parse(xmlnode.Attributes["InheritRDPMinutesToIdleTimeout"]?.Value ?? "False"); connectionInfo.Inheritance.RDPMinutesToIdleTimeout = bool.Parse(xmlnode.Attributes["InheritRDPMinutesToIdleTimeout"]?.Value ?? "False");

View File

@@ -15,7 +15,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers namespace mRemoteNG.Config.Serializers
{ {
public class DataTableDeserializer : IDeserializer<DataTable, ConnectionTreeModel> public class DataTableDeserializer : IDeserializer<DataTable, ConnectionTreeModel>
{ {
public ConnectionTreeModel Deserialize(DataTable table) public ConnectionTreeModel Deserialize(DataTable table)
{ {
@@ -85,12 +85,12 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.UseCredSsp = (bool)dataRow["UseCredSsp"]; connectionInfo.UseCredSsp = (bool)dataRow["UseCredSsp"];
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine), (string)dataRow["RenderingEngine"]); connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine), (string)dataRow["RenderingEngine"]);
connectionInfo.ICAEncryptionStrength = (IcaProtocol.EncryptionStrength)Enum.Parse(typeof(IcaProtocol.EncryptionStrength), (string)dataRow["ICAEncryptionStrength"]); connectionInfo.ICAEncryptionStrength = (IcaProtocol.EncryptionStrength)Enum.Parse(typeof(IcaProtocol.EncryptionStrength), (string)dataRow["ICAEncryptionStrength"]);
connectionInfo.RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel)Enum.Parse(typeof(RdpProtocol.AuthenticationLevel), (string)dataRow["RDPAuthenticationLevel"]); connectionInfo.RDPAuthenticationLevel = (RdpAuthenticationLevel)Enum.Parse(typeof(RdpAuthenticationLevel), (string)dataRow["RDPAuthenticationLevel"]);
connectionInfo.RDPMinutesToIdleTimeout = (int)dataRow["RDPMinutesToIdleTimeout"]; connectionInfo.RDPMinutesToIdleTimeout = (int)dataRow["RDPMinutesToIdleTimeout"];
connectionInfo.RDPAlertIdleTimeout = (bool)dataRow["RDPAlertIdleTimeout"]; connectionInfo.RDPAlertIdleTimeout = (bool)dataRow["RDPAlertIdleTimeout"];
connectionInfo.LoadBalanceInfo = (string)dataRow["LoadBalanceInfo"]; connectionInfo.LoadBalanceInfo = (string)dataRow["LoadBalanceInfo"];
connectionInfo.Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors) ,(string)dataRow["Colors"]); connectionInfo.Colors = (RdpColors)Enum.Parse(typeof(RdpColors) ,(string)dataRow["Colors"]);
connectionInfo.Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions), (string)dataRow["Resolution"]); connectionInfo.Resolution = (RdpResolutions)Enum.Parse(typeof(RdpResolutions), (string)dataRow["Resolution"]);
connectionInfo.AutomaticResize = (bool)dataRow["AutomaticResize"]; connectionInfo.AutomaticResize = (bool)dataRow["AutomaticResize"];
connectionInfo.DisplayWallpaper = (bool)dataRow["DisplayWallpaper"]; connectionInfo.DisplayWallpaper = (bool)dataRow["DisplayWallpaper"];
connectionInfo.DisplayThemes = (bool)dataRow["DisplayThemes"]; connectionInfo.DisplayThemes = (bool)dataRow["DisplayThemes"];
@@ -101,8 +101,8 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.RedirectPorts = (bool)dataRow["RedirectPorts"]; connectionInfo.RedirectPorts = (bool)dataRow["RedirectPorts"];
connectionInfo.RedirectPrinters = (bool)dataRow["RedirectPrinters"]; connectionInfo.RedirectPrinters = (bool)dataRow["RedirectPrinters"];
connectionInfo.RedirectSmartCards = (bool)dataRow["RedirectSmartCards"]; connectionInfo.RedirectSmartCards = (bool)dataRow["RedirectSmartCards"];
connectionInfo.RedirectSound = (RdpProtocol.RDPSounds)Enum.Parse(typeof(RdpProtocol.RDPSounds), (string)dataRow["RedirectSound"]); connectionInfo.RedirectSound = (RdpSounds)Enum.Parse(typeof(RdpSounds), (string)dataRow["RedirectSound"]);
connectionInfo.SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality), (string)dataRow["SoundQuality"]); connectionInfo.SoundQuality = (RdpSoundQuality)Enum.Parse(typeof(RdpSoundQuality), (string)dataRow["SoundQuality"]);
connectionInfo.RedirectKeys = (bool)dataRow["RedirectKeys"]; connectionInfo.RedirectKeys = (bool)dataRow["RedirectKeys"];
connectionInfo.PleaseConnect = (bool)dataRow["Connected"]; connectionInfo.PleaseConnect = (bool)dataRow["Connected"];
connectionInfo.PreExtApp = (string)dataRow["PreExtApp"]; connectionInfo.PreExtApp = (string)dataRow["PreExtApp"];
@@ -121,9 +121,9 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.VNCColors = (ProtocolVNC.Colors)Enum.Parse(typeof(ProtocolVNC.Colors), (string)dataRow["VNCColors"]); connectionInfo.VNCColors = (ProtocolVNC.Colors)Enum.Parse(typeof(ProtocolVNC.Colors), (string)dataRow["VNCColors"]);
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), (string)dataRow["VNCSmartSizeMode"]); connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), (string)dataRow["VNCSmartSizeMode"]);
connectionInfo.VNCViewOnly = (bool)dataRow["VNCViewOnly"]; connectionInfo.VNCViewOnly = (bool)dataRow["VNCViewOnly"];
connectionInfo.RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod)Enum.Parse(typeof(RdpProtocol.RDGatewayUsageMethod), (string)dataRow["RDGatewayUsageMethod"]); connectionInfo.RDGatewayUsageMethod = (RDGatewayUsageMethod)Enum.Parse(typeof(RDGatewayUsageMethod), (string)dataRow["RDGatewayUsageMethod"]);
connectionInfo.RDGatewayHostname = (string)dataRow["RDGatewayHostname"]; connectionInfo.RDGatewayHostname = (string)dataRow["RDGatewayHostname"];
connectionInfo.RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), (string)dataRow["RDGatewayUseConnectionCredentials"]); connectionInfo.RDGatewayUseConnectionCredentials = (RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RDGatewayUseConnectionCredentials), (string)dataRow["RDGatewayUseConnectionCredentials"]);
connectionInfo.RDGatewayUsername = (string)dataRow["RDGatewayUsername"]; connectionInfo.RDGatewayUsername = (string)dataRow["RDGatewayUsername"];
connectionInfo.RDGatewayPassword = (string)dataRow["RDGatewayPassword"]; connectionInfo.RDGatewayPassword = (string)dataRow["RDGatewayPassword"];
connectionInfo.RDGatewayDomain = (string)dataRow["RDGatewayDomain"]; connectionInfo.RDGatewayDomain = (string)dataRow["RDGatewayDomain"];

View File

@@ -13,7 +13,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.MiscSerializers namespace mRemoteNG.Config.Serializers.MiscSerializers
{ {
public class CsvConnectionsDeserializerMremotengFormat : IDeserializer<string, ConnectionTreeModel> public class CsvConnectionsDeserializerMremotengFormat : IDeserializer<string, ConnectionTreeModel>
{ {
public ConnectionTreeModel Deserialize(string serializedData) public ConnectionTreeModel Deserialize(string serializedData)
{ {
@@ -131,21 +131,21 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
if (headers.Contains("RDPAuthenticationLevel")) if (headers.Contains("RDPAuthenticationLevel"))
{ {
RdpProtocol.AuthenticationLevel value; RdpAuthenticationLevel value;
if (Enum.TryParse(connectionCsv[headers.IndexOf("RDPAuthenticationLevel")], out value)) if (Enum.TryParse(connectionCsv[headers.IndexOf("RDPAuthenticationLevel")], out value))
connectionRecord.RDPAuthenticationLevel = value; connectionRecord.RDPAuthenticationLevel = value;
} }
if (headers.Contains("Colors")) if (headers.Contains("Colors"))
{ {
RdpProtocol.RDPColors value; RdpColors value;
if (Enum.TryParse(connectionCsv[headers.IndexOf("Colors")], out value)) if (Enum.TryParse(connectionCsv[headers.IndexOf("Colors")], out value))
connectionRecord.Colors = value; connectionRecord.Colors = value;
} }
if (headers.Contains("Resolution")) if (headers.Contains("Resolution"))
{ {
RdpProtocol.RDPResolutions value; RdpResolutions value;
if (Enum.TryParse(connectionCsv[headers.IndexOf("Resolution")], out value)) if (Enum.TryParse(connectionCsv[headers.IndexOf("Resolution")], out value))
connectionRecord.Resolution = value; connectionRecord.Resolution = value;
} }
@@ -222,7 +222,7 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
if (headers.Contains("RedirectSound")) if (headers.Contains("RedirectSound"))
{ {
RdpProtocol.RDPSounds value; RdpSounds value;
if (Enum.TryParse(connectionCsv[headers.IndexOf("RedirectSound")], out value)) if (Enum.TryParse(connectionCsv[headers.IndexOf("RedirectSound")], out value))
connectionRecord.RedirectSound = value; connectionRecord.RedirectSound = value;
} }
@@ -292,14 +292,14 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
if (headers.Contains("RDGatewayUsageMethod")) if (headers.Contains("RDGatewayUsageMethod"))
{ {
RdpProtocol.RDGatewayUsageMethod value; RDGatewayUsageMethod value;
if (Enum.TryParse(connectionCsv[headers.IndexOf("RDGatewayUsageMethod")], out value)) if (Enum.TryParse(connectionCsv[headers.IndexOf("RDGatewayUsageMethod")], out value))
connectionRecord.RDGatewayUsageMethod = value; connectionRecord.RDGatewayUsageMethod = value;
} }
if (headers.Contains("RDGatewayUseConnectionCredentials")) if (headers.Contains("RDGatewayUseConnectionCredentials"))
{ {
RdpProtocol.RDGatewayUseConnectionCredentials value; RDGatewayUseConnectionCredentials value;
if (Enum.TryParse(connectionCsv[headers.IndexOf("RDGatewayUseConnectionCredentials")], out value)) if (Enum.TryParse(connectionCsv[headers.IndexOf("RDGatewayUseConnectionCredentials")], out value))
connectionRecord.RDGatewayUseConnectionCredentials = value; connectionRecord.RDGatewayUseConnectionCredentials = value;
} }

View File

@@ -6,7 +6,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers namespace mRemoteNG.Config.Serializers
{ {
public class RemoteDesktopConnectionDeserializer : IDeserializer<string, ConnectionTreeModel> public class RemoteDesktopConnectionDeserializer : IDeserializer<string, ConnectionTreeModel>
{ {
// .rdp file schema: https://technet.microsoft.com/en-us/library/ff393699(v=ws.10).aspx // .rdp file schema: https://technet.microsoft.com/en-us/library/ff393699(v=ws.10).aspx
@@ -59,19 +59,19 @@ namespace mRemoteNG.Config.Serializers
switch (value) switch (value)
{ {
case "8": case "8":
connectionInfo.Colors = RdpProtocol.RDPColors.Colors256; connectionInfo.Colors = RdpColors.Colors256;
break; break;
case "15": case "15":
connectionInfo.Colors = RdpProtocol.RDPColors.Colors15Bit; connectionInfo.Colors = RdpColors.Colors15Bit;
break; break;
case "16": case "16":
connectionInfo.Colors = RdpProtocol.RDPColors.Colors16Bit; connectionInfo.Colors = RdpColors.Colors16Bit;
break; break;
case "24": case "24":
connectionInfo.Colors = RdpProtocol.RDPColors.Colors24Bit; connectionInfo.Colors = RdpColors.Colors24Bit;
break; break;
case "32": case "32":
connectionInfo.Colors = RdpProtocol.RDPColors.Colors32Bit; connectionInfo.Colors = RdpColors.Colors32Bit;
break; break;
} }
break; break;
@@ -79,7 +79,7 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.CacheBitmaps = value == "1"; connectionInfo.CacheBitmaps = value == "1";
break; break;
case "screen mode id": case "screen mode id":
connectionInfo.Resolution = value == "2" ? RdpProtocol.RDPResolutions.Fullscreen : RdpProtocol.RDPResolutions.FitToWindow; connectionInfo.Resolution = value == "2" ? RdpResolutions.Fullscreen : RdpResolutions.FitToWindow;
break; break;
case "connect to console": case "connect to console":
connectionInfo.UseConsoleSession = value == "1"; connectionInfo.UseConsoleSession = value == "1";
@@ -112,13 +112,13 @@ namespace mRemoteNG.Config.Serializers
switch (value) switch (value)
{ {
case "0": case "0":
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.BringToThisComputer; connectionInfo.RedirectSound = RdpSounds.BringToThisComputer;
break; break;
case "1": case "1":
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.LeaveAtRemoteComputer; connectionInfo.RedirectSound = RdpSounds.LeaveAtRemoteComputer;
break; break;
case "2": case "2":
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.DoNotPlay; connectionInfo.RedirectSound = RdpSounds.DoNotPlay;
break; break;
} }
break; break;

View File

@@ -1,5 +1,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Xml; using System.Xml;
using mRemoteNG.Connection; using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol; using mRemoteNG.Connection.Protocol;
@@ -7,13 +9,11 @@ using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Container; using mRemoteNG.Container;
using mRemoteNG.Tree; using mRemoteNG.Tree;
using mRemoteNG.Tree.Root; using mRemoteNG.Tree.Root;
using System.Security.Cryptography;
using System.Text;
namespace mRemoteNG.Config.Serializers namespace mRemoteNG.Config.Serializers
{ {
public class RemoteDesktopConnectionManagerDeserializer : IDeserializer<string, ConnectionTreeModel> public class RemoteDesktopConnectionManagerDeserializer : IDeserializer<string, ConnectionTreeModel>
{ {
private static int _schemaVersion; /* 1 = RDCMan v2.2 private static int _schemaVersion; /* 1 = RDCMan v2.2
3 = RDCMan v2.7 */ 3 = RDCMan v2.7 */
@@ -176,7 +176,7 @@ namespace mRemoteNG.Config.Serializers
var gatewaySettingsNode = xmlNode.SelectSingleNode("./gatewaySettings"); var gatewaySettingsNode = xmlNode.SelectSingleNode("./gatewaySettings");
if (gatewaySettingsNode?.Attributes?["inherit"].Value == "None") if (gatewaySettingsNode?.Attributes?["inherit"].Value == "None")
{ {
connectionInfo.RDGatewayUsageMethod = gatewaySettingsNode.SelectSingleNode("./enabled")?.InnerText == "True" ? RdpProtocol.RDGatewayUsageMethod.Always : RdpProtocol.RDGatewayUsageMethod.Never; connectionInfo.RDGatewayUsageMethod = gatewaySettingsNode.SelectSingleNode("./enabled")?.InnerText == "True" ? RDGatewayUsageMethod.Always : RDGatewayUsageMethod.Never;
connectionInfo.RDGatewayHostname = gatewaySettingsNode.SelectSingleNode("./hostName")?.InnerText; connectionInfo.RDGatewayHostname = gatewaySettingsNode.SelectSingleNode("./hostName")?.InnerText;
connectionInfo.RDGatewayUsername = gatewaySettingsNode.SelectSingleNode("./userName")?.InnerText; connectionInfo.RDGatewayUsername = gatewaySettingsNode.SelectSingleNode("./userName")?.InnerText;
@@ -203,26 +203,26 @@ namespace mRemoteNG.Config.Serializers
var resolutionString = remoteDesktopNode.SelectSingleNode("./size")?.InnerText.Replace(" ", ""); var resolutionString = remoteDesktopNode.SelectSingleNode("./size")?.InnerText.Replace(" ", "");
try try
{ {
connectionInfo.Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions), "Res" + resolutionString); connectionInfo.Resolution = (RdpResolutions)Enum.Parse(typeof(RdpResolutions), "Res" + resolutionString);
} }
catch (ArgumentException) catch (ArgumentException)
{ {
connectionInfo.Resolution = RdpProtocol.RDPResolutions.FitToWindow; connectionInfo.Resolution = RdpResolutions.FitToWindow;
} }
if (remoteDesktopNode.SelectSingleNode("./sameSizeAsClientArea")?.InnerText == "True") if (remoteDesktopNode.SelectSingleNode("./sameSizeAsClientArea")?.InnerText == "True")
{ {
connectionInfo.Resolution = RdpProtocol.RDPResolutions.FitToWindow; connectionInfo.Resolution = RdpResolutions.FitToWindow;
} }
if (remoteDesktopNode.SelectSingleNode("./fullScreen")?.InnerText == "True") if (remoteDesktopNode.SelectSingleNode("./fullScreen")?.InnerText == "True")
{ {
connectionInfo.Resolution = RdpProtocol.RDPResolutions.Fullscreen; connectionInfo.Resolution = RdpResolutions.Fullscreen;
} }
var colorDepth = remoteDesktopNode.SelectSingleNode("./colorDepth")?.InnerText; var colorDepth = remoteDesktopNode.SelectSingleNode("./colorDepth")?.InnerText;
if (colorDepth != null) if (colorDepth != null)
connectionInfo.Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors), colorDepth); connectionInfo.Colors = (RdpColors)Enum.Parse(typeof(RdpColors), colorDepth);
} }
else else
{ {
@@ -238,15 +238,15 @@ namespace mRemoteNG.Config.Serializers
{ {
case "0": // Bring to this computer case "0": // Bring to this computer
case "Client": case "Client":
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.BringToThisComputer; connectionInfo.RedirectSound = RdpSounds.BringToThisComputer;
break; break;
case "1": // Leave at remote computer case "1": // Leave at remote computer
case "Remote": case "Remote":
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.LeaveAtRemoteComputer; connectionInfo.RedirectSound = RdpSounds.LeaveAtRemoteComputer;
break; break;
case "2": // Do not play case "2": // Do not play
case "NoSound": case "NoSound":
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.DoNotPlay; connectionInfo.RedirectSound = RdpSounds.DoNotPlay;
break; break;
} }
@@ -294,15 +294,15 @@ namespace mRemoteNG.Config.Serializers
{ {
case "0": // No authentication case "0": // No authentication
case "None": case "None":
connectionInfo.RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.NoAuth; connectionInfo.RDPAuthenticationLevel = RdpAuthenticationLevel.NoAuth;
break; break;
case "1": // Do not connect if authentication fails case "1": // Do not connect if authentication fails
case "Required": case "Required":
connectionInfo.RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.AuthRequired; connectionInfo.RDPAuthenticationLevel = RdpAuthenticationLevel.AuthRequired;
break; break;
case "2": // Warn if authentication fails case "2": // Warn if authentication fails
case "Warn": case "Warn":
connectionInfo.RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.WarnOnFailedAuth; connectionInfo.RDPAuthenticationLevel = RdpAuthenticationLevel.WarnOnFailedAuth;
break; break;
} }
} }

View File

@@ -26,28 +26,29 @@ namespace mRemoteNG.Connection
private string _domain = ""; private string _domain = "";
private ProtocolType _protocol; private ProtocolType _protocol;
private RdpVersionEnum _rdpProtocolVersion;
private string _extApp; private string _extApp;
private int _port; private int _port;
private string _puttySession; private string _puttySession;
private IcaProtocol.EncryptionStrength _icaEncryption; private IcaProtocol.EncryptionStrength _icaEncryption;
private bool _useConsoleSession; private bool _useConsoleSession;
private RdpProtocol.AuthenticationLevel _rdpAuthenticationLevel; private RdpAuthenticationLevel _rdpAuthenticationLevel;
private int _rdpMinutesToIdleTimeout; private int _rdpMinutesToIdleTimeout;
private bool _rdpAlertIdleTimeout; private bool _rdpAlertIdleTimeout;
private string _loadBalanceInfo; private string _loadBalanceInfo;
private HTTPBase.RenderingEngine _renderingEngine; private HTTPBase.RenderingEngine _renderingEngine;
private bool _useCredSsp; private bool _useCredSsp;
private RdpProtocol.RDGatewayUsageMethod _rdGatewayUsageMethod; private RDGatewayUsageMethod _rdGatewayUsageMethod;
private string _rdGatewayHostname; private string _rdGatewayHostname;
private RdpProtocol.RDGatewayUseConnectionCredentials _rdGatewayUseConnectionCredentials; private RDGatewayUseConnectionCredentials _rdGatewayUseConnectionCredentials;
private string _rdGatewayUsername; private string _rdGatewayUsername;
private string _rdGatewayPassword; private string _rdGatewayPassword;
private string _rdGatewayDomain; private string _rdGatewayDomain;
private RdpProtocol.RDPResolutions _resolution; private RdpResolutions _resolution;
private bool _automaticResize; private bool _automaticResize;
private RdpProtocol.RDPColors _colors; private RdpColors _colors;
private bool _cacheBitmaps; private bool _cacheBitmaps;
private bool _displayWallpaper; private bool _displayWallpaper;
private bool _displayThemes; private bool _displayThemes;
@@ -59,8 +60,8 @@ namespace mRemoteNG.Connection
private bool _redirectPrinters; private bool _redirectPrinters;
private bool _redirectPorts; private bool _redirectPorts;
private bool _redirectSmartCards; private bool _redirectSmartCards;
private RdpProtocol.RDPSounds _redirectSound; private RdpSounds _redirectSound;
private RdpProtocol.RDPSoundQuality _soundQuality; private RdpSoundQuality _soundQuality;
private string _preExtApp; private string _preExtApp;
private string _postExtApp; private string _postExtApp;
@@ -170,6 +171,16 @@ namespace mRemoteNG.Connection
set { SetField(ref _protocol, value, "Protocol"); } set { SetField(ref _protocol, value, "Protocol"); }
} }
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRdpProtocolVersion"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRdpProtocolVersion"),
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public virtual RdpVersionEnum RdpProtocolVersion
{
get { return GetPropertyValue(nameof(RdpProtocolVersion), _rdpProtocolVersion); }
set { SetField(ref _rdpProtocolVersion, value, nameof(RdpProtocolVersion)); }
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3), [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalTool"), LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalTool"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalTool"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalTool"),
@@ -223,7 +234,7 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationLevel"), LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationLevel"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationLevel"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationLevel"),
TypeConverter(typeof(MiscTools.EnumTypeConverter))] TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.AuthenticationLevel RDPAuthenticationLevel public RdpAuthenticationLevel RDPAuthenticationLevel
{ {
get { return GetPropertyValue("RDPAuthenticationLevel", _rdpAuthenticationLevel); } get { return GetPropertyValue("RDPAuthenticationLevel", _rdpAuthenticationLevel); }
set { SetField(ref _rdpAuthenticationLevel, value, "RDPAuthenticationLevel"); } set { SetField(ref _rdpAuthenticationLevel, value, "RDPAuthenticationLevel"); }
@@ -288,7 +299,7 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUsageMethod"), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUsageMethod"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUsageMethod"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUsageMethod"),
TypeConverter(typeof(MiscTools.EnumTypeConverter))] TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDGatewayUsageMethod RDGatewayUsageMethod public RDGatewayUsageMethod RDGatewayUsageMethod
{ {
get { return GetPropertyValue("RDGatewayUsageMethod", _rdGatewayUsageMethod); } get { return GetPropertyValue("RDGatewayUsageMethod", _rdGatewayUsageMethod); }
set { SetField(ref _rdGatewayUsageMethod, value, "RDGatewayUsageMethod"); } set { SetField(ref _rdGatewayUsageMethod, value, "RDGatewayUsageMethod"); }
@@ -307,7 +318,7 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUseConnectionCredentials"), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUseConnectionCredentials"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUseConnectionCredentials"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUseConnectionCredentials"),
TypeConverter(typeof(MiscTools.EnumTypeConverter))] TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDGatewayUseConnectionCredentials RDGatewayUseConnectionCredentials public RDGatewayUseConnectionCredentials RDGatewayUseConnectionCredentials
{ {
get { return GetPropertyValue("RDGatewayUseConnectionCredentials", _rdGatewayUseConnectionCredentials); } get { return GetPropertyValue("RDGatewayUseConnectionCredentials", _rdGatewayUseConnectionCredentials); }
set { SetField(ref _rdGatewayUseConnectionCredentials, value, "RDGatewayUseConnectionCredentials"); } set { SetField(ref _rdGatewayUseConnectionCredentials, value, "RDGatewayUseConnectionCredentials"); }
@@ -347,7 +358,7 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayName("strPropertyNameResolution"), LocalizedAttributes.LocalizedDisplayName("strPropertyNameResolution"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionResolution"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionResolution"),
TypeConverter(typeof(MiscTools.EnumTypeConverter))] TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDPResolutions Resolution public RdpResolutions Resolution
{ {
get { return GetPropertyValue("Resolution", _resolution); } get { return GetPropertyValue("Resolution", _resolution); }
set { SetField(ref _resolution, value, "Resolution"); } set { SetField(ref _resolution, value, "Resolution"); }
@@ -367,7 +378,7 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"), LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"),
TypeConverter(typeof(MiscTools.EnumTypeConverter))] TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDPColors Colors public RdpColors Colors
{ {
get { return GetPropertyValue("Colors", _colors); } get { return GetPropertyValue("Colors", _colors); }
set { SetField(ref _colors, value, "Colors"); } set { SetField(ref _colors, value, "Colors"); }
@@ -479,7 +490,7 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSounds"), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSounds"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSounds"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSounds"),
TypeConverter(typeof(MiscTools.EnumTypeConverter))] TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDPSounds RedirectSound public RdpSounds RedirectSound
{ {
get { return GetPropertyValue("RedirectSound", _redirectSound); } get { return GetPropertyValue("RedirectSound", _redirectSound); }
set { SetField(ref _redirectSound, value, "RedirectSound"); } set { SetField(ref _redirectSound, value, "RedirectSound"); }
@@ -489,7 +500,7 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayName("strPropertyNameSoundQuality"), LocalizedAttributes.LocalizedDisplayName("strPropertyNameSoundQuality"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionSoundQuality"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionSoundQuality"),
TypeConverter(typeof(MiscTools.EnumTypeConverter))] TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDPSoundQuality SoundQuality public RdpSoundQuality SoundQuality
{ {
get { return GetPropertyValue("SoundQuality", _soundQuality); } get { return GetPropertyValue("SoundQuality", _soundQuality); }
set { SetField(ref _soundQuality, value, "SoundQuality"); } set { SetField(ref _soundQuality, value, "SoundQuality"); }

View File

@@ -222,7 +222,7 @@ namespace mRemoteNG.Connection
switch (protocol) switch (protocol)
{ {
case ProtocolType.RDP: case ProtocolType.RDP:
return (int)RdpProtocol.Defaults.Port; return (int)RdpProtocol6.Defaults.Port;
case ProtocolType.VNC: case ProtocolType.VNC:
return (int)ProtocolVNC.Defaults.Port; return (int)ProtocolVNC.Defaults.Port;
case ProtocolType.SSH1: case ProtocolType.SSH1:
@@ -269,12 +269,13 @@ namespace mRemoteNG.Connection
private void SetProtocolDefaults() private void SetProtocolDefaults()
{ {
Protocol = (ProtocolType)Enum.Parse(typeof(ProtocolType), Settings.Default.ConDefaultProtocol); Protocol = (ProtocolType)Enum.Parse(typeof(ProtocolType), Settings.Default.ConDefaultProtocol);
ExtApp = Settings.Default.ConDefaultExtApp; RdpProtocolVersion = RdpVersionEnum.Rdc8;
ExtApp = Settings.Default.ConDefaultExtApp;
Port = 0; Port = 0;
PuttySession = Settings.Default.ConDefaultPuttySession; PuttySession = Settings.Default.ConDefaultPuttySession;
ICAEncryptionStrength = (IcaProtocol.EncryptionStrength) Enum.Parse(typeof(IcaProtocol.EncryptionStrength), Settings.Default.ConDefaultICAEncryptionStrength); ICAEncryptionStrength = (IcaProtocol.EncryptionStrength) Enum.Parse(typeof(IcaProtocol.EncryptionStrength), Settings.Default.ConDefaultICAEncryptionStrength);
UseConsoleSession = Settings.Default.ConDefaultUseConsoleSession; UseConsoleSession = Settings.Default.ConDefaultUseConsoleSession;
RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel) Enum.Parse(typeof(RdpProtocol.AuthenticationLevel), Settings.Default.ConDefaultRDPAuthenticationLevel); RDPAuthenticationLevel = (RdpAuthenticationLevel) Enum.Parse(typeof(RdpAuthenticationLevel), Settings.Default.ConDefaultRDPAuthenticationLevel);
RDPMinutesToIdleTimeout = Settings.Default.ConDefaultRDPMinutesToIdleTimeout; RDPMinutesToIdleTimeout = Settings.Default.ConDefaultRDPMinutesToIdleTimeout;
RDPAlertIdleTimeout = Settings.Default.ConDefaultRDPAlertIdleTimeout; RDPAlertIdleTimeout = Settings.Default.ConDefaultRDPAlertIdleTimeout;
LoadBalanceInfo = Settings.Default.ConDefaultLoadBalanceInfo; LoadBalanceInfo = Settings.Default.ConDefaultLoadBalanceInfo;
@@ -284,9 +285,9 @@ namespace mRemoteNG.Connection
private void SetRdGatewayDefaults() private void SetRdGatewayDefaults()
{ {
RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod) Enum.Parse(typeof(RdpProtocol.RDGatewayUsageMethod), Settings.Default.ConDefaultRDGatewayUsageMethod); RDGatewayUsageMethod = (RDGatewayUsageMethod) Enum.Parse(typeof(RDGatewayUsageMethod), Settings.Default.ConDefaultRDGatewayUsageMethod);
RDGatewayHostname = Settings.Default.ConDefaultRDGatewayHostname; RDGatewayHostname = Settings.Default.ConDefaultRDGatewayHostname;
RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials) Enum.Parse(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), Settings.Default.ConDefaultRDGatewayUseConnectionCredentials); RDGatewayUseConnectionCredentials = (RDGatewayUseConnectionCredentials) Enum.Parse(typeof(RDGatewayUseConnectionCredentials), Settings.Default.ConDefaultRDGatewayUseConnectionCredentials);
RDGatewayUsername = Settings.Default.ConDefaultRDGatewayUsername; RDGatewayUsername = Settings.Default.ConDefaultRDGatewayUsername;
RDGatewayPassword = Settings.Default.ConDefaultRDGatewayPassword; RDGatewayPassword = Settings.Default.ConDefaultRDGatewayPassword;
RDGatewayDomain = Settings.Default.ConDefaultRDGatewayDomain; RDGatewayDomain = Settings.Default.ConDefaultRDGatewayDomain;
@@ -294,9 +295,9 @@ namespace mRemoteNG.Connection
private void SetAppearanceDefaults() private void SetAppearanceDefaults()
{ {
Resolution = (RdpProtocol.RDPResolutions) Enum.Parse(typeof(RdpProtocol.RDPResolutions), Settings.Default.ConDefaultResolution); Resolution = (RdpResolutions) Enum.Parse(typeof(RdpResolutions), Settings.Default.ConDefaultResolution);
AutomaticResize = Settings.Default.ConDefaultAutomaticResize; AutomaticResize = Settings.Default.ConDefaultAutomaticResize;
Colors = (RdpProtocol.RDPColors) Enum.Parse(typeof(RdpProtocol.RDPColors), Settings.Default.ConDefaultColors); Colors = (RdpColors) Enum.Parse(typeof(RdpColors), Settings.Default.ConDefaultColors);
CacheBitmaps = Settings.Default.ConDefaultCacheBitmaps; CacheBitmaps = Settings.Default.ConDefaultCacheBitmaps;
DisplayWallpaper = Settings.Default.ConDefaultDisplayWallpaper; DisplayWallpaper = Settings.Default.ConDefaultDisplayWallpaper;
DisplayThemes = Settings.Default.ConDefaultDisplayThemes; DisplayThemes = Settings.Default.ConDefaultDisplayThemes;
@@ -311,8 +312,8 @@ namespace mRemoteNG.Connection
RedirectPrinters = Settings.Default.ConDefaultRedirectPrinters; RedirectPrinters = Settings.Default.ConDefaultRedirectPrinters;
RedirectPorts = Settings.Default.ConDefaultRedirectPorts; RedirectPorts = Settings.Default.ConDefaultRedirectPorts;
RedirectSmartCards = Settings.Default.ConDefaultRedirectSmartCards; RedirectSmartCards = Settings.Default.ConDefaultRedirectSmartCards;
RedirectSound = (RdpProtocol.RDPSounds) Enum.Parse(typeof(RdpProtocol.RDPSounds), Settings.Default.ConDefaultRedirectSound); RedirectSound = (RdpSounds) Enum.Parse(typeof(RdpSounds), Settings.Default.ConDefaultRedirectSound);
SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality), Settings.Default.ConDefaultSoundQuality); SoundQuality = (RdpSoundQuality)Enum.Parse(typeof(RdpSoundQuality), Settings.Default.ConDefaultSoundQuality);
} }
private void SetMiscDefaults() private void SetMiscDefaults()

View File

@@ -100,7 +100,7 @@ namespace mRemoteNG.Connection
var connectionContainer = SetConnectionContainer(connectionInfo, connectionForm); var connectionContainer = SetConnectionContainer(connectionInfo, connectionForm);
SetConnectionFormEventHandlers(newProtocol, connectionForm); SetConnectionFormEventHandlers(newProtocol, connectionForm);
SetConnectionEventHandlers(newProtocol); SetConnectionEventHandlers(newProtocol);
BuildConnectionInterfaceController(connectionInfo, newProtocol, connectionContainer); BuildConnectionInterfaceController(newProtocol, connectionContainer);
newProtocol.Force = force; newProtocol.Force = force;
@@ -144,7 +144,7 @@ namespace mRemoteNG.Connection
{ {
var ic = t.Controls[0] as InterfaceControl; var ic = t.Controls[0] as InterfaceControl;
if (ic == null) continue; if (ic == null) continue;
if (ic.Info == connectionInfo) if (ic.Protocol.Info == connectionInfo)
{ {
return ic; return ic;
} }
@@ -213,9 +213,9 @@ namespace mRemoteNG.Connection
newProtocol.ErrorOccured += Prot_Event_ErrorOccured; newProtocol.ErrorOccured += Prot_Event_ErrorOccured;
} }
private static void BuildConnectionInterfaceController(ConnectionInfo connectionInfo, ProtocolBase newProtocol, Control connectionContainer) private static void BuildConnectionInterfaceController(ProtocolBase newProtocol, Control connectionContainer)
{ {
newProtocol.InterfaceControl = new InterfaceControl(connectionContainer, newProtocol, connectionInfo); newProtocol.InterfaceControl = new InterfaceControl(connectionContainer, newProtocol);
} }
#endregion #endregion
@@ -233,7 +233,7 @@ namespace mRemoteNG.Connection
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strProtocolEventDisconnected, disconnectedMessage), true); Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strProtocolEventDisconnected, disconnectedMessage), true);
var prot = (ProtocolBase)sender; var prot = (ProtocolBase)sender;
if (prot.InterfaceControl.Info.Protocol != ProtocolType.RDP) return; if (prot.Info.Protocol != ProtocolType.RDP) return;
var reasonCode = disconnectedMessage.Split("\r\n".ToCharArray())[0]; var reasonCode = disconnectedMessage.Split("\r\n".ToCharArray())[0];
var desc = disconnectedMessage.Replace("\r\n", " "); var desc = disconnectedMessage.Replace("\r\n", " ");
@@ -246,26 +246,27 @@ namespace mRemoteNG.Connection
} }
} }
private static void Prot_Event_Closed(object sender) private static void Prot_Event_Closed(object sender, EventArgs args)
{ {
try try
{ {
var prot = (ProtocolBase)sender; var prot = (ProtocolBase)sender;
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnenctionCloseEvent, true); Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnenctionCloseEvent, true);
string connDetail; string connDetail;
if (prot.InterfaceControl.Info.Hostname == "" && prot.InterfaceControl.Info.Protocol == ProtocolType.IntApp) if (prot.Info.Hostname == "" && prot.Info.Protocol == ProtocolType.IntApp)
connDetail = prot.InterfaceControl.Info.ExtApp; connDetail = prot.Info.ExtApp;
else if (prot.InterfaceControl.Info.Hostname != "") else if (prot.Info.Hostname != "")
connDetail = prot.InterfaceControl.Info.Hostname; connDetail = prot.Info.Hostname;
else else
connDetail = "UNKNOWN"; connDetail = "UNKNOWN";
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strConnenctionClosedByUser, connDetail, prot.InterfaceControl.Info.Protocol, Environment.UserName)); Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
prot.InterfaceControl.Info.OpenConnections.Remove(prot); string.Format(Language.strConnenctionClosedByUser, connDetail, prot.Info.Protocol, Environment.UserName));
prot.Info.OpenConnections.Remove(prot);
if (prot.InterfaceControl.Info.PostExtApp == "") return; if (prot.Info.PostExtApp == "") return;
var extA = Runtime.ExternalToolsService.GetExtAppByName(prot.InterfaceControl.Info.PostExtApp); var extA = Runtime.ExternalToolsService.GetExtAppByName(prot.Info.PostExtApp);
extA?.Start(prot.InterfaceControl.Info); extA?.Start(prot.Info);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -273,11 +274,12 @@ namespace mRemoteNG.Connection
} }
} }
private static void Prot_Event_Connected(object sender) private static void Prot_Event_Connected(object sender, EventArgs args)
{ {
var prot = (ProtocolBase)sender; var prot = (ProtocolBase)sender;
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnectionEventConnected, true); Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnectionEventConnected, true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strConnectionEventConnectedDetail, prot.InterfaceControl.Info.Hostname, prot.InterfaceControl.Info.Protocol, Environment.UserName, prot.InterfaceControl.Info.Description, prot.InterfaceControl.Info.UserField)); Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
string.Format(Language.strConnectionEventConnectedDetail, prot.Info.Hostname, prot.Info.Protocol, Environment.UserName, prot.Info.Description, prot.Info.UserField));
} }
private static void Prot_Event_ErrorOccured(object sender, string errorMessage) private static void Prot_Event_ErrorOccured(object sender, string errorMessage)
@@ -287,9 +289,12 @@ namespace mRemoteNG.Connection
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnectionEventErrorOccured, true); Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnectionEventErrorOccured, true);
var prot = (ProtocolBase)sender; var prot = (ProtocolBase)sender;
if (prot.InterfaceControl.Info.Protocol != ProtocolType.RDP) return; if (prot.Info.Protocol != ProtocolType.RDP) return;
if (Convert.ToInt32(errorMessage) > -1) var errorMessageAsInt = Convert.ToInt32(errorMessage);
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, string.Format(Language.strConnectionRdpErrorDetail, errorMessage, RdpProtocol.FatalErrors.GetError(errorMessage)));
if (errorMessageAsInt > -1)
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
string.Format(Language.strConnectionRdpErrorDetail, errorMessage, RdpErrorTranslator.Translate(errorMessageAsInt)));
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -10,15 +10,12 @@ namespace mRemoteNG.Connection
public sealed partial class InterfaceControl public sealed partial class InterfaceControl
{ {
public ProtocolBase Protocol { get; set; } public ProtocolBase Protocol { get; set; }
public ConnectionInfo Info { get; set; }
public InterfaceControl(Control parent, ProtocolBase protocol)
public InterfaceControl(Control parent, ProtocolBase protocol, ConnectionInfo info)
{ {
try try
{ {
Protocol = protocol; Protocol = protocol;
Info = info;
Parent = parent; Parent = parent;
Location = new Point(0, 0); Location = new Point(0, 0);
Size = Parent.Size; Size = Parent.Size;

View File

@@ -3,7 +3,8 @@ namespace mRemoteNG.Connection.Protocol.Http
public class ProtocolHTTP : HTTPBase public class ProtocolHTTP : HTTPBase
{ {
public ProtocolHTTP(RenderingEngine RenderingEngine) : base(RenderingEngine) public ProtocolHTTP(ConnectionInfo connectionInfo, RenderingEngine renderingEngine)
: base(connectionInfo, renderingEngine)
{ {
httpOrS = "http"; httpOrS = "http";
defaultPort = (int)Defaults.Port; defaultPort = (int)Defaults.Port;

View File

@@ -9,20 +9,19 @@ namespace mRemoteNG.Connection.Protocol.Http
{ {
public class HTTPBase : ProtocolBase public class HTTPBase : ProtocolBase
{ {
#region Private Properties
private Control wBrowser; private Control wBrowser;
private string tabTitle;
protected string httpOrS; protected string httpOrS;
protected int defaultPort; protected int defaultPort;
private string tabTitle;
#endregion
#region Public Methods #region Public Methods
protected HTTPBase(RenderingEngine RenderingEngine) protected HTTPBase(ConnectionInfo connectionInfo, RenderingEngine renderingEngine)
{ : base(connectionInfo)
{
try try
{ {
if (RenderingEngine == RenderingEngine.Gecko) if (renderingEngine == RenderingEngine.Gecko)
{ {
if(!Xpcom.IsInitialized) if(!Xpcom.IsInitialized)
Xpcom.Initialize("Firefox"); Xpcom.Initialize("Firefox");
@@ -58,7 +57,7 @@ namespace mRemoteNG.Connection.Protocol.Http
{ {
wBrowser = Control; wBrowser = Control;
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko) if (Info.RenderingEngine == RenderingEngine.Gecko)
{ {
var GeckoBrowser = (GeckoWebBrowser) wBrowser; var GeckoBrowser = (GeckoWebBrowser) wBrowser;
if (GeckoBrowser != null) if (GeckoBrowser != null)
@@ -96,7 +95,7 @@ namespace mRemoteNG.Connection.Protocol.Http
{ {
try try
{ {
var strHost = InterfaceControl.Info.Hostname; var strHost = Info.Hostname;
/* /*
* Commenting out since this codes doesn't actually do anything at this time... * Commenting out since this codes doesn't actually do anything at this time...
* Possibly related to MR-221 and/or MR-533 ???? * Possibly related to MR-221 and/or MR-533 ????
@@ -108,7 +107,7 @@ namespace mRemoteNG.Connection.Protocol.Http
strAuth = "Authorization: Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(InterfaceControl.Info.Username + ":" + InterfaceControl.Info.Password)) + Environment.NewLine; strAuth = "Authorization: Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(InterfaceControl.Info.Username + ":" + InterfaceControl.Info.Password)) + Environment.NewLine;
} }
*/ */
if (InterfaceControl.Info.Port != defaultPort) if (Info.Port != defaultPort)
{ {
if (strHost.EndsWith("/")) if (strHost.EndsWith("/"))
{ {
@@ -120,13 +119,13 @@ namespace mRemoteNG.Connection.Protocol.Http
strHost = httpOrS + "://" + strHost; strHost = httpOrS + "://" + strHost;
} }
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko) if (Info.RenderingEngine == RenderingEngine.Gecko)
{ {
((GeckoWebBrowser)wBrowser).Navigate(strHost + ":" + InterfaceControl.Info.Port); ((GeckoWebBrowser)wBrowser).Navigate(strHost + ":" + Info.Port);
} }
else else
{ {
((WebBrowser)wBrowser).Navigate(strHost + ":" + InterfaceControl.Info.Port); ((WebBrowser)wBrowser).Navigate(strHost + ":" + Info.Port);
} }
} }
else else
@@ -136,7 +135,7 @@ namespace mRemoteNG.Connection.Protocol.Http
strHost = httpOrS + "://" + strHost; strHost = httpOrS + "://" + strHost;
} }
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko) if (Info.RenderingEngine == RenderingEngine.Gecko)
{ {
((GeckoWebBrowser)wBrowser).Navigate(strHost); ((GeckoWebBrowser)wBrowser).Navigate(strHost);
} }
@@ -181,7 +180,7 @@ namespace mRemoteNG.Connection.Protocol.Http
if (tabP == null) return; if (tabP == null) return;
string shortTitle; string shortTitle;
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko) if (Info.RenderingEngine == RenderingEngine.Gecko)
{ {
if (((GeckoWebBrowser) wBrowser).DocumentTitle.Length >= 15) if (((GeckoWebBrowser) wBrowser).DocumentTitle.Length >= 15)
{ {
@@ -229,7 +228,7 @@ namespace mRemoteNG.Connection.Protocol.Http
if (tabP == null) return; if (tabP == null) return;
string shortTitle; string shortTitle;
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko) if (Info.RenderingEngine == RenderingEngine.Gecko)
{ {
if (((GeckoWebBrowser)wBrowser).DocumentTitle.Length >= 15) if (((GeckoWebBrowser)wBrowser).DocumentTitle.Length >= 15)
{ {

View File

@@ -2,8 +2,8 @@ namespace mRemoteNG.Connection.Protocol.Http
{ {
public class ProtocolHTTPS : HTTPBase public class ProtocolHTTPS : HTTPBase
{ {
public ProtocolHTTPS(ConnectionInfo connectionInfo, RenderingEngine renderingEngine)
public ProtocolHTTPS(RenderingEngine RenderingEngine) : base(RenderingEngine) : base(connectionInfo, renderingEngine)
{ {
httpOrS = "https"; httpOrS = "https";
defaultPort = (int)Defaults.Port; defaultPort = (int)Defaults.Port;

View File

@@ -16,11 +16,11 @@ namespace mRemoteNG.Connection.Protocol.ICA
public class IcaProtocol : ProtocolBase public class IcaProtocol : ProtocolBase
{ {
private AxICAClient _icaClient; private AxICAClient _icaClient;
private ConnectionInfo _info;
private readonly FrmMain _frmMain = FrmMain.Default; private readonly FrmMain _frmMain = FrmMain.Default;
#region Public Methods #region Public Methods
public IcaProtocol() public IcaProtocol(ConnectionInfo connectionInfo)
: base(connectionInfo)
{ {
try try
{ {
@@ -39,7 +39,6 @@ namespace mRemoteNG.Connection.Protocol.ICA
try try
{ {
_icaClient = (AxICAClient)Control; _icaClient = (AxICAClient)Control;
_info = InterfaceControl.Info;
_icaClient.CreateControl(); _icaClient.CreateControl();
while (!_icaClient.Created) while (!_icaClient.Created)
@@ -48,7 +47,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
Application.DoEvents(); Application.DoEvents();
} }
_icaClient.Address = _info.Hostname; _icaClient.Address = Info.Hostname;
SetCredentials(); SetCredentials();
SetResolution(); SetResolution();
SetColors(); SetColors();
@@ -78,8 +77,8 @@ namespace mRemoteNG.Connection.Protocol.ICA
_icaClient.Hotkey11Shift = null; _icaClient.Hotkey11Shift = null;
_icaClient.Hotkey11Char = null; _icaClient.Hotkey11Char = null;
_icaClient.PersistentCacheEnabled = _info.CacheBitmaps; _icaClient.PersistentCacheEnabled = Info.CacheBitmaps;
_icaClient.Title = _info.Name; _icaClient.Title = Info.Name;
return true; return true;
} }
catch (Exception ex) catch (Exception ex)
@@ -117,9 +116,9 @@ namespace mRemoteNG.Connection.Protocol.ICA
return; return;
} }
var user = _info?.Username ?? ""; var user = Info?.Username ?? "";
var pass = _info?.Password ?? ""; var pass = Info?.Password ?? "";
var dom = _info?.Domain ?? ""; var dom = Info?.Domain ?? "";
if (string.IsNullOrEmpty(user)) if (string.IsNullOrEmpty(user))
{ {
@@ -187,22 +186,22 @@ namespace mRemoteNG.Connection.Protocol.ICA
return; return;
} }
if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.FitToWindow) if (Info.Resolution == RdpResolutions.FitToWindow)
{ {
_icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0); _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0);
} }
else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.SmartSize) else if (Info.Resolution == RdpResolutions.SmartSize)
{ {
_icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0); _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0);
} }
else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.Fullscreen) else if (Info.Resolution == RdpResolutions.Fullscreen)
{ {
_icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(_frmMain).Bounds.Width, Screen.FromControl(_frmMain).Bounds.Height, 0); _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(_frmMain).Bounds.Width, Screen.FromControl(_frmMain).Bounds.Height, 0);
_icaClient.FullScreenWindow(); _icaClient.FullScreenWindow();
} }
else else
{ {
var resolution = RdpProtocol.GetResolutionRectangle(_info.Resolution); var resolution = Info.Resolution.GetResolutionRectangle();
_icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0); _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0);
} }
} }
@@ -215,15 +214,15 @@ namespace mRemoteNG.Connection.Protocol.ICA
private void SetColors() private void SetColors()
{ {
// ReSharper disable once SwitchStatementMissingSomeCases // ReSharper disable once SwitchStatementMissingSomeCases
switch (_info.Colors) switch (Info.Colors)
{ {
case RdpProtocol.RDPColors.Colors256: case RdpColors.Colors256:
_icaClient.SetProp("DesiredColor", "2"); _icaClient.SetProp("DesiredColor", "2");
break; break;
case RdpProtocol.RDPColors.Colors15Bit: case RdpColors.Colors15Bit:
_icaClient.SetProp("DesiredColor", "4"); _icaClient.SetProp("DesiredColor", "4");
break; break;
case RdpProtocol.RDPColors.Colors16Bit: case RdpColors.Colors16Bit:
_icaClient.SetProp("DesiredColor", "4"); _icaClient.SetProp("DesiredColor", "4");
break; break;
default: default:
@@ -235,7 +234,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
private void SetSecurity() private void SetSecurity()
{ {
// ReSharper disable once SwitchStatementMissingSomeCases // ReSharper disable once SwitchStatementMissingSomeCases
switch (_info.ICAEncryptionStrength) switch (Info.ICAEncryptionStrength)
{ {
case EncryptionStrength.Encr128BitLogonOnly: case EncryptionStrength.Encr128BitLogonOnly:
_icaClient.Encrypt = true; _icaClient.Encrypt = true;
@@ -275,22 +274,22 @@ namespace mRemoteNG.Connection.Protocol.ICA
#region Private Events & Handlers #region Private Events & Handlers
private void ICAEvent_OnConnecting(object sender, EventArgs e) private void ICAEvent_OnConnecting(object sender, EventArgs e)
{ {
Event_Connecting(this); RaiseConnectionConnectingEvent(this);
} }
private void ICAEvent_OnConnected(object sender, EventArgs e) private void ICAEvent_OnConnected(object sender, EventArgs e)
{ {
Event_Connected(this); RaiseConnectionConnectedEvent(this);
} }
private void ICAEvent_OnConnectFailed(object sender, EventArgs e) private void ICAEvent_OnConnectFailed(object sender, EventArgs e)
{ {
Event_ErrorOccured(this, e.ToString()); RaiseErrorOccuredEvent(this, e.ToString());
} }
private void ICAEvent_OnDisconnect(object sender, EventArgs e) private void ICAEvent_OnDisconnect(object sender, EventArgs e)
{ {
Event_Disconnected(this, e.ToString()); RaiseConnectionDisconnectedEvent(this, e.ToString());
if (Settings.Default.ReconnectOnDisconnect) if (Settings.Default.ReconnectOnDisconnect)
{ {
@@ -312,7 +311,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
#region Reconnect Stuff #region Reconnect Stuff
public void tmrReconnect_Elapsed(object sender, ElapsedEventArgs e) public void tmrReconnect_Elapsed(object sender, ElapsedEventArgs e)
{ {
var srvReady = PortScanner.IsPortOpen(_info.Hostname, Convert.ToString(_info.Port)); var srvReady = PortScanner.IsPortOpen(Info.Hostname, Convert.ToString(Info.Port));
ReconnectGroup.ServerReady = srvReady; ReconnectGroup.ServerReady = srvReady;

View File

@@ -11,27 +11,30 @@ namespace mRemoteNG.Connection.Protocol
{ {
public class IntegratedProgram : ProtocolBase public class IntegratedProgram : ProtocolBase
{ {
#region Private Fields
private ExternalTool _externalTool; private ExternalTool _externalTool;
private IntPtr _handle; private IntPtr _handle;
private Process _process; private Process _process;
#endregion
public IntegratedProgram(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
}
#region Public Methods #region Public Methods
public override bool Initialize() public override bool Initialize()
{ {
if (InterfaceControl.Info == null) if (Info == null)
return base.Initialize(); return base.Initialize();
_externalTool = Runtime.ExternalToolsService.GetExtAppByName(InterfaceControl.Info.ExtApp); _externalTool = Runtime.ExternalToolsService.GetExtAppByName(Info.ExtApp);
if (_externalTool == null) if (_externalTool == null)
{ {
Runtime.MessageCollector?.AddMessage(MessageClass.ErrorMsg, string.Format(Language.CouldNotFindExternalTool, InterfaceControl.Info.ExtApp)); Runtime.MessageCollector?.AddMessage(MessageClass.ErrorMsg, string.Format(Language.CouldNotFindExternalTool, Info.ExtApp));
return false; return false;
} }
_externalTool.ConnectionInfo = InterfaceControl.Info; _externalTool.ConnectionInfo = Info;
return base.Initialize(); return base.Initialize();
} }
@@ -44,7 +47,7 @@ namespace mRemoteNG.Connection.Protocol
if (_externalTool.TryIntegrate == false) if (_externalTool.TryIntegrate == false)
{ {
_externalTool.Start(InterfaceControl.Info); _externalTool.Start(Info);
/* Don't call close here... There's nothing for the override to do in this case since /* Don't call close here... There's nothing for the override to do in this case since
* _process is not created in this scenario. When returning false, ProtocolBase.Close() * _process is not created in this scenario. When returning false, ProtocolBase.Close()
* will be called - which is just going to call IntegratedProgram.Close() again anyway... * will be called - which is just going to call IntegratedProgram.Close() again anyway...
@@ -169,7 +172,7 @@ namespace mRemoteNG.Connection.Protocol
#region Private Methods #region Private Methods
private void ProcessExited(object sender, EventArgs e) private void ProcessExited(object sender, EventArgs e)
{ {
Event_Closed(this); RaiseConnectionClosedEvent(this);
} }
#endregion #endregion

View File

@@ -3,29 +3,21 @@ using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using mRemoteNG.App; using mRemoteNG.App;
using mRemoteNG.Tools; using mRemoteNG.Tools;
using mRemoteNG.UI.Window;
namespace mRemoteNG.Connection.Protocol namespace mRemoteNG.Connection.Protocol
{ {
public abstract class ProtocolBase public abstract class ProtocolBase
{ {
#region Private Variables private ConnectionWindow _connectionWindow;
private UI.Window.ConnectionWindow _connectionWindow;
private InterfaceControl _interfaceControl; private InterfaceControl _interfaceControl;
private ConnectingEventHandler ConnectingEvent;
private ConnectedEventHandler ConnectedEvent;
private DisconnectedEventHandler DisconnectedEvent;
private ErrorOccuredEventHandler ErrorOccuredEvent;
private ClosingEventHandler ClosingEvent;
private ClosedEventHandler ClosedEvent;
#endregion
#region Public Properties #region Public Properties
#region Control #region Control
private string Name { get; } private string Name { get; }
protected UI.Window.ConnectionWindow ConnectionWindow protected ConnectionWindow ConnectionWindow
{ {
get { return _connectionWindow; } get { return _connectionWindow; }
private set private set
@@ -43,33 +35,38 @@ namespace mRemoteNG.Connection.Protocol
set set
{ {
_interfaceControl = value; _interfaceControl = value;
ConnectionWindow = _interfaceControl.GetContainerControl() as UI.Window.ConnectionWindow; ConnectionWindow = _interfaceControl.GetContainerControl() as ConnectionWindow;
} }
} }
protected Control Control { get; set; } protected Control Control { get; set; }
public ConnectionInfo Info { get; set; }
#endregion #endregion
public ConnectionInfo.Force Force { get; set; } public ConnectionInfo.Force Force { get; set; }
public readonly System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000); public readonly System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
protected ReconnectGroup ReconnectGroup; protected ReconnectGroup ReconnectGroup;
#endregion
protected ProtocolBase(string name) protected ProtocolBase(ConnectionInfo connectionInfo, string name)
{ {
if (connectionInfo == null)
throw new ArgumentNullException(nameof(connectionInfo));
if (name == null)
throw new ArgumentNullException(nameof(name));
Info = connectionInfo;
Name = name; Name = name;
} }
protected ProtocolBase() protected ProtocolBase(ConnectionInfo connectionInfo)
: this(connectionInfo, "")
{ {
} }
#endregion
#region Methods #region Methods
//public abstract int GetDefaultPort();
public virtual void Focus() public virtual void Focus()
{ {
try try
@@ -119,9 +116,8 @@ namespace mRemoteNG.Connection.Protocol
public virtual bool Connect() public virtual bool Connect()
{ {
if (InterfaceControl.Info.Protocol == ProtocolType.RDP) return false; if (Info.Protocol == ProtocolType.RDP) return false;
if (ConnectedEvent == null) return false; RaiseConnectionConnectedEvent(this);
ConnectedEvent(this);
return true; return true;
} }
@@ -140,7 +136,7 @@ namespace mRemoteNG.Connection.Protocol
private void CloseBG() private void CloseBG()
{ {
ClosedEvent?.Invoke(this); RaiseConnectionClosedEvent(this);
try try
{ {
tmrReconnect.Enabled = false; tmrReconnect.Enabled = false;
@@ -225,83 +221,46 @@ namespace mRemoteNG.Connection.Protocol
#endregion #endregion
#region Events #region Events
public delegate void ConnectingEventHandler(object sender); public event EventHandler Connecting;
public event ConnectingEventHandler Connecting public event EventHandler Connected;
{ public event EventHandler Closing;
add { ConnectingEvent = (ConnectingEventHandler) Delegate.Combine(ConnectingEvent, value); } public event EventHandler Closed;
remove { ConnectingEvent = (ConnectingEventHandler) Delegate.Remove(ConnectingEvent, value); }
} public delegate void DisconnectedEventHandler(object sender, string disconnectedMessage);
public event DisconnectedEventHandler Disconnected;
public delegate void ErrorOccuredEventHandler(object sender, string errorMessage);
public event ErrorOccuredEventHandler ErrorOccured;
public delegate void ConnectedEventHandler(object sender); protected void RaiseConnectionClosingEvent(object sender)
public event ConnectedEventHandler Connected
{ {
add { ConnectedEvent = (ConnectedEventHandler) Delegate.Combine(ConnectedEvent, value); } Closing?.Invoke(sender, EventArgs.Empty);
remove { ConnectedEvent = (ConnectedEventHandler) Delegate.Remove(ConnectedEvent, value); }
}
public delegate void DisconnectedEventHandler(object sender, string DisconnectedMessage);
public event DisconnectedEventHandler Disconnected
{
add { DisconnectedEvent = (DisconnectedEventHandler) Delegate.Combine(DisconnectedEvent, value); }
remove { DisconnectedEvent = (DisconnectedEventHandler) Delegate.Remove(DisconnectedEvent, value); }
}
public delegate void ErrorOccuredEventHandler(object sender, string ErrorMessage);
public event ErrorOccuredEventHandler ErrorOccured
{
add { ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Combine(ErrorOccuredEvent, value); }
remove { ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Remove(ErrorOccuredEvent, value); }
}
public delegate void ClosingEventHandler(object sender);
public event ClosingEventHandler Closing
{
add { ClosingEvent = (ClosingEventHandler) Delegate.Combine(ClosingEvent, value); }
remove { ClosingEvent = (ClosingEventHandler) Delegate.Remove(ClosingEvent, value); }
}
public delegate void ClosedEventHandler(object sender);
public event ClosedEventHandler Closed
{
add { ClosedEvent = (ClosedEventHandler) Delegate.Combine(ClosedEvent, value); }
remove { ClosedEvent = (ClosedEventHandler) Delegate.Remove(ClosedEvent, value); }
}
public void Event_Closing(object sender)
{
ClosingEvent?.Invoke(sender);
} }
protected void Event_Closed(object sender) protected void RaiseConnectionClosedEvent(object sender)
{ {
ClosedEvent?.Invoke(sender); Closed?.Invoke(sender, EventArgs.Empty);
} }
protected void Event_Connecting(object sender) protected void RaiseConnectionConnectingEvent(object sender)
{ {
ConnectingEvent?.Invoke(sender); Connecting?.Invoke(sender, EventArgs.Empty);
} }
protected void Event_Connected(object sender) protected void RaiseConnectionConnectedEvent(object sender)
{ {
ConnectedEvent?.Invoke(sender); Connected?.Invoke(sender, EventArgs.Empty);
} }
protected void Event_Disconnected(object sender, string DisconnectedMessage) protected void RaiseConnectionDisconnectedEvent(object sender, string disconnectedMessage)
{ {
DisconnectedEvent?.Invoke(sender, DisconnectedMessage); Disconnected?.Invoke(sender, disconnectedMessage);
} }
protected void Event_ErrorOccured(object sender, string ErrorMsg) protected void RaiseErrorOccuredEvent(object sender, string errorMsg)
{ {
ErrorOccuredEvent?.Invoke(sender, ErrorMsg); ErrorOccured?.Invoke(sender, errorMsg);
} }
protected void Event_ReconnectGroupCloseClicked()
{
Close();
}
#endregion #endregion
} }
} }

View File

@@ -1,4 +1,5 @@
using mRemoteNG.Connection.Protocol.Http; using System;
using mRemoteNG.Connection.Protocol.Http;
using mRemoteNG.Connection.Protocol.ICA; using mRemoteNG.Connection.Protocol.ICA;
using mRemoteNG.Connection.Protocol.RAW; using mRemoteNG.Connection.Protocol.RAW;
using mRemoteNG.Connection.Protocol.RDP; using mRemoteNG.Connection.Protocol.RDP;
@@ -6,11 +7,10 @@ using mRemoteNG.Connection.Protocol.Rlogin;
using mRemoteNG.Connection.Protocol.SSH; using mRemoteNG.Connection.Protocol.SSH;
using mRemoteNG.Connection.Protocol.Telnet; using mRemoteNG.Connection.Protocol.Telnet;
using mRemoteNG.Connection.Protocol.VNC; using mRemoteNG.Connection.Protocol.VNC;
using System;
namespace mRemoteNG.Connection.Protocol namespace mRemoteNG.Connection.Protocol
{ {
public class ProtocolFactory public class ProtocolFactory
{ {
public ProtocolBase CreateProtocol(ConnectionInfo connectionInfo) public ProtocolBase CreateProtocol(ConnectionInfo connectionInfo)
{ {
@@ -19,42 +19,38 @@ namespace mRemoteNG.Connection.Protocol
switch (connectionInfo.Protocol) switch (connectionInfo.Protocol)
{ {
case ProtocolType.RDP: case ProtocolType.RDP:
newProtocol = new RdpProtocol newProtocol = new RdpProtocolFactory().CreateProtocol(connectionInfo);
{
LoadBalanceInfoUseUtf8 = Settings.Default.RdpLoadBalanceInfoUseUtf8
};
((RdpProtocol) newProtocol).tmrReconnect.Elapsed += ((RdpProtocol) newProtocol).tmrReconnect_Elapsed;
break; break;
case ProtocolType.VNC: case ProtocolType.VNC:
newProtocol = new ProtocolVNC(); newProtocol = new ProtocolVNC(connectionInfo);
break; break;
case ProtocolType.SSH1: case ProtocolType.SSH1:
newProtocol = new ProtocolSSH1(); newProtocol = new ProtocolSSH1(connectionInfo);
break; break;
case ProtocolType.SSH2: case ProtocolType.SSH2:
newProtocol = new ProtocolSSH2(); newProtocol = new ProtocolSSH2(connectionInfo);
break; break;
case ProtocolType.Telnet: case ProtocolType.Telnet:
newProtocol = new ProtocolTelnet(); newProtocol = new ProtocolTelnet(connectionInfo);
break; break;
case ProtocolType.Rlogin: case ProtocolType.Rlogin:
newProtocol = new ProtocolRlogin(); newProtocol = new ProtocolRlogin(connectionInfo);
break; break;
case ProtocolType.RAW: case ProtocolType.RAW:
newProtocol = new RawProtocol(); newProtocol = new RawProtocol(connectionInfo);
break; break;
case ProtocolType.HTTP: case ProtocolType.HTTP:
newProtocol = new ProtocolHTTP(connectionInfo.RenderingEngine); newProtocol = new ProtocolHTTP(connectionInfo, connectionInfo.RenderingEngine);
break; break;
case ProtocolType.HTTPS: case ProtocolType.HTTPS:
newProtocol = new ProtocolHTTPS(connectionInfo.RenderingEngine); newProtocol = new ProtocolHTTPS(connectionInfo, connectionInfo.RenderingEngine);
break; break;
case ProtocolType.ICA: case ProtocolType.ICA:
newProtocol = new IcaProtocol(); newProtocol = new IcaProtocol(connectionInfo);
((IcaProtocol) newProtocol).tmrReconnect.Elapsed += ((IcaProtocol) newProtocol).tmrReconnect_Elapsed; ((IcaProtocol) newProtocol).tmrReconnect.Elapsed += ((IcaProtocol) newProtocol).tmrReconnect_Elapsed;
break; break;
case ProtocolType.IntApp: case ProtocolType.IntApp:
newProtocol = new IntegratedProgram(); newProtocol = new IntegratedProgram(connectionInfo);
if (connectionInfo.ExtApp == "") if (connectionInfo.ExtApp == "")
{ {
throw (new Exception(Language.strNoExtAppDefined)); throw (new Exception(Language.strNoExtAppDefined));

View File

@@ -36,10 +36,15 @@ namespace mRemoteNG.Connection.Protocol
#endregion #endregion
public PuttyBase(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
}
#region Private Events & Handlers #region Private Events & Handlers
private void ProcessExited(object sender, EventArgs e) private void ProcessExited(object sender, EventArgs e)
{ {
Event_Closed(this); RaiseConnectionClosedEvent(this);
} }
#endregion #endregion
@@ -61,9 +66,9 @@ namespace mRemoteNG.Connection.Protocol
var arguments = new CommandLineArguments {EscapeForShell = false}; var arguments = new CommandLineArguments {EscapeForShell = false};
arguments.Add("-load", InterfaceControl.Info.PuttySession); arguments.Add("-load", Info.PuttySession);
if (!(InterfaceControl.Info is PuttySessionInfo)) if (!(Info is PuttySessionInfo))
{ {
arguments.Add("-" + PuttyProtocol); arguments.Add("-" + PuttyProtocol);
@@ -72,9 +77,9 @@ namespace mRemoteNG.Connection.Protocol
var username = ""; var username = "";
var password = ""; var password = "";
if (!string.IsNullOrEmpty(InterfaceControl.Info?.Username)) if (!string.IsNullOrEmpty(Info?.Username))
{ {
username = InterfaceControl.Info.Username; username = Info.Username;
} }
else else
{ {
@@ -90,9 +95,9 @@ namespace mRemoteNG.Connection.Protocol
} }
} }
if (!string.IsNullOrEmpty(InterfaceControl.Info?.Password)) if (!string.IsNullOrEmpty(Info?.Password))
{ {
password = InterfaceControl.Info.Password; password = Info.Password;
} }
else else
{ {
@@ -118,8 +123,8 @@ namespace mRemoteNG.Connection.Protocol
} }
} }
arguments.Add("-P", InterfaceControl.Info.Port.ToString()); arguments.Add("-P", Info.Port.ToString());
arguments.Add(InterfaceControl.Info.Hostname); arguments.Add(Info.Hostname);
} }
if (_isPuttyNg) if (_isPuttyNg)

View File

@@ -2,8 +2,9 @@ namespace mRemoteNG.Connection.Protocol.RAW
{ {
public class RawProtocol : PuttyBase public class RawProtocol : PuttyBase
{ {
public RawProtocol() public RawProtocol(ConnectionInfo connectionInfo)
{ : base(connectionInfo)
{
PuttyProtocol = Putty_Protocol.raw; PuttyProtocol = Putty_Protocol.raw;
} }

View File

@@ -0,0 +1,14 @@
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol.RDP
{
public enum RDGatewayUsageMethod
{
[LocalizedAttributes.LocalizedDescription("strNever")]
Never = 0, // TSC_PROXY_MODE_NONE_DIRECT
[LocalizedAttributes.LocalizedDescription("strAlways")]
Always = 1, // TSC_PROXY_MODE_DIRECT
[LocalizedAttributes.LocalizedDescription("strDetect")]
Detect = 2 // TSC_PROXY_MODE_DETECT
}
}

View File

@@ -0,0 +1,14 @@
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol.RDP
{
public enum RDGatewayUseConnectionCredentials
{
[LocalizedAttributes.LocalizedDescription("strUseDifferentUsernameAndPassword")]
No = 0,
[LocalizedAttributes.LocalizedDescription("strUseSameUsernameAndPassword")]
Yes = 1,
[LocalizedAttributes.LocalizedDescription("strUseSmartCard")]
SmartCard = 2
}
}

View File

@@ -0,0 +1,16 @@
using System.ComponentModel;
namespace mRemoteNG.Connection.Protocol.RDP
{
public enum RdpPerformanceFlags
{
[Description("strRDPDisableWallpaper")]DisableWallpaper = 0x1,
// [Description("strRDPDisableFullWindowdrag")]DisableFullWindowDrag = 0x2,
// [Description("strRDPDisableMenuAnimations")]DisableMenuAnimations = 0x4,
[Description("strRDPDisableThemes")]DisableThemes = 0x8,
// [Description("strRDPDisableCursorShadow")]DisableCursorShadow = 0x20,
// [Description("strRDPDisableCursorblinking")]DisableCursorBlinking = 0x40,
[Description("strRDPEnableFontSmoothing")]EnableFontSmoothing = 0x80,
[Description("strRDPEnableDesktopComposition")]EnableDesktopComposition = 0x100
}
}

View File

@@ -0,0 +1,68 @@
using System;
using System.ComponentModel;
using System.Drawing;
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol.RDP
{
public enum RdpResolutions
{
[LocalizedAttributes.LocalizedDescription("strRDPFitToPanel")]
FitToWindow,
[LocalizedAttributes.LocalizedDescription("strFullscreen")]
Fullscreen,
[LocalizedAttributes.LocalizedDescription("strRDPSmartSize")]
SmartSize,
[Description("800x600")]
Res800x600,
[Description("1024x768")]
Res1024x768,
[Description("1152x864")]
Res1152x864,
[Description("1280x800")]
Res1280x800,
[Description("1280x1024")]
Res1280x1024,
[Description("1366x768")]
Res1366x768,
[Description("1440x900")]
Res1440x900,
[Description("1600x900")]
Res1600x900,
[Description("1600x1200")]
Res1600x1200,
[Description("1680x1050")]
Res1680x1050,
[Description("1920x1080")]
Res1920x1080,
[Description("1920x1200")]
Res1920x1200,
[Description("2048x1536")]
Res2048x1536,
[Description("2560x1440")]
Res2560x1440,
[Description("2560x1600")]
Res2560x1600,
[Description("2560x2048")]
Res2560x2048,
[Description("3840x2160")]
Res3840x2160
}
public static class RdpResolutionExtensions
{
public static Rectangle GetResolutionRectangle(this RdpResolutions resolution)
{
string[] resolutionParts = null;
if (resolution != RdpResolutions.FitToWindow & resolution != RdpResolutions.Fullscreen & resolution != RdpResolutions.SmartSize)
{
resolutionParts = resolution.ToString().Replace("Res", "").Split('x');
}
if (resolutionParts == null || resolutionParts.Length != 2)
{
return new Rectangle(0, 0, 0, 0);
}
return new Rectangle(0, 0, Convert.ToInt32(resolutionParts[0]), Convert.ToInt32(resolutionParts[1]));
}
}
}

View File

@@ -0,0 +1,14 @@
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol.RDP
{
public enum RdpSoundQuality
{
[LocalizedAttributes.LocalizedDescription("strRDPSoundQualityDynamic")]
Dynamic = 0,
[LocalizedAttributes.LocalizedDescription("strRDPSoundQualityMedium")]
Medium = 1,
[LocalizedAttributes.LocalizedDescription("strRDPSoundQualityHigh")]
High = 2
}
}

View File

@@ -0,0 +1,14 @@
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol.RDP
{
public enum RdpSounds
{
[LocalizedAttributes.LocalizedDescription("strRDPSoundBringToThisComputer")]
BringToThisComputer = 0,
[LocalizedAttributes.LocalizedDescription("strRDPSoundLeaveAtRemoteComputer")]
LeaveAtRemoteComputer = 1,
[LocalizedAttributes.LocalizedDescription("strRDPSoundDoNotPlay")]
DoNotPlay = 2
}
}

View File

@@ -0,0 +1,14 @@
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol.RDP
{
public enum RdpAuthenticationLevel
{
[LocalizedAttributes.LocalizedDescription("strAlwaysConnectEvenIfAuthFails")]
NoAuth = 0,
[LocalizedAttributes.LocalizedDescription("strDontConnectWhenAuthFails")]
AuthRequired = 1,
[LocalizedAttributes.LocalizedDescription("strWarnIfAuthFails")]
WarnOnFailedAuth = 2
}
}

View File

@@ -0,0 +1,18 @@
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol.RDP
{
public enum RdpColors
{
[LocalizedAttributes.LocalizedDescription("strRDP256Colors")]
Colors256 = 8,
[LocalizedAttributes.LocalizedDescription("strRDP32768Colors")]
Colors15Bit = 15,
[LocalizedAttributes.LocalizedDescription("strRDP65536Colors")]
Colors16Bit = 16,
[LocalizedAttributes.LocalizedDescription("strRDP16777216Colors")]
Colors24Bit = 24,
[LocalizedAttributes.LocalizedDescription("strRDP4294967296Colors")]
Colors32Bit = 32
}
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
namespace mRemoteNG.Connection.Protocol.RDP
{
public static class RdpVersion
{
public static readonly Version RDC60 = new Version(6, 0, 6000);
public static readonly Version RDC61 = new Version(6, 0, 6001);
public static readonly Version RDC70 = new Version(6, 1, 7600);
public static readonly Version RDC80 = new Version(6, 2, 9200);
public static readonly Version RDC81 = new Version(6, 3, 9600);
}
/// <summary>
/// Represents a version of the RDP Client
/// </summary>
public enum RdpVersionEnum
{
Rdc6,
Rdc7,
Rdc8,
Rdc9,
Rdc10
}
public static class RdpVersionEnumExtensions
{
public static IEnumerable<RdpVersionEnum> GetAll(this RdpVersionEnum versionEnum)
{
return new[]
{
RdpVersionEnum.Rdc6,
RdpVersionEnum.Rdc7,
RdpVersionEnum.Rdc8,
RdpVersionEnum.Rdc9,
RdpVersionEnum.Rdc10
};
}
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections;
using mRemoteNG.App;
namespace mRemoteNG.Connection.Protocol.RDP
{
public static class RdpErrorTranslator
{
private static Hashtable _description;
private static void InitDescription()
{
_description = new Hashtable
{
{0, Language.strRdpErrorUnknown},
{1, Language.strRdpErrorCode1},
{2, Language.strRdpErrorOutOfMemory},
{3, Language.strRdpErrorWindowCreation},
{4, Language.strRdpErrorCode2},
{5, Language.strRdpErrorCode3},
{6, Language.strRdpErrorCode4},
{7, Language.strRdpErrorConnection},
{100, Language.strRdpErrorWinsock}
};
}
/// <summary>
/// Translates the provided RDP error ID to
/// a user-friendly error message.
/// </summary>
/// <param name="id"></param>
public static string Translate(int id)
{
try
{
if (_description == null)
InitDescription();
return (string)_description?[id];
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpErrorGetFailure, ex);
return string.Format(Language.strRdpErrorUnknown, id);
}
}
}
}

View File

@@ -1,933 +0,0 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using AxMSTSCLib;
using mRemoteNG.App;
using mRemoteNG.Messages;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using MSTSCLib;
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpProtocol : ProtocolBase
{
/* RDP v8 requires Windows 7 with:
* https://support.microsoft.com/en-us/kb/2592687
* OR
* https://support.microsoft.com/en-us/kb/2923545
*
* Windows 8+ support RDP v8 out of the box.
*/
private MsRdpClient8NotSafeForScripting _rdpClient;
private Version _rdpVersion;
private ConnectionInfo _connectionInfo;
private bool _loginComplete;
private bool _redirectKeys;
private bool _alertOnIdleDisconnect;
private readonly FrmMain _frmMain = FrmMain.Default;
#region Properties
public bool SmartSize
{
get
{
return _rdpClient.AdvancedSettings2.SmartSizing;
}
private set
{
_rdpClient.AdvancedSettings2.SmartSizing = value;
ReconnectForResize();
}
}
public bool Fullscreen
{
get
{
return _rdpClient.FullScreen;
}
private set
{
_rdpClient.FullScreen = value;
ReconnectForResize();
}
}
private bool RedirectKeys
{
/*
get
{
return _redirectKeys;
}
*/
set
{
_redirectKeys = value;
try
{
if (!_redirectKeys)
{
return;
}
Debug.Assert(Convert.ToBoolean(_rdpClient.SecuredSettingsEnabled));
var msRdpClientSecuredSettings = _rdpClient.SecuredSettings2;
msRdpClientSecuredSettings.KeyboardHookMode = 1; // Apply key combinations at the remote server.
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetRedirectKeysFailed, ex);
}
}
}
public bool LoadBalanceInfoUseUtf8 { get; set; }
#endregion
#region Constructors
public RdpProtocol()
{
Control = new AxMsRdpClient8NotSafeForScripting();
}
#endregion
#region Public Methods
public override bool Initialize()
{
base.Initialize();
try
{
Control.CreateControl();
_connectionInfo = InterfaceControl.Info;
try
{
while (!Control.Created)
{
Thread.Sleep(0);
Application.DoEvents();
}
_rdpClient = (MsRdpClient8NotSafeForScripting)((AxMsRdpClient8NotSafeForScripting)Control).GetOcx();
}
catch (System.Runtime.InteropServices.COMException ex)
{
Runtime.MessageCollector.AddExceptionMessage(Language.strRdpControlCreationFailed, ex);
Control.Dispose();
return false;
}
_rdpVersion = new Version(_rdpClient.Version);
_rdpClient.Server = _connectionInfo.Hostname;
SetCredentials();
SetResolution();
_rdpClient.FullScreenTitle = _connectionInfo.Name;
_alertOnIdleDisconnect = _connectionInfo.RDPAlertIdleTimeout;
_rdpClient.AdvancedSettings2.MinutesToIdleTimeout = _connectionInfo.RDPMinutesToIdleTimeout;
//not user changeable
_rdpClient.AdvancedSettings2.GrabFocusOnConnect = true;
_rdpClient.AdvancedSettings3.EnableAutoReconnect = true;
_rdpClient.AdvancedSettings3.MaxReconnectAttempts = Settings.Default.RdpReconnectionCount;
_rdpClient.AdvancedSettings2.keepAliveInterval = 60000; //in milliseconds (10,000 = 10 seconds)
_rdpClient.AdvancedSettings5.AuthenticationLevel = 0;
_rdpClient.AdvancedSettings2.EncryptionEnabled = 1;
_rdpClient.AdvancedSettings2.overallConnectionTimeout = Settings.Default.ConRDPOverallConnectionTimeout;
_rdpClient.AdvancedSettings2.BitmapPeristence = Convert.ToInt32(_connectionInfo.CacheBitmaps);
if (_rdpVersion >= Versions.RDC61)
{
_rdpClient.AdvancedSettings7.EnableCredSspSupport = _connectionInfo.UseCredSsp;
_rdpClient.AdvancedSettings8.AudioQualityMode = (uint)_connectionInfo.SoundQuality;
}
SetUseConsoleSession();
SetPort();
RedirectKeys = _connectionInfo.RedirectKeys;
SetRedirection();
SetAuthenticationLevel();
SetLoadBalanceInfo();
SetRdGateway();
_rdpClient.ColorDepth = (int)_connectionInfo.Colors;
SetPerformanceFlags();
_rdpClient.ConnectingText = Language.strConnecting;
Control.Anchor = AnchorStyles.None;
return true;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPropsFailed, ex);
return false;
}
}
public override bool Connect()
{
_loginComplete = false;
SetEventHandlers();
try
{
_rdpClient.Connect();
base.Connect();
return true;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strConnectionOpenFailed, ex);
}
return false;
}
public override void Disconnect()
{
try
{
_rdpClient.Disconnect();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpDisconnectFailed, ex);
Close();
}
}
public void ToggleFullscreen()
{
try
{
Fullscreen = !Fullscreen;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpToggleFullscreenFailed, ex);
}
}
public void ToggleSmartSize()
{
try
{
SmartSize = !SmartSize;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpToggleSmartSizeFailed, ex);
}
}
public override void Focus()
{
try
{
if (Control.ContainsFocus == false)
{
Control.Focus();
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpFocusFailed, ex);
}
}
private Size _controlBeginningSize;
public override void ResizeBegin(object sender, EventArgs e)
{
_controlBeginningSize = Control.Size;
}
public override void Resize(object sender, EventArgs e)
{
if (DoResize() && _controlBeginningSize.IsEmpty)
{
ReconnectForResize();
}
base.Resize(sender, e);
}
public override void ResizeEnd(object sender, EventArgs e)
{
DoResize();
if (!(Control.Size == _controlBeginningSize))
{
ReconnectForResize();
}
_controlBeginningSize = Size.Empty;
}
#endregion
#region Private Methods
private bool DoResize()
{
Control.Location = InterfaceControl.Location;
if (!(Control.Size == InterfaceControl.Size) && !(InterfaceControl.Size == Size.Empty)) // kmscode - this doesn't look right to me. But I'm not aware of any functionality issues with this currently...
{
Control.Size = InterfaceControl.Size;
return true;
}
else
{
return false;
}
}
private void ReconnectForResize()
{
if (_rdpVersion < Versions.RDC80)
{
return;
}
if (!_loginComplete)
{
return;
}
if (!InterfaceControl.Info.AutomaticResize)
{
return;
}
if (!(InterfaceControl.Info.Resolution == RDPResolutions.FitToWindow | InterfaceControl.Info.Resolution == RDPResolutions.Fullscreen))
{
return;
}
if (SmartSize)
{
return;
}
var size = !Fullscreen ? Control.Size : Screen.FromControl(Control).Bounds.Size;
IMsRdpClient8 msRdpClient8 = _rdpClient;
msRdpClient8.Reconnect((uint)size.Width, (uint)size.Height);
}
private void SetRdGateway()
{
try
{
if (_rdpClient.TransportSettings.GatewayIsSupported == 0)
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strRdpGatewayNotSupported, true);
return;
}
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strRdpGatewayIsSupported, true);
if (_connectionInfo.RDGatewayUsageMethod != RDGatewayUsageMethod.Never)
{
_rdpClient.TransportSettings.GatewayUsageMethod = (uint)_connectionInfo.RDGatewayUsageMethod;
_rdpClient.TransportSettings.GatewayHostname = _connectionInfo.RDGatewayHostname;
_rdpClient.TransportSettings.GatewayProfileUsageMethod = 1; // TSC_PROXY_PROFILE_MODE_EXPLICIT
if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard)
{
_rdpClient.TransportSettings.GatewayCredsSource = 1; // TSC_PROXY_CREDS_MODE_SMARTCARD
}
if (_rdpVersion >= Versions.RDC61 && (Force & ConnectionInfo.Force.NoCredentials) != ConnectionInfo.Force.NoCredentials)
{
if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes)
{
_rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.Username;
_rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.Password;
_rdpClient.TransportSettings2.GatewayDomain = _connectionInfo?.Domain;
}
else if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard)
{
_rdpClient.TransportSettings2.GatewayCredSharing = 0;
}
else
{
_rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.RDGatewayUsername;
_rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.RDGatewayPassword;
_rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.RDGatewayDomain;
_rdpClient.TransportSettings2.GatewayCredSharing = 0;
}
}
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetGatewayFailed, ex);
}
}
private void SetUseConsoleSession()
{
try
{
bool value;
if ((Force & ConnectionInfo.Force.UseConsoleSession) == ConnectionInfo.Force.UseConsoleSession)
{
value = true;
}
else if ((Force & ConnectionInfo.Force.DontUseConsoleSession) == ConnectionInfo.Force.DontUseConsoleSession)
{
value = false;
}
else
{
value = _connectionInfo.UseConsoleSession;
}
if (_rdpVersion >= Versions.RDC61)
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strRdpSetConsoleSwitch, _rdpVersion), true);
_rdpClient.AdvancedSettings7.ConnectToAdministerServer = value;
}
else
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strRdpSetConsoleSwitch, _rdpVersion) + Environment.NewLine + "No longer supported in this RDP version. Reference: https://msdn.microsoft.com/en-us/library/aa380863(v=vs.85).aspx", true);
// ConnectToServerConsole is deprecated
//https://msdn.microsoft.com/en-us/library/aa380863(v=vs.85).aspx
//_rdpClient.AdvancedSettings2.ConnectToServerConsole = value;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetConsoleSessionFailed, ex);
}
}
private void SetCredentials()
{
try
{
if ((Force & ConnectionInfo.Force.NoCredentials) == ConnectionInfo.Force.NoCredentials)
{
return;
}
var userName = _connectionInfo?.Username ?? "";
var password = _connectionInfo?.Password ?? "";
var domain = _connectionInfo?.Domain ?? "";
if (string.IsNullOrEmpty(userName))
{
if (Settings.Default.EmptyCredentials == "windows")
{
_rdpClient.UserName = Environment.UserName;
}
else if (Settings.Default.EmptyCredentials == "custom")
{
_rdpClient.UserName = Settings.Default.DefaultUsername;
}
}
else
{
_rdpClient.UserName = userName;
}
if (string.IsNullOrEmpty(password))
{
if (Settings.Default.EmptyCredentials == "custom")
{
if (Settings.Default.DefaultPassword != "")
{
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
_rdpClient.AdvancedSettings2.ClearTextPassword = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey);
}
}
}
else
{
_rdpClient.AdvancedSettings2.ClearTextPassword = password;
}
if (string.IsNullOrEmpty(domain))
{
if (Settings.Default.EmptyCredentials == "windows")
{
_rdpClient.Domain = Environment.UserDomainName;
}
else if (Settings.Default.EmptyCredentials == "custom")
{
_rdpClient.Domain = Settings.Default.DefaultDomain;
}
}
else
{
_rdpClient.Domain = domain;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetCredentialsFailed, ex);
}
}
private void SetResolution()
{
try
{
if ((Force & ConnectionInfo.Force.Fullscreen) == ConnectionInfo.Force.Fullscreen)
{
_rdpClient.FullScreen = true;
_rdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width;
_rdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height;
return;
}
if ((InterfaceControl.Info.Resolution == RDPResolutions.FitToWindow) || (InterfaceControl.Info.Resolution == RDPResolutions.SmartSize))
{
_rdpClient.DesktopWidth = InterfaceControl.Size.Width;
_rdpClient.DesktopHeight = InterfaceControl.Size.Height;
if (InterfaceControl.Info.Resolution == RDPResolutions.SmartSize)
{
_rdpClient.AdvancedSettings2.SmartSizing = true;
}
}
else if (InterfaceControl.Info.Resolution == RDPResolutions.Fullscreen)
{
_rdpClient.FullScreen = true;
_rdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width;
_rdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height;
}
else
{
var resolution = GetResolutionRectangle(_connectionInfo.Resolution);
_rdpClient.DesktopWidth = resolution.Width;
_rdpClient.DesktopHeight = resolution.Height;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetResolutionFailed, ex);
}
}
private void SetPort()
{
try
{
if (_connectionInfo.Port != (int)Defaults.Port)
{
_rdpClient.AdvancedSettings2.RDPPort = _connectionInfo.Port;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPortFailed, ex);
}
}
private void SetRedirection()
{
try
{
_rdpClient.AdvancedSettings2.RedirectDrives = _connectionInfo.RedirectDiskDrives;
_rdpClient.AdvancedSettings2.RedirectPorts = _connectionInfo.RedirectPorts;
_rdpClient.AdvancedSettings2.RedirectPrinters = _connectionInfo.RedirectPrinters;
_rdpClient.AdvancedSettings2.RedirectSmartCards = _connectionInfo.RedirectSmartCards;
_rdpClient.SecuredSettings2.AudioRedirectionMode = (int)_connectionInfo.RedirectSound;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetRedirectionFailed, ex);
}
}
private void SetPerformanceFlags()
{
try
{
var pFlags = 0;
if (_connectionInfo.DisplayThemes == false)
{
pFlags += Convert.ToInt32(RDPPerformanceFlags.DisableThemes);
}
if (_connectionInfo.DisplayWallpaper == false)
{
pFlags += Convert.ToInt32(RDPPerformanceFlags.DisableWallpaper);
}
if (_connectionInfo.EnableFontSmoothing)
{
pFlags += Convert.ToInt32(RDPPerformanceFlags.EnableFontSmoothing);
}
if (_connectionInfo.EnableDesktopComposition)
{
pFlags += Convert.ToInt32(RDPPerformanceFlags.EnableDesktopComposition);
}
_rdpClient.AdvancedSettings2.PerformanceFlags = pFlags;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPerformanceFlagsFailed, ex);
}
}
private void SetAuthenticationLevel()
{
try
{
_rdpClient.AdvancedSettings5.AuthenticationLevel = (uint)_connectionInfo.RDPAuthenticationLevel;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetAuthenticationLevelFailed, ex);
}
}
private void SetLoadBalanceInfo()
{
if (string.IsNullOrEmpty(_connectionInfo.LoadBalanceInfo))
{
return;
}
try
{
_rdpClient.AdvancedSettings2.LoadBalanceInfo = LoadBalanceInfoUseUtf8
? new AzureLoadBalanceInfoEncoder().Encode(_connectionInfo.LoadBalanceInfo)
: _connectionInfo.LoadBalanceInfo;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace("Unable to set load balance info.", ex);
}
}
private void SetEventHandlers()
{
try
{
_rdpClient.OnConnecting += RDPEvent_OnConnecting;
_rdpClient.OnConnected += RDPEvent_OnConnected;
_rdpClient.OnLoginComplete += RDPEvent_OnLoginComplete;
_rdpClient.OnFatalError += RDPEvent_OnFatalError;
_rdpClient.OnDisconnected += RDPEvent_OnDisconnected;
_rdpClient.OnLeaveFullScreenMode += RDPEvent_OnLeaveFullscreenMode;
_rdpClient.OnIdleTimeoutNotification += RDPEvent_OnIdleTimeoutNotification;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetEventHandlersFailed, ex);
}
}
#endregion
#region Private Events & Handlers
private void RDPEvent_OnIdleTimeoutNotification()
{
Close(); //Simply close the RDP Session if the idle timeout has been triggered.
if (_alertOnIdleDisconnect)
{
string message = "The " + _connectionInfo.Name + " session was disconnected due to inactivity";
const string caption = "Session Disconnected";
MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void RDPEvent_OnFatalError(int errorCode)
{
Event_ErrorOccured(this, Convert.ToString(errorCode));
}
private void RDPEvent_OnDisconnected(int discReason)
{
const int UI_ERR_NORMAL_DISCONNECT = 0xB08;
if (discReason != UI_ERR_NORMAL_DISCONNECT)
{
var reason = _rdpClient.GetErrorDescription((uint)discReason, (uint) _rdpClient.ExtendedDisconnectReason);
Event_Disconnected(this, discReason + "\r\n" + reason);
}
if (Settings.Default.ReconnectOnDisconnect)
{
ReconnectGroup = new ReconnectGroup();
ReconnectGroup.CloseClicked += Event_ReconnectGroupCloseClicked;
ReconnectGroup.Left = (int) ((double) Control.Width / 2 - (double) ReconnectGroup.Width / 2);
ReconnectGroup.Top = (int) ((double) Control.Height / 2 - (double) ReconnectGroup.Height / 2);
ReconnectGroup.Parent = Control;
ReconnectGroup.Show();
tmrReconnect.Enabled = true;
}
else
{
Close();
}
}
private void RDPEvent_OnConnecting()
{
Event_Connecting(this);
}
private void RDPEvent_OnConnected()
{
Event_Connected(this);
}
private void RDPEvent_OnLoginComplete()
{
_loginComplete = true;
}
private void RDPEvent_OnLeaveFullscreenMode()
{
Fullscreen = false;
_leaveFullscreenEvent?.Invoke(this, new EventArgs());
}
#endregion
#region Public Events & Handlers
public delegate void LeaveFullscreenEventHandler(object sender, EventArgs e);
private LeaveFullscreenEventHandler _leaveFullscreenEvent;
public event LeaveFullscreenEventHandler LeaveFullscreen
{
add
{
_leaveFullscreenEvent = (LeaveFullscreenEventHandler)Delegate.Combine(_leaveFullscreenEvent, value);
}
remove
{
_leaveFullscreenEvent = (LeaveFullscreenEventHandler)Delegate.Remove(_leaveFullscreenEvent, value);
}
}
#endregion
#region Enums
public enum Defaults
{
Colors = RDPColors.Colors16Bit,
Sounds = RDPSounds.DoNotPlay,
Resolution = RDPResolutions.FitToWindow,
Port = 3389
}
public enum RDPColors
{
[LocalizedAttributes.LocalizedDescription("strRDP256Colors")]
Colors256 = 8,
[LocalizedAttributes.LocalizedDescription("strRDP32768Colors")]
Colors15Bit = 15,
[LocalizedAttributes.LocalizedDescription("strRDP65536Colors")]
Colors16Bit = 16,
[LocalizedAttributes.LocalizedDescription("strRDP16777216Colors")]
Colors24Bit = 24,
[LocalizedAttributes.LocalizedDescription("strRDP4294967296Colors")]
Colors32Bit = 32
}
public enum RDPSounds
{
[LocalizedAttributes.LocalizedDescription("strRDPSoundBringToThisComputer")]
BringToThisComputer = 0,
[LocalizedAttributes.LocalizedDescription("strRDPSoundLeaveAtRemoteComputer")]
LeaveAtRemoteComputer = 1,
[LocalizedAttributes.LocalizedDescription("strRDPSoundDoNotPlay")]
DoNotPlay = 2
}
public enum RDPSoundQuality
{
[LocalizedAttributes.LocalizedDescription("strRDPSoundQualityDynamic")]
Dynamic = 0,
[LocalizedAttributes.LocalizedDescription("strRDPSoundQualityMedium")]
Medium = 1,
[LocalizedAttributes.LocalizedDescription("strRDPSoundQualityHigh")]
High = 2
}
private enum RDPPerformanceFlags
{
[Description("strRDPDisableWallpaper")]DisableWallpaper = 0x1,
// [Description("strRDPDisableFullWindowdrag")]DisableFullWindowDrag = 0x2,
// [Description("strRDPDisableMenuAnimations")]DisableMenuAnimations = 0x4,
[Description("strRDPDisableThemes")]DisableThemes = 0x8,
// [Description("strRDPDisableCursorShadow")]DisableCursorShadow = 0x20,
// [Description("strRDPDisableCursorblinking")]DisableCursorBlinking = 0x40,
[Description("strRDPEnableFontSmoothing")]EnableFontSmoothing = 0x80,
[Description("strRDPEnableDesktopComposition")]EnableDesktopComposition = 0x100
}
public enum RDPResolutions
{
[LocalizedAttributes.LocalizedDescription("strRDPFitToPanel")]
FitToWindow,
[LocalizedAttributes.LocalizedDescription("strFullscreen")]
Fullscreen,
[LocalizedAttributes.LocalizedDescription("strRDPSmartSize")]
SmartSize,
[Description("800x600")]
Res800x600,
[Description("1024x768")]
Res1024x768,
[Description("1152x864")]
Res1152x864,
[Description("1280x800")]
Res1280x800,
[Description("1280x1024")]
Res1280x1024,
[Description("1366x768")]
Res1366x768,
[Description("1440x900")]
Res1440x900,
[Description("1600x900")]
Res1600x900,
[Description("1600x1200")]
Res1600x1200,
[Description("1680x1050")]
Res1680x1050,
[Description("1920x1080")]
Res1920x1080,
[Description("1920x1200")]
Res1920x1200,
[Description("2048x1536")]
Res2048x1536,
[Description("2560x1440")]
Res2560x1440,
[Description("2560x1600")]
Res2560x1600,
[Description("2560x2048")]
Res2560x2048,
[Description("3840x2160")]
Res3840x2160
}
public enum AuthenticationLevel
{
[LocalizedAttributes.LocalizedDescription("strAlwaysConnectEvenIfAuthFails")]
NoAuth = 0,
[LocalizedAttributes.LocalizedDescription("strDontConnectWhenAuthFails")]
AuthRequired = 1,
[LocalizedAttributes.LocalizedDescription("strWarnIfAuthFails")]
WarnOnFailedAuth = 2
}
public enum RDGatewayUsageMethod
{
[LocalizedAttributes.LocalizedDescription("strNever")]
Never = 0, // TSC_PROXY_MODE_NONE_DIRECT
[LocalizedAttributes.LocalizedDescription("strAlways")]
Always = 1, // TSC_PROXY_MODE_DIRECT
[LocalizedAttributes.LocalizedDescription("strDetect")]
Detect = 2 // TSC_PROXY_MODE_DETECT
}
public enum RDGatewayUseConnectionCredentials
{
[LocalizedAttributes.LocalizedDescription("strUseDifferentUsernameAndPassword")]
No = 0,
[LocalizedAttributes.LocalizedDescription("strUseSameUsernameAndPassword")]
Yes = 1,
[LocalizedAttributes.LocalizedDescription("strUseSmartCard")]
SmartCard = 2
}
#endregion
#region Resolution
public static Rectangle GetResolutionRectangle(RDPResolutions resolution)
{
string[] resolutionParts = null;
if (resolution != RDPResolutions.FitToWindow & resolution != RDPResolutions.Fullscreen & resolution != RDPResolutions.SmartSize)
{
resolutionParts = resolution.ToString().Replace("Res", "").Split('x');
}
if (resolutionParts == null || resolutionParts.Length != 2)
{
return new Rectangle(0, 0, 0, 0);
}
else
{
return new Rectangle(0, 0, Convert.ToInt32(resolutionParts[0]), Convert.ToInt32(resolutionParts[1]));
}
}
#endregion
public static class Versions
{
public static readonly Version RDC60 = new Version(6, 0, 6000);
public static readonly Version RDC61 = new Version(6, 0, 6001);
public static readonly Version RDC70 = new Version(6, 1, 7600);
public static readonly Version RDC80 = new Version(6, 2, 9200);
public static readonly Version RDC81 = new Version(6, 3, 9600);
}
#region Fatal Errors
public static class FatalErrors
{
private static Hashtable _description;
private static void InitDescription()
{
_description = new Hashtable
{
{"0", "Language.strRdpErrorUnknown"},
{"1", "Language.strRdpErrorCode1"},
{"2", "Language.strRdpErrorOutOfMemory"},
{"3", "Language.strRdpErrorWindowCreation"},
{"4", "Language.strRdpErrorCode2"},
{"5", "Language.strRdpErrorCode3"},
{"6", "Language.strRdpErrorCode4"},
{"7", "Language.strRdpErrorConnection"},
{"100", "Language.strRdpErrorWinsock"}
};
}
public static string GetError(string id)
{
try
{
if (_description == null)
InitDescription();
return (string)_description?[id];
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpErrorGetFailure, ex);
return string.Format(Language.strRdpErrorUnknown, id);
}
}
}
#endregion
#region Reconnect Stuff
public void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
var srvReady = PortScanner.IsPortOpen(_connectionInfo.Hostname, Convert.ToString(_connectionInfo.Port));
ReconnectGroup.ServerReady = srvReady;
if (ReconnectGroup.ReconnectWhenReady && srvReady)
{
tmrReconnect.Enabled = false;
ReconnectGroup.DisposeReconnectGroup();
//SetProps()
_rdpClient.Connect();
}
}
#endregion
}
}

View File

@@ -0,0 +1,20 @@
using AxMSTSCLib;
using MSTSCLib;
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpProtocol10 : RdpProtocol9
{
public RdpProtocol10(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
Control = new AxMsRdpClient10NotSafeForScripting();
RdpVersionEnum = RdpVersionEnum.Rdc10;
}
protected override MsRdpClient6NotSafeForScripting CreateRdpClientControl()
{
return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient10NotSafeForScripting)Control).GetOcx();
}
}
}

View File

@@ -0,0 +1,657 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
using AxMSTSCLib;
using mRemoteNG.App;
using mRemoteNG.Messages;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using MSTSCLib;
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpProtocol6 : ProtocolBase
{
private Version _rdpVersion;
private bool _redirectKeys;
private bool _alertOnIdleDisconnect;
private readonly FrmMain _frmMain = FrmMain.Default;
protected MsRdpClient6NotSafeForScripting RdpClient;
protected bool LoginComplete;
#region Properties
public virtual bool SmartSize
{
get
{
return RdpClient.AdvancedSettings2.SmartSizing;
}
protected set
{
RdpClient.AdvancedSettings2.SmartSizing = value;
}
}
public virtual bool Fullscreen
{
get
{
return RdpClient.FullScreen;
}
protected set
{
RdpClient.FullScreen = value;
}
}
private bool RedirectKeys
{
/*
get
{
return _redirectKeys;
}
*/
set
{
_redirectKeys = value;
try
{
if (!_redirectKeys)
{
return;
}
Debug.Assert(Convert.ToBoolean(RdpClient.SecuredSettingsEnabled));
var msRdpClientSecuredSettings = RdpClient.SecuredSettings2;
msRdpClientSecuredSettings.KeyboardHookMode = 1; // Apply key combinations at the remote server.
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetRedirectKeysFailed, ex);
}
}
}
public bool LoadBalanceInfoUseUtf8 { get; set; }
public RdpVersionEnum RdpVersionEnum { get; protected set; }
#endregion
public RdpProtocol6(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
Control = new AxMsRdpClient6NotSafeForScripting();
Connecting += OnConnectingDebugMessage;
RdpVersionEnum = RdpVersionEnum.Rdc6;
}
#region Public Methods
public override bool Initialize()
{
base.Initialize();
try
{
Control.CreateControl();
try
{
while (!Control.Created)
{
Thread.Sleep(0);
Application.DoEvents();
}
RdpClient = CreateRdpClientControl();
}
catch (System.Runtime.InteropServices.COMException ex)
{
Runtime.MessageCollector.AddExceptionMessage(Language.strRdpControlCreationFailed, ex);
Control.Dispose();
return false;
}
_rdpVersion = new Version(RdpClient.Version);
RdpClient.Server = Info.Hostname;
SetCredentials();
SetResolution();
RdpClient.FullScreenTitle = Info.Name;
_alertOnIdleDisconnect = Info.RDPAlertIdleTimeout;
RdpClient.AdvancedSettings2.MinutesToIdleTimeout = Info.RDPMinutesToIdleTimeout;
//not user changeable
RdpClient.AdvancedSettings2.GrabFocusOnConnect = true;
RdpClient.AdvancedSettings3.EnableAutoReconnect = true;
RdpClient.AdvancedSettings3.MaxReconnectAttempts = Settings.Default.RdpReconnectionCount;
RdpClient.AdvancedSettings2.keepAliveInterval = 60000; //in milliseconds (10,000 = 10 seconds)
RdpClient.AdvancedSettings5.AuthenticationLevel = 0;
RdpClient.AdvancedSettings2.EncryptionEnabled = 1;
RdpClient.AdvancedSettings2.overallConnectionTimeout = Settings.Default.ConRDPOverallConnectionTimeout;
RdpClient.AdvancedSettings2.BitmapPeristence = Convert.ToInt32(Info.CacheBitmaps);
if (_rdpVersion >= RdpVersion.RDC61)
{
RdpClient.AdvancedSettings7.EnableCredSspSupport = Info.UseCredSsp;
}
SetUseConsoleSession();
SetPort();
RedirectKeys = Info.RedirectKeys;
SetRedirection();
SetAuthenticationLevel();
SetLoadBalanceInfo();
SetRdGateway();
RdpClient.ColorDepth = (int)Info.Colors;
SetPerformanceFlags();
RdpClient.ConnectingText = Language.strConnecting;
Control.Anchor = AnchorStyles.None;
tmrReconnect.Elapsed += tmrReconnect_Elapsed;
return true;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPropsFailed, ex);
return false;
}
}
public override bool Connect()
{
LoginComplete = false;
SetEventHandlers();
try
{
RdpClient.Connect();
base.Connect();
return true;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strConnectionOpenFailed, ex);
}
return false;
}
public override void Disconnect()
{
try
{
RdpClient.Disconnect();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpDisconnectFailed, ex);
Close();
}
}
public void ToggleFullscreen()
{
try
{
Fullscreen = !Fullscreen;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpToggleFullscreenFailed, ex);
}
}
public void ToggleSmartSize()
{
try
{
SmartSize = !SmartSize;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpToggleSmartSizeFailed, ex);
}
}
public override void Focus()
{
try
{
if (Control.ContainsFocus == false)
{
Control.Focus();
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpFocusFailed, ex);
}
}
#endregion
#region Private Methods
protected virtual MsRdpClient6NotSafeForScripting CreateRdpClientControl()
{
return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient6NotSafeForScripting)Control).GetOcx();
}
private void SetRdGateway()
{
try
{
if (RdpClient.TransportSettings.GatewayIsSupported == 0)
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strRdpGatewayNotSupported, true);
return;
}
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strRdpGatewayIsSupported, true);
if (Info.RDGatewayUsageMethod != RDGatewayUsageMethod.Never)
{
RdpClient.TransportSettings.GatewayUsageMethod = (uint)Info.RDGatewayUsageMethod;
RdpClient.TransportSettings.GatewayHostname = Info.RDGatewayHostname;
RdpClient.TransportSettings.GatewayProfileUsageMethod = 1; // TSC_PROXY_PROFILE_MODE_EXPLICIT
if (Info.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard)
{
RdpClient.TransportSettings.GatewayCredsSource = 1; // TSC_PROXY_CREDS_MODE_SMARTCARD
}
if (_rdpVersion >= RdpVersion.RDC61 && (Force & ConnectionInfo.Force.NoCredentials) != ConnectionInfo.Force.NoCredentials)
{
if (Info.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes)
{
RdpClient.TransportSettings2.GatewayUsername = Info.Username;
RdpClient.TransportSettings2.GatewayPassword = Info.Password;
RdpClient.TransportSettings2.GatewayDomain = Info?.Domain;
}
else if (Info.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard)
{
RdpClient.TransportSettings2.GatewayCredSharing = 0;
}
else
{
RdpClient.TransportSettings2.GatewayUsername = Info.RDGatewayUsername;
RdpClient.TransportSettings2.GatewayPassword = Info.RDGatewayPassword;
RdpClient.TransportSettings2.GatewayDomain = Info.RDGatewayDomain;
RdpClient.TransportSettings2.GatewayCredSharing = 0;
}
}
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetGatewayFailed, ex);
}
}
private void SetUseConsoleSession()
{
try
{
bool value;
if ((Force & ConnectionInfo.Force.UseConsoleSession) == ConnectionInfo.Force.UseConsoleSession)
{
value = true;
}
else if ((Force & ConnectionInfo.Force.DontUseConsoleSession) == ConnectionInfo.Force.DontUseConsoleSession)
{
value = false;
}
else
{
value = Info.UseConsoleSession;
}
if (_rdpVersion >= RdpVersion.RDC61)
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strRdpSetConsoleSwitch, _rdpVersion), true);
RdpClient.AdvancedSettings7.ConnectToAdministerServer = value;
}
else
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strRdpSetConsoleSwitch, _rdpVersion) + Environment.NewLine + "No longer supported in this RDP version. Reference: https://msdn.microsoft.com/en-us/library/aa380863(v=vs.85).aspx", true);
// ConnectToServerConsole is deprecated
//https://msdn.microsoft.com/en-us/library/aa380863(v=vs.85).aspx
//_rdpClient.AdvancedSettings2.ConnectToServerConsole = value;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetConsoleSessionFailed, ex);
}
}
private void SetCredentials()
{
try
{
if ((Force & ConnectionInfo.Force.NoCredentials) == ConnectionInfo.Force.NoCredentials)
{
return;
}
var userName = Info?.Username ?? "";
var password = Info?.Password ?? "";
var domain = Info?.Domain ?? "";
if (string.IsNullOrEmpty(userName))
{
if (Settings.Default.EmptyCredentials == "windows")
{
RdpClient.UserName = Environment.UserName;
}
else if (Settings.Default.EmptyCredentials == "custom")
{
RdpClient.UserName = Settings.Default.DefaultUsername;
}
}
else
{
RdpClient.UserName = userName;
}
if (string.IsNullOrEmpty(password))
{
if (Settings.Default.EmptyCredentials == "custom")
{
if (Settings.Default.DefaultPassword != "")
{
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
RdpClient.AdvancedSettings2.ClearTextPassword = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey);
}
}
}
else
{
RdpClient.AdvancedSettings2.ClearTextPassword = password;
}
if (string.IsNullOrEmpty(domain))
{
if (Settings.Default.EmptyCredentials == "windows")
{
RdpClient.Domain = Environment.UserDomainName;
}
else if (Settings.Default.EmptyCredentials == "custom")
{
RdpClient.Domain = Settings.Default.DefaultDomain;
}
}
else
{
RdpClient.Domain = domain;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetCredentialsFailed, ex);
}
}
private void SetResolution()
{
try
{
if ((Force & ConnectionInfo.Force.Fullscreen) == ConnectionInfo.Force.Fullscreen)
{
RdpClient.FullScreen = true;
RdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width;
RdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height;
return;
}
if ((Info.Resolution == RdpResolutions.FitToWindow) || (Info.Resolution == RdpResolutions.SmartSize))
{
RdpClient.DesktopWidth = InterfaceControl.Size.Width;
RdpClient.DesktopHeight = InterfaceControl.Size.Height;
if (Info.Resolution == RdpResolutions.SmartSize)
{
RdpClient.AdvancedSettings2.SmartSizing = true;
}
}
else if (Info.Resolution == RdpResolutions.Fullscreen)
{
RdpClient.FullScreen = true;
RdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width;
RdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height;
}
else
{
var resolution = Info.Resolution.GetResolutionRectangle();
RdpClient.DesktopWidth = resolution.Width;
RdpClient.DesktopHeight = resolution.Height;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetResolutionFailed, ex);
}
}
private void SetPort()
{
try
{
if (Info.Port != (int)Defaults.Port)
{
RdpClient.AdvancedSettings2.RDPPort = Info.Port;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPortFailed, ex);
}
}
private void SetRedirection()
{
try
{
RdpClient.AdvancedSettings2.RedirectDrives = Info.RedirectDiskDrives;
RdpClient.AdvancedSettings2.RedirectPorts = Info.RedirectPorts;
RdpClient.AdvancedSettings2.RedirectPrinters = Info.RedirectPrinters;
RdpClient.AdvancedSettings2.RedirectSmartCards = Info.RedirectSmartCards;
RdpClient.SecuredSettings2.AudioRedirectionMode = (int)Info.RedirectSound;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetRedirectionFailed, ex);
}
}
private void SetPerformanceFlags()
{
try
{
var pFlags = 0;
if (Info.DisplayThemes == false)
{
pFlags += Convert.ToInt32(RdpPerformanceFlags.DisableThemes);
}
if (Info.DisplayWallpaper == false)
{
pFlags += Convert.ToInt32(RdpPerformanceFlags.DisableWallpaper);
}
if (Info.EnableFontSmoothing)
{
pFlags += Convert.ToInt32(RdpPerformanceFlags.EnableFontSmoothing);
}
if (Info.EnableDesktopComposition)
{
pFlags += Convert.ToInt32(RdpPerformanceFlags.EnableDesktopComposition);
}
RdpClient.AdvancedSettings2.PerformanceFlags = pFlags;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPerformanceFlagsFailed, ex);
}
}
private void SetAuthenticationLevel()
{
try
{
RdpClient.AdvancedSettings5.AuthenticationLevel = (uint)Info.RDPAuthenticationLevel;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetAuthenticationLevelFailed, ex);
}
}
private void SetLoadBalanceInfo()
{
if (string.IsNullOrEmpty(Info.LoadBalanceInfo))
{
return;
}
try
{
RdpClient.AdvancedSettings2.LoadBalanceInfo = LoadBalanceInfoUseUtf8
? new AzureLoadBalanceInfoEncoder().Encode(Info.LoadBalanceInfo)
: Info.LoadBalanceInfo;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace("Unable to set load balance info.", ex);
}
}
private void SetEventHandlers()
{
try
{
RdpClient.OnConnecting += RDPEvent_OnConnecting;
RdpClient.OnConnected += RDPEvent_OnConnected;
RdpClient.OnLoginComplete += RDPEvent_OnLoginComplete;
RdpClient.OnFatalError += RDPEvent_OnFatalError;
RdpClient.OnDisconnected += RDPEvent_OnDisconnected;
RdpClient.OnLeaveFullScreenMode += RDPEvent_OnLeaveFullscreenMode;
RdpClient.OnIdleTimeoutNotification += RDPEvent_OnIdleTimeoutNotification;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetEventHandlersFailed, ex);
}
}
private void OnConnectingDebugMessage(object sender, EventArgs args)
{
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg,
$"Connection requested RDP version: '{Info.RdpProtocolVersion}'. Using RDP provider: '{sender.GetType().Name}'");
}
#endregion
#region Private Events & Handlers
private void RDPEvent_OnIdleTimeoutNotification()
{
Close(); //Simply close the RDP Session if the idle timeout has been triggered.
if (_alertOnIdleDisconnect)
{
string message = "The " + Info.Name + " session was disconnected due to inactivity";
const string caption = "Session Disconnected";
MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void RDPEvent_OnFatalError(int errorCode)
{
RaiseErrorOccuredEvent(this, Convert.ToString(errorCode));
}
private void RDPEvent_OnDisconnected(int discReason)
{
const int UI_ERR_NORMAL_DISCONNECT = 0xB08;
if (discReason != UI_ERR_NORMAL_DISCONNECT)
{
var reason = RdpClient.GetErrorDescription((uint)discReason, (uint) RdpClient.ExtendedDisconnectReason);
RaiseConnectionDisconnectedEvent(this, discReason + "\r\n" + reason);
}
if (Settings.Default.ReconnectOnDisconnect)
{
ReconnectGroup = new ReconnectGroup();
ReconnectGroup.CloseClicked += Close;
ReconnectGroup.Left = (int) ((double) Control.Width / 2 - (double) ReconnectGroup.Width / 2);
ReconnectGroup.Top = (int) ((double) Control.Height / 2 - (double) ReconnectGroup.Height / 2);
ReconnectGroup.Parent = Control;
ReconnectGroup.Show();
tmrReconnect.Enabled = true;
}
else
{
Close();
}
}
private void RDPEvent_OnConnecting()
{
RaiseConnectionConnectingEvent(this);
}
private void RDPEvent_OnConnected()
{
RaiseConnectionConnectedEvent(this);
}
private void RDPEvent_OnLoginComplete()
{
LoginComplete = true;
}
private void RDPEvent_OnLeaveFullscreenMode()
{
Fullscreen = false;
LeaveFullscreen?.Invoke(this, new EventArgs());
}
#endregion
public delegate void LeaveFullscreenEventHandler(object sender, EventArgs e);
public event LeaveFullscreenEventHandler LeaveFullscreen;
public enum Defaults
{
Colors = RdpColors.Colors16Bit,
Sounds = RdpSounds.DoNotPlay,
Resolution = RdpResolutions.FitToWindow,
Port = 3389
}
#region Reconnect Stuff
public void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
var srvReady = PortScanner.IsPortOpen(Info.Hostname, Convert.ToString(Info.Port));
ReconnectGroup.ServerReady = srvReady;
if (ReconnectGroup.ReconnectWhenReady && srvReady)
{
tmrReconnect.Enabled = false;
ReconnectGroup.DisposeReconnectGroup();
//SetProps()
RdpClient.Connect();
}
}
#endregion
}
}

View File

@@ -0,0 +1,20 @@
using AxMSTSCLib;
using MSTSCLib;
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpProtocol7 : RdpProtocol6
{
public RdpProtocol7(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
Control = new AxMsRdpClient7NotSafeForScripting();
RdpVersionEnum = RdpVersionEnum.Rdc7;
}
protected override MsRdpClient6NotSafeForScripting CreateRdpClientControl()
{
return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient7NotSafeForScripting)Control).GetOcx();
}
}
}

View File

@@ -0,0 +1,125 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using AxMSTSCLib;
using mRemoteNG.App;
using MSTSCLib;
namespace mRemoteNG.Connection.Protocol.RDP
{
/* RDP v8 requires Windows 7 with:
* https://support.microsoft.com/en-us/kb/2592687
* OR
* https://support.microsoft.com/en-us/kb/2923545
*
* Windows 8+ support RDP v8 out of the box.
*/
public class RdpProtocol8 : RdpProtocol7
{
private MsRdpClient8NotSafeForScripting _rdpClient => (MsRdpClient8NotSafeForScripting)RdpClient;
private Size _controlBeginningSize;
public override bool SmartSize
{
get { return base.SmartSize; }
protected set
{
base.SmartSize = value;
ReconnectForResize();
}
}
public override bool Fullscreen
{
get => base.Fullscreen;
protected set
{
base.Fullscreen = value;
ReconnectForResize();
}
}
public RdpProtocol8(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
Control = new AxMsRdpClient8NotSafeForScripting();
RdpVersionEnum = RdpVersionEnum.Rdc8;
}
public override bool Initialize()
{
base.Initialize();
try
{
_rdpClient.AdvancedSettings8.AudioQualityMode = (uint)Info.SoundQuality;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPropsFailed, ex);
return false;
}
return true;
}
protected override MsRdpClient6NotSafeForScripting CreateRdpClientControl()
{
return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient8NotSafeForScripting)Control).GetOcx();
}
public override void ResizeBegin(object sender, EventArgs e)
{
_controlBeginningSize = Control.Size;
}
public override void Resize(object sender, EventArgs e)
{
if (DoResize() && _controlBeginningSize.IsEmpty)
{
ReconnectForResize();
}
base.Resize(sender, e);
}
public override void ResizeEnd(object sender, EventArgs e)
{
DoResize();
if (!(Control.Size == _controlBeginningSize))
{
ReconnectForResize();
}
_controlBeginningSize = Size.Empty;
}
private void ReconnectForResize()
{
if (!LoginComplete)
return;
if (!Info.AutomaticResize)
return;
if (!(Info.Resolution == RdpResolutions.FitToWindow | Info.Resolution == RdpResolutions.Fullscreen))
return;
if (SmartSize)
return;
var size = Fullscreen
? Screen.FromControl(Control).Bounds.Size
: Control.Size;
_rdpClient.Reconnect((uint)size.Width, (uint)size.Height);
}
private bool DoResize()
{
Control.Location = InterfaceControl.Location;
if (!(Control.Size == InterfaceControl.Size) && !(InterfaceControl.Size == Size.Empty)) // kmscode - this doesn't look right to me. But I'm not aware of any functionality issues with this currently...
{
Control.Size = InterfaceControl.Size;
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,20 @@
using AxMSTSCLib;
using MSTSCLib;
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpProtocol9 : RdpProtocol8
{
public RdpProtocol9(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
Control = new AxMsRdpClient9NotSafeForScripting();
RdpVersionEnum = RdpVersionEnum.Rdc9;
}
protected override MsRdpClient6NotSafeForScripting CreateRdpClientControl()
{
return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient9NotSafeForScripting)Control).GetOcx();
}
}
}

View File

@@ -0,0 +1,42 @@
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpProtocolFactory
{
public ProtocolBase CreateProtocol(ConnectionInfo connectionInfo)
{
return CreateProtocol(connectionInfo.RdpProtocolVersion, connectionInfo);
}
public ProtocolBase CreateProtocol(RdpVersionEnum version, ConnectionInfo connectionInfo)
{
RdpProtocol6 newProtocol = null;
// ReSharper disable once SwitchStatementMissingSomeCases
switch (version)
{
case RdpVersionEnum.Rdc6:
newProtocol = new RdpProtocol6(connectionInfo);
break;
case RdpVersionEnum.Rdc7:
newProtocol = new RdpProtocol7(connectionInfo);
break;
case RdpVersionEnum.Rdc8:
newProtocol = new RdpProtocol8(connectionInfo);
break;
case RdpVersionEnum.Rdc9:
newProtocol = new RdpProtocol9(connectionInfo);
break;
case RdpVersionEnum.Rdc10:
newProtocol = new RdpProtocol10(connectionInfo);
break;
}
if (newProtocol != null)
{
newProtocol.LoadBalanceInfoUseUtf8 = Settings.Default.RdpLoadBalanceInfoUseUtf8;
}
return newProtocol;
}
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpSupportTester
{
/// <summary>
/// Returns a list of the RDP versions that can be used on the current
/// host.
/// </summary>
/// <returns></returns>
public List<RdpVersionEnum> GetSupportedRdpVersions()
{
var supportedVersions = new List<RdpVersionEnum>();
var connectionInfo = new ConnectionInfo();
var rdpFactory = new RdpProtocolFactory();
foreach (var version in RdpVersionEnum.Rdc6.GetAll())
{
var protocol = rdpFactory.CreateProtocol(version, connectionInfo);
if (RdpClientIsSupported(protocol))
supportedVersions.Add(version);
}
return supportedVersions;
}
private bool RdpClientIsSupported(ProtocolBase rdpProtocol)
{
try
{
return rdpProtocol.Initialize();
}
catch (Exception)
{
return false;
}
finally
{
rdpProtocol.Close();
}
}
}
}

View File

@@ -2,10 +2,10 @@ namespace mRemoteNG.Connection.Protocol.Rlogin
{ {
public class ProtocolRlogin : PuttyBase public class ProtocolRlogin : PuttyBase
{ {
public ProtocolRlogin(ConnectionInfo connectionInfo)
public ProtocolRlogin() : base(connectionInfo)
{ {
this.PuttyProtocol = Putty_Protocol.rlogin; PuttyProtocol = Putty_Protocol.rlogin;
} }
public enum Defaults public enum Defaults

View File

@@ -4,11 +4,11 @@ namespace mRemoteNG.Connection.Protocol.SSH
{ {
public class ProtocolSSH1 : PuttyBase public class ProtocolSSH1 : PuttyBase
{ {
public ProtocolSSH1(ConnectionInfo connectionInfo)
public ProtocolSSH1() : base(connectionInfo)
{ {
this.PuttyProtocol = Putty_Protocol.ssh; PuttyProtocol = Putty_Protocol.ssh;
this.PuttySSHVersion = Putty_SSHVersion.ssh1; PuttySSHVersion = Putty_SSHVersion.ssh1;
} }
public enum Defaults public enum Defaults

View File

@@ -2,11 +2,11 @@ namespace mRemoteNG.Connection.Protocol.SSH
{ {
public class ProtocolSSH2 : PuttyBase public class ProtocolSSH2 : PuttyBase
{ {
public ProtocolSSH2(ConnectionInfo connectionInfo)
public ProtocolSSH2() : base(connectionInfo)
{ {
this.PuttyProtocol = Putty_Protocol.ssh; PuttyProtocol = Putty_Protocol.ssh;
this.PuttySSHVersion = Putty_SSHVersion.ssh2; PuttySSHVersion = Putty_SSHVersion.ssh2;
} }
public enum Defaults public enum Defaults

View File

@@ -2,10 +2,10 @@ namespace mRemoteNG.Connection.Protocol.Serial
{ {
public class ProtocolSerial : PuttyBase public class ProtocolSerial : PuttyBase
{ {
public ProtocolSerial(ConnectionInfo connectionInfo)
public ProtocolSerial() : base(connectionInfo)
{ {
this.PuttyProtocol = Putty_Protocol.serial; PuttyProtocol = Putty_Protocol.serial;
} }
public enum Defaults public enum Defaults

View File

@@ -2,10 +2,10 @@ namespace mRemoteNG.Connection.Protocol.Telnet
{ {
public class ProtocolTelnet : PuttyBase public class ProtocolTelnet : PuttyBase
{ {
public ProtocolTelnet(ConnectionInfo connectionInfo)
public ProtocolTelnet() : base(connectionInfo)
{ {
this.PuttyProtocol = Putty_Protocol.telnet; PuttyProtocol = Putty_Protocol.telnet;
} }
public enum Defaults public enum Defaults

View File

@@ -10,7 +10,8 @@ namespace mRemoteNG.Connection.Protocol.VNC
{ {
public class ProtocolVNC : ProtocolBase public class ProtocolVNC : ProtocolBase
{ {
#region Properties private VncSharp.RemoteDesktop _VNC;
public bool SmartSize public bool SmartSize
{ {
get { return _VNC.Scaled; } get { return _VNC.Scaled; }
@@ -22,16 +23,11 @@ namespace mRemoteNG.Connection.Protocol.VNC
get { return _VNC.ViewOnly; } get { return _VNC.ViewOnly; }
set { _VNC.ViewOnly = value; } set { _VNC.ViewOnly = value; }
} }
#endregion
#region Private Declarations
private VncSharp.RemoteDesktop _VNC;
private ConnectionInfo Info;
#endregion
#region Public Methods #region Public Methods
public ProtocolVNC() public ProtocolVNC(ConnectionInfo connectionInfo)
: base(connectionInfo)
{ {
Control = new VncSharp.RemoteDesktop(); Control = new VncSharp.RemoteDesktop();
} }
@@ -44,7 +40,7 @@ namespace mRemoteNG.Connection.Protocol.VNC
{ {
_VNC = (VncSharp.RemoteDesktop)Control; _VNC = (VncSharp.RemoteDesktop)Control;
Info = InterfaceControl.Info; Info = InterfaceControl.Protocol.Info;
_VNC.VncPort = Info.Port; _VNC.VncPort = Info.Port;
@@ -180,14 +176,14 @@ namespace mRemoteNG.Connection.Protocol.VNC
#region Private Events & Handlers #region Private Events & Handlers
private void VNCEvent_Connected(object sender, EventArgs e) private void VNCEvent_Connected(object sender, EventArgs e)
{ {
Event_Connected(this); RaiseConnectionConnectedEvent(this);
_VNC.AutoScroll = Info.VNCSmartSizeMode == SmartSizeMode.SmartSNo; _VNC.AutoScroll = Info.VNCSmartSizeMode == SmartSizeMode.SmartSNo;
} }
private void VNCEvent_Disconnected(object sender, EventArgs e) private void VNCEvent_Disconnected(object sender, EventArgs e)
{ {
FrmMain.ClipboardChanged -= VNCEvent_ClipboardChanged; FrmMain.ClipboardChanged -= VNCEvent_ClipboardChanged;
Event_Disconnected(sender, e.ToString()); RaiseConnectionDisconnectedEvent(sender, e.ToString());
Close(); Close();
} }

View File

@@ -4668,6 +4668,15 @@ namespace mRemoteNG {
} }
} }
/// <summary>
/// Looks up a localized string similar to Sets the version of the RDP protocol to use when opening connections..
/// </summary>
internal static string strPropertyDescriptionRdpProtocolVersion {
get {
return ResourceManager.GetString("strPropertyDescriptionRdpProtocolVersion", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Select whether local disk drives should be shown on the remote host.. /// Looks up a localized string similar to Select whether local disk drives should be shown on the remote host..
/// </summary> /// </summary>
@@ -5172,6 +5181,15 @@ namespace mRemoteNG {
} }
} }
/// <summary>
/// Looks up a localized string similar to RDP Protocol Version.
/// </summary>
internal static string strPropertyNameRdpProtocolVersion {
get {
return ResourceManager.GetString("strPropertyNameRdpProtocolVersion", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Disk Drives. /// Looks up a localized string similar to Disk Drives.
/// </summary> /// </summary>

View File

@@ -2631,4 +2631,10 @@ This page will walk you through the process of upgrading your connections file o
<data name="LoadBalanceInfoUseUtf8" xml:space="preserve"> <data name="LoadBalanceInfoUseUtf8" xml:space="preserve">
<value>Use UTF8 encoding for RDP "Load Balance Info" property</value> <value>Use UTF8 encoding for RDP "Load Balance Info" property</value>
</data> </data>
<data name="strPropertyDescriptionRdpProtocolVersion" xml:space="preserve">
<value>Sets the version of the RDP protocol to use when opening connections.</value>
</data>
<data name="strPropertyNameRdpProtocolVersion" xml:space="preserve">
<value>RDP Protocol Version</value>
</data>
</root> </root>

View File

@@ -20,7 +20,7 @@ namespace mRemoteNG.Tools
public static int HttpPort { get; set; } = (int)ProtocolHTTP.Defaults.Port; public static int HttpPort { get; set; } = (int)ProtocolHTTP.Defaults.Port;
public static int HttpsPort { get; set; } = (int)ProtocolHTTPS.Defaults.Port; public static int HttpsPort { get; set; } = (int)ProtocolHTTPS.Defaults.Port;
public static int RloginPort { get; set; } = (int)ProtocolRlogin.Defaults.Port; public static int RloginPort { get; set; } = (int)ProtocolRlogin.Defaults.Port;
public static int RdpPort { get; set; } = (int)RdpProtocol.Defaults.Port; public static int RdpPort { get; set; } = (int)RdpProtocol6.Defaults.Port;
public static int VncPort { get; set; } = (int)ProtocolVNC.Defaults.Port; public static int VncPort { get; set; } = (int)ProtocolVNC.Defaults.Port;
public ArrayList OpenPorts { get; set; } public ArrayList OpenPorts { get; set; }
public ArrayList ClosedPorts { get; set; } public ArrayList ClosedPorts { get; set; }

View File

@@ -437,7 +437,7 @@ namespace mRemoteNG.UI.Menu
foreach (var i in icList) foreach (var i in icList)
{ {
i.Protocol.Close(); i.Protocol.Close();
ConnectionInitiator.OpenConnection(i.Info, ConnectionInfo.Force.DoNotJump); ConnectionInitiator.OpenConnection(i.Protocol.Info, ConnectionInfo.Force.DoNotJump);
} }
// throw it on the garbage collector // throw it on the garbage collector

View File

@@ -2,6 +2,8 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using AxMSTSCLib; using AxMSTSCLib;
using AxWFICALib; using AxWFICALib;
@@ -458,42 +460,26 @@ namespace mRemoteNG.UI.Window
{ {
pnlCheck1.Visible = true; pnlCheck1.Visible = true;
try var tester = new RdpSupportTester();
var supportedRdpVersions = tester.GetSupportedRdpVersions();
if (supportedRdpVersions.Any())
{ {
using (var rdpClient = new AxMsRdpClient8NotSafeForScripting()) pbCheck1.Image = Resources.Good_Symbol;
{ lblCheck1.ForeColor = Color.DarkOliveGreen;
rdpClient.CreateControl(); lblCheck1.Text = "RDP (Remote Desktop) " + Language.strCcCheckSucceeded;
txtCheck1.Text = string.Format(Language.strCcRDPOK, supportedRdpVersions.Aggregate(new StringBuilder(), (builder, enum1) => builder.Append(enum1+",")));
while (!rdpClient.Created) Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "RDP installed", true);
{ return;
Thread.Sleep(10);
System.Windows.Forms.Application.DoEvents();
}
if (!(new Version(rdpClient.Version) >= RdpProtocol.Versions.RDC80))
{
throw new Exception(
$"Found RDC Client version {rdpClient.Version} but version {RdpProtocol.Versions.RDC80} or higher is required.");
}
pbCheck1.Image = Resources.Good_Symbol;
lblCheck1.ForeColor = Color.DarkOliveGreen;
lblCheck1.Text = "RDP (Remote Desktop) " + Language.strCcCheckSucceeded;
txtCheck1.Text = string.Format(Language.strCcRDPOK, rdpClient.Version);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "RDP installed", true);
}
} }
catch (Exception ex)
{
pbCheck1.Image = Resources.Bad_Symbol;
lblCheck1.ForeColor = Color.Firebrick;
lblCheck1.Text = "RDP (Remote Desktop) " + Language.strCcCheckFailed;
txtCheck1.Text = string.Format(Language.strCcRDPFailed, GeneralAppInfo.UrlForum);
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, pbCheck1.Image = Resources.Bad_Symbol;
"RDP " + Language.strCcNotInstalledProperly, true); lblCheck1.ForeColor = Color.Firebrick;
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, ex.Message, true); lblCheck1.Text = "RDP (Remote Desktop) " + Language.strCcCheckFailed;
} txtCheck1.Text = string.Format(Language.strCcRDPFailed, GeneralAppInfo.UrlForum);
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
"RDP " + Language.strCcNotInstalledProperly, true);
} }
private void CheckVnc() private void CheckVnc()

View File

@@ -878,7 +878,7 @@ namespace mRemoteNG.UI.Window
{ {
strHide.Add("RDPAlertIdleTimeout"); strHide.Add("RDPAlertIdleTimeout");
} }
if (conI.RDGatewayUsageMethod == RdpProtocol.RDGatewayUsageMethod.Never) if (conI.RDGatewayUsageMethod == RDGatewayUsageMethod.Never)
{ {
strHide.Add("RDGatewayDomain"); strHide.Add("RDGatewayDomain");
strHide.Add("RDGatewayHostname"); strHide.Add("RDGatewayHostname");
@@ -886,17 +886,17 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials"); strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername"); strHide.Add("RDGatewayUsername");
} }
else if (conI.RDGatewayUseConnectionCredentials == RdpProtocol.RDGatewayUseConnectionCredentials.Yes) else if (conI.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes)
{ {
strHide.Add("RDGatewayDomain"); strHide.Add("RDGatewayDomain");
strHide.Add("RDGatewayPassword"); strHide.Add("RDGatewayPassword");
strHide.Add("RDGatewayUsername"); strHide.Add("RDGatewayUsername");
} }
if (!(conI.Resolution == RdpProtocol.RDPResolutions.FitToWindow || conI.Resolution == RdpProtocol.RDPResolutions.Fullscreen)) if (!(conI.Resolution == RdpResolutions.FitToWindow || conI.Resolution == RdpResolutions.Fullscreen))
{ {
strHide.Add("AutomaticResize"); strHide.Add("AutomaticResize");
} }
if (conI.RedirectSound != RdpProtocol.RDPSounds.BringToThisComputer) if (conI.RedirectSound != RdpSounds.BringToThisComputer)
{ {
strHide.Add("SoundQuality"); strHide.Add("SoundQuality");
} }

View File

@@ -160,7 +160,7 @@ namespace mRemoteNG.UI.Window
else else
{ {
var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl;
FrmMain.Default.SelectedConnection = interfaceControl?.Info; FrmMain.Default.SelectedConnection = interfaceControl?.Protocol.Info;
} }
} }
#endregion #endregion
@@ -178,7 +178,7 @@ namespace mRemoteNG.UI.Window
if(ThemeManager.getInstance().ThemingActive) if(ThemeManager.getInstance().ThemingActive)
{ {
base.ApplyTheme(); base.ApplyTheme();
this.vsToolStripExtender = new WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender(this.components); vsToolStripExtender = new VisualStudioToolStripExtender(components);
vsToolStripExtender.DefaultRenderer = _toolStripProfessionalRenderer; vsToolStripExtender.DefaultRenderer = _toolStripProfessionalRenderer;
vsToolStripExtender.SetStyle(cmenTab, ThemeManager.getInstance().ActiveTheme.Version, ThemeManager.getInstance().ActiveTheme.Theme); vsToolStripExtender.SetStyle(cmenTab, ThemeManager.getInstance().ActiveTheme.Version, ThemeManager.getInstance().ActiveTheme.Theme);
TabController.BackColor = ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Tab_Item_Background"); TabController.BackColor = ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Tab_Item_Background");
@@ -377,9 +377,9 @@ namespace mRemoteNG.UI.Window
var interfaceControl = (InterfaceControl)TabController.SelectedTab?.Tag; var interfaceControl = (InterfaceControl)TabController.SelectedTab?.Tag;
if (interfaceControl == null) return; if (interfaceControl == null) return;
if (interfaceControl.Info.Protocol == ProtocolType.RDP) if (interfaceControl.Protocol.Info.Protocol == ProtocolType.RDP)
{ {
var rdp = (RdpProtocol)interfaceControl.Protocol; var rdp = (RdpProtocol6)interfaceControl.Protocol;
cmenTabFullscreen.Visible = true; cmenTabFullscreen.Visible = true;
cmenTabFullscreen.Checked = rdp.Fullscreen; cmenTabFullscreen.Checked = rdp.Fullscreen;
cmenTabSmartSize.Visible = true; cmenTabSmartSize.Visible = true;
@@ -391,7 +391,7 @@ namespace mRemoteNG.UI.Window
cmenTabSmartSize.Visible = false; cmenTabSmartSize.Visible = false;
} }
if (interfaceControl.Info.Protocol == ProtocolType.VNC) if (interfaceControl.Protocol.Info.Protocol == ProtocolType.VNC)
{ {
var vnc = (ProtocolVNC)interfaceControl.Protocol; var vnc = (ProtocolVNC)interfaceControl.Protocol;
cmenTabSendSpecialKeys.Visible = true; cmenTabSendSpecialKeys.Visible = true;
@@ -412,7 +412,7 @@ namespace mRemoteNG.UI.Window
cmenTabTransferFile.Visible = false; cmenTabTransferFile.Visible = false;
} }
if (interfaceControl.Info.Protocol == ProtocolType.SSH1 | interfaceControl.Info.Protocol == ProtocolType.SSH2) if (interfaceControl.Protocol.Info.Protocol == ProtocolType.SSH1 | interfaceControl.Protocol.Info.Protocol == ProtocolType.SSH2)
{ {
cmenTabTransferFile.Visible = true; cmenTabTransferFile.Visible = true;
} }
@@ -443,7 +443,7 @@ namespace mRemoteNG.UI.Window
if (!(TabController.SelectedTab?.Tag is InterfaceControl)) return; if (!(TabController.SelectedTab?.Tag is InterfaceControl)) return;
var interfaceControl = (InterfaceControl)TabController.SelectedTab?.Tag; var interfaceControl = (InterfaceControl)TabController.SelectedTab?.Tag;
var protocol = interfaceControl.Protocol as RdpProtocol; var protocol = interfaceControl.Protocol as RdpProtocol6;
if (protocol != null) if (protocol != null)
{ {
var rdp = protocol; var rdp = protocol;
@@ -468,9 +468,9 @@ namespace mRemoteNG.UI.Window
var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl;
if (interfaceControl == null) return; if (interfaceControl == null) return;
if (interfaceControl.Info.Protocol == ProtocolType.SSH1 | interfaceControl.Info.Protocol == ProtocolType.SSH2) if (interfaceControl.Protocol.Info.Protocol == ProtocolType.SSH1 | interfaceControl.Protocol.Info.Protocol == ProtocolType.SSH2)
SshTransferFile(); SshTransferFile();
else if (interfaceControl.Info.Protocol == ProtocolType.VNC) else if (interfaceControl.Protocol.Info.Protocol == ProtocolType.VNC)
VncTransferFile(); VncTransferFile();
} }
catch (Exception ex) catch (Exception ex)
@@ -487,7 +487,7 @@ namespace mRemoteNG.UI.Window
if (interfaceControl == null) return; if (interfaceControl == null) return;
Windows.Show(WindowType.SSHTransfer); Windows.Show(WindowType.SSHTransfer);
var connectionInfo = interfaceControl.Info; var connectionInfo = interfaceControl.Protocol.Info;
Windows.SshtransferForm.Hostname = connectionInfo.Hostname; Windows.SshtransferForm.Hostname = connectionInfo.Hostname;
Windows.SshtransferForm.Username = connectionInfo.Username; Windows.SshtransferForm.Username = connectionInfo.Username;
@@ -577,7 +577,7 @@ namespace mRemoteNG.UI.Window
try try
{ {
var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl;
var rdp = interfaceControl?.Protocol as RdpProtocol; var rdp = interfaceControl?.Protocol as RdpProtocol6;
rdp?.ToggleFullscreen(); rdp?.ToggleFullscreen();
} }
catch (Exception ex) catch (Exception ex)
@@ -640,7 +640,7 @@ namespace mRemoteNG.UI.Window
try try
{ {
var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl;
externalTool.Start(interfaceControl?.Info); externalTool.Start(interfaceControl?.Protocol.Info);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -667,7 +667,7 @@ namespace mRemoteNG.UI.Window
{ {
var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl;
if (interfaceControl == null) return; if (interfaceControl == null) return;
_connectionInitiator.OpenConnection(interfaceControl.Info, ConnectionInfo.Force.DoNotJump); _connectionInitiator.OpenConnection(interfaceControl.Protocol.Info, ConnectionInfo.Force.DoNotJump);
_ignoreChangeSelectedTabClick = false; _ignoreChangeSelectedTabClick = false;
} }
catch (Exception ex) catch (Exception ex)
@@ -683,7 +683,7 @@ namespace mRemoteNG.UI.Window
var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl;
if (interfaceControl == null) return; if (interfaceControl == null) return;
interfaceControl.Protocol.Close(); interfaceControl.Protocol.Close();
_connectionInitiator.OpenConnection(interfaceControl.Info, ConnectionInfo.Force.DoNotJump); _connectionInitiator.OpenConnection(interfaceControl.Protocol.Info, ConnectionInfo.Force.DoNotJump);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -714,7 +714,7 @@ namespace mRemoteNG.UI.Window
#endregion #endregion
#region Protocols #region Protocols
public void Prot_Event_Closed(object sender) public void Prot_Event_Closed(object sender, EventArgs args)
{ {
var protocolBase = sender as ProtocolBase; var protocolBase = sender as ProtocolBase;
var tabPage = protocolBase?.InterfaceControl.Parent as TabPage; var tabPage = protocolBase?.InterfaceControl.Parent as TabPage;
@@ -844,7 +844,7 @@ namespace mRemoteNG.UI.Window
try try
{ {
var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl;
if (interfaceControl?.Info.Protocol == ProtocolType.VNC) if (interfaceControl?.Protocol.Info.Protocol == ProtocolType.VNC)
((ProtocolVNC)interfaceControl.Protocol).RefreshScreen(); ((ProtocolVNC)interfaceControl.Protocol).RefreshScreen();
} }
catch (Exception ex) catch (Exception ex)
@@ -868,7 +868,7 @@ namespace mRemoteNG.UI.Window
if (tabClientRectangle.Contains(MousePosition)) if (tabClientRectangle.Contains(MousePosition))
{ {
var interfaceControl = selectedTab.Tag as InterfaceControl; var interfaceControl = selectedTab.Tag as InterfaceControl;
if (interfaceControl?.Info?.Protocol == ProtocolType.RDP) if (interfaceControl?.Protocol.Info?.Protocol == ProtocolType.RDP)
{ {
interfaceControl.Protocol.Focus(); interfaceControl.Protocol.Focus();
return; // Do not pass to base class return; // Do not pass to base class

View File

@@ -236,7 +236,23 @@
<Compile Include="Connection\IHasParent.cs" /> <Compile Include="Connection\IHasParent.cs" />
<Compile Include="Connection\Protocol\Http\Connection.Protocol.HTTPS.CertEvent.cs" /> <Compile Include="Connection\Protocol\Http\Connection.Protocol.HTTPS.CertEvent.cs" />
<Compile Include="Connection\Protocol\ProtocolFactory.cs" /> <Compile Include="Connection\Protocol\ProtocolFactory.cs" />
<Compile Include="Connection\Protocol\RDP\Enums\RdpVersion.cs" />
<Compile Include="Connection\Protocol\RDP\Enums\RdpAuthenticationLevel.cs" />
<Compile Include="Connection\Protocol\RDP\AzureLoadBalanceInfoEncoder.cs" /> <Compile Include="Connection\Protocol\RDP\AzureLoadBalanceInfoEncoder.cs" />
<Compile Include="Connection\Protocol\RDP\Enums\RDGatewayUsageMethod.cs" />
<Compile Include="Connection\Protocol\RDP\Enums\RDGatewayUseConnectionCredentials.cs" />
<Compile Include="Connection\Protocol\RDP\Enums\RdpColors.cs" />
<Compile Include="Connection\Protocol\RDP\Enums\RdpPerformanceFlags.cs" />
<Compile Include="Connection\Protocol\RDP\Enums\RdpResolutions.cs" />
<Compile Include="Connection\Protocol\RDP\Enums\RdpSoundQuality.cs" />
<Compile Include="Connection\Protocol\RDP\Enums\RdpSounds.cs" />
<Compile Include="Connection\Protocol\RDP\RdpErrorTranslator.cs" />
<Compile Include="Connection\Protocol\RDP\RdpProtocol10.cs" />
<Compile Include="Connection\Protocol\RDP\RdpProtocol7.cs" />
<Compile Include="Connection\Protocol\RDP\RdpProtocol8.cs" />
<Compile Include="Connection\Protocol\RDP\RdpProtocol9.cs" />
<Compile Include="Connection\Protocol\RDP\RdpProtocolFactory.cs" />
<Compile Include="Connection\Protocol\RDP\RdpSupportTester.cs" />
<Compile Include="Connection\Protocol\VNC\VNCEnum.cs" /> <Compile Include="Connection\Protocol\VNC\VNCEnum.cs" />
<Compile Include="Connection\WebHelper.cs" /> <Compile Include="Connection\WebHelper.cs" />
<Compile Include="Credential\PlaceholderCredentialRecord.cs" /> <Compile Include="Credential\PlaceholderCredentialRecord.cs" />
@@ -569,7 +585,7 @@
<Compile Include="Connection\Protocol\ProtocolType.cs" /> <Compile Include="Connection\Protocol\ProtocolType.cs" />
<Compile Include="Connection\Protocol\PuttyBase.cs" /> <Compile Include="Connection\Protocol\PuttyBase.cs" />
<Compile Include="Connection\Protocol\RAW\RawProtocol.cs" /> <Compile Include="Connection\Protocol\RAW\RawProtocol.cs" />
<Compile Include="Connection\Protocol\RDP\RdpProtocol.cs" /> <Compile Include="Connection\Protocol\RDP\RdpProtocol6.cs" />
<Compile Include="Connection\Protocol\Rlogin\Connection.Protocol.Rlogin.cs" /> <Compile Include="Connection\Protocol\Rlogin\Connection.Protocol.Rlogin.cs" />
<Compile Include="Connection\Protocol\Serial\Connection.Protocol.Serial.cs" /> <Compile Include="Connection\Protocol\Serial\Connection.Protocol.Serial.cs" />
<Compile Include="Connection\Protocol\SSH\Connection.Protocol.SSH1.cs" /> <Compile Include="Connection\Protocol\SSH\Connection.Protocol.SSH1.cs" />

View File

@@ -4,6 +4,7 @@
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=config_005Cserializers_005Cexportserializers/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=config_005Cserializers_005Cexportserializers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=config_005Cserializers_005Cexternalserializers/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=config_005Cserializers_005Cexternalserializers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=config_005Cserializers_005Cmiscserializers/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=config_005Cserializers_005Cmiscserializers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=connection_005Cprotocol_005Crdp_005Cnewfolder1/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=messages_005Cmessagefilteringoptions/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=messages_005Cmessagefilteringoptions/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tree_005Cclickhandlers/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tree_005Cclickhandlers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ui_005Ccontrols_005Cconnectiontree/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ui_005Ccontrols_005Cconnectiontree/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>