mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-18 06:21:41 +08:00
Compare commits
23 Commits
refactor_r
...
v1.76Alpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
575dae446f | ||
|
|
9b438576f2 | ||
|
|
cbd32f1a07 | ||
|
|
516182ec40 | ||
|
|
4ad3a68d80 | ||
|
|
2f9ba32c07 | ||
|
|
dfc45a2904 | ||
|
|
563fdffb67 | ||
|
|
f2e9c5e2c0 | ||
|
|
86a591364c | ||
|
|
2a82485f81 | ||
|
|
e13549d361 | ||
|
|
a85c1bd7d3 | ||
|
|
946679f490 | ||
|
|
b6f27eac18 | ||
|
|
2cc82145a3 | ||
|
|
2dae0f2d8e | ||
|
|
412f6edc36 | ||
|
|
764791b8e5 | ||
|
|
bd20d6ae7d | ||
|
|
8db0bf7bea | ||
|
|
cff6aa72fc | ||
|
|
63ddf06057 |
@@ -1,12 +1,20 @@
|
||||
1.76.0 Alpha 3 (2018-xx-xx):
|
||||
1.76.2 Alpha 4 (2018-03-03):
|
||||
|
||||
Fixes:
|
||||
------
|
||||
#899: DoNotPlay is Case Sensitive in XML Serialization
|
||||
|
||||
|
||||
1.76.1 Alpha 3 (2018-02-24):
|
||||
|
||||
Features/Enhancements:
|
||||
----------------------
|
||||
#625: Added ability to import mRemoteNG formatted CSV files
|
||||
#648: The port scan ping timeout is now configurable
|
||||
|
||||
Fixes:
|
||||
------
|
||||
|
||||
Fixed a few Xml serialization bugs that would occur if boolean values weren't capitalized
|
||||
|
||||
|
||||
1.76.0 Alpha 2 (2018-02-01):
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
| ---------------|--------------|-----------|
|
||||
| Stable | [](https://ci.appveyor.com/project/mremoteng/mremoteng/branch/master) | [](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.75.7011) |
|
||||
| Beta | | [](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.75.7011) |
|
||||
| Development | [](https://ci.appveyor.com/project/mremoteng/mremoteng/branch/develop) | [](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.76Alpha2) |
|
||||
| Development | [](https://ci.appveyor.com/project/mremoteng/mremoteng/branch/develop) | [](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.76Alpha3) |
|
||||
|
||||
mRemoteNG is the next generation of mRemote, a full-featured, multi-tab remote connections manager.
|
||||
|
||||
|
||||
106
Tools/CreateBulkConnections_ConfCons2_6.ps1
Normal file
106
Tools/CreateBulkConnections_ConfCons2_6.ps1
Normal file
@@ -0,0 +1,106 @@
|
||||
$EncryptionKey = (Get-Credential -Message "Enter the encryption key you would like to use. This must match the encryption key used by the rest of the confCons file." -UserName "DontNeedUsername").Password
|
||||
$PathToMrngFolder = "C:\Users\SparerD\Downloads\mRemoteNG-Portable-1.75.7012.16846"
|
||||
|
||||
if ($PathToMrngFolder -eq "") {
|
||||
Write-Error -Message 'You must set the $PathToMrngFolder variable in this script to the folder which contains mRemoteNG.exe'
|
||||
}
|
||||
|
||||
$assembly = [System.Reflection.Assembly]::LoadFile((Join-Path -Path $PathToMrngFolder -ChildPath "mRemoteNG.exe"))
|
||||
$assembly = [System.Reflection.Assembly]::LoadFile((Join-Path -Path $PathToMrngFolder -ChildPath "BouncyCastle.Crypto.dll"))
|
||||
|
||||
function New-mRemoteNGXmlSerializer {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[SecureString]
|
||||
$EncryptionKey
|
||||
)
|
||||
|
||||
PROCESS {
|
||||
$cryptoProvider = New-Object -TypeName mRemoteNG.Security.SymmetricEncryption.AeadCryptographyProvider
|
||||
$saveFilter = New-Object -TypeName mRemoteNG.Security.SaveFilter -ArgumentList @($false)
|
||||
$xmlSerializer = New-Object -TypeName mRemoteNG.Config.Serializers.XmlConnectionNodeSerializer -ArgumentList @($cryptoProvider, $encryptionKey, $saveFilter)
|
||||
Write-Output $xmlSerializer
|
||||
}
|
||||
}
|
||||
|
||||
function New-mRemoteNGConnectionInfo {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
)
|
||||
|
||||
PROCESS {
|
||||
$connectionInfo = New-Object -TypeName mRemoteNG.Connection.ConnectionInfo
|
||||
Write-Output $connectionInfo
|
||||
}
|
||||
}
|
||||
|
||||
function New-mRemoteNGContainerInfo {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
)
|
||||
|
||||
PROCESS {
|
||||
$connectionInfo = New-Object -TypeName mRemoteNG.Container.ContainerInfo
|
||||
Write-Output $connectionInfo
|
||||
}
|
||||
}
|
||||
|
||||
# Setup the services needed to do serialization
|
||||
$xmlSerializer = New-mRemoteNGXmlSerializer -EncryptionKey $EncryptionKey
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# Example 1: serialize many connections
|
||||
# Here you can define the number of connection info objects to create
|
||||
# You can also provide a list of desired hostnames and iterate over those
|
||||
$xml = ""
|
||||
foreach($i in 1..5)
|
||||
{
|
||||
$connectionInfo = New-mRemoteNGConnectionInfo
|
||||
|
||||
# Set connection info properties
|
||||
$connectionInfo.Name = "server-$i"
|
||||
$connectionInfo.Hostname = "some-win-server-$i"
|
||||
$connectionInfo.Protocol = [mRemoteNG.Connection.Protocol.ProtocolType]::RDP
|
||||
$connectionInfo.Inheritance.Username = $true
|
||||
$connectionInfo.Inheritance.Domain = $true
|
||||
$connectionInfo.Inheritance.Password = $true
|
||||
|
||||
$serializedConnection = $xmlSerializer.SerializeConnectionInfo($connectionInfo).ToString()
|
||||
$xml += $serializedConnection + [System.Environment]::NewLine
|
||||
}
|
||||
|
||||
Write-Output $xml
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# Example 2: serialize a container which has connections
|
||||
# You can also create containers and add connections to them, which will be nested correctly when serialized
|
||||
$xml = ""
|
||||
$container = New-mRemoteNGContainerInfo
|
||||
$container.Name = "ProductionServers"
|
||||
$serializedContainer = $xmlSerializer.SerializeConnectionInfo($container)
|
||||
|
||||
foreach($i in 1..3)
|
||||
{
|
||||
$connectionInfo = New-mRemoteNGConnectionInfo
|
||||
|
||||
# Set connection info properties
|
||||
$connectionInfo.Name = "server-$i"
|
||||
$connectionInfo.Hostname = "some-linux-server-$i"
|
||||
$connectionInfo.Protocol = [mRemoteNG.Connection.Protocol.ProtocolType]::SSH2
|
||||
$connectionInfo.Inheritance.Username = $true
|
||||
$connectionInfo.Inheritance.Domain = $true
|
||||
$connectionInfo.Inheritance.Password = $true
|
||||
|
||||
# serialize the connection
|
||||
$serializedConnection = $xmlSerializer.SerializeConnectionInfo($connectionInfo)
|
||||
# add the connection to the container
|
||||
$serializedContainer.Add($serializedConnection)
|
||||
}
|
||||
|
||||
# get the raw xml text
|
||||
Write-Output $serializedContainer.ToString()
|
||||
@@ -1,5 +1,6 @@
|
||||
$githubUrl = 'https://api.github.com'
|
||||
|
||||
# GitHub doesn't support the default powershell protocol (TLS 1.0)
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
function Publish-GitHubRelease {
|
||||
param (
|
||||
|
||||
@@ -45,5 +45,5 @@ Format-Table -AutoSize -Wrap -InputObject @{
|
||||
& "$PSScriptRoot\verify_LargeAddressAware.ps1" -TargetDir $TargetDir -TargetFileName $TargetFileName
|
||||
& "$PSScriptRoot\tidy_files_for_release.ps1" -TargetDir $TargetDir -ConfigurationName $ConfigurationName
|
||||
& "$PSScriptRoot\sign_binaries.ps1" -TargetDir $TargetDir -CertificatePath $CertificatePath -CertificatePassword $CertificatePassword -ConfigurationName $ConfigurationName -Exclude $ExcludeFromSigning
|
||||
& "$PSScriptRoot\verify_binary_signatures.ps1" -TargetDir $TargetDir -ConfigurationName $ConfigurationName
|
||||
& "$PSScriptRoot\verify_binary_signatures.ps1" -TargetDir $TargetDir -ConfigurationName $ConfigurationName -CertificatePath $CertificatePath
|
||||
& "$PSScriptRoot\zip_portable_files.ps1" -SolutionDir $SolutionDir -TargetDir $TargetDir -ConfigurationName $ConfigurationName
|
||||
@@ -9,7 +9,7 @@ Write-Host $SolutionDir
|
||||
Write-Host $renameTarget
|
||||
|
||||
$targetVersionedFile = "$SolutionDir\mRemoteV1\bin\Release\mRemoteNG.exe"
|
||||
$version = &"$SolutionDir\Tools\sigcheck.exe" /accepteula -q -n $targetVersionedFile
|
||||
$version = &"$SolutionDir\Tools\exes\sigcheck.exe" /accepteula -q -n $targetVersionedFile
|
||||
|
||||
|
||||
$renameTargetFileObject = Get-Item -Path $renameTarget -ErrorAction SilentlyContinue
|
||||
|
||||
@@ -8,6 +8,7 @@ param (
|
||||
$ConfigurationName,
|
||||
|
||||
[string]
|
||||
[Parameter(Mandatory=$true)]
|
||||
# The code signing certificate to use when signing the files.
|
||||
$CertificatePath
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Security;
|
||||
using System.Xml.Linq;
|
||||
using mRemoteNG.Config;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.MiscSerializers;
|
||||
using mRemoteNG.Config.Serializers.Csv;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Connection.Protocol.Http;
|
||||
@@ -11,12 +10,13 @@ using mRemoteNG.Connection.Protocol.RDP;
|
||||
using mRemoteNG.Connection.Protocol.VNC;
|
||||
using mRemoteNG.Credential;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNGTests.TestHelpers;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Csv
|
||||
{
|
||||
public class CsvConnectionsDeserializerMremotengFormatTests
|
||||
public class CsvConnectionsDeserializerMremotengFormatTests
|
||||
{
|
||||
private CsvConnectionsDeserializerMremotengFormat _deserializer;
|
||||
private ICredentialRepositoryList _credentialRepositoryList;
|
||||
@@ -50,6 +50,22 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TreeStructureDeserializedCorrectly()
|
||||
{
|
||||
//Root
|
||||
// |- folder1
|
||||
// | |- Con1
|
||||
// |- Con2
|
||||
var treeModel = new ConnectionTreeModelBuilder().Build();
|
||||
var serializer = new CsvConnectionsSerializerMremotengFormat(new SaveFilter(), _credentialRepositoryList);
|
||||
var csv = serializer.Serialize(treeModel);
|
||||
var deserializedConnections = _deserializer.Deserialize(csv);
|
||||
var con1 = deserializedConnections.GetRecursiveChildList().First(info => info.Name == "Con1");
|
||||
var folder1 = deserializedConnections.GetRecursiveChildList().First(info => info.Name == "folder1");
|
||||
Assert.That(con1.Parent, Is.EqualTo(folder1));
|
||||
}
|
||||
|
||||
internal static ConnectionInfo GetTestConnection()
|
||||
{
|
||||
return new ConnectionInfo
|
||||
@@ -82,9 +98,9 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
UseCredSsp = true,
|
||||
RenderingEngine = HTTPBase.RenderingEngine.Gecko,
|
||||
ICAEncryptionStrength = IcaProtocol.EncryptionStrength.Encr40Bit,
|
||||
RDPAuthenticationLevel = RdpAuthenticationLevel.WarnOnFailedAuth,
|
||||
Colors = RdpColors.Colors16Bit,
|
||||
Resolution = RdpResolutions.Res1366x768,
|
||||
RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.WarnOnFailedAuth,
|
||||
Colors = RdpProtocol.RDPColors.Colors16Bit,
|
||||
Resolution = RdpProtocol.RDPResolutions.Res1366x768,
|
||||
AutomaticResize = true,
|
||||
DisplayWallpaper = true,
|
||||
DisplayThemes = true,
|
||||
@@ -95,7 +111,7 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
RedirectPorts = true,
|
||||
RedirectPrinters = true,
|
||||
RedirectSmartCards = true,
|
||||
RedirectSound = RdpSounds.LeaveAtRemoteComputer,
|
||||
RedirectSound = RdpProtocol.RDPSounds.LeaveAtRemoteComputer,
|
||||
RedirectKeys = true,
|
||||
VNCCompression = ProtocolVNC.Compression.Comp4,
|
||||
VNCEncoding = ProtocolVNC.Encoding.EncRRE,
|
||||
@@ -105,8 +121,8 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
VNCColors = ProtocolVNC.Colors.Col8Bit,
|
||||
VNCSmartSizeMode = ProtocolVNC.SmartSizeMode.SmartSAspect,
|
||||
VNCViewOnly = true,
|
||||
RDGatewayUsageMethod = RDGatewayUsageMethod.Detect,
|
||||
RDGatewayUseConnectionCredentials = RDGatewayUseConnectionCredentials.SmartCard
|
||||
RDGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Detect,
|
||||
RDGatewayUseConnectionCredentials = RdpProtocol.RDGatewayUseConnectionCredentials.SmartCard
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Csv;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Credential;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNGTests.TestHelpers;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Csv
|
||||
{
|
||||
public class CsvConnectionsSerializerMremotengFormatTests
|
||||
{
|
||||
@@ -28,6 +32,24 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
_credentialRepositoryList.GetCredentialRecord(new Guid()).ReturnsForAnyArgs(credRecord);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SerializesNodeId()
|
||||
{
|
||||
var serializer = new CsvConnectionsSerializerMremotengFormat(new SaveFilter(), _credentialRepositoryList);
|
||||
var connectionInfo = BuildConnectionInfo();
|
||||
var csv = serializer.Serialize(connectionInfo);
|
||||
Assert.That(csv, Does.Match(connectionInfo.ConstantID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DoesntSerializeTheRootNode()
|
||||
{
|
||||
var serializer = new CsvConnectionsSerializerMremotengFormat(new SaveFilter(), _credentialRepositoryList);
|
||||
var treeModel = new ConnectionTreeModelBuilder().Build();
|
||||
var csv = serializer.Serialize(treeModel);
|
||||
Assert.That(csv, Does.Not.Match($"{treeModel.RootNodes[0].ConstantID};.*;{TreeNodeType.Root}"));
|
||||
}
|
||||
|
||||
[TestCase(Username)]
|
||||
[TestCase(Domain)]
|
||||
[TestCase(Password)]
|
||||
@@ -82,6 +104,32 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
Assert.Throws<ArgumentNullException>(() => serializer.Serialize((ConnectionTreeModel)null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FoldersAreSerialized()
|
||||
{
|
||||
var serializer = new CsvConnectionsSerializerMremotengFormat(new SaveFilter(), _credentialRepositoryList);
|
||||
var container = BuildContainer();
|
||||
var csv = serializer.Serialize(container);
|
||||
Assert.That(csv, Does.Match(container.Name));
|
||||
Assert.That(csv, Does.Match(container.Username));
|
||||
Assert.That(csv, Does.Match(container.Domain));
|
||||
Assert.That(csv, Does.Match(container.Password));
|
||||
Assert.That(csv, Does.Contain(TreeNodeType.Container.ToString()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SerializationIncludesRawInheritedValuesIfObjectInheritsFromParentOutsideOfSerializationScope()
|
||||
{
|
||||
var serializer = new CsvConnectionsSerializerMremotengFormat(new SaveFilter(), _credentialRepositoryList);
|
||||
var treeModel = new ConnectionTreeModelBuilder().Build();
|
||||
var serializationTarget = treeModel.GetRecursiveChildList().First(info => info.Name == "folder3");
|
||||
var csv = serializer.Serialize(serializationTarget);
|
||||
var lineWithFolder3 = csv.Split(new[] {Environment.NewLine}, StringSplitOptions.None).First(s => s.Contains(serializationTarget.Name));
|
||||
Assert.That(lineWithFolder3, Does.Contain(serializationTarget.Username));
|
||||
Assert.That(lineWithFolder3, Does.Contain(serializationTarget.Domain));
|
||||
Assert.That(lineWithFolder3, Does.Contain(serializationTarget.Password));
|
||||
}
|
||||
|
||||
private ConnectionInfo BuildConnectionInfo()
|
||||
{
|
||||
return new ConnectionInfo
|
||||
@@ -93,5 +141,16 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
Inheritance = {Colors = true}
|
||||
};
|
||||
}
|
||||
|
||||
private ContainerInfo BuildContainer()
|
||||
{
|
||||
return new ContainerInfo
|
||||
{
|
||||
Name = "MyFolder",
|
||||
Username = "BlahBlah1",
|
||||
Domain = "aklkskkksh8",
|
||||
Password = "qweraslkdjf87"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using mRemoteNGTests.TestHelpers;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Xml
|
||||
{
|
||||
public class ValidateXmlSchemas
|
||||
{
|
||||
private XmlConnectionsSerializer _serializer;
|
||||
private ConnectionTreeModel _connectionTreeModel;
|
||||
private ICryptographyProvider _cryptographyProvider;
|
||||
private XmlReaderSettings _xmlReaderSettings;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_connectionTreeModel = new ConnectionTreeModelBuilder().Build();
|
||||
_cryptographyProvider = new AeadCryptographyProvider();
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer26(
|
||||
_cryptographyProvider,
|
||||
_connectionTreeModel.RootNodes.OfType<RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
|
||||
new SaveFilter());
|
||||
_serializer = new XmlConnectionsSerializer(_cryptographyProvider, connectionNodeSerializer);
|
||||
_xmlReaderSettings = new XmlReaderSettings
|
||||
{
|
||||
ValidationType = ValidationType.Schema,
|
||||
ValidationFlags = XmlSchemaValidationFlags.ProcessInlineSchema |
|
||||
XmlSchemaValidationFlags.ProcessSchemaLocation |
|
||||
XmlSchemaValidationFlags.ReportValidationWarnings
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValidateSchema()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var xml = _serializer.Serialize(_connectionTreeModel);
|
||||
|
||||
var schemaFile = GetTargetPath("mremoteng_confcons_v2_6.xsd");
|
||||
_xmlReaderSettings.Schemas.Add("http://mremoteng.org", schemaFile);
|
||||
_xmlReaderSettings.ValidationEventHandler += (sender, args) =>
|
||||
{
|
||||
sb.AppendLine($"{args.Severity}: {args.Message}");
|
||||
};
|
||||
|
||||
using (var stream = GenerateStreamFromString(xml))
|
||||
{
|
||||
var reader = XmlReader.Create(stream, _xmlReaderSettings);
|
||||
while (reader.Read()) ;
|
||||
}
|
||||
|
||||
Assert.That(sb.ToString(), Is.Empty);
|
||||
}
|
||||
|
||||
public string GetTargetPath(string fileName, [CallerFilePath] string sourceFilePath = "")
|
||||
{
|
||||
const string debugOrRelease =
|
||||
#if DEBUG
|
||||
"Debug";
|
||||
#else
|
||||
"Release";
|
||||
#endif
|
||||
|
||||
const string normalOrPortable =
|
||||
#if PORTABLE
|
||||
" Portable";
|
||||
#else
|
||||
"";
|
||||
#endif
|
||||
var path = Path.GetDirectoryName(sourceFilePath);
|
||||
var filePath = $@"{path}\..\..\..\..\bin\{debugOrRelease}{normalOrPortable}\Schemas\{fileName}";
|
||||
return filePath;
|
||||
}
|
||||
|
||||
private Stream GenerateStreamFromString(string s)
|
||||
{
|
||||
var stream = new MemoryStream();
|
||||
var writer = new StreamWriter(stream);
|
||||
writer.Write(s);
|
||||
writer.Flush();
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
@@ -9,7 +10,7 @@ using mRemoteNG.Tree;
|
||||
using mRemoteNGTests.Properties;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Xml
|
||||
{
|
||||
public class XmlConnectionsDeserializerTests
|
||||
{
|
||||
@@ -104,6 +105,14 @@ namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers
|
||||
Assert.That(folder22.Inheritance.Username, Is.True);
|
||||
}
|
||||
|
||||
[TestCaseSource(typeof(XmlConnectionsDeserializerFixtureData), nameof(XmlConnectionsDeserializerFixtureData.FixtureParams))]
|
||||
public void ExpandedPropertyGetsDeserialized(Datagram testData)
|
||||
{
|
||||
Setup(testData.ConfCons, testData.Password);
|
||||
var folder1 = GetFolderNamed("Folder1", _connectionTreeModel.GetRecursiveChildList());
|
||||
Assert.That(folder1.IsExpanded, Is.True);
|
||||
}
|
||||
|
||||
private bool ContainsNodeNamed(string name, IEnumerable<ConnectionInfo> list)
|
||||
{
|
||||
return list.Any(node => node.Name == name);
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Xml.XPath;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
@@ -9,7 +10,7 @@ using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Xml
|
||||
{
|
||||
public class XmlConnectionsDocumentCompilerTests
|
||||
{
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
@@ -9,7 +10,7 @@ using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Xml
|
||||
{
|
||||
public class XmlConnectionsDocumentEncryptorTests
|
||||
{
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
@@ -10,7 +11,7 @@ using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Xml
|
||||
{
|
||||
public class XmlConnectionsSerializerTests
|
||||
{
|
||||
@@ -55,7 +56,7 @@ namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers
|
||||
[TestCase("Username", "")]
|
||||
[TestCase("Domain", "")]
|
||||
[TestCase("Password", "")]
|
||||
[TestCase("InheritAutomaticResize", "False")]
|
||||
[TestCase("InheritAutomaticResize", "false")]
|
||||
public void SerializerRespectsSaveFilterSettings(string attributeName, string expectedValue)
|
||||
{
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer26(
|
||||
@@ -2,13 +2,14 @@
|
||||
using System.Collections;
|
||||
using System.Xml.Linq;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.Factories;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Xml
|
||||
{
|
||||
public class XmlRootNodeSerializerTests
|
||||
{
|
||||
@@ -75,7 +76,7 @@ namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers
|
||||
{
|
||||
var element = _rootNodeSerializer.SerializeRootNodeInfo(_rootNodeInfo, _cryptographyProvider, fullFileEncryption);
|
||||
var attributeValue = element.Attribute(XName.Get("FullFileEncryption"))?.Value;
|
||||
Assert.That(attributeValue, Is.EqualTo(fullFileEncryption.ToString()));
|
||||
Assert.That(bool.Parse(attributeValue), Is.EqualTo(fullFileEncryption));
|
||||
}
|
||||
|
||||
[TestCase("", "ThisIsNotProtected")]
|
||||
@@ -1,4 +1,5 @@
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using System.Linq;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
@@ -26,7 +27,7 @@ namespace mRemoteNGTests.Config.Serializers
|
||||
{
|
||||
var model = CreateConnectionTreeModel();
|
||||
var dataTable = _dataTableSerializer.Serialize(model);
|
||||
Assert.That(dataTable.Rows.Count, Is.EqualTo(3));
|
||||
Assert.That(dataTable.Rows.Count, Is.EqualTo(model.GetRecursiveChildList().Count()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -8,7 +8,7 @@ using NUnit.Framework;
|
||||
|
||||
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
|
||||
private RemoteDesktopConnectionDeserializer _deserializer;
|
||||
@@ -18,9 +18,9 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
private const string ExpectedDomain = "myspecialdomain";
|
||||
private const string ExpectedGatewayHostname = "gatewayhostname.domain.com";
|
||||
private const int ExpectedPort = 9933;
|
||||
private const RdpColors ExpectedColors = RdpColors.Colors24Bit;
|
||||
private const RdpProtocol.RDPColors ExpectedColors = RdpProtocol.RDPColors.Colors24Bit;
|
||||
private const bool ExpectedBitmapCaching = false;
|
||||
private const RdpResolutions ExpectedResolutionMode = RdpResolutions.FitToWindow;
|
||||
private const RdpProtocol.RDPResolutions ExpectedResolutionMode = RdpProtocol.RDPResolutions.FitToWindow;
|
||||
private const bool ExpectedWallpaperDisplay = true;
|
||||
private const bool ExpectedThemesDisplay = true;
|
||||
private const bool ExpectedFontSmoothing = true;
|
||||
@@ -29,7 +29,7 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
private const bool ExpectedDriveRedirection = true;
|
||||
private const bool ExpectedPortRedirection = true;
|
||||
private const bool ExpectedPrinterRedirection = true;
|
||||
private const RdpSounds ExpectedSoundRedirection = RdpSounds.BringToThisComputer;
|
||||
private const RdpProtocol.RDPSounds ExpectedSoundRedirection = RdpProtocol.RDPSounds.BringToThisComputer;
|
||||
|
||||
|
||||
[OneTimeSetUp]
|
||||
|
||||
@@ -10,7 +10,7 @@ using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
{
|
||||
public class RemoteDesktopConnectionManager27DeserializerTests
|
||||
public class RemoteDesktopConnectionManager27DeserializerTests
|
||||
{
|
||||
private string _connectionFileContents;
|
||||
private RemoteDesktopConnectionManagerDeserializer _deserializer;
|
||||
@@ -23,20 +23,20 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
private const string ExpectedPassword = "passwordHere!";
|
||||
private const bool ExpectedUseConsoleSession = true;
|
||||
private const int ExpectedPort = 9933;
|
||||
private const RDGatewayUsageMethod ExpectedGatewayUsageMethod = RDGatewayUsageMethod.Always;
|
||||
private const RdpProtocol.RDGatewayUsageMethod ExpectedGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Always;
|
||||
private const string ExpectedGatewayHostname = "gatewayserverhost.innerdomain.net";
|
||||
private const string ExpectedGatewayUsername = "gatewayusername";
|
||||
private const string ExpectedGatewayDomain = "innerdomain";
|
||||
private const string ExpectedGatewayPassword = "gatewayPassword123";
|
||||
private const RdpResolutions ExpectedRdpResolution = RdpResolutions.FitToWindow;
|
||||
private const RdpColors ExpectedRdpColorDepth = RdpColors.Colors24Bit;
|
||||
private const RdpSounds ExpectedAudioRedirection = RdpSounds.DoNotPlay;
|
||||
private const RdpProtocol.RDPResolutions ExpectedRdpResolution = RdpProtocol.RDPResolutions.FitToWindow;
|
||||
private const RdpProtocol.RDPColors ExpectedRdpColorDepth = RdpProtocol.RDPColors.Colors24Bit;
|
||||
private const RdpProtocol.RDPSounds ExpectedAudioRedirection = RdpProtocol.RDPSounds.DoNotPlay;
|
||||
private const bool ExpectedKeyRedirection = true;
|
||||
private const bool ExpectedSmartcardRedirection = true;
|
||||
private const bool ExpectedDriveRedirection = true;
|
||||
private const bool ExpectedPortRedirection = true;
|
||||
private const bool ExpectedPrinterRedirection = true;
|
||||
private const RdpAuthenticationLevel ExpectedAuthLevel = RdpAuthenticationLevel.WarnOnFailedAuth;
|
||||
private const RdpProtocol.AuthenticationLevel ExpectedAuthLevel = RdpProtocol.AuthenticationLevel.WarnOnFailedAuth;
|
||||
|
||||
|
||||
[OneTimeSetUp]
|
||||
|
||||
@@ -10,7 +10,7 @@ using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
{
|
||||
public class RemoteDesktopConnectionManagerDeserializerTests
|
||||
public class RemoteDesktopConnectionManagerDeserializerTests
|
||||
{
|
||||
private string _connectionFileContents;
|
||||
private RemoteDesktopConnectionManagerDeserializer _deserializer;
|
||||
@@ -23,20 +23,20 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
private const string ExpectedPassword = "passwordHere!";
|
||||
private const bool ExpectedUseConsoleSession = true;
|
||||
private const int ExpectedPort = 9933;
|
||||
private const RDGatewayUsageMethod ExpectedGatewayUsageMethod = RDGatewayUsageMethod.Always;
|
||||
private const RdpProtocol.RDGatewayUsageMethod ExpectedGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Always;
|
||||
private const string ExpectedGatewayHostname = "gatewayserverhost.innerdomain.net";
|
||||
private const string ExpectedGatewayUsername = "gatewayusername";
|
||||
private const string ExpectedGatewayDomain = "innerdomain";
|
||||
private const string ExpectedGatewayPassword = "gatewayPassword123";
|
||||
private const RdpResolutions ExpectedRdpResolution = RdpResolutions.FitToWindow;
|
||||
private const RdpColors ExpectedRdpColorDepth = RdpColors.Colors24Bit;
|
||||
private const RdpSounds ExpectedAudioRedirection = RdpSounds.DoNotPlay;
|
||||
private const RdpProtocol.RDPResolutions ExpectedRdpResolution = RdpProtocol.RDPResolutions.FitToWindow;
|
||||
private const RdpProtocol.RDPColors ExpectedRdpColorDepth = RdpProtocol.RDPColors.Colors24Bit;
|
||||
private const RdpProtocol.RDPSounds ExpectedAudioRedirection = RdpProtocol.RDPSounds.DoNotPlay;
|
||||
private const bool ExpectedKeyRedirection = true;
|
||||
private const bool ExpectedSmartcardRedirection = true;
|
||||
private const bool ExpectedDriveRedirection = true;
|
||||
private const bool ExpectedPortRedirection = true;
|
||||
private const bool ExpectedPrinterRedirection = true;
|
||||
private const RdpAuthenticationLevel ExpectedAuthLevel = RdpAuthenticationLevel.AuthRequired;
|
||||
private const RdpProtocol.AuthenticationLevel ExpectedAuthLevel = RdpProtocol.AuthenticationLevel.AuthRequired;
|
||||
|
||||
|
||||
[OneTimeSetUp]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using mRemoteNG.Connection;
|
||||
using System;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Connection.Protocol.Http;
|
||||
using mRemoteNG.Connection.Protocol.ICA;
|
||||
@@ -12,7 +13,11 @@ namespace mRemoteNGTests.Connection
|
||||
public class AbstractConnectionInfoDataTests
|
||||
{
|
||||
#pragma warning disable 618
|
||||
private class TestAbstractConnectionInfoData : AbstractConnectionRecord {}
|
||||
private class TestAbstractConnectionInfoData : AbstractConnectionRecord {
|
||||
public TestAbstractConnectionInfoData() : base(Guid.NewGuid().ToString())
|
||||
{
|
||||
}
|
||||
}
|
||||
#pragma warning restore 618
|
||||
private TestAbstractConnectionInfoData _testAbstractConnectionInfoData;
|
||||
|
||||
@@ -160,7 +165,7 @@ namespace mRemoteNGTests.Connection
|
||||
{
|
||||
var wasCalled = false;
|
||||
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
|
||||
_testAbstractConnectionInfoData.RDPAuthenticationLevel = RdpAuthenticationLevel.AuthRequired;
|
||||
_testAbstractConnectionInfoData.RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.AuthRequired;
|
||||
Assert.That(wasCalled, Is.True);
|
||||
}
|
||||
|
||||
@@ -196,7 +201,7 @@ namespace mRemoteNGTests.Connection
|
||||
{
|
||||
var wasCalled = false;
|
||||
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
|
||||
_testAbstractConnectionInfoData.RDGatewayUsageMethod = RDGatewayUsageMethod.Always;
|
||||
_testAbstractConnectionInfoData.RDGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Always;
|
||||
Assert.That(wasCalled, Is.True);
|
||||
}
|
||||
|
||||
@@ -214,7 +219,7 @@ namespace mRemoteNGTests.Connection
|
||||
{
|
||||
var wasCalled = false;
|
||||
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
|
||||
_testAbstractConnectionInfoData.RDGatewayUseConnectionCredentials = RDGatewayUseConnectionCredentials.SmartCard;
|
||||
_testAbstractConnectionInfoData.RDGatewayUseConnectionCredentials = RdpProtocol.RDGatewayUseConnectionCredentials.SmartCard;
|
||||
Assert.That(wasCalled, Is.True);
|
||||
}
|
||||
|
||||
@@ -250,7 +255,7 @@ namespace mRemoteNGTests.Connection
|
||||
{
|
||||
var wasCalled = false;
|
||||
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
|
||||
_testAbstractConnectionInfoData.Resolution = RdpResolutions.Res1366x768;
|
||||
_testAbstractConnectionInfoData.Resolution = RdpProtocol.RDPResolutions.Res1366x768;
|
||||
Assert.That(wasCalled, Is.True);
|
||||
}
|
||||
|
||||
@@ -268,7 +273,7 @@ namespace mRemoteNGTests.Connection
|
||||
{
|
||||
var wasCalled = false;
|
||||
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
|
||||
_testAbstractConnectionInfoData.Colors = RdpColors.Colors16Bit;
|
||||
_testAbstractConnectionInfoData.Colors = RdpProtocol.RDPColors.Colors16Bit;
|
||||
Assert.That(wasCalled, Is.True);
|
||||
}
|
||||
|
||||
@@ -367,7 +372,7 @@ namespace mRemoteNGTests.Connection
|
||||
{
|
||||
var wasCalled = false;
|
||||
_testAbstractConnectionInfoData.PropertyChanged += (sender, args) => wasCalled = true;
|
||||
_testAbstractConnectionInfoData.RedirectSound = RdpSounds.DoNotPlay;
|
||||
_testAbstractConnectionInfoData.RedirectSound = RdpProtocol.RDPSounds.DoNotPlay;
|
||||
Assert.That(wasCalled, Is.True);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,22 +27,6 @@ namespace mRemoteNGTests.Connection
|
||||
_connectionInfo = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreatingConnectionInfoWithParentSetsTheParentProperty()
|
||||
{
|
||||
var container = new ContainerInfo();
|
||||
var connectionInfo = new ConnectionInfo(container);
|
||||
Assert.That(connectionInfo.Parent, Is.EqualTo(container));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreatingConnectionInfoWithParentAddsToTheParentsChildList()
|
||||
{
|
||||
var container = new ContainerInfo();
|
||||
var connectionInfo = new ConnectionInfo(container);
|
||||
Assert.That(container.Children, Does.Contain(connectionInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyCreatesMemberwiseCopy()
|
||||
{
|
||||
@@ -81,7 +65,7 @@ namespace mRemoteNGTests.Connection
|
||||
{
|
||||
var eventWasCalled = false;
|
||||
_connectionInfo.PropertyChanged += (sender, args) => eventWasCalled = true;
|
||||
_connectionInfo.OpenConnections.Add(new ProtocolSSH2(_connectionInfo));
|
||||
_connectionInfo.OpenConnections.Add(new ProtocolSSH2());
|
||||
Assert.That(eventWasCalled);
|
||||
}
|
||||
|
||||
@@ -90,7 +74,7 @@ namespace mRemoteNGTests.Connection
|
||||
{
|
||||
var nameOfModifiedProperty = "";
|
||||
_connectionInfo.PropertyChanged += (sender, args) => nameOfModifiedProperty = args.PropertyName;
|
||||
_connectionInfo.OpenConnections.Add(new ProtocolSSH2(_connectionInfo));
|
||||
_connectionInfo.OpenConnections.Add(new ProtocolSSH2());
|
||||
Assert.That(nameOfModifiedProperty, Is.EqualTo("OpenConnections"));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using mRemoteNG.App;
|
||||
using System.Collections.ObjectModel;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Tools;
|
||||
@@ -11,7 +12,7 @@ namespace mRemoteNGTests.Connection.Protocol
|
||||
{
|
||||
public class IntegratedProgramTests
|
||||
{
|
||||
private readonly ExternalTool _extTool = new ExternalTool
|
||||
private readonly ExternalTool _extTool = new ExternalTool
|
||||
{
|
||||
DisplayName = "notepad",
|
||||
FileName = @"%windir%\system32\notepad.exe",
|
||||
@@ -19,13 +20,13 @@ namespace mRemoteNGTests.Connection.Protocol
|
||||
TryIntegrate = true
|
||||
};
|
||||
|
||||
|
||||
[Test]
|
||||
public void CanStartExternalApp()
|
||||
{
|
||||
SetExternalToolList(_extTool);
|
||||
var connectionInfo = new ConnectionInfo { ExtApp = _extTool.DisplayName };
|
||||
var sut = new IntegratedProgram(connectionInfo);
|
||||
sut.InterfaceControl = BuildInterfaceControl(sut);
|
||||
var sut = new IntegratedProgram();
|
||||
sut.InterfaceControl = BuildInterfaceControl("notepad", sut);
|
||||
sut.Initialize();
|
||||
var appStarted = sut.Connect();
|
||||
sut.Disconnect();
|
||||
@@ -36,9 +37,8 @@ namespace mRemoteNGTests.Connection.Protocol
|
||||
public void ConnectingToExternalAppThatDoesntExistDoesNothing()
|
||||
{
|
||||
SetExternalToolList(_extTool);
|
||||
var connectionInfo = new ConnectionInfo { ExtApp = "doesntExist" };
|
||||
var sut = new IntegratedProgram(connectionInfo);
|
||||
sut.InterfaceControl = BuildInterfaceControl(sut);
|
||||
var sut = new IntegratedProgram();
|
||||
sut.InterfaceControl = BuildInterfaceControl("doesntExist", sut);
|
||||
var appInitialized = sut.Initialize();
|
||||
Assert.That(appInitialized, Is.False);
|
||||
}
|
||||
@@ -48,10 +48,11 @@ namespace mRemoteNGTests.Connection.Protocol
|
||||
Runtime.ExternalToolsService.ExternalTools = new FullyObservableCollection<ExternalTool> {externalTool};
|
||||
}
|
||||
|
||||
private InterfaceControl BuildInterfaceControl(ProtocolBase sut)
|
||||
private InterfaceControl BuildInterfaceControl(string extAppName, ProtocolBase sut)
|
||||
{
|
||||
var connectionWindow = new ConnectionWindow(new DockContent());
|
||||
return new InterfaceControl(connectionWindow, sut);
|
||||
var connectionInfo = new ConnectionInfo {ExtApp = extAppName};
|
||||
return new InterfaceControl(connectionWindow, sut, connectionInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Connection.Protocol.SSH;
|
||||
using mRemoteNG.Connection.Protocol.Telnet;
|
||||
@@ -22,9 +21,9 @@ namespace mRemoteNGTests.Connection.Protocol
|
||||
public void Setup()
|
||||
{
|
||||
_protocolList = new ProtocolList();
|
||||
_protocol1 = new ProtocolTelnet(new ConnectionInfo());
|
||||
_protocol2 = new ProtocolSSH2(new ConnectionInfo());
|
||||
_protocol3 = new ProtocolVNC(new ConnectionInfo());
|
||||
_protocol1 = new ProtocolTelnet();
|
||||
_protocol2 = new ProtocolSSH2();
|
||||
_protocol3 = new ProtocolVNC();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
|
||||
@@ -34,8 +34,9 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using NUnit.Extensions.Forms;
|
||||
|
||||
namespace NUnit.Extensions.Forms
|
||||
namespace mRemoteNGTests
|
||||
{
|
||||
/// <summary>
|
||||
/// A ControlTester for testing List Views.
|
||||
|
||||
@@ -7,17 +7,52 @@ namespace mRemoteNGTests.TestHelpers
|
||||
{
|
||||
public class ConnectionTreeModelBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds a tree which looks like:
|
||||
/// Root
|
||||
/// |- folder1
|
||||
/// | |- con1
|
||||
/// |- con2
|
||||
/// |- folder2
|
||||
/// |- folder3
|
||||
/// |- con3
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ConnectionTreeModel Build()
|
||||
{
|
||||
var model = new ConnectionTreeModel();
|
||||
var root = new RootNodeInfo(RootNodeType.Connection);
|
||||
var folder1 = new ContainerInfo { Name = "folder1", Username = "user1", Domain = "domain1", Password = "password1" };
|
||||
var folder2 = new ContainerInfo { Name = "folder2", Username = "user2", Domain = "domain2", Password = "password2" };
|
||||
var folder3 = new ContainerInfo
|
||||
{
|
||||
Name = "folder3",
|
||||
Inheritance =
|
||||
{
|
||||
Username = true,
|
||||
Domain = true,
|
||||
Password = true
|
||||
}
|
||||
};
|
||||
var con1 = new ConnectionInfo { Name = "Con1", Username = "user1", Domain = "domain1", Password = "password1" };
|
||||
var con2 = new ConnectionInfo { Name = "Con2", Username = "user2", Domain = "domain2", Password = "password2" };
|
||||
var con3 = new ContainerInfo
|
||||
{
|
||||
Name = "con3",
|
||||
Inheritance =
|
||||
{
|
||||
Username = true,
|
||||
Domain = true,
|
||||
Password = true
|
||||
}
|
||||
};
|
||||
|
||||
root.AddChild(folder1);
|
||||
root.AddChild(con2);
|
||||
folder1.AddChild(con1);
|
||||
root.AddChild(folder2);
|
||||
folder2.AddChild(folder3);
|
||||
folder3.AddChild(con3);
|
||||
model.AddRootNode(root);
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Tools
|
||||
{
|
||||
public class MaybeTests
|
||||
public class OptionalTests
|
||||
{
|
||||
[Test]
|
||||
public void MaybeReturnsEmptyListWhenGivenNullValue()
|
||||
{
|
||||
var sut = new Maybe<object>(null);
|
||||
var sut = new Optional<object>(null);
|
||||
Assert.That(sut, Is.Empty);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace mRemoteNGTests.Tools
|
||||
public void MaybeReturnsValueIfNotNull()
|
||||
{
|
||||
var expected = new object();
|
||||
var sut = new Maybe<object>(expected);
|
||||
var sut = new Optional<object>(expected);
|
||||
Assert.That(sut, Has.Member(expected));
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
<Compile Include="Config\DataProviders\FileBackupCreatorTests.cs" />
|
||||
<Compile Include="Config\DataProviders\FileDataProviderTests.cs" />
|
||||
<Compile Include="Config\DataProviders\FileDataProviderWithRollingBackupTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\Xml\ValidateXmlSchemas.cs" />
|
||||
<Compile Include="Config\Serializers\DataTableDeserializerTests.cs" />
|
||||
<Compile Include="Config\CredentialHarvesterTests.cs" />
|
||||
<Compile Include="Config\CredentialRecordLoaderTests.cs" />
|
||||
@@ -121,21 +122,21 @@
|
||||
<Compile Include="Config\Serializers\CredentialProviderSerializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\CredentialSerializers\XmlCredentialPasswordDecryptorDecoratorTests.cs" />
|
||||
<Compile Include="Config\Serializers\CredentialSerializers\XmlCredentialPasswordEncryptorDecoratorTests.cs" />
|
||||
<Compile Include="Config\Serializers\MiscSerializers\CsvConnectionsDeserializerMremotengFormatTests.cs" />
|
||||
<Compile Include="Config\Serializers\MiscSerializers\CsvConnectionsSerializerMremotengFormatTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\Csv\CsvConnectionsDeserializerMremotengFormatTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\Csv\CsvConnectionsSerializerMremotengFormatTests.cs" />
|
||||
<Compile Include="Config\Serializers\DataTableSerializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\MiscSerializers\PortScanDeserializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\MiscSerializers\PuttyConnectionManagerDeserializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\XmlConnectionsDeserializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\Xml\XmlConnectionsDeserializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\MiscSerializers\RemoteDesktopConnectionDeserializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\MiscSerializers\RemoteDesktopConnectionManager27DeserializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\MiscSerializers\RemoteDesktopConnectionManagerDeserializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\XmlConnectionsDocumentCompilerTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\XmlConnectionsDocumentEncryptorTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\XmlConnectionsSerializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\Xml\XmlConnectionsDocumentCompilerTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\Xml\XmlConnectionsDocumentEncryptorTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\Xml\XmlConnectionsSerializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\CredentialSerializers\XmlCredentialRecordDeserializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\CredentialSerializers\XmlCredentialSerializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\XmlRootNodeSerializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\ConnectionSerializers\Xml\XmlRootNodeSerializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\Versioning\SqlVersion22To23UpgraderTests.cs" />
|
||||
<Compile Include="Config\Serializers\Versioning\SqlVersion23To24UpgraderTests.cs" />
|
||||
<Compile Include="Config\Serializers\Versioning\SqlVersion24To25UpgraderTests.cs" />
|
||||
@@ -173,7 +174,7 @@
|
||||
<Compile Include="TestHelpers\FileTestHelpers.cs" />
|
||||
<Compile Include="Tools\ExternalToolsArgumentParserTests.cs" />
|
||||
<Compile Include="Tools\FullyObservableCollectionTests.cs" />
|
||||
<Compile Include="Tools\MaybeTests.cs" />
|
||||
<Compile Include="Tools\OptionalTests.cs" />
|
||||
<Compile Include="Tree\ClickHandlers\TreeNodeCompositeClickHandlerTests.cs" />
|
||||
<Compile Include="Tree\ConnectionTreeDragAndDropHandlerTests.cs" />
|
||||
<Compile Include="Tree\ConnectionTreeModelTests.cs" />
|
||||
|
||||
@@ -4,6 +4,8 @@ using System.Windows.Forms;
|
||||
using mRemoteNG.Config.Connections;
|
||||
using mRemoteNG.Config.DataProviders;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Csv;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace mRemoteNG.Config.Connections
|
||||
/// The previous <see cref="ConnectionTreeModel"/> that is being
|
||||
/// unloaded.
|
||||
/// </summary>
|
||||
public Maybe<ConnectionTreeModel> PreviousConnectionTreeModel { get; }
|
||||
public Optional<ConnectionTreeModel> PreviousConnectionTreeModel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True if the previous <see cref="ConnectionTreeModel"/> was loaded from
|
||||
@@ -37,7 +37,7 @@ namespace mRemoteNG.Config.Connections
|
||||
public string NewSourcePath { get; }
|
||||
|
||||
public ConnectionsLoadedEventArgs(
|
||||
Maybe<ConnectionTreeModel> previousTreeModelModel, ConnectionTreeModel newTreeModelModel,
|
||||
Optional<ConnectionTreeModel> previousTreeModelModel, ConnectionTreeModel newTreeModelModel,
|
||||
bool previousSourceWasDatabase, bool newSourceIsDatabase,
|
||||
string newSourcePath)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Config.DataProviders;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Csv;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Tree;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
using System.IO;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
|
||||
namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Config.DataProviders;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.Factories;
|
||||
using mRemoteNG.Tree;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Linq;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Config.DataProviders;
|
||||
using mRemoteNG.Config.Serializers.MiscSerializers;
|
||||
using mRemoteNG.Config.Serializers.Csv;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Messages;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Config.DataProviders;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Config.Serializers.Xml;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Messages;
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@ using mRemoteNG.Container;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
|
||||
namespace mRemoteNG.Config.Serializers.MiscSerializers
|
||||
namespace mRemoteNG.Config.Serializers.Csv
|
||||
{
|
||||
public class CsvConnectionsDeserializerMremotengFormat : IDeserializer<string, ConnectionTreeModel>
|
||||
public class CsvConnectionsDeserializerMremotengFormat : IDeserializer<string, ConnectionTreeModel>
|
||||
{
|
||||
public ConnectionTreeModel Deserialize(string serializedData)
|
||||
{
|
||||
var root = new RootNodeInfo(RootNodeType.Connection);
|
||||
|
||||
var lines = serializedData.Split(new []{"\r\n", "\r", "\n"}, StringSplitOptions.RemoveEmptyEntries);
|
||||
var csvHeaders = new List<string>();
|
||||
// used to map a connectioninfo to it's parent's GUID
|
||||
var parentMapping = new Dictionary<ConnectionInfo, string>();
|
||||
|
||||
for (var lineNumber = 0; lineNumber < lines.Length; lineNumber++)
|
||||
{
|
||||
@@ -30,39 +30,58 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
|
||||
else
|
||||
{
|
||||
var connectionInfo = ParseConnectionInfo(csvHeaders, line);
|
||||
var folder = ParseConnectionFolder(line[csvHeaders.IndexOf("Folder")], root);
|
||||
folder.AddChild(connectionInfo);
|
||||
parentMapping.Add(connectionInfo, line[csvHeaders.IndexOf("Parent")]);
|
||||
}
|
||||
}
|
||||
|
||||
var root = CreateTreeStructure(parentMapping);
|
||||
var connectionTreeModel = new ConnectionTreeModel();
|
||||
connectionTreeModel.AddRootNode(root);
|
||||
return connectionTreeModel;
|
||||
}
|
||||
|
||||
private ContainerInfo ParseConnectionFolder(string folderString, ContainerInfo rootContainer)
|
||||
private RootNodeInfo CreateTreeStructure(Dictionary<ConnectionInfo, string> parentMapping)
|
||||
{
|
||||
var containerNames = folderString.Split('\\');
|
||||
var parentContainer = rootContainer;
|
||||
var root = new RootNodeInfo(RootNodeType.Connection);
|
||||
|
||||
for (var i = containerNames.Length - 2; i >= 0; i--)
|
||||
foreach (var node in parentMapping)
|
||||
{
|
||||
var containerName = containerNames[i];
|
||||
var container = parentContainer.Children.OfType<ContainerInfo>().FirstOrDefault(info => info.Name == containerName);
|
||||
if (container == null)
|
||||
// no parent mapped, add to root
|
||||
if (string.IsNullOrEmpty(node.Value))
|
||||
root.AddChild(node.Key);
|
||||
|
||||
// search for parent in the list by GUID
|
||||
var parent = parentMapping
|
||||
.Keys
|
||||
.OfType<ContainerInfo>()
|
||||
.FirstOrDefault(info => info.ConstantID == node.Value);
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
container = new ContainerInfo {Name = containerName};
|
||||
parentContainer.AddChild(container);
|
||||
parent.AddChild(node.Key);
|
||||
}
|
||||
else
|
||||
{
|
||||
root.AddChild(node.Key);
|
||||
}
|
||||
parentContainer = container;
|
||||
}
|
||||
|
||||
return parentContainer;
|
||||
return root;
|
||||
}
|
||||
|
||||
private ConnectionInfo ParseConnectionInfo(IList<string> headers, string[] connectionCsv)
|
||||
{
|
||||
var connectionRecord = new ConnectionInfo();
|
||||
var nodeType = headers.Contains("NodeType")
|
||||
? (TreeNodeType)Enum.Parse(typeof(TreeNodeType), connectionCsv[headers.IndexOf("NodeType")], true)
|
||||
: TreeNodeType.Connection;
|
||||
|
||||
var nodeId = headers.Contains("Id")
|
||||
? connectionCsv[headers.IndexOf("Id")]
|
||||
: Guid.NewGuid().ToString();
|
||||
|
||||
var connectionRecord = nodeType == TreeNodeType.Connection
|
||||
? new ConnectionInfo(nodeId)
|
||||
: new ContainerInfo(nodeId);
|
||||
|
||||
connectionRecord.Name = headers.Contains("Name") ? connectionCsv[headers.IndexOf("Name")] : "";
|
||||
connectionRecord.Description = headers.Contains("Description") ? connectionCsv[headers.IndexOf("Description")] : "";
|
||||
@@ -131,21 +150,21 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
|
||||
|
||||
if (headers.Contains("RDPAuthenticationLevel"))
|
||||
{
|
||||
RdpAuthenticationLevel value;
|
||||
RdpProtocol.AuthenticationLevel value;
|
||||
if (Enum.TryParse(connectionCsv[headers.IndexOf("RDPAuthenticationLevel")], out value))
|
||||
connectionRecord.RDPAuthenticationLevel = value;
|
||||
}
|
||||
|
||||
if (headers.Contains("Colors"))
|
||||
{
|
||||
RdpColors value;
|
||||
RdpProtocol.RDPColors value;
|
||||
if (Enum.TryParse(connectionCsv[headers.IndexOf("Colors")], out value))
|
||||
connectionRecord.Colors = value;
|
||||
}
|
||||
|
||||
if (headers.Contains("Resolution"))
|
||||
{
|
||||
RdpResolutions value;
|
||||
RdpProtocol.RDPResolutions value;
|
||||
if (Enum.TryParse(connectionCsv[headers.IndexOf("Resolution")], out value))
|
||||
connectionRecord.Resolution = value;
|
||||
}
|
||||
@@ -222,7 +241,7 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
|
||||
|
||||
if (headers.Contains("RedirectSound"))
|
||||
{
|
||||
RdpSounds value;
|
||||
RdpProtocol.RDPSounds value;
|
||||
if (Enum.TryParse(connectionCsv[headers.IndexOf("RedirectSound")], out value))
|
||||
connectionRecord.RedirectSound = value;
|
||||
}
|
||||
@@ -292,14 +311,14 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
|
||||
|
||||
if (headers.Contains("RDGatewayUsageMethod"))
|
||||
{
|
||||
RDGatewayUsageMethod value;
|
||||
RdpProtocol.RDGatewayUsageMethod value;
|
||||
if (Enum.TryParse(connectionCsv[headers.IndexOf("RDGatewayUsageMethod")], out value))
|
||||
connectionRecord.RDGatewayUsageMethod = value;
|
||||
}
|
||||
|
||||
if (headers.Contains("RDGatewayUseConnectionCredentials"))
|
||||
{
|
||||
RDGatewayUseConnectionCredentials value;
|
||||
RdpProtocol.RDGatewayUseConnectionCredentials value;
|
||||
if (Enum.TryParse(connectionCsv[headers.IndexOf("RDGatewayUseConnectionCredentials")], out value))
|
||||
connectionRecord.RDGatewayUseConnectionCredentials = value;
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Credential;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
|
||||
namespace mRemoteNG.Config.Serializers.Csv
|
||||
{
|
||||
public class CsvConnectionsSerializerMremotengFormat : ISerializer<ConnectionInfo,string>
|
||||
{
|
||||
private readonly SaveFilter _saveFilter;
|
||||
private readonly ICredentialRepositoryList _credentialRepositoryList;
|
||||
|
||||
|
||||
public CsvConnectionsSerializerMremotengFormat(SaveFilter saveFilter, ICredentialRepositoryList credentialRepositoryList)
|
||||
{
|
||||
saveFilter.ThrowIfNull(nameof(saveFilter));
|
||||
credentialRepositoryList.ThrowIfNull(nameof(credentialRepositoryList));
|
||||
|
||||
_saveFilter = saveFilter;
|
||||
_credentialRepositoryList = credentialRepositoryList;
|
||||
}
|
||||
|
||||
public string Serialize(ConnectionTreeModel connectionTreeModel)
|
||||
{
|
||||
connectionTreeModel.ThrowIfNull(nameof(connectionTreeModel));
|
||||
|
||||
var rootNode = connectionTreeModel.RootNodes.First(node => node is RootNodeInfo);
|
||||
return Serialize(rootNode);
|
||||
}
|
||||
|
||||
public string Serialize(ConnectionInfo serializationTarget)
|
||||
{
|
||||
serializationTarget.ThrowIfNull(nameof(serializationTarget));
|
||||
var sb = new StringBuilder();
|
||||
|
||||
WriteCsvHeader(sb);
|
||||
SerializeNodesRecursive(serializationTarget, sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private void WriteCsvHeader(StringBuilder sb)
|
||||
{
|
||||
sb.Append("Name;Id;Parent;NodeType;Description;Icon;Panel;");
|
||||
if (_saveFilter.SaveUsername)
|
||||
sb.Append("Username;");
|
||||
if (_saveFilter.SavePassword)
|
||||
sb.Append("Password;");
|
||||
if (_saveFilter.SaveDomain)
|
||||
sb.Append("Domain;");
|
||||
sb.Append("Hostname;Protocol;PuttySession;Port;ConnectToConsole;UseCredSsp;RenderingEngine;ICAEncryptionStrength;RDPAuthenticationLevel;LoadBalanceInfo;Colors;Resolution;AutomaticResize;DisplayWallpaper;DisplayThemes;EnableFontSmoothing;EnableDesktopComposition;CacheBitmaps;RedirectDiskDrives;RedirectPorts;RedirectPrinters;RedirectSmartCards;RedirectSound;RedirectKeys;PreExtApp;PostExtApp;MacAddress;UserField;ExtApp;VNCCompression;VNCEncoding;VNCAuthMode;VNCProxyType;VNCProxyIP;VNCProxyPort;VNCProxyUsername;VNCProxyPassword;VNCColors;VNCSmartSizeMode;VNCViewOnly;RDGatewayUsageMethod;RDGatewayHostname;RDGatewayUseConnectionCredentials;RDGatewayUsername;RDGatewayPassword;RDGatewayDomain;");
|
||||
if (_saveFilter.SaveInheritance)
|
||||
sb.Append("InheritCacheBitmaps;InheritColors;InheritDescription;InheritDisplayThemes;InheritDisplayWallpaper;InheritEnableFontSmoothing;InheritEnableDesktopComposition;InheritDomain;InheritIcon;InheritPanel;InheritPassword;InheritPort;InheritProtocol;InheritPuttySession;InheritRedirectDiskDrives;InheritRedirectKeys;InheritRedirectPorts;InheritRedirectPrinters;InheritRedirectSmartCards;InheritRedirectSound;InheritResolution;InheritAutomaticResize;InheritUseConsoleSession;InheritUseCredSsp;InheritRenderingEngine;InheritUsername;InheritICAEncryptionStrength;InheritRDPAuthenticationLevel;InheritLoadBalanceInfo;InheritPreExtApp;InheritPostExtApp;InheritMacAddress;InheritUserField;InheritExtApp;InheritVNCCompression;InheritVNCEncoding;InheritVNCAuthMode;InheritVNCProxyType;InheritVNCProxyIP;InheritVNCProxyPort;InheritVNCProxyUsername;InheritVNCProxyPassword;InheritVNCColors;InheritVNCSmartSizeMode;InheritVNCViewOnly;InheritRDGatewayUsageMethod;InheritRDGatewayHostname;InheritRDGatewayUseConnectionCredentials;InheritRDGatewayUsername;InheritRDGatewayPassword;InheritRDGatewayDomain;InheritRDPAlertIdleTimeout;InheritRDPMinutesToIdleTimeout;InheritSoundQuality");
|
||||
}
|
||||
|
||||
private void SerializeNodesRecursive(ConnectionInfo node, StringBuilder sb)
|
||||
{
|
||||
var nodeAsContainer = node as ContainerInfo;
|
||||
if (nodeAsContainer != null)
|
||||
{
|
||||
foreach (var child in nodeAsContainer.Children)
|
||||
{
|
||||
SerializeNodesRecursive(child, sb);
|
||||
}
|
||||
}
|
||||
|
||||
// dont serialize the root node
|
||||
if (node is RootNodeInfo)
|
||||
return;
|
||||
|
||||
SerializeConnectionInfo(node, sb);
|
||||
}
|
||||
|
||||
private void SerializeConnectionInfo(ConnectionInfo con, StringBuilder sb)
|
||||
{
|
||||
sb.AppendLine();
|
||||
sb.Append(string.Join(";",
|
||||
CleanStringForCsv(con.Name),
|
||||
CleanStringForCsv(con.ConstantID),
|
||||
CleanStringForCsv(con.Parent?.ConstantID ?? ""),
|
||||
CleanStringForCsv(con.GetTreeNodeType()),
|
||||
CleanStringForCsv(con.Description),
|
||||
CleanStringForCsv(con.Icon),
|
||||
CleanStringForCsv(con.Panel)))
|
||||
.Append(";");
|
||||
|
||||
if (_saveFilter.SaveUsername)
|
||||
sb.Append($"{CleanStringForCsv(con.Username)};");
|
||||
|
||||
if (_saveFilter.SavePassword)
|
||||
sb.Append($"{CleanStringForCsv(con.Password)};");
|
||||
|
||||
if (_saveFilter.SaveDomain)
|
||||
sb.Append($"{CleanStringForCsv(con.Domain)};");
|
||||
|
||||
sb.Append(string.Join(";",
|
||||
CleanStringForCsv(con.Hostname),
|
||||
CleanStringForCsv(con.Protocol),
|
||||
CleanStringForCsv(con.PuttySession),
|
||||
CleanStringForCsv(con.Port),
|
||||
CleanStringForCsv(con.UseConsoleSession),
|
||||
CleanStringForCsv(con.UseCredSsp),
|
||||
CleanStringForCsv(con.RenderingEngine),
|
||||
CleanStringForCsv(con.ICAEncryptionStrength),
|
||||
CleanStringForCsv(con.RDPAuthenticationLevel),
|
||||
CleanStringForCsv(con.LoadBalanceInfo),
|
||||
CleanStringForCsv(con.Colors),
|
||||
CleanStringForCsv(con.Resolution),
|
||||
CleanStringForCsv(con.AutomaticResize),
|
||||
CleanStringForCsv(con.DisplayWallpaper),
|
||||
CleanStringForCsv(con.DisplayThemes),
|
||||
CleanStringForCsv(con.EnableFontSmoothing),
|
||||
CleanStringForCsv(con.EnableDesktopComposition),
|
||||
CleanStringForCsv(con.CacheBitmaps),
|
||||
CleanStringForCsv(con.RedirectDiskDrives),
|
||||
CleanStringForCsv(con.RedirectPorts),
|
||||
CleanStringForCsv(con.RedirectPrinters),
|
||||
CleanStringForCsv(con.RedirectSmartCards),
|
||||
CleanStringForCsv(con.RedirectSound),
|
||||
CleanStringForCsv(con.RedirectKeys),
|
||||
CleanStringForCsv(con.PreExtApp),
|
||||
CleanStringForCsv(con.PostExtApp),
|
||||
CleanStringForCsv(con.MacAddress),
|
||||
CleanStringForCsv(con.UserField),
|
||||
CleanStringForCsv(con.ExtApp),
|
||||
CleanStringForCsv(con.VNCCompression),
|
||||
CleanStringForCsv(con.VNCEncoding),
|
||||
CleanStringForCsv(con.VNCAuthMode),
|
||||
CleanStringForCsv(con.VNCProxyType),
|
||||
CleanStringForCsv(con.VNCProxyIP),
|
||||
CleanStringForCsv(con.VNCProxyPort),
|
||||
CleanStringForCsv(con.VNCProxyUsername),
|
||||
CleanStringForCsv(con.VNCProxyPassword),
|
||||
CleanStringForCsv(con.VNCColors),
|
||||
CleanStringForCsv(con.VNCSmartSizeMode),
|
||||
CleanStringForCsv(con.VNCViewOnly),
|
||||
CleanStringForCsv(con.RDGatewayUsageMethod),
|
||||
CleanStringForCsv(con.RDGatewayHostname),
|
||||
CleanStringForCsv(con.RDGatewayUseConnectionCredentials),
|
||||
CleanStringForCsv(con.RDGatewayUsername),
|
||||
CleanStringForCsv(con.RDGatewayPassword),
|
||||
CleanStringForCsv(con.RDGatewayDomain)))
|
||||
.Append(";");
|
||||
|
||||
|
||||
if (!_saveFilter.SaveInheritance)
|
||||
return;
|
||||
|
||||
sb.Append(string.Join(";",
|
||||
con.Inheritance.CacheBitmaps,
|
||||
con.Inheritance.Colors,
|
||||
con.Inheritance.Description,
|
||||
con.Inheritance.DisplayThemes,
|
||||
con.Inheritance.DisplayWallpaper,
|
||||
con.Inheritance.EnableFontSmoothing,
|
||||
con.Inheritance.EnableDesktopComposition,
|
||||
con.Inheritance.Domain,
|
||||
con.Inheritance.Icon,
|
||||
con.Inheritance.Panel,
|
||||
con.Inheritance.Password,
|
||||
con.Inheritance.Port,
|
||||
con.Inheritance.Protocol,
|
||||
con.Inheritance.PuttySession,
|
||||
con.Inheritance.RedirectDiskDrives,
|
||||
con.Inheritance.RedirectKeys,
|
||||
con.Inheritance.RedirectPorts,
|
||||
con.Inheritance.RedirectPrinters,
|
||||
con.Inheritance.RedirectSmartCards,
|
||||
con.Inheritance.RedirectSound,
|
||||
con.Inheritance.Resolution,
|
||||
con.Inheritance.AutomaticResize,
|
||||
con.Inheritance.UseConsoleSession,
|
||||
con.Inheritance.UseCredSsp,
|
||||
con.Inheritance.RenderingEngine,
|
||||
con.Inheritance.Username,
|
||||
con.Inheritance.ICAEncryptionStrength,
|
||||
con.Inheritance.RDPAuthenticationLevel,
|
||||
con.Inheritance.LoadBalanceInfo,
|
||||
con.Inheritance.PreExtApp,
|
||||
con.Inheritance.PostExtApp,
|
||||
con.Inheritance.MacAddress,
|
||||
con.Inheritance.UserField,
|
||||
con.Inheritance.ExtApp,
|
||||
con.Inheritance.VNCCompression,
|
||||
con.Inheritance.VNCEncoding,
|
||||
con.Inheritance.VNCAuthMode,
|
||||
con.Inheritance.VNCProxyType,
|
||||
con.Inheritance.VNCProxyIP,
|
||||
con.Inheritance.VNCProxyPort,
|
||||
con.Inheritance.VNCProxyUsername,
|
||||
con.Inheritance.VNCProxyPassword,
|
||||
con.Inheritance.VNCColors,
|
||||
con.Inheritance.VNCSmartSizeMode,
|
||||
con.Inheritance.VNCViewOnly,
|
||||
con.Inheritance.RDGatewayUsageMethod,
|
||||
con.Inheritance.RDGatewayHostname,
|
||||
con.Inheritance.RDGatewayUseConnectionCredentials,
|
||||
con.Inheritance.RDGatewayUsername,
|
||||
con.Inheritance.RDGatewayPassword,
|
||||
con.Inheritance.RDGatewayDomain,
|
||||
con.Inheritance.RDPAlertIdleTimeout,
|
||||
con.Inheritance.RDPMinutesToIdleTimeout,
|
||||
con.Inheritance.SoundQuality));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove text that is unsafe for use in CSV files
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
private string CleanStringForCsv(object text)
|
||||
{
|
||||
return text.ToString().Replace(";", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Serializers
|
||||
namespace mRemoteNG.Config.Serializers.Xml
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class XmlConnectionNodeSerializer26 : ISerializer<ConnectionInfo,XElement>
|
||||
@@ -43,7 +42,7 @@ namespace mRemoteNG.Config.Serializers
|
||||
element.Add(new XAttribute("Name", connectionInfo.Name));
|
||||
element.Add(new XAttribute("Type", connectionInfo.GetTreeNodeType().ToString()));
|
||||
if (nodeAsContainer != null)
|
||||
element.Add(new XAttribute("Expanded", nodeAsContainer.IsExpanded.ToString()));
|
||||
element.Add(new XAttribute("Expanded", nodeAsContainer.IsExpanded.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("Descr", connectionInfo.Description));
|
||||
element.Add(new XAttribute("Icon", connectionInfo.Icon));
|
||||
element.Add(new XAttribute("Panel", connectionInfo.Panel));
|
||||
@@ -66,30 +65,30 @@ namespace mRemoteNG.Config.Serializers
|
||||
element.Add(new XAttribute("Protocol", connectionInfo.Protocol));
|
||||
element.Add(new XAttribute("PuttySession", connectionInfo.PuttySession));
|
||||
element.Add(new XAttribute("Port", connectionInfo.Port));
|
||||
element.Add(new XAttribute("ConnectToConsole", connectionInfo.UseConsoleSession.ToString()));
|
||||
element.Add(new XAttribute("UseCredSsp", connectionInfo.UseCredSsp.ToString()));
|
||||
element.Add(new XAttribute("ConnectToConsole", connectionInfo.UseConsoleSession.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("UseCredSsp", connectionInfo.UseCredSsp.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("RenderingEngine", connectionInfo.RenderingEngine));
|
||||
element.Add(new XAttribute("ICAEncryptionStrength", connectionInfo.ICAEncryptionStrength));
|
||||
element.Add(new XAttribute("RDPAuthenticationLevel", connectionInfo.RDPAuthenticationLevel));
|
||||
element.Add(new XAttribute("RDPMinutesToIdleTimeout", connectionInfo.RDPMinutesToIdleTimeout));
|
||||
element.Add(new XAttribute("RDPAlertIdleTimeout", connectionInfo.RDPAlertIdleTimeout));
|
||||
element.Add(new XAttribute("RDPAlertIdleTimeout", connectionInfo.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("LoadBalanceInfo", connectionInfo.LoadBalanceInfo));
|
||||
element.Add(new XAttribute("Colors", connectionInfo.Colors));
|
||||
element.Add(new XAttribute("Resolution", connectionInfo.Resolution));
|
||||
element.Add(new XAttribute("AutomaticResize", connectionInfo.AutomaticResize.ToString()));
|
||||
element.Add(new XAttribute("DisplayWallpaper", connectionInfo.DisplayWallpaper.ToString()));
|
||||
element.Add(new XAttribute("DisplayThemes", connectionInfo.DisplayThemes.ToString()));
|
||||
element.Add(new XAttribute("EnableFontSmoothing", connectionInfo.EnableFontSmoothing.ToString()));
|
||||
element.Add(new XAttribute("EnableDesktopComposition", connectionInfo.EnableDesktopComposition.ToString()));
|
||||
element.Add(new XAttribute("CacheBitmaps", connectionInfo.CacheBitmaps.ToString()));
|
||||
element.Add(new XAttribute("RedirectDiskDrives", connectionInfo.RedirectDiskDrives.ToString()));
|
||||
element.Add(new XAttribute("RedirectPorts", connectionInfo.RedirectPorts.ToString()));
|
||||
element.Add(new XAttribute("RedirectPrinters", connectionInfo.RedirectPrinters.ToString()));
|
||||
element.Add(new XAttribute("RedirectSmartCards", connectionInfo.RedirectSmartCards.ToString()));
|
||||
element.Add(new XAttribute("AutomaticResize", connectionInfo.AutomaticResize.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("DisplayWallpaper", connectionInfo.DisplayWallpaper.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("DisplayThemes", connectionInfo.DisplayThemes.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("EnableFontSmoothing", connectionInfo.EnableFontSmoothing.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("EnableDesktopComposition", connectionInfo.EnableDesktopComposition.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("CacheBitmaps", connectionInfo.CacheBitmaps.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("RedirectDiskDrives", connectionInfo.RedirectDiskDrives.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("RedirectPorts", connectionInfo.RedirectPorts.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("RedirectPrinters", connectionInfo.RedirectPrinters.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("RedirectSmartCards", connectionInfo.RedirectSmartCards.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("RedirectSound", connectionInfo.RedirectSound.ToString()));
|
||||
element.Add(new XAttribute("SoundQuality", connectionInfo.SoundQuality.ToString()));
|
||||
element.Add(new XAttribute("RedirectKeys", connectionInfo.RedirectKeys.ToString()));
|
||||
element.Add(new XAttribute("Connected", (connectionInfo.OpenConnections.Count > 0).ToString()));
|
||||
element.Add(new XAttribute("RedirectKeys", connectionInfo.RedirectKeys.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("Connected", (connectionInfo.OpenConnections.Count > 0).ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("PreExtApp", connectionInfo.PreExtApp));
|
||||
element.Add(new XAttribute("PostExtApp", connectionInfo.PostExtApp));
|
||||
element.Add(new XAttribute("MacAddress", connectionInfo.MacAddress));
|
||||
@@ -113,7 +112,7 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
element.Add(new XAttribute("VNCColors", connectionInfo.VNCColors));
|
||||
element.Add(new XAttribute("VNCSmartSizeMode", connectionInfo.VNCSmartSizeMode));
|
||||
element.Add(new XAttribute("VNCViewOnly", connectionInfo.VNCViewOnly.ToString()));
|
||||
element.Add(new XAttribute("VNCViewOnly", connectionInfo.VNCViewOnly.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("RDGatewayUsageMethod", connectionInfo.RDGatewayUsageMethod));
|
||||
element.Add(new XAttribute("RDGatewayHostname", connectionInfo.RDGatewayHostname));
|
||||
element.Add(new XAttribute("RDGatewayUseConnectionCredentials", connectionInfo.RDGatewayUseConnectionCredentials));
|
||||
@@ -136,117 +135,118 @@ namespace mRemoteNG.Config.Serializers
|
||||
{
|
||||
if (_saveFilter.SaveInheritance)
|
||||
{
|
||||
element.Add(new XAttribute("InheritCacheBitmaps", connectionInfo.Inheritance.CacheBitmaps.ToString()));
|
||||
element.Add(new XAttribute("InheritColors", connectionInfo.Inheritance.Colors.ToString()));
|
||||
element.Add(new XAttribute("InheritDescription", connectionInfo.Inheritance.Description.ToString()));
|
||||
element.Add(new XAttribute("InheritDisplayThemes", connectionInfo.Inheritance.DisplayThemes.ToString()));
|
||||
element.Add(new XAttribute("InheritDisplayWallpaper", connectionInfo.Inheritance.DisplayWallpaper.ToString()));
|
||||
element.Add(new XAttribute("InheritEnableFontSmoothing", connectionInfo.Inheritance.EnableFontSmoothing.ToString()));
|
||||
element.Add(new XAttribute("InheritEnableDesktopComposition", connectionInfo.Inheritance.EnableDesktopComposition.ToString()));
|
||||
element.Add(new XAttribute("InheritDomain", connectionInfo.Inheritance.Domain.ToString()));
|
||||
element.Add(new XAttribute("InheritIcon", connectionInfo.Inheritance.Icon.ToString()));
|
||||
element.Add(new XAttribute("InheritPanel", connectionInfo.Inheritance.Panel.ToString()));
|
||||
element.Add(new XAttribute("InheritPassword", connectionInfo.Inheritance.Password.ToString()));
|
||||
element.Add(new XAttribute("InheritPort", connectionInfo.Inheritance.Port.ToString()));
|
||||
element.Add(new XAttribute("InheritProtocol", connectionInfo.Inheritance.Protocol.ToString()));
|
||||
element.Add(new XAttribute("InheritPuttySession", connectionInfo.Inheritance.PuttySession.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectDiskDrives", connectionInfo.Inheritance.RedirectDiskDrives.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectKeys", connectionInfo.Inheritance.RedirectKeys.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectPorts", connectionInfo.Inheritance.RedirectPorts.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectPrinters", connectionInfo.Inheritance.RedirectPrinters.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectSmartCards", connectionInfo.Inheritance.RedirectSmartCards.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectSound", connectionInfo.Inheritance.RedirectSound.ToString()));
|
||||
element.Add(new XAttribute("InheritSoundQuality", connectionInfo.Inheritance.SoundQuality.ToString()));
|
||||
element.Add(new XAttribute("InheritResolution", connectionInfo.Inheritance.Resolution.ToString()));
|
||||
element.Add(new XAttribute("InheritAutomaticResize", connectionInfo.Inheritance.AutomaticResize.ToString()));
|
||||
element.Add(new XAttribute("InheritUseConsoleSession", connectionInfo.Inheritance.UseConsoleSession.ToString()));
|
||||
element.Add(new XAttribute("InheritUseCredSsp", connectionInfo.Inheritance.UseCredSsp.ToString()));
|
||||
element.Add(new XAttribute("InheritRenderingEngine", connectionInfo.Inheritance.RenderingEngine.ToString()));
|
||||
element.Add(new XAttribute("InheritUsername", connectionInfo.Inheritance.Username.ToString()));
|
||||
element.Add(new XAttribute("InheritICAEncryptionStrength", connectionInfo.Inheritance.ICAEncryptionStrength.ToString()));
|
||||
element.Add(new XAttribute("InheritRDPAuthenticationLevel", connectionInfo.Inheritance.RDPAuthenticationLevel.ToString()));
|
||||
element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout", connectionInfo.Inheritance.RDPMinutesToIdleTimeout.ToString()));
|
||||
element.Add(new XAttribute("InheritRDPAlertIdleTimeout", connectionInfo.Inheritance.RDPAlertIdleTimeout.ToString()));
|
||||
element.Add(new XAttribute("InheritLoadBalanceInfo", connectionInfo.Inheritance.LoadBalanceInfo.ToString()));
|
||||
element.Add(new XAttribute("InheritPreExtApp", connectionInfo.Inheritance.PreExtApp.ToString()));
|
||||
element.Add(new XAttribute("InheritPostExtApp", connectionInfo.Inheritance.PostExtApp.ToString()));
|
||||
element.Add(new XAttribute("InheritMacAddress", connectionInfo.Inheritance.MacAddress.ToString()));
|
||||
element.Add(new XAttribute("InheritUserField", connectionInfo.Inheritance.UserField.ToString()));
|
||||
element.Add(new XAttribute("InheritExtApp", connectionInfo.Inheritance.ExtApp.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCCompression", connectionInfo.Inheritance.VNCCompression.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCEncoding", connectionInfo.Inheritance.VNCEncoding.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCAuthMode", connectionInfo.Inheritance.VNCAuthMode.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyType", connectionInfo.Inheritance.VNCProxyType.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyIP", connectionInfo.Inheritance.VNCProxyIP.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyPort", connectionInfo.Inheritance.VNCProxyPort.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyUsername", connectionInfo.Inheritance.VNCProxyUsername.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyPassword", connectionInfo.Inheritance.VNCProxyPassword.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCColors", connectionInfo.Inheritance.VNCColors.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCSmartSizeMode", connectionInfo.Inheritance.VNCSmartSizeMode.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCViewOnly", connectionInfo.Inheritance.VNCViewOnly.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayUsageMethod", connectionInfo.Inheritance.RDGatewayUsageMethod.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayHostname", connectionInfo.Inheritance.RDGatewayHostname.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", connectionInfo.Inheritance.RDGatewayUseConnectionCredentials.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayUsername", connectionInfo.Inheritance.RDGatewayUsername.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayPassword", connectionInfo.Inheritance.RDGatewayPassword.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayDomain", connectionInfo.Inheritance.RDGatewayDomain.ToString()));
|
||||
element.Add(new XAttribute("InheritCacheBitmaps", connectionInfo.Inheritance.CacheBitmaps.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritColors", connectionInfo.Inheritance.Colors.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritDescription", connectionInfo.Inheritance.Description.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritDisplayThemes", connectionInfo.Inheritance.DisplayThemes.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritDisplayWallpaper", connectionInfo.Inheritance.DisplayWallpaper.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritEnableFontSmoothing", connectionInfo.Inheritance.EnableFontSmoothing.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritEnableDesktopComposition", connectionInfo.Inheritance.EnableDesktopComposition.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritDomain", connectionInfo.Inheritance.Domain.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritIcon", connectionInfo.Inheritance.Icon.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritPanel", connectionInfo.Inheritance.Panel.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritPassword", connectionInfo.Inheritance.Password.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritPort", connectionInfo.Inheritance.Port.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritProtocol", connectionInfo.Inheritance.Protocol.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritPuttySession", connectionInfo.Inheritance.PuttySession.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRedirectDiskDrives", connectionInfo.Inheritance.RedirectDiskDrives.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRedirectKeys", connectionInfo.Inheritance.RedirectKeys.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRedirectPorts", connectionInfo.Inheritance.RedirectPorts.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRedirectPrinters", connectionInfo.Inheritance.RedirectPrinters.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRedirectSmartCards", connectionInfo.Inheritance.RedirectSmartCards.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRedirectSound", connectionInfo.Inheritance.RedirectSound.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritSoundQuality", connectionInfo.Inheritance.SoundQuality.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritResolution", connectionInfo.Inheritance.Resolution.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritAutomaticResize", connectionInfo.Inheritance.AutomaticResize.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritUseConsoleSession", connectionInfo.Inheritance.UseConsoleSession.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritUseCredSsp", connectionInfo.Inheritance.UseCredSsp.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRenderingEngine", connectionInfo.Inheritance.RenderingEngine.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritUsername", connectionInfo.Inheritance.Username.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritICAEncryptionStrength", connectionInfo.Inheritance.ICAEncryptionStrength.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRDPAuthenticationLevel", connectionInfo.Inheritance.RDPAuthenticationLevel.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout", connectionInfo.Inheritance.RDPMinutesToIdleTimeout.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRDPAlertIdleTimeout", connectionInfo.Inheritance.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritLoadBalanceInfo", connectionInfo.Inheritance.LoadBalanceInfo.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritPreExtApp", connectionInfo.Inheritance.PreExtApp.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritPostExtApp", connectionInfo.Inheritance.PostExtApp.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritMacAddress", connectionInfo.Inheritance.MacAddress.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritUserField", connectionInfo.Inheritance.UserField.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritExtApp", connectionInfo.Inheritance.ExtApp.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCCompression", connectionInfo.Inheritance.VNCCompression.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCEncoding", connectionInfo.Inheritance.VNCEncoding.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCAuthMode", connectionInfo.Inheritance.VNCAuthMode.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCProxyType", connectionInfo.Inheritance.VNCProxyType.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCProxyIP", connectionInfo.Inheritance.VNCProxyIP.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCProxyPort", connectionInfo.Inheritance.VNCProxyPort.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCProxyUsername", connectionInfo.Inheritance.VNCProxyUsername.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCProxyPassword", connectionInfo.Inheritance.VNCProxyPassword.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCColors", connectionInfo.Inheritance.VNCColors.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCSmartSizeMode", connectionInfo.Inheritance.VNCSmartSizeMode.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritVNCViewOnly", connectionInfo.Inheritance.VNCViewOnly.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRDGatewayUsageMethod", connectionInfo.Inheritance.RDGatewayUsageMethod.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRDGatewayHostname", connectionInfo.Inheritance.RDGatewayHostname.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", connectionInfo.Inheritance.RDGatewayUseConnectionCredentials.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRDGatewayUsername", connectionInfo.Inheritance.RDGatewayUsername.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRDGatewayPassword", connectionInfo.Inheritance.RDGatewayPassword.ToString().ToLowerInvariant()));
|
||||
element.Add(new XAttribute("InheritRDGatewayDomain", connectionInfo.Inheritance.RDGatewayDomain.ToString().ToLowerInvariant()));
|
||||
}
|
||||
else
|
||||
{
|
||||
element.Add(new XAttribute("InheritCacheBitmaps", false.ToString()));
|
||||
element.Add(new XAttribute("InheritColors", false.ToString()));
|
||||
element.Add(new XAttribute("InheritDescription", false.ToString()));
|
||||
element.Add(new XAttribute("InheritDisplayThemes", false.ToString()));
|
||||
element.Add(new XAttribute("InheritDisplayWallpaper", false.ToString()));
|
||||
element.Add(new XAttribute("InheritEnableFontSmoothing", false.ToString()));
|
||||
element.Add(new XAttribute("InheritEnableDesktopComposition", false.ToString()));
|
||||
element.Add(new XAttribute("InheritDomain", false.ToString()));
|
||||
element.Add(new XAttribute("InheritIcon", false.ToString()));
|
||||
element.Add(new XAttribute("InheritPanel", false.ToString()));
|
||||
element.Add(new XAttribute("InheritPassword", false.ToString()));
|
||||
element.Add(new XAttribute("InheritPort", false.ToString()));
|
||||
element.Add(new XAttribute("InheritProtocol", false.ToString()));
|
||||
element.Add(new XAttribute("InheritPuttySession", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectDiskDrives", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectKeys", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectPorts", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectPrinters", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectSmartCards", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRedirectSound", false.ToString()));
|
||||
element.Add(new XAttribute("InheritSoundQuality", false.ToString()));
|
||||
element.Add(new XAttribute("InheritResolution", false.ToString()));
|
||||
element.Add(new XAttribute("InheritAutomaticResize", false.ToString()));
|
||||
element.Add(new XAttribute("InheritUseConsoleSession", false.ToString()));
|
||||
element.Add(new XAttribute("InheritUseCredSsp", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRenderingEngine", false.ToString()));
|
||||
element.Add(new XAttribute("InheritUsername", false.ToString()));
|
||||
element.Add(new XAttribute("InheritICAEncryptionStrength", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRDPAuthenticationLevel", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRDPAlertIdleTimeout", false.ToString()));
|
||||
element.Add(new XAttribute("InheritLoadBalanceInfo", false.ToString()));
|
||||
element.Add(new XAttribute("InheritPreExtApp", false.ToString()));
|
||||
element.Add(new XAttribute("InheritPostExtApp", false.ToString()));
|
||||
element.Add(new XAttribute("InheritMacAddress", false.ToString()));
|
||||
element.Add(new XAttribute("InheritUserField", false.ToString()));
|
||||
element.Add(new XAttribute("InheritExtApp", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCCompression", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCEncoding", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCAuthMode", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyType", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyIP", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyPort", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyUsername", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCProxyPassword", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCColors", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCSmartSizeMode", false.ToString()));
|
||||
element.Add(new XAttribute("InheritVNCViewOnly", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayUsageMethod", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayHostname", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayUsername", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayPassword", false.ToString()));
|
||||
element.Add(new XAttribute("InheritRDGatewayDomain", false.ToString()));
|
||||
var falseString = false.ToString().ToLowerInvariant();
|
||||
element.Add(new XAttribute("InheritCacheBitmaps", falseString));
|
||||
element.Add(new XAttribute("InheritColors", falseString));
|
||||
element.Add(new XAttribute("InheritDescription", falseString));
|
||||
element.Add(new XAttribute("InheritDisplayThemes", falseString));
|
||||
element.Add(new XAttribute("InheritDisplayWallpaper", falseString));
|
||||
element.Add(new XAttribute("InheritEnableFontSmoothing", falseString));
|
||||
element.Add(new XAttribute("InheritEnableDesktopComposition", falseString));
|
||||
element.Add(new XAttribute("InheritDomain", falseString));
|
||||
element.Add(new XAttribute("InheritIcon", falseString));
|
||||
element.Add(new XAttribute("InheritPanel", falseString));
|
||||
element.Add(new XAttribute("InheritPassword", falseString));
|
||||
element.Add(new XAttribute("InheritPort", falseString));
|
||||
element.Add(new XAttribute("InheritProtocol", falseString));
|
||||
element.Add(new XAttribute("InheritPuttySession", falseString));
|
||||
element.Add(new XAttribute("InheritRedirectDiskDrives", falseString));
|
||||
element.Add(new XAttribute("InheritRedirectKeys", falseString));
|
||||
element.Add(new XAttribute("InheritRedirectPorts", falseString));
|
||||
element.Add(new XAttribute("InheritRedirectPrinters", falseString));
|
||||
element.Add(new XAttribute("InheritRedirectSmartCards", falseString));
|
||||
element.Add(new XAttribute("InheritRedirectSound", falseString));
|
||||
element.Add(new XAttribute("InheritSoundQuality", falseString));
|
||||
element.Add(new XAttribute("InheritResolution", falseString));
|
||||
element.Add(new XAttribute("InheritAutomaticResize", falseString));
|
||||
element.Add(new XAttribute("InheritUseConsoleSession", falseString));
|
||||
element.Add(new XAttribute("InheritUseCredSsp", falseString));
|
||||
element.Add(new XAttribute("InheritRenderingEngine", falseString));
|
||||
element.Add(new XAttribute("InheritUsername", falseString));
|
||||
element.Add(new XAttribute("InheritICAEncryptionStrength", falseString));
|
||||
element.Add(new XAttribute("InheritRDPAuthenticationLevel", falseString));
|
||||
element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout", falseString));
|
||||
element.Add(new XAttribute("InheritRDPAlertIdleTimeout", falseString));
|
||||
element.Add(new XAttribute("InheritLoadBalanceInfo", falseString));
|
||||
element.Add(new XAttribute("InheritPreExtApp", falseString));
|
||||
element.Add(new XAttribute("InheritPostExtApp", falseString));
|
||||
element.Add(new XAttribute("InheritMacAddress", falseString));
|
||||
element.Add(new XAttribute("InheritUserField", falseString));
|
||||
element.Add(new XAttribute("InheritExtApp", falseString));
|
||||
element.Add(new XAttribute("InheritVNCCompression", falseString));
|
||||
element.Add(new XAttribute("InheritVNCEncoding", falseString));
|
||||
element.Add(new XAttribute("InheritVNCAuthMode", falseString));
|
||||
element.Add(new XAttribute("InheritVNCProxyType", falseString));
|
||||
element.Add(new XAttribute("InheritVNCProxyIP", falseString));
|
||||
element.Add(new XAttribute("InheritVNCProxyPort", falseString));
|
||||
element.Add(new XAttribute("InheritVNCProxyUsername", falseString));
|
||||
element.Add(new XAttribute("InheritVNCProxyPassword", falseString));
|
||||
element.Add(new XAttribute("InheritVNCColors", falseString));
|
||||
element.Add(new XAttribute("InheritVNCSmartSizeMode", falseString));
|
||||
element.Add(new XAttribute("InheritVNCViewOnly", falseString));
|
||||
element.Add(new XAttribute("InheritRDGatewayUsageMethod", falseString));
|
||||
element.Add(new XAttribute("InheritRDGatewayHostname", falseString));
|
||||
element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", falseString));
|
||||
element.Add(new XAttribute("InheritRDGatewayUsername", falseString));
|
||||
element.Add(new XAttribute("InheritRDGatewayPassword", falseString));
|
||||
element.Add(new XAttribute("InheritRDGatewayDomain", falseString));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,12 @@ using mRemoteNG.Connection.Protocol.VNC;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using mRemoteNG.UI.Forms;
|
||||
using mRemoteNG.UI.TaskDialog;
|
||||
|
||||
namespace mRemoteNG.Config.Serializers
|
||||
namespace mRemoteNG.Config.Serializers.Xml
|
||||
{
|
||||
public class XmlConnectionsDeserializer : IDeserializer<string, ConnectionTreeModel>
|
||||
{
|
||||
@@ -71,7 +70,8 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
if (_confVersion >= 2.6)
|
||||
{
|
||||
if (rootXmlElement?.Attributes["FullFileEncryption"].Value == "True")
|
||||
var fullFileEncryptionValue = rootXmlElement?.Attributes["FullFileEncryption"].Value ?? "";
|
||||
if (bool.Parse(fullFileEncryptionValue))
|
||||
{
|
||||
var decryptedContent = _decryptor.Decrypt(rootXmlElement.InnerText);
|
||||
rootXmlElement.InnerXml = decryptedContent;
|
||||
@@ -143,10 +143,10 @@ namespace mRemoteNG.Config.Serializers
|
||||
if (_confVersion >= 2.6)
|
||||
{
|
||||
BlockCipherEngines engine;
|
||||
Enum.TryParse(connectionsRootElement?.Attributes["EncryptionEngine"].Value, out engine);
|
||||
Enum.TryParse(connectionsRootElement?.Attributes["EncryptionEngine"].Value, true, out engine);
|
||||
|
||||
BlockCipherModes mode;
|
||||
Enum.TryParse(connectionsRootElement?.Attributes["BlockCipherMode"].Value, out mode);
|
||||
Enum.TryParse(connectionsRootElement?.Attributes["BlockCipherMode"].Value, true, out mode);
|
||||
|
||||
int keyDerivationIterations;
|
||||
int.TryParse(connectionsRootElement?.Attributes["KdfIterations"].Value, out keyDerivationIterations);
|
||||
@@ -186,7 +186,10 @@ namespace mRemoteNG.Config.Serializers
|
||||
if (_confVersion >= 0.9)
|
||||
containerInfo.CopyFrom(GetConnectionInfoFromXml(xmlNode));
|
||||
if (_confVersion >= 0.8)
|
||||
containerInfo.IsExpanded = xmlNode.Attributes?["Expanded"].Value == "True";
|
||||
{
|
||||
var expandedValue = xmlNode.Attributes?["Expanded"].Value ?? "";
|
||||
containerInfo.IsExpanded = bool.Parse(expandedValue);
|
||||
}
|
||||
|
||||
parentContainer.AddChild(containerInfo);
|
||||
AddNodesFromXmlRecursive(xmlNode, containerInfo);
|
||||
@@ -204,7 +207,9 @@ namespace mRemoteNG.Config.Serializers
|
||||
private ConnectionInfo GetConnectionInfoFromXml(XmlNode xmlnode)
|
||||
{
|
||||
if (xmlnode.Attributes == null) return null;
|
||||
var connectionInfo = new ConnectionInfo();
|
||||
|
||||
var connectionId = xmlnode.Attributes["Id"]?.Value ?? Guid.NewGuid().ToString();
|
||||
var connectionInfo = new ConnectionInfo(connectionId);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -219,7 +224,9 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
if (_confVersion < 1.1) //1.0 - 0.1
|
||||
{
|
||||
connectionInfo.Resolution = Convert.ToBoolean(xmlnode.Attributes["Fullscreen"].Value) ? RdpResolutions.Fullscreen : RdpResolutions.FitToWindow;
|
||||
connectionInfo.Resolution = Convert.ToBoolean(xmlnode.Attributes["Fullscreen"].Value)
|
||||
? RdpProtocol.RDPResolutions.Fullscreen
|
||||
: RdpProtocol.RDPResolutions.FitToWindow;
|
||||
}
|
||||
|
||||
if (_confVersion <= 2.6) // 0.2 - 2.6
|
||||
@@ -249,7 +256,7 @@ namespace mRemoteNG.Config.Serializers
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionInfo.Port = (int)RdpProtocol6.Defaults.Port;
|
||||
connectionInfo.Port = (int)RdpProtocol.Defaults.Port;
|
||||
connectionInfo.Protocol = ProtocolType.RDP;
|
||||
}
|
||||
|
||||
@@ -257,7 +264,9 @@ namespace mRemoteNG.Config.Serializers
|
||||
{
|
||||
if (_confVersion < 0.7)
|
||||
{
|
||||
connectionInfo.Port = Convert.ToInt32(Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) ? xmlnode.Attributes["VNCPort"].Value : xmlnode.Attributes["RDPPort"].Value);
|
||||
connectionInfo.Port = Convert.ToInt32(Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value)
|
||||
? xmlnode.Attributes["VNCPort"].Value
|
||||
: xmlnode.Attributes["RDPPort"].Value);
|
||||
}
|
||||
|
||||
connectionInfo.UseConsoleSession = bool.Parse(xmlnode.Attributes["ConnectToConsole"].Value);
|
||||
@@ -269,7 +278,7 @@ namespace mRemoteNG.Config.Serializers
|
||||
if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value))
|
||||
connectionInfo.Port = (int)ProtocolVNC.Defaults.Port;
|
||||
else
|
||||
connectionInfo.Port = (int)RdpProtocol6.Defaults.Port;
|
||||
connectionInfo.Port = (int)RdpProtocol.Defaults.Port;
|
||||
}
|
||||
connectionInfo.UseConsoleSession = false;
|
||||
}
|
||||
@@ -291,7 +300,9 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
if (_confVersion >= 0.7)
|
||||
{
|
||||
connectionInfo.Protocol = (ProtocolType)MiscTools.StringToEnum(typeof(ProtocolType), xmlnode.Attributes["Protocol"].Value);
|
||||
ProtocolType protocolType;
|
||||
Enum.TryParse(xmlnode.Attributes["Protocol"].Value, true, out protocolType);
|
||||
connectionInfo.Protocol = protocolType;
|
||||
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["Port"].Value);
|
||||
}
|
||||
|
||||
@@ -307,34 +318,34 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
if (_confVersion >= 1.3)
|
||||
{
|
||||
connectionInfo.Colors = (RdpColors)MiscTools.StringToEnum(typeof(RdpColors), xmlnode.Attributes["Colors"].Value);
|
||||
connectionInfo.Resolution = (RdpResolutions)MiscTools.StringToEnum(typeof(RdpResolutions), Convert.ToString(xmlnode.Attributes["Resolution"].Value));
|
||||
connectionInfo.RedirectSound = (RdpSounds)MiscTools.StringToEnum(typeof(RdpSounds), Convert.ToString(xmlnode.Attributes["RedirectSound"].Value));
|
||||
connectionInfo.Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors), xmlnode.Attributes["Colors"].Value, true);
|
||||
connectionInfo.Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions), xmlnode.Attributes["Resolution"].Value, true);
|
||||
connectionInfo.RedirectSound = (RdpProtocol.RDPSounds)Enum.Parse(typeof(RdpProtocol.RDPSounds), xmlnode.Attributes["RedirectSound"].Value, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (Convert.ToInt32(xmlnode.Attributes["Colors"].Value))
|
||||
{
|
||||
case 0:
|
||||
connectionInfo.Colors = RdpColors.Colors256;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors256;
|
||||
break;
|
||||
case 1:
|
||||
connectionInfo.Colors = RdpColors.Colors16Bit;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors16Bit;
|
||||
break;
|
||||
case 2:
|
||||
connectionInfo.Colors = RdpColors.Colors24Bit;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors24Bit;
|
||||
break;
|
||||
case 3:
|
||||
connectionInfo.Colors = RdpColors.Colors32Bit;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors32Bit;
|
||||
break;
|
||||
// ReSharper disable once RedundantCaseLabel
|
||||
case 4:
|
||||
default:
|
||||
connectionInfo.Colors = RdpColors.Colors15Bit;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors15Bit;
|
||||
break;
|
||||
}
|
||||
|
||||
connectionInfo.RedirectSound = (RdpSounds)Convert.ToInt32(xmlnode.Attributes["RedirectSound"].Value);
|
||||
connectionInfo.RedirectSound = (RdpProtocol.RDPSounds)Convert.ToInt32(xmlnode.Attributes["RedirectSound"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion >= 1.3)
|
||||
@@ -385,7 +396,7 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
if (_confVersion >= 1.6)
|
||||
{
|
||||
connectionInfo.ICAEncryptionStrength = (IcaProtocol.EncryptionStrength)MiscTools.StringToEnum(typeof(IcaProtocol.EncryptionStrength), xmlnode.Attributes["ICAEncryptionStrength"].Value);
|
||||
connectionInfo.ICAEncryptionStrength = (IcaProtocol.EncryptionStrength)Enum.Parse(typeof(IcaProtocol.EncryptionStrength), xmlnode.Attributes["ICAEncryptionStrength"].Value, true);
|
||||
connectionInfo.Inheritance.ICAEncryptionStrength = bool.Parse(xmlnode.Attributes["InheritICAEncryptionStrength"].Value);
|
||||
connectionInfo.PreExtApp = xmlnode.Attributes["PreExtApp"].Value;
|
||||
connectionInfo.PostExtApp = xmlnode.Attributes["PostExtApp"].Value;
|
||||
@@ -395,16 +406,16 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
if (_confVersion >= 1.7)
|
||||
{
|
||||
connectionInfo.VNCCompression = (ProtocolVNC.Compression)MiscTools.StringToEnum(typeof(ProtocolVNC.Compression), xmlnode.Attributes["VNCCompression"].Value);
|
||||
connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)MiscTools.StringToEnum(typeof(ProtocolVNC.Encoding), Convert.ToString(xmlnode.Attributes["VNCEncoding"].Value));
|
||||
connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)MiscTools.StringToEnum(typeof(ProtocolVNC.AuthMode), xmlnode.Attributes["VNCAuthMode"].Value);
|
||||
connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)MiscTools.StringToEnum(typeof(ProtocolVNC.ProxyType), xmlnode.Attributes["VNCProxyType"].Value);
|
||||
connectionInfo.VNCCompression = (ProtocolVNC.Compression)Enum.Parse(typeof(ProtocolVNC.Compression), xmlnode.Attributes["VNCCompression"].Value, true);
|
||||
connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Enum.Parse(typeof(ProtocolVNC.Encoding), xmlnode.Attributes["VNCEncoding"].Value, true);
|
||||
connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Enum.Parse(typeof(ProtocolVNC.AuthMode), xmlnode.Attributes["VNCAuthMode"].Value, true);
|
||||
connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Enum.Parse(typeof(ProtocolVNC.ProxyType), xmlnode.Attributes["VNCProxyType"].Value, true);
|
||||
connectionInfo.VNCProxyIP = xmlnode.Attributes["VNCProxyIP"].Value;
|
||||
connectionInfo.VNCProxyPort = Convert.ToInt32(xmlnode.Attributes["VNCProxyPort"].Value);
|
||||
connectionInfo.VNCProxyUsername = xmlnode.Attributes["VNCProxyUsername"].Value;
|
||||
connectionInfo.VNCProxyPassword = _decryptor.Decrypt(xmlnode.Attributes["VNCProxyPassword"].Value);
|
||||
connectionInfo.VNCColors = (ProtocolVNC.Colors)MiscTools.StringToEnum(typeof(ProtocolVNC.Colors), xmlnode.Attributes["VNCColors"].Value);
|
||||
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)MiscTools.StringToEnum(typeof(ProtocolVNC.SmartSizeMode), xmlnode.Attributes["VNCSmartSizeMode"].Value);
|
||||
connectionInfo.VNCColors = (ProtocolVNC.Colors)Enum.Parse(typeof(ProtocolVNC.Colors), xmlnode.Attributes["VNCColors"].Value, true);
|
||||
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), xmlnode.Attributes["VNCSmartSizeMode"].Value, true);
|
||||
connectionInfo.VNCViewOnly = bool.Parse(xmlnode.Attributes["VNCViewOnly"].Value);
|
||||
connectionInfo.Inheritance.VNCCompression = bool.Parse(xmlnode.Attributes["InheritVNCCompression"].Value);
|
||||
connectionInfo.Inheritance.VNCEncoding = bool.Parse(xmlnode.Attributes["InheritVNCEncoding"].Value);
|
||||
@@ -421,13 +432,13 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
if (_confVersion >= 1.8)
|
||||
{
|
||||
connectionInfo.RDPAuthenticationLevel = (RdpAuthenticationLevel)MiscTools.StringToEnum(typeof(RdpAuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value);
|
||||
connectionInfo.RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel)Enum.Parse(typeof(RdpProtocol.AuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value, true);
|
||||
connectionInfo.Inheritance.RDPAuthenticationLevel = bool.Parse(xmlnode.Attributes["InheritRDPAuthenticationLevel"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion >= 1.9)
|
||||
{
|
||||
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)MiscTools.StringToEnum(typeof(HTTPBase.RenderingEngine), xmlnode.Attributes["RenderingEngine"].Value);
|
||||
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine), xmlnode.Attributes["RenderingEngine"].Value, true);
|
||||
connectionInfo.MacAddress = xmlnode.Attributes["MacAddress"].Value;
|
||||
connectionInfo.Inheritance.RenderingEngine = bool.Parse(xmlnode.Attributes["InheritRenderingEngine"].Value);
|
||||
connectionInfo.Inheritance.MacAddress = bool.Parse(xmlnode.Attributes["InheritMacAddress"].Value);
|
||||
@@ -448,9 +459,9 @@ namespace mRemoteNG.Config.Serializers
|
||||
if (_confVersion >= 2.2)
|
||||
{
|
||||
// Get settings
|
||||
connectionInfo.RDGatewayUsageMethod = (RDGatewayUsageMethod)MiscTools.StringToEnum(typeof(RDGatewayUsageMethod), Convert.ToString(xmlnode.Attributes["RDGatewayUsageMethod"].Value));
|
||||
connectionInfo.RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod)Enum.Parse(typeof(RdpProtocol.RDGatewayUsageMethod), xmlnode.Attributes["RDGatewayUsageMethod"].Value, true);
|
||||
connectionInfo.RDGatewayHostname = xmlnode.Attributes["RDGatewayHostname"].Value;
|
||||
connectionInfo.RDGatewayUseConnectionCredentials = (RDGatewayUseConnectionCredentials)MiscTools.StringToEnum(typeof(RDGatewayUseConnectionCredentials), Convert.ToString(xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value));
|
||||
connectionInfo.RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value, true);
|
||||
connectionInfo.RDGatewayUsername = xmlnode.Attributes["RDGatewayUsername"].Value;
|
||||
connectionInfo.RDGatewayPassword = _decryptor.Decrypt(Convert.ToString(xmlnode.Attributes["RDGatewayPassword"].Value));
|
||||
connectionInfo.RDGatewayDomain = xmlnode.Attributes["RDGatewayDomain"].Value;
|
||||
@@ -491,8 +502,7 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
if (_confVersion >= 2.6)
|
||||
{
|
||||
connectionInfo.ConstantID = xmlnode.Attributes["Id"]?.Value ?? connectionInfo.ConstantID;
|
||||
connectionInfo.SoundQuality = (RdpSoundQuality)MiscTools.StringToEnum(typeof(RdpSoundQuality), Convert.ToString(xmlnode.Attributes["SoundQuality"].Value));
|
||||
connectionInfo.SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality), xmlnode.Attributes["SoundQuality"].Value, true);
|
||||
connectionInfo.Inheritance.SoundQuality = bool.Parse(xmlnode.Attributes["InheritSoundQuality"].Value);
|
||||
connectionInfo.RDPMinutesToIdleTimeout = Convert.ToInt32(xmlnode.Attributes["RDPMinutesToIdleTimeout"]?.Value ?? "0");
|
||||
connectionInfo.Inheritance.RDPMinutesToIdleTimeout = bool.Parse(xmlnode.Attributes["InheritRDPMinutesToIdleTimeout"]?.Value ?? "False");
|
||||
@@ -8,8 +8,7 @@ using mRemoteNG.Security;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Serializers
|
||||
namespace mRemoteNG.Config.Serializers.Xml
|
||||
{
|
||||
public class XmlConnectionsDocumentCompiler
|
||||
{
|
||||
@@ -2,8 +2,7 @@
|
||||
using System.Xml.Linq;
|
||||
using mRemoteNG.Security;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Serializers
|
||||
namespace mRemoteNG.Config.Serializers.Xml
|
||||
{
|
||||
public class XmlConnectionsDocumentEncryptor
|
||||
{
|
||||
@@ -10,7 +10,7 @@ using mRemoteNG.Security;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
|
||||
namespace mRemoteNG.Config.Serializers
|
||||
namespace mRemoteNG.Config.Serializers.Xml
|
||||
{
|
||||
public class XmlConnectionsSerializer : ISerializer<ConnectionTreeModel,string>, ISerializer<ConnectionInfo, string>
|
||||
{
|
||||
@@ -2,19 +2,21 @@
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Tree.Root;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Serializers
|
||||
namespace mRemoteNG.Config.Serializers.Xml
|
||||
{
|
||||
public class XmlRootNodeSerializer
|
||||
public class XmlRootNodeSerializer
|
||||
{
|
||||
public XElement SerializeRootNodeInfo(RootNodeInfo rootNodeInfo, ICryptographyProvider cryptographyProvider, bool fullFileEncryption = false)
|
||||
{
|
||||
var element = new XElement("Connections");
|
||||
XNamespace xmlNamespace = "http://mremoteng.org";
|
||||
var element = new XElement(xmlNamespace + "Connections");
|
||||
element.Add(new XAttribute(XNamespace.Xmlns+"mrng", xmlNamespace));
|
||||
element.Add(new XAttribute(XName.Get("Name"), rootNodeInfo.Name));
|
||||
element.Add(new XAttribute(XName.Get("EncryptionEngine"), cryptographyProvider.CipherEngine));
|
||||
element.Add(new XAttribute(XName.Get("Export"), "false"));
|
||||
element.Add(new XAttribute(XName.Get("EncryptionEngine"), cryptographyProvider.CipherEngine));
|
||||
element.Add(new XAttribute(XName.Get("BlockCipherMode"), cryptographyProvider.CipherMode));
|
||||
element.Add(new XAttribute(XName.Get("KdfIterations"), cryptographyProvider.KeyDerivationIterations));
|
||||
element.Add(new XAttribute(XName.Get("FullFileEncryption"), fullFileEncryption.ToString()));
|
||||
element.Add(new XAttribute(XName.Get("FullFileEncryption"), fullFileEncryption.ToString().ToLowerInvariant()));
|
||||
element.Add(CreateProtectedAttribute(rootNodeInfo, cryptographyProvider));
|
||||
element.Add(new XAttribute(XName.Get("ConfVersion"), "2.6"));
|
||||
return element;
|
||||
@@ -46,14 +46,16 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
private ConnectionInfo DeserializeConnectionInfo(DataRow row)
|
||||
{
|
||||
var connectionInfo = new ConnectionInfo();
|
||||
var connectionId = row["ConstantID"] as string ?? Guid.NewGuid().ToString();
|
||||
var connectionInfo = new ConnectionInfo(connectionId);
|
||||
PopulateConnectionInfoFromDatarow(row, connectionInfo);
|
||||
return connectionInfo;
|
||||
}
|
||||
|
||||
private ContainerInfo DeserializeContainerInfo(DataRow row)
|
||||
{
|
||||
var containerInfo = new ContainerInfo();
|
||||
var containerId = row["ConstantID"] as string ?? Guid.NewGuid().ToString();
|
||||
var containerInfo = new ContainerInfo(containerId);
|
||||
PopulateConnectionInfoFromDatarow(row, containerInfo);
|
||||
return containerInfo;
|
||||
}
|
||||
@@ -61,7 +63,6 @@ namespace mRemoteNG.Config.Serializers
|
||||
private void PopulateConnectionInfoFromDatarow(DataRow dataRow, ConnectionInfo connectionInfo)
|
||||
{
|
||||
connectionInfo.Name = (string)dataRow["Name"];
|
||||
connectionInfo.ConstantID = (string)dataRow["ConstantID"];
|
||||
|
||||
// This throws a NPE - Parent is a connectionInfo object which will be null at this point.
|
||||
// The Parent object is linked properly later in CreateNodeHierarchy()
|
||||
@@ -85,12 +86,12 @@ namespace mRemoteNG.Config.Serializers
|
||||
connectionInfo.UseCredSsp = (bool)dataRow["UseCredSsp"];
|
||||
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.RDPAuthenticationLevel = (RdpAuthenticationLevel)Enum.Parse(typeof(RdpAuthenticationLevel), (string)dataRow["RDPAuthenticationLevel"]);
|
||||
connectionInfo.RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel)Enum.Parse(typeof(RdpProtocol.AuthenticationLevel), (string)dataRow["RDPAuthenticationLevel"]);
|
||||
connectionInfo.RDPMinutesToIdleTimeout = (int)dataRow["RDPMinutesToIdleTimeout"];
|
||||
connectionInfo.RDPAlertIdleTimeout = (bool)dataRow["RDPAlertIdleTimeout"];
|
||||
connectionInfo.LoadBalanceInfo = (string)dataRow["LoadBalanceInfo"];
|
||||
connectionInfo.Colors = (RdpColors)Enum.Parse(typeof(RdpColors) ,(string)dataRow["Colors"]);
|
||||
connectionInfo.Resolution = (RdpResolutions)Enum.Parse(typeof(RdpResolutions), (string)dataRow["Resolution"]);
|
||||
connectionInfo.Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors) ,(string)dataRow["Colors"]);
|
||||
connectionInfo.Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions), (string)dataRow["Resolution"]);
|
||||
connectionInfo.AutomaticResize = (bool)dataRow["AutomaticResize"];
|
||||
connectionInfo.DisplayWallpaper = (bool)dataRow["DisplayWallpaper"];
|
||||
connectionInfo.DisplayThemes = (bool)dataRow["DisplayThemes"];
|
||||
@@ -101,8 +102,8 @@ namespace mRemoteNG.Config.Serializers
|
||||
connectionInfo.RedirectPorts = (bool)dataRow["RedirectPorts"];
|
||||
connectionInfo.RedirectPrinters = (bool)dataRow["RedirectPrinters"];
|
||||
connectionInfo.RedirectSmartCards = (bool)dataRow["RedirectSmartCards"];
|
||||
connectionInfo.RedirectSound = (RdpSounds)Enum.Parse(typeof(RdpSounds), (string)dataRow["RedirectSound"]);
|
||||
connectionInfo.SoundQuality = (RdpSoundQuality)Enum.Parse(typeof(RdpSoundQuality), (string)dataRow["SoundQuality"]);
|
||||
connectionInfo.RedirectSound = (RdpProtocol.RDPSounds)Enum.Parse(typeof(RdpProtocol.RDPSounds), (string)dataRow["RedirectSound"]);
|
||||
connectionInfo.SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality), (string)dataRow["SoundQuality"]);
|
||||
connectionInfo.RedirectKeys = (bool)dataRow["RedirectKeys"];
|
||||
connectionInfo.PleaseConnect = (bool)dataRow["Connected"];
|
||||
connectionInfo.PreExtApp = (string)dataRow["PreExtApp"];
|
||||
@@ -121,9 +122,9 @@ namespace mRemoteNG.Config.Serializers
|
||||
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.VNCViewOnly = (bool)dataRow["VNCViewOnly"];
|
||||
connectionInfo.RDGatewayUsageMethod = (RDGatewayUsageMethod)Enum.Parse(typeof(RDGatewayUsageMethod), (string)dataRow["RDGatewayUsageMethod"]);
|
||||
connectionInfo.RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod)Enum.Parse(typeof(RdpProtocol.RDGatewayUsageMethod), (string)dataRow["RDGatewayUsageMethod"]);
|
||||
connectionInfo.RDGatewayHostname = (string)dataRow["RDGatewayHostname"];
|
||||
connectionInfo.RDGatewayUseConnectionCredentials = (RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RDGatewayUseConnectionCredentials), (string)dataRow["RDGatewayUseConnectionCredentials"]);
|
||||
connectionInfo.RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), (string)dataRow["RDGatewayUseConnectionCredentials"]);
|
||||
connectionInfo.RDGatewayUsername = (string)dataRow["RDGatewayUsername"];
|
||||
connectionInfo.RDGatewayPassword = (string)dataRow["RDGatewayPassword"];
|
||||
connectionInfo.RDGatewayDomain = (string)dataRow["RDGatewayDomain"];
|
||||
@@ -187,7 +188,7 @@ namespace mRemoteNG.Config.Serializers
|
||||
private ConnectionTreeModel CreateNodeHierarchy(List<ConnectionInfo> connectionList, DataTable dataTable)
|
||||
{
|
||||
var connectionTreeModel = new ConnectionTreeModel();
|
||||
var rootNode = new RootNodeInfo(RootNodeType.Connection) {ConstantID = "0"};
|
||||
var rootNode = new RootNodeInfo(RootNodeType.Connection, "0");
|
||||
connectionTreeModel.AddRootNode(rootNode);
|
||||
|
||||
foreach (DataRow row in dataTable.Rows)
|
||||
|
||||
@@ -1,238 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Credential;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
|
||||
namespace mRemoteNG.Config.Serializers
|
||||
{
|
||||
public class CsvConnectionsSerializerMremotengFormat : ISerializer<ConnectionInfo,string>
|
||||
{
|
||||
private string _csv = "";
|
||||
private ConnectionInfo _serializationTarget;
|
||||
private readonly SaveFilter _saveFilter;
|
||||
private readonly ICredentialRepositoryList _credentialRepositoryList;
|
||||
|
||||
|
||||
public CsvConnectionsSerializerMremotengFormat(SaveFilter saveFilter, ICredentialRepositoryList credentialRepositoryList)
|
||||
{
|
||||
if (saveFilter == null)
|
||||
throw new ArgumentNullException(nameof(saveFilter));
|
||||
if (credentialRepositoryList == null)
|
||||
throw new ArgumentNullException(nameof(credentialRepositoryList));
|
||||
|
||||
_saveFilter = saveFilter;
|
||||
_credentialRepositoryList = credentialRepositoryList;
|
||||
}
|
||||
|
||||
public string Serialize(ConnectionTreeModel connectionTreeModel)
|
||||
{
|
||||
if (connectionTreeModel == null)
|
||||
throw new ArgumentNullException(nameof(connectionTreeModel));
|
||||
|
||||
var rootNode = connectionTreeModel.RootNodes.First(node => node is RootNodeInfo);
|
||||
return Serialize(rootNode);
|
||||
}
|
||||
|
||||
public string Serialize(ConnectionInfo serializationTarget)
|
||||
{
|
||||
if (serializationTarget == null)
|
||||
throw new ArgumentNullException(nameof(serializationTarget));
|
||||
|
||||
_csv = "";
|
||||
_serializationTarget = serializationTarget;
|
||||
WriteCsvHeader();
|
||||
SerializeNodesRecursive(serializationTarget);
|
||||
return _csv;
|
||||
}
|
||||
|
||||
private void WriteCsvHeader()
|
||||
{
|
||||
var csvHeader = string.Empty;
|
||||
csvHeader += "Name;Folder;Description;Icon;Panel;";
|
||||
if (_saveFilter.SaveUsername)
|
||||
csvHeader += "Username;";
|
||||
if (_saveFilter.SavePassword)
|
||||
csvHeader += "Password;";
|
||||
if (_saveFilter.SaveDomain)
|
||||
csvHeader += "Domain;";
|
||||
csvHeader += "Hostname;Protocol;PuttySession;Port;ConnectToConsole;UseCredSsp;RenderingEngine;ICAEncryptionStrength;RDPAuthenticationLevel;LoadBalanceInfo;Colors;Resolution;AutomaticResize;DisplayWallpaper;DisplayThemes;EnableFontSmoothing;EnableDesktopComposition;CacheBitmaps;RedirectDiskDrives;RedirectPorts;RedirectPrinters;RedirectSmartCards;RedirectSound;RedirectKeys;PreExtApp;PostExtApp;MacAddress;UserField;ExtApp;VNCCompression;VNCEncoding;VNCAuthMode;VNCProxyType;VNCProxyIP;VNCProxyPort;VNCProxyUsername;VNCProxyPassword;VNCColors;VNCSmartSizeMode;VNCViewOnly;RDGatewayUsageMethod;RDGatewayHostname;RDGatewayUseConnectionCredentials;RDGatewayUsername;RDGatewayPassword;RDGatewayDomain;";
|
||||
if (_saveFilter.SaveInheritance)
|
||||
csvHeader += "InheritCacheBitmaps;InheritColors;InheritDescription;InheritDisplayThemes;InheritDisplayWallpaper;InheritEnableFontSmoothing;InheritEnableDesktopComposition;InheritDomain;InheritIcon;InheritPanel;InheritPassword;InheritPort;InheritProtocol;InheritPuttySession;InheritRedirectDiskDrives;InheritRedirectKeys;InheritRedirectPorts;InheritRedirectPrinters;InheritRedirectSmartCards;InheritRedirectSound;InheritResolution;InheritAutomaticResize;InheritUseConsoleSession;InheritUseCredSsp;InheritRenderingEngine;InheritUsername;InheritICAEncryptionStrength;InheritRDPAuthenticationLevel;InheritLoadBalanceInfo;InheritPreExtApp;InheritPostExtApp;InheritMacAddress;InheritUserField;InheritExtApp;InheritVNCCompression;InheritVNCEncoding;InheritVNCAuthMode;InheritVNCProxyType;InheritVNCProxyIP;InheritVNCProxyPort;InheritVNCProxyUsername;InheritVNCProxyPassword;InheritVNCColors;InheritVNCSmartSizeMode;InheritVNCViewOnly;InheritRDGatewayUsageMethod;InheritRDGatewayHostname;InheritRDGatewayUseConnectionCredentials;InheritRDGatewayUsername;InheritRDGatewayPassword;InheritRDGatewayDomain;InheritRDPAlertIdleTimeout;InheritRDPMinutesToIdleTimeout;InheritSoundQuality";
|
||||
_csv += csvHeader;
|
||||
}
|
||||
|
||||
private void SerializeNodesRecursive(ConnectionInfo node)
|
||||
{
|
||||
var nodeAsContainer = node as ContainerInfo;
|
||||
if (nodeAsContainer != null)
|
||||
{
|
||||
foreach (var child in nodeAsContainer.Children)
|
||||
{
|
||||
var info = child as ContainerInfo;
|
||||
if (info != null)
|
||||
SerializeNodesRecursive(info);
|
||||
else
|
||||
SerializeConnectionInfo(child);
|
||||
}
|
||||
}
|
||||
else
|
||||
SerializeConnectionInfo(node);
|
||||
}
|
||||
|
||||
private void SerializeConnectionInfo(ConnectionInfo con)
|
||||
{
|
||||
var csvLine = Environment.NewLine;
|
||||
|
||||
csvLine += CleanStringForCsv(con.Name) + ";" +
|
||||
CleanStringForCsv(GetNodePath(con)) + ";" +
|
||||
CleanStringForCsv(con.Description) + ";" +
|
||||
CleanStringForCsv(con.Icon) + ";" +
|
||||
CleanStringForCsv(con.Panel) + ";";
|
||||
|
||||
if (_saveFilter.SaveUsername)
|
||||
csvLine += CleanStringForCsv(con.Username) + ";";
|
||||
|
||||
if (_saveFilter.SavePassword)
|
||||
csvLine += CleanStringForCsv(con.Password) + ";";
|
||||
|
||||
if (_saveFilter.SaveDomain)
|
||||
csvLine += CleanStringForCsv(con.Domain) + ";";
|
||||
|
||||
csvLine += CleanStringForCsv(con.Hostname) + ";" +
|
||||
CleanStringForCsv(con.Protocol) + ";" +
|
||||
CleanStringForCsv(con.PuttySession) + ";" +
|
||||
CleanStringForCsv(con.Port) + ";" +
|
||||
CleanStringForCsv(con.UseConsoleSession) + ";" +
|
||||
CleanStringForCsv(con.UseCredSsp) + ";" +
|
||||
CleanStringForCsv(con.RenderingEngine) + ";" +
|
||||
CleanStringForCsv(con.ICAEncryptionStrength) + ";" +
|
||||
CleanStringForCsv(con.RDPAuthenticationLevel) + ";" +
|
||||
CleanStringForCsv(con.LoadBalanceInfo) + ";" +
|
||||
CleanStringForCsv(con.Colors) + ";" +
|
||||
CleanStringForCsv(con.Resolution) + ";" +
|
||||
CleanStringForCsv(con.AutomaticResize) + ";" +
|
||||
CleanStringForCsv(con.DisplayWallpaper) + ";" +
|
||||
CleanStringForCsv(con.DisplayThemes) + ";" +
|
||||
CleanStringForCsv(con.EnableFontSmoothing) + ";" +
|
||||
CleanStringForCsv(con.EnableDesktopComposition) + ";" +
|
||||
CleanStringForCsv(con.CacheBitmaps) + ";" +
|
||||
CleanStringForCsv(con.RedirectDiskDrives) + ";" +
|
||||
CleanStringForCsv(con.RedirectPorts) + ";" +
|
||||
CleanStringForCsv(con.RedirectPrinters) + ";" +
|
||||
CleanStringForCsv(con.RedirectSmartCards) + ";" +
|
||||
CleanStringForCsv(con.RedirectSound) + ";" +
|
||||
CleanStringForCsv(con.RedirectKeys) + ";" +
|
||||
CleanStringForCsv(con.PreExtApp) + ";" +
|
||||
CleanStringForCsv(con.PostExtApp) + ";" +
|
||||
CleanStringForCsv(con.MacAddress) + ";" +
|
||||
CleanStringForCsv(con.UserField) + ";" +
|
||||
CleanStringForCsv(con.ExtApp) + ";" +
|
||||
CleanStringForCsv(con.VNCCompression) + ";" +
|
||||
CleanStringForCsv(con.VNCEncoding) + ";" +
|
||||
CleanStringForCsv(con.VNCAuthMode) + ";" +
|
||||
CleanStringForCsv(con.VNCProxyType) + ";" +
|
||||
CleanStringForCsv(con.VNCProxyIP) + ";" +
|
||||
CleanStringForCsv(con.VNCProxyPort) + ";" +
|
||||
CleanStringForCsv(con.VNCProxyUsername) + ";" +
|
||||
CleanStringForCsv(con.VNCProxyPassword) + ";" +
|
||||
CleanStringForCsv(con.VNCColors) + ";" +
|
||||
CleanStringForCsv(con.VNCSmartSizeMode) + ";" +
|
||||
CleanStringForCsv(con.VNCViewOnly) + ";" +
|
||||
CleanStringForCsv(con.RDGatewayUsageMethod) + ";" +
|
||||
CleanStringForCsv(con.RDGatewayHostname) + ";" +
|
||||
CleanStringForCsv(con.RDGatewayUseConnectionCredentials) + ";" +
|
||||
CleanStringForCsv(con.RDGatewayUsername) + ";" +
|
||||
CleanStringForCsv(con.RDGatewayPassword) + ";" +
|
||||
CleanStringForCsv(con.RDGatewayDomain) + ";";
|
||||
|
||||
|
||||
if (_saveFilter.SaveInheritance)
|
||||
{
|
||||
csvLine += con.Inheritance.CacheBitmaps + ";" +
|
||||
con.Inheritance.Colors + ";" +
|
||||
con.Inheritance.Description + ";" +
|
||||
con.Inheritance.DisplayThemes + ";" +
|
||||
con.Inheritance.DisplayWallpaper + ";" +
|
||||
con.Inheritance.EnableFontSmoothing + ";" +
|
||||
con.Inheritance.EnableDesktopComposition + ";" +
|
||||
con.Inheritance.Domain + ";" +
|
||||
con.Inheritance.Icon + ";" +
|
||||
con.Inheritance.Panel + ";" +
|
||||
con.Inheritance.Password + ";" +
|
||||
con.Inheritance.Port + ";" +
|
||||
con.Inheritance.Protocol + ";" +
|
||||
con.Inheritance.PuttySession + ";" +
|
||||
con.Inheritance.RedirectDiskDrives + ";" +
|
||||
con.Inheritance.RedirectKeys + ";" +
|
||||
con.Inheritance.RedirectPorts + ";" +
|
||||
con.Inheritance.RedirectPrinters + ";" +
|
||||
con.Inheritance.RedirectSmartCards + ";" +
|
||||
con.Inheritance.RedirectSound + ";" +
|
||||
con.Inheritance.Resolution + ";" +
|
||||
con.Inheritance.AutomaticResize + ";" +
|
||||
con.Inheritance.UseConsoleSession + ";" +
|
||||
con.Inheritance.UseCredSsp + ";" +
|
||||
con.Inheritance.RenderingEngine + ";" +
|
||||
con.Inheritance.Username + ";" +
|
||||
con.Inheritance.ICAEncryptionStrength + ";" +
|
||||
con.Inheritance.RDPAuthenticationLevel + ";" +
|
||||
con.Inheritance.LoadBalanceInfo + ";" +
|
||||
con.Inheritance.PreExtApp + ";" +
|
||||
con.Inheritance.PostExtApp + ";" +
|
||||
con.Inheritance.MacAddress + ";" +
|
||||
con.Inheritance.UserField + ";" +
|
||||
con.Inheritance.ExtApp + ";" +
|
||||
con.Inheritance.VNCCompression + ";" +
|
||||
con.Inheritance.VNCEncoding + ";" +
|
||||
con.Inheritance.VNCAuthMode + ";" +
|
||||
con.Inheritance.VNCProxyType + ";" +
|
||||
con.Inheritance.VNCProxyIP + ";" +
|
||||
con.Inheritance.VNCProxyPort + ";" +
|
||||
con.Inheritance.VNCProxyUsername + ";" +
|
||||
con.Inheritance.VNCProxyPassword + ";" +
|
||||
con.Inheritance.VNCColors + ";" +
|
||||
con.Inheritance.VNCSmartSizeMode + ";" +
|
||||
con.Inheritance.VNCViewOnly + ";" +
|
||||
con.Inheritance.RDGatewayUsageMethod + ";" +
|
||||
con.Inheritance.RDGatewayHostname + ";" +
|
||||
con.Inheritance.RDGatewayUseConnectionCredentials + ";" +
|
||||
con.Inheritance.RDGatewayUsername + ";" +
|
||||
con.Inheritance.RDGatewayPassword + ";" +
|
||||
con.Inheritance.RDGatewayDomain + ";" +
|
||||
con.Inheritance.RDPAlertIdleTimeout + ";" +
|
||||
con.Inheritance.RDPMinutesToIdleTimeout + ";" +
|
||||
con.Inheritance.SoundQuality;
|
||||
}
|
||||
|
||||
_csv += csvLine;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove text that is unsafe for use in CSV files
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
private string CleanStringForCsv(object text)
|
||||
{
|
||||
return text.ToString().Replace(";", "");
|
||||
}
|
||||
|
||||
private string GetNodePath(ConnectionInfo connectionInfo)
|
||||
{
|
||||
var nodePath = "";
|
||||
var currentItem = connectionInfo;
|
||||
while (currentItem != _serializationTarget)
|
||||
{
|
||||
currentItem = currentItem.Parent;
|
||||
if (currentItem == null)
|
||||
break;
|
||||
nodePath += $@"{currentItem.Name}\";
|
||||
}
|
||||
nodePath = nodePath.TrimEnd('\\');
|
||||
return nodePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using mRemoteNG.Tree.Root;
|
||||
|
||||
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
|
||||
|
||||
@@ -59,19 +59,19 @@ namespace mRemoteNG.Config.Serializers
|
||||
switch (value)
|
||||
{
|
||||
case "8":
|
||||
connectionInfo.Colors = RdpColors.Colors256;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors256;
|
||||
break;
|
||||
case "15":
|
||||
connectionInfo.Colors = RdpColors.Colors15Bit;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors15Bit;
|
||||
break;
|
||||
case "16":
|
||||
connectionInfo.Colors = RdpColors.Colors16Bit;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors16Bit;
|
||||
break;
|
||||
case "24":
|
||||
connectionInfo.Colors = RdpColors.Colors24Bit;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors24Bit;
|
||||
break;
|
||||
case "32":
|
||||
connectionInfo.Colors = RdpColors.Colors32Bit;
|
||||
connectionInfo.Colors = RdpProtocol.RDPColors.Colors32Bit;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -79,7 +79,7 @@ namespace mRemoteNG.Config.Serializers
|
||||
connectionInfo.CacheBitmaps = value == "1";
|
||||
break;
|
||||
case "screen mode id":
|
||||
connectionInfo.Resolution = value == "2" ? RdpResolutions.Fullscreen : RdpResolutions.FitToWindow;
|
||||
connectionInfo.Resolution = value == "2" ? RdpProtocol.RDPResolutions.Fullscreen : RdpProtocol.RDPResolutions.FitToWindow;
|
||||
break;
|
||||
case "connect to console":
|
||||
connectionInfo.UseConsoleSession = value == "1";
|
||||
@@ -112,13 +112,13 @@ namespace mRemoteNG.Config.Serializers
|
||||
switch (value)
|
||||
{
|
||||
case "0":
|
||||
connectionInfo.RedirectSound = RdpSounds.BringToThisComputer;
|
||||
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.BringToThisComputer;
|
||||
break;
|
||||
case "1":
|
||||
connectionInfo.RedirectSound = RdpSounds.LeaveAtRemoteComputer;
|
||||
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.LeaveAtRemoteComputer;
|
||||
break;
|
||||
case "2":
|
||||
connectionInfo.RedirectSound = RdpSounds.DoNotPlay;
|
||||
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.DoNotPlay;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
@@ -9,11 +7,13 @@ using mRemoteNG.Connection.Protocol.RDP;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Serializers
|
||||
{
|
||||
public class RemoteDesktopConnectionManagerDeserializer : IDeserializer<string, ConnectionTreeModel>
|
||||
public class RemoteDesktopConnectionManagerDeserializer : IDeserializer<string, ConnectionTreeModel>
|
||||
{
|
||||
private static int _schemaVersion; /* 1 = RDCMan v2.2
|
||||
3 = RDCMan v2.7 */
|
||||
@@ -176,7 +176,7 @@ namespace mRemoteNG.Config.Serializers
|
||||
var gatewaySettingsNode = xmlNode.SelectSingleNode("./gatewaySettings");
|
||||
if (gatewaySettingsNode?.Attributes?["inherit"].Value == "None")
|
||||
{
|
||||
connectionInfo.RDGatewayUsageMethod = gatewaySettingsNode.SelectSingleNode("./enabled")?.InnerText == "True" ? RDGatewayUsageMethod.Always : RDGatewayUsageMethod.Never;
|
||||
connectionInfo.RDGatewayUsageMethod = gatewaySettingsNode.SelectSingleNode("./enabled")?.InnerText == "True" ? RdpProtocol.RDGatewayUsageMethod.Always : RdpProtocol.RDGatewayUsageMethod.Never;
|
||||
connectionInfo.RDGatewayHostname = gatewaySettingsNode.SelectSingleNode("./hostName")?.InnerText;
|
||||
connectionInfo.RDGatewayUsername = gatewaySettingsNode.SelectSingleNode("./userName")?.InnerText;
|
||||
|
||||
@@ -203,26 +203,26 @@ namespace mRemoteNG.Config.Serializers
|
||||
var resolutionString = remoteDesktopNode.SelectSingleNode("./size")?.InnerText.Replace(" ", "");
|
||||
try
|
||||
{
|
||||
connectionInfo.Resolution = (RdpResolutions)Enum.Parse(typeof(RdpResolutions), "Res" + resolutionString);
|
||||
connectionInfo.Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions), "Res" + resolutionString);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
connectionInfo.Resolution = RdpResolutions.FitToWindow;
|
||||
connectionInfo.Resolution = RdpProtocol.RDPResolutions.FitToWindow;
|
||||
}
|
||||
|
||||
if (remoteDesktopNode.SelectSingleNode("./sameSizeAsClientArea")?.InnerText == "True")
|
||||
{
|
||||
connectionInfo.Resolution = RdpResolutions.FitToWindow;
|
||||
connectionInfo.Resolution = RdpProtocol.RDPResolutions.FitToWindow;
|
||||
}
|
||||
|
||||
if (remoteDesktopNode.SelectSingleNode("./fullScreen")?.InnerText == "True")
|
||||
{
|
||||
connectionInfo.Resolution = RdpResolutions.Fullscreen;
|
||||
connectionInfo.Resolution = RdpProtocol.RDPResolutions.Fullscreen;
|
||||
}
|
||||
|
||||
var colorDepth = remoteDesktopNode.SelectSingleNode("./colorDepth")?.InnerText;
|
||||
if (colorDepth != null)
|
||||
connectionInfo.Colors = (RdpColors)Enum.Parse(typeof(RdpColors), colorDepth);
|
||||
connectionInfo.Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors), colorDepth);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -238,15 +238,15 @@ namespace mRemoteNG.Config.Serializers
|
||||
{
|
||||
case "0": // Bring to this computer
|
||||
case "Client":
|
||||
connectionInfo.RedirectSound = RdpSounds.BringToThisComputer;
|
||||
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.BringToThisComputer;
|
||||
break;
|
||||
case "1": // Leave at remote computer
|
||||
case "Remote":
|
||||
connectionInfo.RedirectSound = RdpSounds.LeaveAtRemoteComputer;
|
||||
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.LeaveAtRemoteComputer;
|
||||
break;
|
||||
case "2": // Do not play
|
||||
case "NoSound":
|
||||
connectionInfo.RedirectSound = RdpSounds.DoNotPlay;
|
||||
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.DoNotPlay;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -294,15 +294,15 @@ namespace mRemoteNG.Config.Serializers
|
||||
{
|
||||
case "0": // No authentication
|
||||
case "None":
|
||||
connectionInfo.RDPAuthenticationLevel = RdpAuthenticationLevel.NoAuth;
|
||||
connectionInfo.RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.NoAuth;
|
||||
break;
|
||||
case "1": // Do not connect if authentication fails
|
||||
case "Required":
|
||||
connectionInfo.RDPAuthenticationLevel = RdpAuthenticationLevel.AuthRequired;
|
||||
connectionInfo.RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.AuthRequired;
|
||||
break;
|
||||
case "2": // Warn if authentication fails
|
||||
case "Warn":
|
||||
connectionInfo.RDPAuthenticationLevel = RdpAuthenticationLevel.WarnOnFailedAuth;
|
||||
connectionInfo.RDPAuthenticationLevel = RdpProtocol.AuthenticationLevel.WarnOnFailedAuth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,29 +26,28 @@ namespace mRemoteNG.Connection
|
||||
private string _domain = "";
|
||||
|
||||
private ProtocolType _protocol;
|
||||
private RdpVersionEnum _rdpProtocolVersion;
|
||||
private string _extApp;
|
||||
private int _port;
|
||||
private string _puttySession;
|
||||
private IcaProtocol.EncryptionStrength _icaEncryption;
|
||||
private bool _useConsoleSession;
|
||||
private RdpAuthenticationLevel _rdpAuthenticationLevel;
|
||||
private RdpProtocol.AuthenticationLevel _rdpAuthenticationLevel;
|
||||
private int _rdpMinutesToIdleTimeout;
|
||||
private bool _rdpAlertIdleTimeout;
|
||||
private string _loadBalanceInfo;
|
||||
private HTTPBase.RenderingEngine _renderingEngine;
|
||||
private bool _useCredSsp;
|
||||
|
||||
private RDGatewayUsageMethod _rdGatewayUsageMethod;
|
||||
private RdpProtocol.RDGatewayUsageMethod _rdGatewayUsageMethod;
|
||||
private string _rdGatewayHostname;
|
||||
private RDGatewayUseConnectionCredentials _rdGatewayUseConnectionCredentials;
|
||||
private RdpProtocol.RDGatewayUseConnectionCredentials _rdGatewayUseConnectionCredentials;
|
||||
private string _rdGatewayUsername;
|
||||
private string _rdGatewayPassword;
|
||||
private string _rdGatewayDomain;
|
||||
|
||||
private RdpResolutions _resolution;
|
||||
private RdpProtocol.RDPResolutions _resolution;
|
||||
private bool _automaticResize;
|
||||
private RdpColors _colors;
|
||||
private RdpProtocol.RDPColors _colors;
|
||||
private bool _cacheBitmaps;
|
||||
private bool _displayWallpaper;
|
||||
private bool _displayThemes;
|
||||
@@ -60,8 +59,8 @@ namespace mRemoteNG.Connection
|
||||
private bool _redirectPrinters;
|
||||
private bool _redirectPorts;
|
||||
private bool _redirectSmartCards;
|
||||
private RdpSounds _redirectSound;
|
||||
private RdpSoundQuality _soundQuality;
|
||||
private RdpProtocol.RDPSounds _redirectSound;
|
||||
private RdpProtocol.RDPSoundQuality _soundQuality;
|
||||
|
||||
private string _preExtApp;
|
||||
private string _postExtApp;
|
||||
@@ -171,16 +170,6 @@ namespace mRemoteNG.Connection
|
||||
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.LocalizedDisplayName("strPropertyNameExternalTool"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalTool"),
|
||||
@@ -234,7 +223,7 @@ namespace mRemoteNG.Connection
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationLevel"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationLevel"),
|
||||
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
|
||||
public RdpAuthenticationLevel RDPAuthenticationLevel
|
||||
public RdpProtocol.AuthenticationLevel RDPAuthenticationLevel
|
||||
{
|
||||
get { return GetPropertyValue("RDPAuthenticationLevel", _rdpAuthenticationLevel); }
|
||||
set { SetField(ref _rdpAuthenticationLevel, value, "RDPAuthenticationLevel"); }
|
||||
@@ -299,7 +288,7 @@ namespace mRemoteNG.Connection
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUsageMethod"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUsageMethod"),
|
||||
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
|
||||
public RDGatewayUsageMethod RDGatewayUsageMethod
|
||||
public RdpProtocol.RDGatewayUsageMethod RDGatewayUsageMethod
|
||||
{
|
||||
get { return GetPropertyValue("RDGatewayUsageMethod", _rdGatewayUsageMethod); }
|
||||
set { SetField(ref _rdGatewayUsageMethod, value, "RDGatewayUsageMethod"); }
|
||||
@@ -318,7 +307,7 @@ namespace mRemoteNG.Connection
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUseConnectionCredentials"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUseConnectionCredentials"),
|
||||
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
|
||||
public RDGatewayUseConnectionCredentials RDGatewayUseConnectionCredentials
|
||||
public RdpProtocol.RDGatewayUseConnectionCredentials RDGatewayUseConnectionCredentials
|
||||
{
|
||||
get { return GetPropertyValue("RDGatewayUseConnectionCredentials", _rdGatewayUseConnectionCredentials); }
|
||||
set { SetField(ref _rdGatewayUseConnectionCredentials, value, "RDGatewayUseConnectionCredentials"); }
|
||||
@@ -358,7 +347,7 @@ namespace mRemoteNG.Connection
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameResolution"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionResolution"),
|
||||
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
|
||||
public RdpResolutions Resolution
|
||||
public RdpProtocol.RDPResolutions Resolution
|
||||
{
|
||||
get { return GetPropertyValue("Resolution", _resolution); }
|
||||
set { SetField(ref _resolution, value, "Resolution"); }
|
||||
@@ -378,7 +367,7 @@ namespace mRemoteNG.Connection
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"),
|
||||
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
|
||||
public RdpColors Colors
|
||||
public RdpProtocol.RDPColors Colors
|
||||
{
|
||||
get { return GetPropertyValue("Colors", _colors); }
|
||||
set { SetField(ref _colors, value, "Colors"); }
|
||||
@@ -490,7 +479,7 @@ namespace mRemoteNG.Connection
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSounds"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSounds"),
|
||||
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
|
||||
public RdpSounds RedirectSound
|
||||
public RdpProtocol.RDPSounds RedirectSound
|
||||
{
|
||||
get { return GetPropertyValue("RedirectSound", _redirectSound); }
|
||||
set { SetField(ref _redirectSound, value, "RedirectSound"); }
|
||||
@@ -500,7 +489,7 @@ namespace mRemoteNG.Connection
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameSoundQuality"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionSoundQuality"),
|
||||
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
|
||||
public RdpSoundQuality SoundQuality
|
||||
public RdpProtocol.RDPSoundQuality SoundQuality
|
||||
{
|
||||
get { return GetPropertyValue("SoundQuality", _soundQuality); }
|
||||
set { SetField(ref _soundQuality, value, "SoundQuality"); }
|
||||
@@ -509,7 +498,7 @@ namespace mRemoteNG.Connection
|
||||
|
||||
#region Misc
|
||||
[Browsable(false)]
|
||||
public string ConstantID { get; set; }
|
||||
public string ConstantID { get; /*set;*/ }
|
||||
|
||||
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolBefore"),
|
||||
@@ -669,6 +658,11 @@ namespace mRemoteNG.Connection
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
protected AbstractConnectionRecord(string uniqueId)
|
||||
{
|
||||
ConstantID = uniqueId.ThrowIfNullOrEmpty(nameof(uniqueId));
|
||||
}
|
||||
|
||||
protected virtual TPropertyType GetPropertyValue<TPropertyType>(string propertyName, TPropertyType value)
|
||||
{
|
||||
return (TPropertyType)GetType().GetProperty(propertyName).GetValue(this, null);
|
||||
|
||||
@@ -14,7 +14,6 @@ using mRemoteNG.Connection.Protocol.SSH;
|
||||
using mRemoteNG.Connection.Protocol.Telnet;
|
||||
using mRemoteNG.Connection.Protocol.VNC;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
|
||||
@@ -32,7 +31,7 @@ namespace mRemoteNG.Connection
|
||||
public ProtocolList OpenConnections { get; protected set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public bool IsContainer { get; set; }
|
||||
public virtual bool IsContainer { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public bool IsDefault { get; set; }
|
||||
@@ -52,7 +51,14 @@ namespace mRemoteNG.Connection
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public ConnectionInfo()
|
||||
|
||||
public ConnectionInfo()
|
||||
: this(Guid.NewGuid().ToString())
|
||||
{
|
||||
}
|
||||
|
||||
public ConnectionInfo(string uniqueId)
|
||||
: base(uniqueId)
|
||||
{
|
||||
SetTreeDisplayDefaults();
|
||||
SetConnectionDefaults();
|
||||
@@ -65,12 +71,6 @@ namespace mRemoteNG.Connection
|
||||
SetNonBrowsablePropertiesDefaults();
|
||||
SetDefaults();
|
||||
}
|
||||
|
||||
public ConnectionInfo(ContainerInfo parent) : this()
|
||||
{
|
||||
IsContainer = true;
|
||||
parent.AddChild(this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
@@ -78,7 +78,6 @@ namespace mRemoteNG.Connection
|
||||
{
|
||||
var newConnectionInfo = new ConnectionInfo();
|
||||
newConnectionInfo.CopyFrom(this);
|
||||
newConnectionInfo.ConstantID = MiscTools.CreateConstantID();
|
||||
newConnectionInfo.Inheritance = Inheritance.Clone();
|
||||
return newConnectionInfo;
|
||||
}
|
||||
@@ -222,7 +221,7 @@ namespace mRemoteNG.Connection
|
||||
switch (protocol)
|
||||
{
|
||||
case ProtocolType.RDP:
|
||||
return (int)RdpProtocol6.Defaults.Port;
|
||||
return (int)RdpProtocol.Defaults.Port;
|
||||
case ProtocolType.VNC:
|
||||
return (int)ProtocolVNC.Defaults.Port;
|
||||
case ProtocolType.SSH1:
|
||||
@@ -269,13 +268,12 @@ namespace mRemoteNG.Connection
|
||||
private void SetProtocolDefaults()
|
||||
{
|
||||
Protocol = (ProtocolType)Enum.Parse(typeof(ProtocolType), Settings.Default.ConDefaultProtocol);
|
||||
RdpProtocolVersion = RdpVersionEnum.Rdc8;
|
||||
ExtApp = Settings.Default.ConDefaultExtApp;
|
||||
ExtApp = Settings.Default.ConDefaultExtApp;
|
||||
Port = 0;
|
||||
PuttySession = Settings.Default.ConDefaultPuttySession;
|
||||
ICAEncryptionStrength = (IcaProtocol.EncryptionStrength) Enum.Parse(typeof(IcaProtocol.EncryptionStrength), Settings.Default.ConDefaultICAEncryptionStrength);
|
||||
UseConsoleSession = Settings.Default.ConDefaultUseConsoleSession;
|
||||
RDPAuthenticationLevel = (RdpAuthenticationLevel) Enum.Parse(typeof(RdpAuthenticationLevel), Settings.Default.ConDefaultRDPAuthenticationLevel);
|
||||
RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel) Enum.Parse(typeof(RdpProtocol.AuthenticationLevel), Settings.Default.ConDefaultRDPAuthenticationLevel);
|
||||
RDPMinutesToIdleTimeout = Settings.Default.ConDefaultRDPMinutesToIdleTimeout;
|
||||
RDPAlertIdleTimeout = Settings.Default.ConDefaultRDPAlertIdleTimeout;
|
||||
LoadBalanceInfo = Settings.Default.ConDefaultLoadBalanceInfo;
|
||||
@@ -285,9 +283,9 @@ namespace mRemoteNG.Connection
|
||||
|
||||
private void SetRdGatewayDefaults()
|
||||
{
|
||||
RDGatewayUsageMethod = (RDGatewayUsageMethod) Enum.Parse(typeof(RDGatewayUsageMethod), Settings.Default.ConDefaultRDGatewayUsageMethod);
|
||||
RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod) Enum.Parse(typeof(RdpProtocol.RDGatewayUsageMethod), Settings.Default.ConDefaultRDGatewayUsageMethod);
|
||||
RDGatewayHostname = Settings.Default.ConDefaultRDGatewayHostname;
|
||||
RDGatewayUseConnectionCredentials = (RDGatewayUseConnectionCredentials) Enum.Parse(typeof(RDGatewayUseConnectionCredentials), Settings.Default.ConDefaultRDGatewayUseConnectionCredentials);
|
||||
RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials) Enum.Parse(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), Settings.Default.ConDefaultRDGatewayUseConnectionCredentials);
|
||||
RDGatewayUsername = Settings.Default.ConDefaultRDGatewayUsername;
|
||||
RDGatewayPassword = Settings.Default.ConDefaultRDGatewayPassword;
|
||||
RDGatewayDomain = Settings.Default.ConDefaultRDGatewayDomain;
|
||||
@@ -295,9 +293,9 @@ namespace mRemoteNG.Connection
|
||||
|
||||
private void SetAppearanceDefaults()
|
||||
{
|
||||
Resolution = (RdpResolutions) Enum.Parse(typeof(RdpResolutions), Settings.Default.ConDefaultResolution);
|
||||
Resolution = (RdpProtocol.RDPResolutions) Enum.Parse(typeof(RdpProtocol.RDPResolutions), Settings.Default.ConDefaultResolution);
|
||||
AutomaticResize = Settings.Default.ConDefaultAutomaticResize;
|
||||
Colors = (RdpColors) Enum.Parse(typeof(RdpColors), Settings.Default.ConDefaultColors);
|
||||
Colors = (RdpProtocol.RDPColors) Enum.Parse(typeof(RdpProtocol.RDPColors), Settings.Default.ConDefaultColors);
|
||||
CacheBitmaps = Settings.Default.ConDefaultCacheBitmaps;
|
||||
DisplayWallpaper = Settings.Default.ConDefaultDisplayWallpaper;
|
||||
DisplayThemes = Settings.Default.ConDefaultDisplayThemes;
|
||||
@@ -312,13 +310,12 @@ namespace mRemoteNG.Connection
|
||||
RedirectPrinters = Settings.Default.ConDefaultRedirectPrinters;
|
||||
RedirectPorts = Settings.Default.ConDefaultRedirectPorts;
|
||||
RedirectSmartCards = Settings.Default.ConDefaultRedirectSmartCards;
|
||||
RedirectSound = (RdpSounds) Enum.Parse(typeof(RdpSounds), Settings.Default.ConDefaultRedirectSound);
|
||||
SoundQuality = (RdpSoundQuality)Enum.Parse(typeof(RdpSoundQuality), Settings.Default.ConDefaultSoundQuality);
|
||||
RedirectSound = (RdpProtocol.RDPSounds) Enum.Parse(typeof(RdpProtocol.RDPSounds), Settings.Default.ConDefaultRedirectSound);
|
||||
SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality), Settings.Default.ConDefaultSoundQuality);
|
||||
}
|
||||
|
||||
private void SetMiscDefaults()
|
||||
{
|
||||
ConstantID = MiscTools.CreateConstantID();
|
||||
PreExtApp = Settings.Default.ConDefaultPreExtApp;
|
||||
PostExtApp = Settings.Default.ConDefaultPostExtApp;
|
||||
MacAddress = Settings.Default.ConDefaultMacAddress;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace mRemoteNG.Connection
|
||||
var connectionContainer = SetConnectionContainer(connectionInfo, connectionForm);
|
||||
SetConnectionFormEventHandlers(newProtocol, connectionForm);
|
||||
SetConnectionEventHandlers(newProtocol);
|
||||
BuildConnectionInterfaceController(newProtocol, connectionContainer);
|
||||
BuildConnectionInterfaceController(connectionInfo, newProtocol, connectionContainer);
|
||||
|
||||
newProtocol.Force = force;
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace mRemoteNG.Connection
|
||||
{
|
||||
var ic = t.Controls[0] as InterfaceControl;
|
||||
if (ic == null) continue;
|
||||
if (ic.Protocol.Info == connectionInfo)
|
||||
if (ic.Info == connectionInfo)
|
||||
{
|
||||
return ic;
|
||||
}
|
||||
@@ -213,9 +213,9 @@ namespace mRemoteNG.Connection
|
||||
newProtocol.ErrorOccured += Prot_Event_ErrorOccured;
|
||||
}
|
||||
|
||||
private static void BuildConnectionInterfaceController(ProtocolBase newProtocol, Control connectionContainer)
|
||||
private static void BuildConnectionInterfaceController(ConnectionInfo connectionInfo, ProtocolBase newProtocol, Control connectionContainer)
|
||||
{
|
||||
newProtocol.InterfaceControl = new InterfaceControl(connectionContainer, newProtocol);
|
||||
newProtocol.InterfaceControl = new InterfaceControl(connectionContainer, newProtocol, connectionInfo);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace mRemoteNG.Connection
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strProtocolEventDisconnected, disconnectedMessage), true);
|
||||
|
||||
var prot = (ProtocolBase)sender;
|
||||
if (prot.Info.Protocol != ProtocolType.RDP) return;
|
||||
if (prot.InterfaceControl.Info.Protocol != ProtocolType.RDP) return;
|
||||
var reasonCode = disconnectedMessage.Split("\r\n".ToCharArray())[0];
|
||||
var desc = disconnectedMessage.Replace("\r\n", " ");
|
||||
|
||||
@@ -246,27 +246,26 @@ namespace mRemoteNG.Connection
|
||||
}
|
||||
}
|
||||
|
||||
private static void Prot_Event_Closed(object sender, EventArgs args)
|
||||
private static void Prot_Event_Closed(object sender)
|
||||
{
|
||||
try
|
||||
{
|
||||
var prot = (ProtocolBase)sender;
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnenctionCloseEvent, true);
|
||||
string connDetail;
|
||||
if (prot.Info.Hostname == "" && prot.Info.Protocol == ProtocolType.IntApp)
|
||||
connDetail = prot.Info.ExtApp;
|
||||
else if (prot.Info.Hostname != "")
|
||||
connDetail = prot.Info.Hostname;
|
||||
if (prot.InterfaceControl.Info.Hostname == "" && prot.InterfaceControl.Info.Protocol == ProtocolType.IntApp)
|
||||
connDetail = prot.InterfaceControl.Info.ExtApp;
|
||||
else if (prot.InterfaceControl.Info.Hostname != "")
|
||||
connDetail = prot.InterfaceControl.Info.Hostname;
|
||||
else
|
||||
connDetail = "UNKNOWN";
|
||||
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
|
||||
string.Format(Language.strConnenctionClosedByUser, connDetail, prot.Info.Protocol, Environment.UserName));
|
||||
prot.Info.OpenConnections.Remove(prot);
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strConnenctionClosedByUser, connDetail, prot.InterfaceControl.Info.Protocol, Environment.UserName));
|
||||
prot.InterfaceControl.Info.OpenConnections.Remove(prot);
|
||||
|
||||
if (prot.Info.PostExtApp == "") return;
|
||||
var extA = Runtime.ExternalToolsService.GetExtAppByName(prot.Info.PostExtApp);
|
||||
extA?.Start(prot.Info);
|
||||
if (prot.InterfaceControl.Info.PostExtApp == "") return;
|
||||
var extA = Runtime.ExternalToolsService.GetExtAppByName(prot.InterfaceControl.Info.PostExtApp);
|
||||
extA?.Start(prot.InterfaceControl.Info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -274,12 +273,11 @@ namespace mRemoteNG.Connection
|
||||
}
|
||||
}
|
||||
|
||||
private static void Prot_Event_Connected(object sender, EventArgs args)
|
||||
private static void Prot_Event_Connected(object sender)
|
||||
{
|
||||
var prot = (ProtocolBase)sender;
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnectionEventConnected, true);
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
|
||||
string.Format(Language.strConnectionEventConnectedDetail, prot.Info.Hostname, prot.Info.Protocol, Environment.UserName, prot.Info.Description, prot.Info.UserField));
|
||||
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));
|
||||
}
|
||||
|
||||
private static void Prot_Event_ErrorOccured(object sender, string errorMessage)
|
||||
@@ -289,12 +287,9 @@ namespace mRemoteNG.Connection
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnectionEventErrorOccured, true);
|
||||
var prot = (ProtocolBase)sender;
|
||||
|
||||
if (prot.Info.Protocol != ProtocolType.RDP) return;
|
||||
var errorMessageAsInt = Convert.ToInt32(errorMessage);
|
||||
|
||||
if (errorMessageAsInt > -1)
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
|
||||
string.Format(Language.strConnectionRdpErrorDetail, errorMessage, RdpErrorTranslator.Translate(errorMessageAsInt)));
|
||||
if (prot.InterfaceControl.Info.Protocol != ProtocolType.RDP) return;
|
||||
if (Convert.ToInt32(errorMessage) > -1)
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, string.Format(Language.strConnectionRdpErrorDetail, errorMessage, RdpProtocol.FatalErrors.GetError(errorMessage)));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace mRemoteNG.Connection
|
||||
public event EventHandler<ConnectionsLoadedEventArgs> ConnectionsLoaded;
|
||||
public event EventHandler<ConnectionsSavedEventArgs> ConnectionsSaved;
|
||||
|
||||
private void RaiseConnectionsLoadedEvent(Maybe<ConnectionTreeModel> previousTreeModel, ConnectionTreeModel newTreeModel,
|
||||
private void RaiseConnectionsLoadedEvent(Optional<ConnectionTreeModel> previousTreeModel, ConnectionTreeModel newTreeModel,
|
||||
bool previousSourceWasDatabase, bool newSourceIsDatabase,
|
||||
string newSourcePath)
|
||||
{
|
||||
|
||||
@@ -10,12 +10,15 @@ namespace mRemoteNG.Connection
|
||||
public sealed partial class InterfaceControl
|
||||
{
|
||||
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
|
||||
{
|
||||
Protocol = protocol;
|
||||
Info = info;
|
||||
Parent = parent;
|
||||
Location = new Point(0, 0);
|
||||
Size = Parent.Size;
|
||||
|
||||
@@ -3,8 +3,7 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
public class ProtocolHTTP : HTTPBase
|
||||
{
|
||||
|
||||
public ProtocolHTTP(ConnectionInfo connectionInfo, RenderingEngine renderingEngine)
|
||||
: base(connectionInfo, renderingEngine)
|
||||
public ProtocolHTTP(RenderingEngine RenderingEngine) : base(RenderingEngine)
|
||||
{
|
||||
httpOrS = "http";
|
||||
defaultPort = (int)Defaults.Port;
|
||||
|
||||
@@ -9,19 +9,20 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
{
|
||||
public class HTTPBase : ProtocolBase
|
||||
{
|
||||
#region Private Properties
|
||||
private Control wBrowser;
|
||||
private string tabTitle;
|
||||
protected string httpOrS;
|
||||
protected int defaultPort;
|
||||
private string tabTitle;
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
protected HTTPBase(ConnectionInfo connectionInfo, RenderingEngine renderingEngine)
|
||||
: base(connectionInfo)
|
||||
{
|
||||
protected HTTPBase(RenderingEngine RenderingEngine)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (renderingEngine == RenderingEngine.Gecko)
|
||||
if (RenderingEngine == RenderingEngine.Gecko)
|
||||
{
|
||||
if(!Xpcom.IsInitialized)
|
||||
Xpcom.Initialize("Firefox");
|
||||
@@ -57,7 +58,7 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
{
|
||||
wBrowser = Control;
|
||||
|
||||
if (Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
{
|
||||
var GeckoBrowser = (GeckoWebBrowser) wBrowser;
|
||||
if (GeckoBrowser != null)
|
||||
@@ -95,7 +96,7 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
{
|
||||
try
|
||||
{
|
||||
var strHost = Info.Hostname;
|
||||
var strHost = InterfaceControl.Info.Hostname;
|
||||
/*
|
||||
* Commenting out since this codes doesn't actually do anything at this time...
|
||||
* Possibly related to MR-221 and/or MR-533 ????
|
||||
@@ -107,7 +108,7 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
strAuth = "Authorization: Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(InterfaceControl.Info.Username + ":" + InterfaceControl.Info.Password)) + Environment.NewLine;
|
||||
}
|
||||
*/
|
||||
if (Info.Port != defaultPort)
|
||||
if (InterfaceControl.Info.Port != defaultPort)
|
||||
{
|
||||
if (strHost.EndsWith("/"))
|
||||
{
|
||||
@@ -119,13 +120,13 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
strHost = httpOrS + "://" + strHost;
|
||||
}
|
||||
|
||||
if (Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
{
|
||||
((GeckoWebBrowser)wBrowser).Navigate(strHost + ":" + Info.Port);
|
||||
((GeckoWebBrowser)wBrowser).Navigate(strHost + ":" + InterfaceControl.Info.Port);
|
||||
}
|
||||
else
|
||||
{
|
||||
((WebBrowser)wBrowser).Navigate(strHost + ":" + Info.Port);
|
||||
((WebBrowser)wBrowser).Navigate(strHost + ":" + InterfaceControl.Info.Port);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -135,7 +136,7 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
strHost = httpOrS + "://" + strHost;
|
||||
}
|
||||
|
||||
if (Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
{
|
||||
((GeckoWebBrowser)wBrowser).Navigate(strHost);
|
||||
}
|
||||
@@ -180,7 +181,7 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
if (tabP == null) return;
|
||||
string shortTitle;
|
||||
|
||||
if (Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
{
|
||||
if (((GeckoWebBrowser) wBrowser).DocumentTitle.Length >= 15)
|
||||
{
|
||||
@@ -228,7 +229,7 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
if (tabP == null) return;
|
||||
string shortTitle;
|
||||
|
||||
if (Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
|
||||
{
|
||||
if (((GeckoWebBrowser)wBrowser).DocumentTitle.Length >= 15)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
{
|
||||
public class ProtocolHTTPS : HTTPBase
|
||||
{
|
||||
public ProtocolHTTPS(ConnectionInfo connectionInfo, RenderingEngine renderingEngine)
|
||||
: base(connectionInfo, renderingEngine)
|
||||
|
||||
public ProtocolHTTPS(RenderingEngine RenderingEngine) : base(RenderingEngine)
|
||||
{
|
||||
httpOrS = "https";
|
||||
defaultPort = (int)Defaults.Port;
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
public class IcaProtocol : ProtocolBase
|
||||
{
|
||||
private AxICAClient _icaClient;
|
||||
private ConnectionInfo _info;
|
||||
private readonly FrmMain _frmMain = FrmMain.Default;
|
||||
|
||||
#region Public Methods
|
||||
public IcaProtocol(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
public IcaProtocol()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -39,6 +39,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
try
|
||||
{
|
||||
_icaClient = (AxICAClient)Control;
|
||||
_info = InterfaceControl.Info;
|
||||
_icaClient.CreateControl();
|
||||
|
||||
while (!_icaClient.Created)
|
||||
@@ -47,7 +48,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
Application.DoEvents();
|
||||
}
|
||||
|
||||
_icaClient.Address = Info.Hostname;
|
||||
_icaClient.Address = _info.Hostname;
|
||||
SetCredentials();
|
||||
SetResolution();
|
||||
SetColors();
|
||||
@@ -77,8 +78,8 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
_icaClient.Hotkey11Shift = null;
|
||||
_icaClient.Hotkey11Char = null;
|
||||
|
||||
_icaClient.PersistentCacheEnabled = Info.CacheBitmaps;
|
||||
_icaClient.Title = Info.Name;
|
||||
_icaClient.PersistentCacheEnabled = _info.CacheBitmaps;
|
||||
_icaClient.Title = _info.Name;
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -116,9 +117,9 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
return;
|
||||
}
|
||||
|
||||
var user = Info?.Username ?? "";
|
||||
var pass = Info?.Password ?? "";
|
||||
var dom = Info?.Domain ?? "";
|
||||
var user = _info?.Username ?? "";
|
||||
var pass = _info?.Password ?? "";
|
||||
var dom = _info?.Domain ?? "";
|
||||
|
||||
if (string.IsNullOrEmpty(user))
|
||||
{
|
||||
@@ -186,22 +187,22 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
return;
|
||||
}
|
||||
|
||||
if (Info.Resolution == RdpResolutions.FitToWindow)
|
||||
if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.FitToWindow)
|
||||
{
|
||||
_icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0);
|
||||
}
|
||||
else if (Info.Resolution == RdpResolutions.SmartSize)
|
||||
else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.SmartSize)
|
||||
{
|
||||
_icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0);
|
||||
}
|
||||
else if (Info.Resolution == RdpResolutions.Fullscreen)
|
||||
else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.Fullscreen)
|
||||
{
|
||||
_icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(_frmMain).Bounds.Width, Screen.FromControl(_frmMain).Bounds.Height, 0);
|
||||
_icaClient.FullScreenWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
var resolution = Info.Resolution.GetResolutionRectangle();
|
||||
var resolution = RdpProtocol.GetResolutionRectangle(_info.Resolution);
|
||||
_icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0);
|
||||
}
|
||||
}
|
||||
@@ -214,15 +215,15 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
private void SetColors()
|
||||
{
|
||||
// ReSharper disable once SwitchStatementMissingSomeCases
|
||||
switch (Info.Colors)
|
||||
switch (_info.Colors)
|
||||
{
|
||||
case RdpColors.Colors256:
|
||||
case RdpProtocol.RDPColors.Colors256:
|
||||
_icaClient.SetProp("DesiredColor", "2");
|
||||
break;
|
||||
case RdpColors.Colors15Bit:
|
||||
case RdpProtocol.RDPColors.Colors15Bit:
|
||||
_icaClient.SetProp("DesiredColor", "4");
|
||||
break;
|
||||
case RdpColors.Colors16Bit:
|
||||
case RdpProtocol.RDPColors.Colors16Bit:
|
||||
_icaClient.SetProp("DesiredColor", "4");
|
||||
break;
|
||||
default:
|
||||
@@ -234,7 +235,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
private void SetSecurity()
|
||||
{
|
||||
// ReSharper disable once SwitchStatementMissingSomeCases
|
||||
switch (Info.ICAEncryptionStrength)
|
||||
switch (_info.ICAEncryptionStrength)
|
||||
{
|
||||
case EncryptionStrength.Encr128BitLogonOnly:
|
||||
_icaClient.Encrypt = true;
|
||||
@@ -274,22 +275,22 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
#region Private Events & Handlers
|
||||
private void ICAEvent_OnConnecting(object sender, EventArgs e)
|
||||
{
|
||||
RaiseConnectionConnectingEvent(this);
|
||||
Event_Connecting(this);
|
||||
}
|
||||
|
||||
private void ICAEvent_OnConnected(object sender, EventArgs e)
|
||||
{
|
||||
RaiseConnectionConnectedEvent(this);
|
||||
Event_Connected(this);
|
||||
}
|
||||
|
||||
private void ICAEvent_OnConnectFailed(object sender, EventArgs e)
|
||||
{
|
||||
RaiseErrorOccuredEvent(this, e.ToString());
|
||||
Event_ErrorOccured(this, e.ToString());
|
||||
}
|
||||
|
||||
private void ICAEvent_OnDisconnect(object sender, EventArgs e)
|
||||
{
|
||||
RaiseConnectionDisconnectedEvent(this, e.ToString());
|
||||
Event_Disconnected(this, e.ToString());
|
||||
|
||||
if (Settings.Default.ReconnectOnDisconnect)
|
||||
{
|
||||
@@ -311,7 +312,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
#region Reconnect Stuff
|
||||
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;
|
||||
|
||||
|
||||
@@ -11,30 +11,27 @@ namespace mRemoteNG.Connection.Protocol
|
||||
{
|
||||
public class IntegratedProgram : ProtocolBase
|
||||
{
|
||||
#region Private Fields
|
||||
private ExternalTool _externalTool;
|
||||
private IntPtr _handle;
|
||||
private Process _process;
|
||||
|
||||
public IntegratedProgram(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public override bool Initialize()
|
||||
{
|
||||
if (Info == null)
|
||||
if (InterfaceControl.Info == null)
|
||||
return base.Initialize();
|
||||
|
||||
_externalTool = Runtime.ExternalToolsService.GetExtAppByName(Info.ExtApp);
|
||||
_externalTool = Runtime.ExternalToolsService.GetExtAppByName(InterfaceControl.Info.ExtApp);
|
||||
|
||||
if (_externalTool == null)
|
||||
{
|
||||
Runtime.MessageCollector?.AddMessage(MessageClass.ErrorMsg, string.Format(Language.CouldNotFindExternalTool, Info.ExtApp));
|
||||
Runtime.MessageCollector?.AddMessage(MessageClass.ErrorMsg, string.Format(Language.CouldNotFindExternalTool, InterfaceControl.Info.ExtApp));
|
||||
return false;
|
||||
}
|
||||
|
||||
_externalTool.ConnectionInfo = Info;
|
||||
_externalTool.ConnectionInfo = InterfaceControl.Info;
|
||||
|
||||
return base.Initialize();
|
||||
}
|
||||
@@ -47,7 +44,7 @@ namespace mRemoteNG.Connection.Protocol
|
||||
|
||||
if (_externalTool.TryIntegrate == false)
|
||||
{
|
||||
_externalTool.Start(Info);
|
||||
_externalTool.Start(InterfaceControl.Info);
|
||||
/* 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()
|
||||
* will be called - which is just going to call IntegratedProgram.Close() again anyway...
|
||||
@@ -172,7 +169,7 @@ namespace mRemoteNG.Connection.Protocol
|
||||
#region Private Methods
|
||||
private void ProcessExited(object sender, EventArgs e)
|
||||
{
|
||||
RaiseConnectionClosedEvent(this);
|
||||
Event_Closed(this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -3,21 +3,29 @@ using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.UI.Window;
|
||||
|
||||
|
||||
namespace mRemoteNG.Connection.Protocol
|
||||
{
|
||||
public abstract class ProtocolBase
|
||||
{
|
||||
private ConnectionWindow _connectionWindow;
|
||||
#region Private Variables
|
||||
|
||||
private UI.Window.ConnectionWindow _connectionWindow;
|
||||
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 Control
|
||||
private string Name { get; }
|
||||
|
||||
protected ConnectionWindow ConnectionWindow
|
||||
protected UI.Window.ConnectionWindow ConnectionWindow
|
||||
{
|
||||
get { return _connectionWindow; }
|
||||
private set
|
||||
@@ -35,38 +43,33 @@ namespace mRemoteNG.Connection.Protocol
|
||||
set
|
||||
{
|
||||
_interfaceControl = value;
|
||||
ConnectionWindow = _interfaceControl.GetContainerControl() as ConnectionWindow;
|
||||
ConnectionWindow = _interfaceControl.GetContainerControl() as UI.Window.ConnectionWindow;
|
||||
}
|
||||
}
|
||||
|
||||
protected Control Control { get; set; }
|
||||
|
||||
public ConnectionInfo Info { get; set; }
|
||||
#endregion
|
||||
|
||||
public ConnectionInfo.Force Force { get; set; }
|
||||
|
||||
public readonly System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
|
||||
protected ReconnectGroup ReconnectGroup;
|
||||
#endregion
|
||||
|
||||
protected ProtocolBase(ConnectionInfo connectionInfo, string name)
|
||||
protected ProtocolBase(string name)
|
||||
{
|
||||
if (connectionInfo == null)
|
||||
throw new ArgumentNullException(nameof(connectionInfo));
|
||||
if (name == null)
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
|
||||
Info = connectionInfo;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
protected ProtocolBase(ConnectionInfo connectionInfo)
|
||||
: this(connectionInfo, "")
|
||||
protected ProtocolBase()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
//public abstract int GetDefaultPort();
|
||||
|
||||
public virtual void Focus()
|
||||
{
|
||||
try
|
||||
@@ -116,8 +119,9 @@ namespace mRemoteNG.Connection.Protocol
|
||||
|
||||
public virtual bool Connect()
|
||||
{
|
||||
if (Info.Protocol == ProtocolType.RDP) return false;
|
||||
RaiseConnectionConnectedEvent(this);
|
||||
if (InterfaceControl.Info.Protocol == ProtocolType.RDP) return false;
|
||||
if (ConnectedEvent == null) return false;
|
||||
ConnectedEvent(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -136,7 +140,7 @@ namespace mRemoteNG.Connection.Protocol
|
||||
|
||||
private void CloseBG()
|
||||
{
|
||||
RaiseConnectionClosedEvent(this);
|
||||
ClosedEvent?.Invoke(this);
|
||||
try
|
||||
{
|
||||
tmrReconnect.Enabled = false;
|
||||
@@ -221,46 +225,83 @@ namespace mRemoteNG.Connection.Protocol
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
public event EventHandler Connecting;
|
||||
public event EventHandler Connected;
|
||||
public event EventHandler Closing;
|
||||
public event EventHandler Closed;
|
||||
|
||||
public delegate void DisconnectedEventHandler(object sender, string disconnectedMessage);
|
||||
public event DisconnectedEventHandler Disconnected;
|
||||
|
||||
public delegate void ErrorOccuredEventHandler(object sender, string errorMessage);
|
||||
public event ErrorOccuredEventHandler ErrorOccured;
|
||||
|
||||
protected void RaiseConnectionClosingEvent(object sender)
|
||||
public delegate void ConnectingEventHandler(object sender);
|
||||
public event ConnectingEventHandler Connecting
|
||||
{
|
||||
Closing?.Invoke(sender, EventArgs.Empty);
|
||||
add { ConnectingEvent = (ConnectingEventHandler) Delegate.Combine(ConnectingEvent, value); }
|
||||
remove { ConnectingEvent = (ConnectingEventHandler) Delegate.Remove(ConnectingEvent, value); }
|
||||
}
|
||||
|
||||
public delegate void ConnectedEventHandler(object sender);
|
||||
public event ConnectedEventHandler Connected
|
||||
{
|
||||
add { ConnectedEvent = (ConnectedEventHandler) Delegate.Combine(ConnectedEvent, value); }
|
||||
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 RaiseConnectionClosedEvent(object sender)
|
||||
protected void Event_Closed(object sender)
|
||||
{
|
||||
Closed?.Invoke(sender, EventArgs.Empty);
|
||||
ClosedEvent?.Invoke(sender);
|
||||
}
|
||||
|
||||
protected void RaiseConnectionConnectingEvent(object sender)
|
||||
protected void Event_Connecting(object sender)
|
||||
{
|
||||
Connecting?.Invoke(sender, EventArgs.Empty);
|
||||
ConnectingEvent?.Invoke(sender);
|
||||
}
|
||||
|
||||
protected void RaiseConnectionConnectedEvent(object sender)
|
||||
protected void Event_Connected(object sender)
|
||||
{
|
||||
Connected?.Invoke(sender, EventArgs.Empty);
|
||||
ConnectedEvent?.Invoke(sender);
|
||||
}
|
||||
|
||||
protected void RaiseConnectionDisconnectedEvent(object sender, string disconnectedMessage)
|
||||
protected void Event_Disconnected(object sender, string DisconnectedMessage)
|
||||
{
|
||||
Disconnected?.Invoke(sender, disconnectedMessage);
|
||||
DisconnectedEvent?.Invoke(sender, DisconnectedMessage);
|
||||
}
|
||||
|
||||
protected void RaiseErrorOccuredEvent(object sender, string errorMsg)
|
||||
protected void Event_ErrorOccured(object sender, string ErrorMsg)
|
||||
{
|
||||
ErrorOccured?.Invoke(sender, errorMsg);
|
||||
ErrorOccuredEvent?.Invoke(sender, ErrorMsg);
|
||||
}
|
||||
|
||||
protected void Event_ReconnectGroupCloseClicked()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using mRemoteNG.Connection.Protocol.Http;
|
||||
using mRemoteNG.Connection.Protocol.Http;
|
||||
using mRemoteNG.Connection.Protocol.ICA;
|
||||
using mRemoteNG.Connection.Protocol.RAW;
|
||||
using mRemoteNG.Connection.Protocol.RDP;
|
||||
@@ -7,10 +6,11 @@ using mRemoteNG.Connection.Protocol.Rlogin;
|
||||
using mRemoteNG.Connection.Protocol.SSH;
|
||||
using mRemoteNG.Connection.Protocol.Telnet;
|
||||
using mRemoteNG.Connection.Protocol.VNC;
|
||||
using System;
|
||||
|
||||
namespace mRemoteNG.Connection.Protocol
|
||||
{
|
||||
public class ProtocolFactory
|
||||
public class ProtocolFactory
|
||||
{
|
||||
public ProtocolBase CreateProtocol(ConnectionInfo connectionInfo)
|
||||
{
|
||||
@@ -19,38 +19,42 @@ namespace mRemoteNG.Connection.Protocol
|
||||
switch (connectionInfo.Protocol)
|
||||
{
|
||||
case ProtocolType.RDP:
|
||||
newProtocol = new RdpProtocolFactory().CreateProtocol(connectionInfo);
|
||||
newProtocol = new RdpProtocol
|
||||
{
|
||||
LoadBalanceInfoUseUtf8 = Settings.Default.RdpLoadBalanceInfoUseUtf8
|
||||
};
|
||||
((RdpProtocol) newProtocol).tmrReconnect.Elapsed += ((RdpProtocol) newProtocol).tmrReconnect_Elapsed;
|
||||
break;
|
||||
case ProtocolType.VNC:
|
||||
newProtocol = new ProtocolVNC(connectionInfo);
|
||||
newProtocol = new ProtocolVNC();
|
||||
break;
|
||||
case ProtocolType.SSH1:
|
||||
newProtocol = new ProtocolSSH1(connectionInfo);
|
||||
newProtocol = new ProtocolSSH1();
|
||||
break;
|
||||
case ProtocolType.SSH2:
|
||||
newProtocol = new ProtocolSSH2(connectionInfo);
|
||||
newProtocol = new ProtocolSSH2();
|
||||
break;
|
||||
case ProtocolType.Telnet:
|
||||
newProtocol = new ProtocolTelnet(connectionInfo);
|
||||
newProtocol = new ProtocolTelnet();
|
||||
break;
|
||||
case ProtocolType.Rlogin:
|
||||
newProtocol = new ProtocolRlogin(connectionInfo);
|
||||
newProtocol = new ProtocolRlogin();
|
||||
break;
|
||||
case ProtocolType.RAW:
|
||||
newProtocol = new RawProtocol(connectionInfo);
|
||||
newProtocol = new RawProtocol();
|
||||
break;
|
||||
case ProtocolType.HTTP:
|
||||
newProtocol = new ProtocolHTTP(connectionInfo, connectionInfo.RenderingEngine);
|
||||
newProtocol = new ProtocolHTTP(connectionInfo.RenderingEngine);
|
||||
break;
|
||||
case ProtocolType.HTTPS:
|
||||
newProtocol = new ProtocolHTTPS(connectionInfo, connectionInfo.RenderingEngine);
|
||||
newProtocol = new ProtocolHTTPS(connectionInfo.RenderingEngine);
|
||||
break;
|
||||
case ProtocolType.ICA:
|
||||
newProtocol = new IcaProtocol(connectionInfo);
|
||||
newProtocol = new IcaProtocol();
|
||||
((IcaProtocol) newProtocol).tmrReconnect.Elapsed += ((IcaProtocol) newProtocol).tmrReconnect_Elapsed;
|
||||
break;
|
||||
case ProtocolType.IntApp:
|
||||
newProtocol = new IntegratedProgram(connectionInfo);
|
||||
newProtocol = new IntegratedProgram();
|
||||
if (connectionInfo.ExtApp == "")
|
||||
{
|
||||
throw (new Exception(Language.strNoExtAppDefined));
|
||||
|
||||
@@ -36,15 +36,10 @@ namespace mRemoteNG.Connection.Protocol
|
||||
|
||||
#endregion
|
||||
|
||||
public PuttyBase(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
{
|
||||
}
|
||||
|
||||
#region Private Events & Handlers
|
||||
private void ProcessExited(object sender, EventArgs e)
|
||||
{
|
||||
RaiseConnectionClosedEvent(this);
|
||||
Event_Closed(this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -66,9 +61,9 @@ namespace mRemoteNG.Connection.Protocol
|
||||
|
||||
var arguments = new CommandLineArguments {EscapeForShell = false};
|
||||
|
||||
arguments.Add("-load", Info.PuttySession);
|
||||
arguments.Add("-load", InterfaceControl.Info.PuttySession);
|
||||
|
||||
if (!(Info is PuttySessionInfo))
|
||||
if (!(InterfaceControl.Info is PuttySessionInfo))
|
||||
{
|
||||
arguments.Add("-" + PuttyProtocol);
|
||||
|
||||
@@ -77,9 +72,9 @@ namespace mRemoteNG.Connection.Protocol
|
||||
var username = "";
|
||||
var password = "";
|
||||
|
||||
if (!string.IsNullOrEmpty(Info?.Username))
|
||||
if (!string.IsNullOrEmpty(InterfaceControl.Info?.Username))
|
||||
{
|
||||
username = Info.Username;
|
||||
username = InterfaceControl.Info.Username;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -95,9 +90,9 @@ namespace mRemoteNG.Connection.Protocol
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Info?.Password))
|
||||
if (!string.IsNullOrEmpty(InterfaceControl.Info?.Password))
|
||||
{
|
||||
password = Info.Password;
|
||||
password = InterfaceControl.Info.Password;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -123,8 +118,8 @@ namespace mRemoteNG.Connection.Protocol
|
||||
}
|
||||
}
|
||||
|
||||
arguments.Add("-P", Info.Port.ToString());
|
||||
arguments.Add(Info.Hostname);
|
||||
arguments.Add("-P", InterfaceControl.Info.Port.ToString());
|
||||
arguments.Add(InterfaceControl.Info.Hostname);
|
||||
}
|
||||
|
||||
if (_isPuttyNg)
|
||||
|
||||
@@ -2,9 +2,8 @@ namespace mRemoteNG.Connection.Protocol.RAW
|
||||
{
|
||||
public class RawProtocol : PuttyBase
|
||||
{
|
||||
public RawProtocol(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
{
|
||||
public RawProtocol()
|
||||
{
|
||||
PuttyProtocol = Putty_Protocol.raw;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
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]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
933
mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs
Normal file
933
mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs
Normal file
@@ -0,0 +1,933 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,657 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@ namespace mRemoteNG.Connection.Protocol.Rlogin
|
||||
{
|
||||
public class ProtocolRlogin : PuttyBase
|
||||
{
|
||||
public ProtocolRlogin(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
{
|
||||
PuttyProtocol = Putty_Protocol.rlogin;
|
||||
|
||||
public ProtocolRlogin()
|
||||
{
|
||||
this.PuttyProtocol = Putty_Protocol.rlogin;
|
||||
}
|
||||
|
||||
public enum Defaults
|
||||
|
||||
@@ -4,11 +4,11 @@ namespace mRemoteNG.Connection.Protocol.SSH
|
||||
{
|
||||
public class ProtocolSSH1 : PuttyBase
|
||||
{
|
||||
public ProtocolSSH1(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
|
||||
public ProtocolSSH1()
|
||||
{
|
||||
PuttyProtocol = Putty_Protocol.ssh;
|
||||
PuttySSHVersion = Putty_SSHVersion.ssh1;
|
||||
this.PuttyProtocol = Putty_Protocol.ssh;
|
||||
this.PuttySSHVersion = Putty_SSHVersion.ssh1;
|
||||
}
|
||||
|
||||
public enum Defaults
|
||||
|
||||
@@ -2,11 +2,11 @@ namespace mRemoteNG.Connection.Protocol.SSH
|
||||
{
|
||||
public class ProtocolSSH2 : PuttyBase
|
||||
{
|
||||
public ProtocolSSH2(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
{
|
||||
PuttyProtocol = Putty_Protocol.ssh;
|
||||
PuttySSHVersion = Putty_SSHVersion.ssh2;
|
||||
|
||||
public ProtocolSSH2()
|
||||
{
|
||||
this.PuttyProtocol = Putty_Protocol.ssh;
|
||||
this.PuttySSHVersion = Putty_SSHVersion.ssh2;
|
||||
}
|
||||
|
||||
public enum Defaults
|
||||
|
||||
@@ -2,10 +2,10 @@ namespace mRemoteNG.Connection.Protocol.Serial
|
||||
{
|
||||
public class ProtocolSerial : PuttyBase
|
||||
{
|
||||
public ProtocolSerial(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
{
|
||||
PuttyProtocol = Putty_Protocol.serial;
|
||||
|
||||
public ProtocolSerial()
|
||||
{
|
||||
this.PuttyProtocol = Putty_Protocol.serial;
|
||||
}
|
||||
|
||||
public enum Defaults
|
||||
|
||||
@@ -2,10 +2,10 @@ namespace mRemoteNG.Connection.Protocol.Telnet
|
||||
{
|
||||
public class ProtocolTelnet : PuttyBase
|
||||
{
|
||||
public ProtocolTelnet(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
{
|
||||
PuttyProtocol = Putty_Protocol.telnet;
|
||||
|
||||
public ProtocolTelnet()
|
||||
{
|
||||
this.PuttyProtocol = Putty_Protocol.telnet;
|
||||
}
|
||||
|
||||
public enum Defaults
|
||||
|
||||
@@ -10,8 +10,7 @@ namespace mRemoteNG.Connection.Protocol.VNC
|
||||
{
|
||||
public class ProtocolVNC : ProtocolBase
|
||||
{
|
||||
private VncSharp.RemoteDesktop _VNC;
|
||||
|
||||
#region Properties
|
||||
public bool SmartSize
|
||||
{
|
||||
get { return _VNC.Scaled; }
|
||||
@@ -23,11 +22,16 @@ namespace mRemoteNG.Connection.Protocol.VNC
|
||||
get { return _VNC.ViewOnly; }
|
||||
set { _VNC.ViewOnly = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Declarations
|
||||
private VncSharp.RemoteDesktop _VNC;
|
||||
private ConnectionInfo Info;
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public ProtocolVNC(ConnectionInfo connectionInfo)
|
||||
: base(connectionInfo)
|
||||
public ProtocolVNC()
|
||||
{
|
||||
Control = new VncSharp.RemoteDesktop();
|
||||
}
|
||||
@@ -40,7 +44,7 @@ namespace mRemoteNG.Connection.Protocol.VNC
|
||||
{
|
||||
_VNC = (VncSharp.RemoteDesktop)Control;
|
||||
|
||||
Info = InterfaceControl.Protocol.Info;
|
||||
Info = InterfaceControl.Info;
|
||||
|
||||
_VNC.VncPort = Info.Port;
|
||||
|
||||
@@ -176,14 +180,14 @@ namespace mRemoteNG.Connection.Protocol.VNC
|
||||
#region Private Events & Handlers
|
||||
private void VNCEvent_Connected(object sender, EventArgs e)
|
||||
{
|
||||
RaiseConnectionConnectedEvent(this);
|
||||
Event_Connected(this);
|
||||
_VNC.AutoScroll = Info.VNCSmartSizeMode == SmartSizeMode.SmartSNo;
|
||||
}
|
||||
|
||||
private void VNCEvent_Disconnected(object sender, EventArgs e)
|
||||
{
|
||||
FrmMain.ClipboardChanged -= VNCEvent_ClipboardChanged;
|
||||
RaiseConnectionDisconnectedEvent(sender, e.ToString());
|
||||
Event_Disconnected(sender, e.ToString());
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using mRemoteNG.Connection;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
|
||||
namespace mRemoteNG.Container
|
||||
{
|
||||
[DefaultProperty("Name")]
|
||||
[DefaultProperty("Name")]
|
||||
public class ContainerInfo : ConnectionInfo, INotifyCollectionChanged
|
||||
{
|
||||
[Browsable(false)]
|
||||
@@ -19,13 +18,20 @@ namespace mRemoteNG.Container
|
||||
[Category(""), Browsable(false), ReadOnly(false), Bindable(false), DefaultValue(""), DesignOnly(false)]
|
||||
public bool IsExpanded { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool IsContainer { get { return true; } set {} }
|
||||
|
||||
public ContainerInfo()
|
||||
public ContainerInfo(string uniqueId)
|
||||
: base(uniqueId)
|
||||
{
|
||||
SetDefaults();
|
||||
IsContainer = true;
|
||||
}
|
||||
|
||||
public ContainerInfo()
|
||||
: this(Guid.NewGuid().ToString())
|
||||
{
|
||||
}
|
||||
|
||||
public override TreeNodeType GetTreeNodeType()
|
||||
{
|
||||
return TreeNodeType.Container;
|
||||
@@ -178,7 +184,6 @@ namespace mRemoteNG.Container
|
||||
{
|
||||
var newContainer = new ContainerInfo();
|
||||
newContainer.CopyFrom(this);
|
||||
newContainer.ConstantID = MiscTools.CreateConstantID();
|
||||
newContainer.OpenConnections = new ProtocolList();
|
||||
newContainer.Inheritance = Inheritance.Clone();
|
||||
foreach (var child in Children.ToArray())
|
||||
|
||||
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
[assembly: AssemblyVersion("1.76.0.*")]
|
||||
[assembly: AssemblyVersion("1.76.2.*")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
27
mRemoteV1/Resources/Language/Language.Designer.cs
generated
27
mRemoteV1/Resources/Language/Language.Designer.cs
generated
@@ -4668,15 +4668,6 @@ 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>
|
||||
/// Looks up a localized string similar to Select whether local disk drives should be shown on the remote host..
|
||||
/// </summary>
|
||||
@@ -5181,15 +5172,6 @@ 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>
|
||||
/// Looks up a localized string similar to Disk Drives.
|
||||
/// </summary>
|
||||
@@ -7525,6 +7507,15 @@ namespace mRemoteNG {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Timeout (seconds).
|
||||
/// </summary>
|
||||
internal static string TimeoutInSeconds {
|
||||
get {
|
||||
return ResourceManager.GetString("TimeoutInSeconds", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unlock.
|
||||
/// </summary>
|
||||
|
||||
@@ -2631,10 +2631,7 @@ This page will walk you through the process of upgrading your connections file o
|
||||
<data name="LoadBalanceInfoUseUtf8" xml:space="preserve">
|
||||
<value>Use UTF8 encoding for RDP "Load Balance Info" property</value>
|
||||
</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 name="TimeoutInSeconds" xml:space="preserve">
|
||||
<value>Timeout (seconds)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema id="mremoteng_confcons_v2_6"
|
||||
targetNamespace="http://mremoteng.org"
|
||||
elementFormDefault="qualified"
|
||||
xmlns="http://mremoteng.org"
|
||||
xmlns:mrng="http://mremoteng.org"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="unqualified"
|
||||
>
|
||||
|
||||
|
||||
<xs:element name="Connections">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="Node" type="mrng:connectioninfo" />
|
||||
</xs:sequence>
|
||||
<xs:attribute name="Name" type="xs:string" use="required" />
|
||||
@@ -31,6 +31,7 @@
|
||||
</xs:sequence>
|
||||
<xs:attribute name="Name" type="xs:string" use="required" />
|
||||
<xs:attribute name="Type" type="xs:string" use="required" />
|
||||
<xs:attribute name="Expanded" type="xs:boolean" use="optional" />
|
||||
<xs:attribute name="Descr" type="xs:string" use="required" />
|
||||
<xs:attribute name="Icon" type="xs:string" use="required" />
|
||||
<xs:attribute name="Panel" type="xs:string" use="required" />
|
||||
|
||||
@@ -5,20 +5,20 @@ namespace mRemoteNG.Tools
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static Maybe<T> Maybe<T>(this T value)
|
||||
public static Optional<T> Maybe<T>(this T value)
|
||||
{
|
||||
return new Maybe<T>(value);
|
||||
return new Optional<T>(value);
|
||||
}
|
||||
|
||||
public static Maybe<U> MaybeParse<T, U>(this T value, Func<T, U> parseFunc)
|
||||
public static Optional<U> MaybeParse<T, U>(this T value, Func<T, U> parseFunc)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new Maybe<U>(parseFunc(value));
|
||||
return new Optional<U>(parseFunc(value));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new Maybe<U>();
|
||||
return new Optional<U>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ using static System.String;
|
||||
|
||||
namespace mRemoteNG.Tools
|
||||
{
|
||||
public static class MiscTools
|
||||
public static class MiscTools
|
||||
{
|
||||
public static Icon GetIconFromFile(string FileName)
|
||||
{
|
||||
@@ -68,13 +68,6 @@ namespace mRemoteNG.Tools
|
||||
{
|
||||
return Text.Replace("\'", "\'\'");
|
||||
}
|
||||
|
||||
|
||||
public static object StringToEnum(Type t, string value)
|
||||
{
|
||||
return Enum.Parse(t, value);
|
||||
}
|
||||
|
||||
|
||||
public static string GetExceptionMessageRecursive(Exception ex)
|
||||
{
|
||||
|
||||
@@ -4,16 +4,16 @@ using System.Linq;
|
||||
|
||||
namespace mRemoteNG.Tools
|
||||
{
|
||||
public class Maybe<T> : IEnumerable<T>
|
||||
public class Optional<T> : IEnumerable<T>
|
||||
{
|
||||
private readonly T[] _maybe;
|
||||
|
||||
public Maybe()
|
||||
public Optional()
|
||||
{
|
||||
_maybe = new T[0];
|
||||
}
|
||||
|
||||
public Maybe(T value)
|
||||
public Optional(T value)
|
||||
{
|
||||
_maybe = value != null
|
||||
? new[] {value}
|
||||
@@ -35,16 +35,16 @@ namespace mRemoteNG.Tools
|
||||
return _maybe.Any() ? _maybe.First().ToString() : "";
|
||||
}
|
||||
|
||||
public static implicit operator Maybe<T>(T value)
|
||||
public static implicit operator Optional<T>(T value)
|
||||
{
|
||||
return new Maybe<T>(value);
|
||||
return new Optional<T>(value);
|
||||
}
|
||||
|
||||
public static Maybe<TOut> FromNullable<TOut>(TOut? value) where TOut : struct
|
||||
public static Optional<TOut> FromNullable<TOut>(TOut? value) where TOut : struct
|
||||
{
|
||||
return value.HasValue
|
||||
? new Maybe<TOut>(value.Value)
|
||||
: new Maybe<TOut>();
|
||||
? new Optional<TOut>(value.Value)
|
||||
: new Optional<TOut>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,17 +17,24 @@ namespace mRemoteNG.Tools
|
||||
private readonly List<int> _ports = new List<int>();
|
||||
private Thread _scanThread;
|
||||
private readonly List<ScanHost> _scannedHosts = new List<ScanHost>();
|
||||
private readonly int _timeoutInMilliseconds;
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public PortScanner(IPAddress ipAddress1, IPAddress ipAddress2, int port1, int port2)
|
||||
public PortScanner(IPAddress ipAddress1, IPAddress ipAddress2, int port1, int port2, int timeoutInMilliseconds = 5000)
|
||||
{
|
||||
var ipAddressStart = IpAddressMin(ipAddress1, ipAddress2);
|
||||
var ipAddressEnd = IpAddressMax(ipAddress1, ipAddress2);
|
||||
|
||||
var portStart = Math.Min(port1, port2);
|
||||
var portEnd = Math.Max(port1, port2);
|
||||
|
||||
|
||||
if (timeoutInMilliseconds < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(timeoutInMilliseconds));
|
||||
|
||||
_timeoutInMilliseconds = timeoutInMilliseconds;
|
||||
|
||||
|
||||
_ports.Clear();
|
||||
for (var port = portStart; port <= portEnd; port++)
|
||||
{
|
||||
@@ -87,7 +94,7 @@ namespace mRemoteNG.Tools
|
||||
try
|
||||
{
|
||||
pingSender.PingCompleted += PingSender_PingCompleted;
|
||||
pingSender.SendAsync(ipAddress, ipAddress);
|
||||
pingSender.SendAsync(ipAddress, _timeoutInMilliseconds, ipAddress);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace mRemoteNG.Tools
|
||||
public static int HttpPort { get; set; } = (int)ProtocolHTTP.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 RdpPort { get; set; } = (int)RdpProtocol6.Defaults.Port;
|
||||
public static int RdpPort { get; set; } = (int)RdpProtocol.Defaults.Port;
|
||||
public static int VncPort { get; set; } = (int)ProtocolVNC.Defaults.Port;
|
||||
public ArrayList OpenPorts { get; set; }
|
||||
public ArrayList ClosedPorts { get; set; }
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using mRemoteNG.Tools;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Security;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Tools;
|
||||
|
||||
|
||||
namespace mRemoteNG.Tree.Root
|
||||
@@ -13,11 +12,17 @@ namespace mRemoteNG.Tree.Root
|
||||
private string _name;
|
||||
private string _customPassword = "";
|
||||
|
||||
public RootNodeInfo(RootNodeType rootType)
|
||||
public RootNodeInfo(RootNodeType rootType, string uniqueId)
|
||||
: base(uniqueId)
|
||||
{
|
||||
_name = Language.strConnections;
|
||||
Type = rootType;
|
||||
}
|
||||
|
||||
public RootNodeInfo(RootNodeType rootType)
|
||||
: this(rootType, Guid.NewGuid().ToString())
|
||||
{
|
||||
}
|
||||
|
||||
#region Public Properties
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ namespace mRemoteNG.UI.Menu
|
||||
foreach (var i in icList)
|
||||
{
|
||||
i.Protocol.Close();
|
||||
ConnectionInitiator.OpenConnection(i.Protocol.Info, ConnectionInfo.Force.DoNotJump);
|
||||
ConnectionInitiator.OpenConnection(i.Info, ConnectionInfo.Force.DoNotJump);
|
||||
}
|
||||
|
||||
// throw it on the garbage collector
|
||||
|
||||
@@ -2,8 +2,6 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using AxMSTSCLib;
|
||||
using AxWFICALib;
|
||||
@@ -460,26 +458,42 @@ namespace mRemoteNG.UI.Window
|
||||
{
|
||||
pnlCheck1.Visible = true;
|
||||
|
||||
var tester = new RdpSupportTester();
|
||||
var supportedRdpVersions = tester.GetSupportedRdpVersions();
|
||||
|
||||
if (supportedRdpVersions.Any())
|
||||
try
|
||||
{
|
||||
pbCheck1.Image = Resources.Good_Symbol;
|
||||
lblCheck1.ForeColor = Color.DarkOliveGreen;
|
||||
lblCheck1.Text = "RDP (Remote Desktop) " + Language.strCcCheckSucceeded;
|
||||
txtCheck1.Text = string.Format(Language.strCcRDPOK, supportedRdpVersions.Aggregate(new StringBuilder(), (builder, enum1) => builder.Append(enum1+",")));
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "RDP installed", true);
|
||||
return;
|
||||
using (var rdpClient = new AxMsRdpClient8NotSafeForScripting())
|
||||
{
|
||||
rdpClient.CreateControl();
|
||||
|
||||
while (!rdpClient.Created)
|
||||
{
|
||||
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);
|
||||
|
||||
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,
|
||||
"RDP " + Language.strCcNotInstalledProperly, true);
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
|
||||
"RDP " + Language.strCcNotInstalledProperly, true);
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, ex.Message, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckVnc()
|
||||
|
||||
@@ -878,7 +878,7 @@ namespace mRemoteNG.UI.Window
|
||||
{
|
||||
strHide.Add("RDPAlertIdleTimeout");
|
||||
}
|
||||
if (conI.RDGatewayUsageMethod == RDGatewayUsageMethod.Never)
|
||||
if (conI.RDGatewayUsageMethod == RdpProtocol.RDGatewayUsageMethod.Never)
|
||||
{
|
||||
strHide.Add("RDGatewayDomain");
|
||||
strHide.Add("RDGatewayHostname");
|
||||
@@ -886,17 +886,17 @@ namespace mRemoteNG.UI.Window
|
||||
strHide.Add("RDGatewayUseConnectionCredentials");
|
||||
strHide.Add("RDGatewayUsername");
|
||||
}
|
||||
else if (conI.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes)
|
||||
else if (conI.RDGatewayUseConnectionCredentials == RdpProtocol.RDGatewayUseConnectionCredentials.Yes)
|
||||
{
|
||||
strHide.Add("RDGatewayDomain");
|
||||
strHide.Add("RDGatewayPassword");
|
||||
strHide.Add("RDGatewayUsername");
|
||||
}
|
||||
if (!(conI.Resolution == RdpResolutions.FitToWindow || conI.Resolution == RdpResolutions.Fullscreen))
|
||||
if (!(conI.Resolution == RdpProtocol.RDPResolutions.FitToWindow || conI.Resolution == RdpProtocol.RDPResolutions.Fullscreen))
|
||||
{
|
||||
strHide.Add("AutomaticResize");
|
||||
}
|
||||
if (conI.RedirectSound != RdpSounds.BringToThisComputer)
|
||||
if (conI.RedirectSound != RdpProtocol.RDPSounds.BringToThisComputer)
|
||||
{
|
||||
strHide.Add("SoundQuality");
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user