Compare commits

...

86 Commits

Author SHA1 Message Date
Dimitrij
9e70dce626 update PuTTY to v.0.75 2021-07-04 14:44:56 +01:00
David Sparer
52d1b9a270 Merge branch 'release/v1.76' 2019-04-12 09:14:26 -05:00
David Sparer
068f5942e7 updated changelog and bumped version to 1.76.20 2019-04-12 08:38:06 -05:00
David Sparer
703cefaf19 ensure rdcman import never sets properties to null. fixes #1401 2019-04-12 08:24:05 -05:00
Sean Kaim
3d32557177 Merge pull request #1390 from mRemoteNG/release/v1.76
Release/v1.76
2019-04-04 15:51:02 -04:00
Sean Kaim
ea1f72b8b7 bump version and changelog update 2019-04-04 15:44:34 -04:00
Sean Kaim
993b6759cc Update PuTTYNG.exe
Reference #1374
2019-04-04 15:41:55 -04:00
David Sparer
c0b07307f5 Merge branch 'release/v1.76' 2019-03-20 10:38:31 -05:00
David Sparer
15f23769d6 bumped version to v1.76.18 and updated changelog 2019-03-20 09:33:21 -05:00
Sean Kaim
2d175fd575 border fix for puttyng 0.70.0.1+ -- backported from develop 2019-03-20 10:21:56 -04:00
David Sparer
bdeb4b4dcc bumped version to v1.76.17 and updated changelog 2019-03-20 07:32:27 -05:00
David Sparer
bdfbb57504 updated puttyng to 0.71
fixes #1362
2019-03-20 07:29:13 -05:00
David Sparer
38d1c756f3 Merge branch 'release/v1.76' 2019-03-14 18:01:20 -05:00
David Sparer
6c89913bc6 updated changelog 2019-03-14 17:58:53 -05:00
David Sparer
efa72cb697 bumped version to 1.76.16 2019-03-14 17:58:43 -05:00
David Sparer
a31fec5fb9 encrypt correct db field
fixes #1347
2019-03-14 17:35:28 -05:00
David Sparer
ed81030976 bumped v1.76.15 release date 2019-03-09 11:21:21 -06:00
David Sparer
54322ca949 updated changelog 2019-03-08 10:41:57 -06:00
David Sparer
738b159e95 handle sql first-run case
fixes #1303
2019-03-08 10:31:39 -06:00
David Sparer
e8f2e4f50c bumped patch version 2019-03-04 11:45:07 -06:00
David Sparer
5cd201440e added tests for the disposable action class 2019-03-04 11:44:30 -06:00
David Sparer
5c6c76b898 one more parse bug fix 2019-03-04 11:30:34 -06:00
David Sparer
4847ce054b resolved several parsing bugs in the rdcman deserializer 2019-03-04 11:17:45 -06:00
David Sparer
ec42fe7d7d improved testability of the import class 2019-03-04 11:17:19 -06:00
David Sparer
07a20ed5ad batch saves when importing connection files
This reduces saves/backup overwrites when importing multiple files
2019-03-04 08:41:27 -06:00
Sean Kaim
08201b0f00 Port FIPS override back to 1.76
Fixes #222
2019-02-08 16:51:58 -05:00
Sean Kaim
92416b4661 test build for running with FIPS enabled
Reference #222
2018-12-22 19:19:11 -05:00
David Sparer
75e0b8f4c2 set release date in changelog 2018-11-08 15:09:08 -06:00
David Sparer
8d29ff2d61 fixes #1168 2018-11-04 19:13:10 -06:00
David Sparer
eea79da1ae updated changelog 2018-11-04 18:06:14 -06:00
David Sparer
cb5447f86e fixes #1181 2018-11-04 18:03:39 -06:00
David Sparer
8cb31ad524 slight cleanup of Runtime class 2018-11-04 18:03:29 -06:00
David Sparer
6ca52a0db1 updated changelog 2018-11-04 16:39:25 -06:00
David Sparer
25e30672c8 bumped version to v1.76.12 2018-11-04 16:38:14 -06:00
David Sparer
abcab2aadf sql now encrypts and decrypts passwords 2018-11-03 18:28:53 -05:00
David Sparer
19bb8f7595 refactored db classes to expose tblRoot data 2018-11-03 11:02:26 -05:00
David Sparer
0427956e8b we can now prevent saving to the database when a save was triggered for a local-only property change
this will prevent unnecessary db saves
2018-11-03 10:34:30 -05:00
David Sparer
78bf40282a the IsExapnded property is no longer saved to the DB 2018-11-02 11:30:39 -05:00
David Sparer
6c6a82f8e6 minor cleanup 2018-11-02 11:03:25 -05:00
David Sparer
4b9cc7be08 Merge branch 'release/v1.76' into 1134_dont_save_connection_status_to_db
# Conflicts:
#	mRemoteV1/Connection/ConnectionsService.cs
2018-11-02 10:56:49 -05:00
David Sparer
dc2d6b8160 added a few debug messages to track db connection loading events 2018-11-02 10:45:18 -05:00
David Sparer
083456e33a fixed several event handle leaks #1173 2018-11-02 10:29:09 -05:00
David Sparer
80e43e8634 added a safety check to the previous session opener to only open sessions that aren't already open 2018-11-02 09:30:18 -05:00
David Sparer
e99b8ed453 hooked up the local settings serializer 2018-11-01 19:14:25 -05:00
David Sparer
4aba36b756 added classes to handle local connection properties when dealing with the DB 2018-11-01 16:37:30 -05:00
David Sparer
2ebf654973 added a ForEach extension for enumerables 2018-11-01 16:36:56 -05:00
David Sparer
f560fb86d8 moved database serializers to more logical place 2018-11-01 15:00:51 -05:00
David Sparer
8ab221e5a8 Merge branch 'release/v1.76' 2018-10-18 17:29:11 -05:00
David Sparer
21e51c8455 updated changelog and credits 2018-10-18 17:08:30 -05:00
David Sparer
3234896caf bumped version 2018-10-18 17:08:22 -05:00
David Sparer
b00dd1c5f5 fixes #1136 2018-10-17 17:48:16 -05:00
David Sparer
992a3f9d1c cherrypicked pr #1145
Fixing "Reconnect to previously opened sessions on startup"
2018-10-17 16:52:22 -05:00
David Sparer
d1a7a37909 Merge branch 'release/v1.76' 2018-10-07 18:42:03 -05:00
David Sparer
1c12b52ada extension to the fix for #1124 2018-10-07 18:32:17 -05:00
David Sparer
722fe40899 updated changelog and bumped version 2018-10-07 16:33:29 -05:00
David Sparer
b2e7ebf43d fixed #1124 2018-10-07 16:28:09 -05:00
David Sparer
3ed8e768aa bumped patch version 2018-10-07 09:04:48 -05:00
David Sparer
d362691389 updated build scripts to include debug symbols and normalized github
asset names

cherrypicked from the develop branch
2018-10-07 07:53:31 -05:00
David Sparer
4b7c54d5b5 updated changelog 2018-10-07 07:28:57 -05:00
David Sparer
ec80a5aa70 fixed #1117 2018-09-30 13:19:35 -05:00
David Sparer
0c95f178ca updated changelog 2018-09-30 11:04:03 -05:00
David Sparer
e0405b15df fixes #1110 2018-09-30 11:02:01 -05:00
David Sparer
e029f30acf added a few try/catch blocks around some rdp code. related to #853 2018-09-30 10:44:22 -05:00
David Sparer
44ed836b7c fixed #1115 2018-09-29 12:14:44 -05:00
David Sparer
00401201d1 fixed Spanish translation issue. fixes #1112 2018-09-27 08:23:17 -05:00
David Sparer
20f46bea61 fixes #1106 2018-09-20 15:10:43 -05:00
Sean Kaim
a5d22d287c Fixed #1091 2018-08-28 14:59:07 -04:00
Sean Kaim
793095900b fix #1092
parse enums properly
2018-08-28 09:35:08 -04:00
David Sparer
f10e54e47b bumped assembly version to 1.76.8 2018-08-25 10:31:35 -05:00
David Sparer
704e0c1dc1 updated changelog 2018-08-25 10:29:43 -05:00
David Sparer
0c79a9acde fixes #1088 2018-08-24 14:43:08 -05:00
David Sparer
ebfc2715e7 updated changelog 2018-08-24 13:24:23 -05:00
David Sparer
b0dbc9dc18 only delete reg key value if the value exists 2018-08-24 13:23:52 -05:00
David Sparer
507cdf75a5 fixes #1087 2018-08-24 13:23:02 -05:00
David Sparer
8f8492b0be xml deserializer now gives connections an ID if the ID string in xml is empty
fixes #1082
2018-08-24 10:37:54 -05:00
David Sparer
457e715188 set assembly version to 1.76.7 and set release date in changelog 2018-08-22 10:59:45 -05:00
David Sparer
1724521ebf added some null guards to methods 2018-08-22 07:06:44 -05:00
David Sparer
b0fb3596aa added some safety checks around accessing putty registry settings 2018-08-22 07:06:16 -05:00
David Sparer
fb228d72b1 resolved bug #1076 2018-08-19 11:44:43 -05:00
David Sparer
916361a3be update changelog 2018-08-11 20:03:27 -05:00
David Sparer
408c40f699 fixed a few toolbar location loading edge cases
related to #1068
2018-08-11 10:02:07 -05:00
David Sparer
4173f6d775 swapped direct calls to Monitor with a lock statement and added a few method comments 2018-08-11 06:47:31 -05:00
Sean Kaim
e6f3c22064 code clean up / add'l checks
related to #1061
2018-08-03 10:13:31 -04:00
David Sparer
a013518eac bump assembly version 2018-08-03 08:51:44 -05:00
David Sparer
9c88cacb3d hopefully a fix for #1061 2018-08-03 08:33:51 -05:00
David Sparer
d49bf04b15 fixes #1062 2018-08-03 08:13:39 -05:00
82 changed files with 1854 additions and 716 deletions

View File

@@ -1,3 +1,130 @@
1.76.20 (2019-04-12):
Fixes:
------
#1401: Connections corrupted when importing RDC Manager files that are missing certain fields
1.76.19 (2019-04-04):
Fixes:
------
#1374: Vertical Scroll Bar missing in PuTTYNG after 0.70.0.1 & 0.71 updates
1.76.18 (2019-03-20):
Fixes:
------
#1365: PuTTY window not centered after 0.71 update
1.76.17 (2019-03-20):
Fixes:
------
#1362: Updated PuTTYNG to 0.71
1.76.16 (2019-03-14):
Fixes:
------
#1347: Remote Desktop Gateway username field encrypted instead of password
1.76.15 (2019-03-09):
Fixes:
------
#1303: Exception on first connection with new SQL server database
#1304: Resolved several issues with importing multiple RDP Manager v2.7 files
Features/Enhancements:
----------------------
Importing multiple files now only causes 1 save event, rather than 1 per file imported.
1.76.14 (2019-02-08):
Features/Enhancements:
----------------------
#222: Allow FIPS to be enabled
1.76.13 (2018-12-22):
Changes:
--------
#222: Pre-Release Test build for running on systems with FIPS Enabled
1.76.12 (2018-11-08):
Features/Enhancements:
----------------------
#1180: Allow saving certain connection properties locally when using database
Fixes:
------
#1181: Connections sometimes dont immediately load when switching to sql feature
#1173: Fixed memory leak when loading connections multiple times
#1168: Autohide Connection and Config tab won't open when ssh connection active
#1134: Fixed issue where opening a connection opens same connection on other clients when using database feature
#449: Encrypt passwords saved to database
1.76.11 (2018-10-18):
Fixes:
------
#1139: Feature "Reconnect to previously opened sessions" not working
#1136: Putty window not maximized
1.76.10 (2018-10-07):
Fixes:
------
#1124: Enabling themes causes an exception
1.76.9 (2018-10-07):
Fixes:
------
#1117: Duplicate panel created when "Reconnect on Startup" and "Create Empty Panel" settings enabled
#1115: Exception when changing from xml data storage to SQL
#1110: Pressing Delete button during connection rename attempts to delete the connection instead of the text
#1106: Inheritance does not work when parent has C# default type set
#1092: Invalid Cast Exceptions loading default connectioninfo
#1091: Minor themeing issues
#853: Added some additional safety checks and logging to help address RDP crashes
1.76.8 (2018-08-25):
Fixes:
------
#1088: Delete and Launch buttons are not disabled when last external tool deleted
#1087: 'Save connections after every edit' setting not honored
#1082: Connections not given GUID if Id is empty in connection xml
1.76.7 (2018-08-22):
Fixes:
------
#1076: Wrong object selected when duplicating connection then switching between properties and inheritance in config window
#1068: Fixed some toolbar positioning bugs
1.76.6 (2018-08-03):
Fixes:
------
#1062: Entering correct password when starting app does not load connections file
1.76.5 (2018-08-02):
Fixes:

View File

@@ -24,6 +24,7 @@ github.com/pfjason
github.com/sirLoaf
github.com/Fyers
Vladimir Semenov (github.com/sli-pro)
Stephan (github.com/st-schuler)
Past Contributors

View File

@@ -62,11 +62,10 @@ node('windows') {
stage ('Publish to GitHub') {
withCredentials([string(credentialsId: '5443a369-dbe8-42d3-b4e8-04d0b4e9039a', variable: 'GH_AUTH_TOKEN')]) {
def zipPath = "${jobDir}\\Release\\*.zip"
def msiPath = "${jobDir}\\Release\\*.msi"
def releaseFolder = "${jobDir}\\Release"
// because batch files suck at handling newline characters, we have to convert to base64 in groovy and back to text in powershell
def base64Description = env.ReleaseDescription.bytes.encodeBase64().toString()
bat "powershell -ExecutionPolicy Bypass -File \"${jobDir}\\Tools\\publish_to_github.ps1\" -Owner \"mRemoteNG\" -Repository \"mRemoteNG\" -ReleaseTitle \"${env.ReleaseTitle}\" -TagName \"${env.TagName}\" -TargetCommitish \"${env.TargetBranch}\" -Description \"${base64Description}\" -IsDraft ${env.IsDraft} -IsPrerelease ${env.IsPreRelease} -ZipFilePath \"${zipPath}\" -MsiFilePath \"${msiPath}\" -AuthToken \"${env.GH_AUTH_TOKEN}\" -DescriptionIsBase64Encoded"
bat "powershell -ExecutionPolicy Bypass -File \"${jobDir}\\Tools\\publish_to_github.ps1\" -Owner \"mRemoteNG\" -Repository \"mRemoteNG\" -ReleaseTitle \"${env.ReleaseTitle}\" -TagName \"${env.TagName}\" -TargetCommitish \"${env.TargetBranch}\" -Description \"${base64Description}\" -IsDraft ${env.IsDraft} -IsPrerelease ${env.IsPreRelease} -ReleaseFolderPath \"${releaseFolder}\" -AuthToken \"${env.GH_AUTH_TOKEN}\" -DescriptionIsBase64Encoded"
}
}
}

View File

@@ -171,17 +171,26 @@ function Upload-GitHubReleaseAsset {
[string]
[Parameter(Mandatory=$true)]
# The OAuth2 token to use for authentication.
$AuthToken
$AuthToken,
[string]
# A short description label for the asset
$Label = ""
)
$UploadUri = $UploadUri -replace "(\{[\w,\?]*\})$"
$files = Get-Item -Path $FilePath
$labelParam = ""
if ($Label -ne "") {
$labelParam = "&label=$Label"
}
# Get-Item could produce an array of files if a wildcard is provided. (C:\*.txt)
# Upload each matching item individually
foreach ($file in $files) {
Write-Output "Uploading asset to GitHub release: '$($file.FullName)'"
$req_uploadZipAsset = Invoke-WebRequest -Uri "$($UploadUri)?name=$($file.Name)" -Method Post -Headers @{"Authorization"="token $AuthToken"} -ContentType $ContentType -InFile $file.FullName -ErrorAction Stop
$req_uploadZipAsset = Invoke-WebRequest -Uri "$($UploadUri)?name=$($file.Name)$labelParam" -Method Post -Headers @{"Authorization"="token $AuthToken"} -ContentType $ContentType -InFile $file.FullName -ErrorAction Stop
}
}

View File

@@ -43,13 +43,8 @@ param (
[string]
[Parameter(Mandatory=$true)]
# Path to the zip file to upload with the release
$ZipFilePath,
[string]
[Parameter(Mandatory=$true)]
#Path to the msi file to upload with the release
$MsiFilePath,
# Path to the folder which contains release assets to upload
$ReleaseFolderPath,
[string]
[Parameter(Mandatory=$true)]
@@ -70,7 +65,17 @@ if ($DescriptionIsBase64Encoded) {
. "$PSScriptRoot\github_functions.ps1"
$releaseFolderItems = Get-ChildItem -Path $ReleaseFolderPath
$mrngPortablePath = ($releaseFolderItems | ?{$_.Name -match "portable-[\d\.]+\.zip"}).FullName
$mrngNormalPath = ($releaseFolderItems | ?{$_.Name -match "installer-[\d\.]+\.msi"}).FullName
$mrngPortableSymbolsPath = ($releaseFolderItems | ?{$_.Name -match "mremoteng-portable-symbols-[\d\.]+\.zip"}).FullName
$mrngNormalSymbolsPath = ($releaseFolderItems | ?{$_.Name -match "mremoteng-symbols-[\d\.]+\.zip"}).FullName
$release = Publish-GitHubRelease -Owner $Owner -Repository $Repository -ReleaseTitle $ReleaseTitle -TagName $TagName -TargetCommitish $TargetCommitish -Description $Description -IsDraft ([bool]::Parse($IsDraft)) -IsPrerelease ([bool]::Parse($IsPrerelease)) -AuthToken $AuthToken
$zipUpload = Upload-GitHubReleaseAsset -UploadUri $release.upload_url -FilePath $ZipFilePath -ContentType "application/zip" -AuthToken $AuthToken
$msiUpload = Upload-GitHubReleaseAsset -UploadUri $release.upload_url -FilePath $MsiFilePath -ContentType "application/octet-stream" -AuthToken $AuthToken
$zipUpload = Upload-GitHubReleaseAsset -UploadUri $release.upload_url -FilePath $mrngPortablePath -ContentType "application/zip" -AuthToken $AuthToken -Label "Portable Edition (zip)"
$msiUpload = Upload-GitHubReleaseAsset -UploadUri $release.upload_url -FilePath $mrngNormalPath -ContentType "application/octet-stream" -AuthToken $AuthToken -Label "Normal Edition (msi)"
$portableEditionSymbols = Upload-GitHubReleaseAsset -UploadUri $release.upload_url -FilePath $mrngPortableSymbolsPath -ContentType "application/zip" -AuthToken $AuthToken -Label "Portable Edition Debug Symbols"
$normalEditionSymbols = Upload-GitHubReleaseAsset -UploadUri $release.upload_url -FilePath $mrngNormalSymbolsPath -ContentType "application/zip" -AuthToken $AuthToken -Label "Normal Edition Debug Symbols"
Write-Output (Get-GitHubRelease -Owner $Owner -Repository $Repository -ReleaseId $release.id -AuthToken $AuthToken)

View File

@@ -0,0 +1,47 @@
using System.IO;
using mRemoteNG.App;
using mRemoteNG.Config.Putty;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNGTests.Properties;
using mRemoteNGTests.TestHelpers;
using NUnit.Framework;
namespace mRemoteNGTests.App
{
public class ImportTests
{
[Test]
public void ErrorHandlerCalledWhenUnsupportedFileExtensionFound()
{
using (FileTestHelpers.DisposableTempFile(out var file, ".blah"))
{
var conService = new ConnectionsService(PuttySessionsManager.Instance);
var container = new ContainerInfo();
var exceptionOccurred = false;
Import.HeadlessFileImport(new []{file}, container, conService, s => exceptionOccurred = true);
Assert.That(exceptionOccurred);
}
}
[Test]
public void AnErrorInOneFileDoNotPreventOtherFilesFromProcessing()
{
using (FileTestHelpers.DisposableTempFile(out var badFile, ".blah"))
using (FileTestHelpers.DisposableTempFile(out var rdpFile, ".rdp"))
{
File.AppendAllText(rdpFile, Resources.test_remotedesktopconnection_rdp);
var conService = new ConnectionsService(PuttySessionsManager.Instance);
var container = new ContainerInfo();
var exceptionCount = 0;
Import.HeadlessFileImport(new[] { badFile, rdpFile }, container, conService, s => exceptionCount++);
Assert.That(exceptionCount, Is.EqualTo(1));
Assert.That(container.Children, Has.One.Items);
}
}
}
}

View File

@@ -1,10 +1,12 @@
using System.Data;
using System.Linq;
using mRemoteNG.Config.Serializers;
using System.Security;
using mRemoteNG.Config.Serializers.MsSql;
using mRemoteNG.Connection;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tree;
using mRemoteNGTests.TestHelpers;
using NSubstitute;
using NUnit.Framework;
namespace mRemoteNGTests.Config.Serializers
@@ -12,30 +14,37 @@ namespace mRemoteNGTests.Config.Serializers
public class DataTableDeserializerTests
{
private DataTableDeserializer _deserializer;
private ICryptographyProvider _cryptographyProvider;
[SetUp]
public void Setup()
{
_cryptographyProvider = new LegacyRijndaelCryptographyProvider();
}
[Test]
public void WeCanDeserializeATree()
{
var model = CreateConnectionTreeModel();
var dataTable = CreateDataTable(model.RootNodes[0]);
_deserializer = new DataTableDeserializer();
_deserializer = new DataTableDeserializer(_cryptographyProvider, new SecureString());
var output = _deserializer.Deserialize(dataTable);
Assert.That(output.GetRecursiveChildList().Count(), Is.EqualTo(model.GetRecursiveChildList().Count()));
Assert.That(output.GetRecursiveChildList().Count, Is.EqualTo(model.GetRecursiveChildList().Count));
}
[Test]
public void WeCanDeserializeASingleEntry()
{
var dataTable = CreateDataTable(new ConnectionInfo());
_deserializer = new DataTableDeserializer();
_deserializer = new DataTableDeserializer(_cryptographyProvider, new SecureString());
var output = _deserializer.Deserialize(dataTable);
Assert.That(output.GetRecursiveChildList().Count(), Is.EqualTo(1));
Assert.That(output.GetRecursiveChildList().Count, Is.EqualTo(1));
}
private DataTable CreateDataTable(ConnectionInfo tableContent)
{
var serializer = new DataTableSerializer(new SaveFilter());
var serializer = new DataTableSerializer(new SaveFilter(), _cryptographyProvider, new SecureString());
return serializer.Serialize(tableContent);
}

View File

@@ -1,11 +1,15 @@
using System.Linq;
using System.Security;
using mRemoteNG.Config.Serializers;
using mRemoteNG.Config.Serializers.MsSql;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using mRemoteNGTests.TestHelpers;
using NSubstitute;
using NUnit.Framework;
namespace mRemoteNGTests.Config.Serializers
@@ -19,7 +23,10 @@ namespace mRemoteNGTests.Config.Serializers
public void Setup()
{
_saveFilter = new SaveFilter();
_dataTableSerializer = new DataTableSerializer(_saveFilter);
_dataTableSerializer = new DataTableSerializer(
_saveFilter,
new LegacyRijndaelCryptographyProvider(),
new SecureString());
}
[Test]

View File

@@ -1,20 +1,21 @@
using System.IO;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using mRemoteNG.Config.Serializers;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Container;
using mRemoteNG.Tree;
using mRemoteNGTests.Properties;
using NUnit.Framework;
namespace mRemoteNGTests.Config.Serializers.MiscSerializers
{
public class RemoteDesktopConnectionManager27DeserializerTests
public class RemoteDesktopConnectionManager27DeserializerTests
{
private string _connectionFileContents;
private RemoteDesktopConnectionManagerDeserializer _deserializer;
private ConnectionTreeModel _connectionTreeModel;
private const string ExpectedName = "server1_displayname";
private const string ExpectedHostname = "server1";
private const string ExpectedDescription = "Comment text here";
@@ -44,265 +45,80 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
{
_connectionFileContents = Resources.test_rdcman_v2_7_schema3;
_deserializer = new RemoteDesktopConnectionManagerDeserializer();
_connectionTreeModel = _deserializer.Deserialize(_connectionFileContents);
}
[Test]
public void ConnectionTreeModelHasARootNode()
{
var numberOfRootNodes = _connectionTreeModel.RootNodes.Count;
var connectionTreeModel = _deserializer.Deserialize(_connectionFileContents);
var numberOfRootNodes = connectionTreeModel.RootNodes.Count;
Assert.That(numberOfRootNodes, Is.GreaterThan(0));
}
[Test]
public void RootNodeHasContents()
{
var rootNodeContents = _connectionTreeModel.RootNodes.First().Children;
var connectionTreeModel = _deserializer.Deserialize(_connectionFileContents);
var rootNodeContents = connectionTreeModel.RootNodes.First().Children;
Assert.That(rootNodeContents, Is.Not.Empty);
}
[Test]
public void AllSubRootFoldersImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var connectionTreeModel = _deserializer.Deserialize(_connectionFileContents);
var rootNode = connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var rootNodeContents = importedRdcmanRootNode.Children.Count(node => node.Name == "Group1" || node.Name == "Group2");
Assert.That(rootNodeContents, Is.EqualTo(2));
}
[Test]
public void ConnectionDisplayNameImported()
[TestCaseSource(nameof(ExpectedPropertyValues))]
public void PropertiesWithValuesAreCorrectlyImported(Func<ConnectionInfo, object> propSelector, object expectedValue)
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.Name, Is.EqualTo(ExpectedName));
var connectionTreeModel = _deserializer.Deserialize(_connectionFileContents);
var connection = connectionTreeModel
.GetRecursiveChildList()
.OfType<ContainerInfo>()
.First(node => node.Name == "Group1")
.Children
.First();
Assert.That(propSelector(connection), Is.EqualTo(expectedValue));
}
[Test]
public void ConnectionHostnameImported()
[TestCaseSource(nameof(NullPropertyValues))]
public void PropertiesWithoutValuesAreIgnored(Func<ConnectionInfo, object> propSelector)
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.Hostname, Is.EqualTo(ExpectedHostname));
var connectionTreeModel = _deserializer.Deserialize(Resources.test_rdcman_v2_7_schema3_empty_values);
var importedConnection = connectionTreeModel
.GetRecursiveChildList()
.OfType<ContainerInfo>()
.First(node => node.Name == "Group1")
.Children
.First();
Assert.That(propSelector(importedConnection), Is.EqualTo(propSelector(new ConnectionInfo())));
}
[Test]
public void ConnectionDescriptionImported()
[TestCaseSource(nameof(NullPropertyValues))]
public void NonExistantPropertiesAreIgnored(Func<ConnectionInfo, object> propSelector)
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.Description, Is.EqualTo(ExpectedDescription));
var connectionTreeModel = _deserializer.Deserialize(Resources.test_rdcman_v2_7_schema3_null_values);
var importedConnection = connectionTreeModel
.GetRecursiveChildList()
.OfType<ContainerInfo>()
.First(node => node.Name == "Group1")
.Children
.First();
Assert.That(propSelector(importedConnection), Is.EqualTo(propSelector(new ConnectionInfo())));
}
[Test]
public void ConnectionUsernameImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.Username, Is.EqualTo(ExpectedUsername));
}
[Test]
public void ConnectionDomainImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.Domain, Is.EqualTo(ExpectedDomain));
}
// Since password is encrypted with a machine key, cant test decryption on another machine
//[Test]
//public void ConnectionPasswordImported()
//{
// var rootNode = _connectionTreeModel.RootNodes.First();
// var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
// var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
// var connection = group1.Children.First();
// Assert.That(connection.Password, Is.EqualTo(ExpectedPassword));
//}
[Test]
public void ConnectionProtocolSetToRdp()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.Protocol, Is.EqualTo(ProtocolType.RDP));
}
[Test]
public void ConnectionUseConsoleSessionImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.UseConsoleSession, Is.EqualTo(ExpectedUseConsoleSession));
}
[Test]
public void ConnectionPortImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.Port, Is.EqualTo(ExpectedPort));
}
[Test]
public void ConnectionGatewayUsageMethodImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RDGatewayUsageMethod, Is.EqualTo(ExpectedGatewayUsageMethod));
}
[Test]
public void ConnectionGatewayHostnameImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RDGatewayHostname, Is.EqualTo(ExpectedGatewayHostname));
}
[Test]
public void ConnectionGatewayUsernameImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RDGatewayUsername, Is.EqualTo(ExpectedGatewayUsername));
}
// Since password is encrypted with a machine key, cant test decryption on another machine
//[Test]
//public void ConnectionGatewayPasswordImported()
//{
// var rootNode = _connectionTreeModel.RootNodes.First();
// var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
// var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
// var connection = group1.Children.First();
// Assert.That(connection.RDGatewayPassword, Is.EqualTo(ExpectedGatewayPassword));
//}
[Test]
public void ConnectionGatewayDomainImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RDGatewayDomain, Is.EqualTo(ExpectedGatewayDomain));
}
[Test]
public void ConnectionResolutionImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.Resolution, Is.EqualTo(ExpectedRdpResolution));
}
[Test]
public void ConnectionColorDepthImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.Colors, Is.EqualTo(ExpectedRdpColorDepth));
}
[Test]
public void ConnectionAudioRedirectionImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RedirectSound, Is.EqualTo(ExpectedAudioRedirection));
}
[Test]
public void ConnectionKeyRedirectionImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RedirectKeys, Is.EqualTo(ExpectedKeyRedirection));
}
[Test]
public void ConnectionDriveRedirectionImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RedirectDiskDrives, Is.EqualTo(ExpectedDriveRedirection));
}
[Test]
public void ConnectionPortRedirectionImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RedirectPorts, Is.EqualTo(ExpectedPortRedirection));
}
[Test]
public void ConnectionPrinterRedirectionImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RedirectPrinters, Is.EqualTo(ExpectedPrinterRedirection));
}
[Test]
public void ConnectionSmartcardRedirectionImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RedirectSmartCards, Is.EqualTo(ExpectedSmartcardRedirection));
}
[Test]
public void ConnectionauthenticationLevelImported()
{
var rootNode = _connectionTreeModel.RootNodes.First();
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
var connection = group1.Children.First();
Assert.That(connection.RDPAuthenticationLevel, Is.EqualTo(ExpectedAuthLevel));
}
[Test]
[Test]
public void ExceptionThrownOnBadSchemaVersion()
{
var badFileContents = Resources.test_rdcman_v2_2_badschemaversion;
@@ -322,5 +138,61 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
var badFileContents = Resources.test_rdcman_noversion;
Assert.That(() => _deserializer.Deserialize(badFileContents), Throws.TypeOf<FileFormatException>());
}
private static IEnumerable<TestCaseData> ExpectedPropertyValues()
{
return new[]
{
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Name), ExpectedName).SetName(nameof(ConnectionInfo.Name)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Hostname), ExpectedHostname).SetName(nameof(ConnectionInfo.Hostname)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Description), ExpectedDescription).SetName(nameof(ConnectionInfo.Description)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Username), ExpectedUsername).SetName(nameof(ConnectionInfo.Username)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Domain), ExpectedDomain).SetName(nameof(ConnectionInfo.Domain)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Protocol), ProtocolType.RDP).SetName(nameof(ConnectionInfo.Protocol)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.UseConsoleSession), ExpectedUseConsoleSession).SetName(nameof(ConnectionInfo.UseConsoleSession)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Port), ExpectedPort).SetName(nameof(ConnectionInfo.Port)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDGatewayUsageMethod), ExpectedGatewayUsageMethod).SetName(nameof(ConnectionInfo.RDGatewayUsageMethod)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDGatewayHostname), ExpectedGatewayHostname).SetName(nameof(ConnectionInfo.RDGatewayHostname)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDGatewayUsername), ExpectedGatewayUsername).SetName(nameof(ConnectionInfo.RDGatewayUsername)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDGatewayDomain), ExpectedGatewayDomain).SetName(nameof(ConnectionInfo.RDGatewayDomain)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Resolution), ExpectedRdpResolution).SetName(nameof(ConnectionInfo.Resolution)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Colors), ExpectedRdpColorDepth).SetName(nameof(ConnectionInfo.Colors)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectSound), ExpectedAudioRedirection).SetName(nameof(ConnectionInfo.RedirectSound)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectKeys), ExpectedKeyRedirection).SetName(nameof(ConnectionInfo.RedirectKeys)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDPAuthenticationLevel), ExpectedAuthLevel).SetName(nameof(ConnectionInfo.RDPAuthenticationLevel)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectSmartCards), ExpectedSmartcardRedirection).SetName(nameof(ConnectionInfo.RedirectSmartCards)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectPrinters), ExpectedPrinterRedirection).SetName(nameof(ConnectionInfo.RedirectPrinters)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectPorts), ExpectedPortRedirection).SetName(nameof(ConnectionInfo.RedirectPorts)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectDiskDrives), ExpectedDriveRedirection).SetName(nameof(ConnectionInfo.RedirectDiskDrives)),
};
}
private static IEnumerable<TestCaseData> NullPropertyValues()
{
return new[]
{
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Name)).SetName(nameof(ConnectionInfo.Name)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Hostname)).SetName(nameof(ConnectionInfo.Hostname)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Description)).SetName(nameof(ConnectionInfo.Description)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Username)).SetName(nameof(ConnectionInfo.Username)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Domain)).SetName(nameof(ConnectionInfo.Domain)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Protocol)).SetName(nameof(ConnectionInfo.Protocol)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.UseConsoleSession)).SetName(nameof(ConnectionInfo.UseConsoleSession)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Port)).SetName(nameof(ConnectionInfo.Port)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDGatewayUsageMethod)).SetName(nameof(ConnectionInfo.RDGatewayUsageMethod)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDGatewayHostname)).SetName(nameof(ConnectionInfo.RDGatewayHostname)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDGatewayUsername)).SetName(nameof(ConnectionInfo.RDGatewayUsername)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDGatewayDomain)).SetName(nameof(ConnectionInfo.RDGatewayDomain)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Resolution)).SetName(nameof(ConnectionInfo.Resolution)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.Colors)).SetName(nameof(ConnectionInfo.Colors)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectSound)).SetName(nameof(ConnectionInfo.RedirectSound)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectKeys)).SetName(nameof(ConnectionInfo.RedirectKeys)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RDPAuthenticationLevel)).SetName(nameof(ConnectionInfo.RDPAuthenticationLevel)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectSmartCards)).SetName(nameof(ConnectionInfo.RedirectSmartCards)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectPrinters)).SetName(nameof(ConnectionInfo.RedirectPrinters)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectPorts)).SetName(nameof(ConnectionInfo.RedirectPorts)),
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectDiskDrives)).SetName(nameof(ConnectionInfo.RedirectDiskDrives)),
};
}
}
}

View File

@@ -1,8 +1,9 @@
using mRemoteNG.Connection;
using mRemoteNG.Container;
using NUnit.Framework;
using System.Reflection;
using System.Collections;
using System.Linq;
using System.Reflection;
namespace mRemoteNGTests.Connection
{
@@ -74,6 +75,22 @@ namespace mRemoteNGTests.Connection
Assert.That(hasEverythingInheritedProperty, Is.False);
}
[Test]
public void AlwaysReturnInheritedValueIfRequested()
{
var expectedSetting = false;
var container = new ContainerInfo { AutomaticResize = expectedSetting };
var con1 = new ConnectionInfo
{
AutomaticResize = true,
Inheritance = {AutomaticResize = true}
};
container.AddChild(con1);
Assert.That(con1.AutomaticResize, Is.EqualTo(expectedSetting));
}
private bool AllInheritancePropertiesAreTrue()
{
var allPropertiesTrue = true;

View File

@@ -43,6 +43,20 @@ namespace mRemoteNGTests.Connection
Assert.That(clonedConnection.Parent, Is.Null);
}
[Test]
public void CloneAlsoCopiesInheritanceObject()
{
var clonedConnection = _connectionInfo.Clone();
Assert.That(clonedConnection.Inheritance, Is.Not.EqualTo(_connectionInfo.Inheritance));
}
[Test]
public void CloneCorrectlySetsParentOfInheritanceObject()
{
var clonedConnection = _connectionInfo.Clone();
Assert.That(clonedConnection.Inheritance.Parent, Is.EqualTo(clonedConnection));
}
[Test]
public void CopyFromCopiesProperties()
{

View File

@@ -1,4 +1,6 @@
using System.Linq;
using System;
using System.Linq;
using System.Xml.Linq;
using mRemoteNG.Config.Serializers;
using mRemoteNG.Config.Serializers.Xml;
using mRemoteNG.Connection;
@@ -29,20 +31,19 @@ namespace mRemoteNGTests.IntegrationTests
_originalModel.RootNodes.OfType<RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
new SaveFilter());
_serializer = new XmlConnectionsSerializer(cryptoProvider, nodeSerializer);
_deserializer = new XmlConnectionsDeserializer();
}
[TearDown]
public void Teardown()
{
_serializer = null;
_deserializer = null;
}
[Test]
public void SerializeThenDeserialize()
{
var serializedContent = _serializer.Serialize(_originalModel);
_deserializer = new XmlConnectionsDeserializer();
var deserializedModel = _deserializer.Deserialize(serializedContent);
var nodeNamesFromDeserializedModel = deserializedModel.GetRecursiveChildList().Select(node => node.Name);
var nodeNamesFromOriginalModel = _originalModel.GetRecursiveChildList().Select(node => node.Name);
@@ -54,7 +55,6 @@ namespace mRemoteNGTests.IntegrationTests
{
_serializer.UseFullEncryption = true;
var serializedContent = _serializer.Serialize(_originalModel);
_deserializer = new XmlConnectionsDeserializer();
var deserializedModel = _deserializer.Deserialize(serializedContent);
var nodeNamesFromDeserializedModel = deserializedModel.GetRecursiveChildList().Select(node => node.Name);
var nodeNamesFromOriginalModel = _originalModel.GetRecursiveChildList().Select(node => node.Name);
@@ -66,7 +66,6 @@ namespace mRemoteNGTests.IntegrationTests
{
var originalConnectionInfo = new ConnectionInfo {Name = "con1", Description = "£°úg¶┬ä" };
var serializedContent = _serializer.Serialize(originalConnectionInfo);
_deserializer = new XmlConnectionsDeserializer();
var deserializedModel = _deserializer.Deserialize(serializedContent);
var deserializedConnectionInfo = deserializedModel.GetRecursiveChildList().First(node => node.Name == originalConnectionInfo.Name);
Assert.That(deserializedConnectionInfo.Description, Is.EqualTo(originalConnectionInfo.Description));
@@ -84,13 +83,26 @@ namespace mRemoteNGTests.IntegrationTests
new SaveFilter());
_serializer = new XmlConnectionsSerializer(cryptoProvider, nodeSerializer);
var serializedContent = _serializer.Serialize(_originalModel);
_deserializer = new XmlConnectionsDeserializer();
var deserializedModel = _deserializer.Deserialize(serializedContent);
var nodeNamesFromDeserializedModel = deserializedModel.GetRecursiveChildList().Select(node => node.Name);
var nodeNamesFromOriginalModel = _originalModel.GetRecursiveChildList().Select(node => node.Name);
Assert.That(nodeNamesFromDeserializedModel, Is.EquivalentTo(nodeNamesFromOriginalModel));
}
[Test]
public void GuidCreatedIfNonExistedInXml()
{
var originalConnectionInfo = new ConnectionInfo { Name = "con1" };
var serializedContent = _serializer.Serialize(originalConnectionInfo);
// remove GUID from connection xml
serializedContent = serializedContent.Replace(originalConnectionInfo.ConstantID, "");
var deserializedModel = _deserializer.Deserialize(serializedContent);
var deserializedConnectionInfo = deserializedModel.GetRecursiveChildList().First(node => node.Name == originalConnectionInfo.Name);
Assert.That(Guid.TryParse(deserializedConnectionInfo.ConstantID, out var guid));
}
private ConnectionTreeModel SetupConnectionTreeModel()
{

View File

@@ -298,6 +298,58 @@ namespace mRemoteNGTests.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
///&lt;RDCMan programVersion=&quot;2.7&quot; schemaVersion=&quot;3&quot;&gt;
/// &lt;file&gt;
/// &lt;credentialsProfiles /&gt;
/// &lt;properties&gt;
/// &lt;expanded&gt;True&lt;/expanded&gt;
/// &lt;name&gt;test_RDCMan_connections&lt;/name&gt;
/// &lt;/properties&gt;
/// &lt;smartGroup&gt;
/// &lt;properties&gt;
/// &lt;expanded&gt;False&lt;/expanded&gt;
/// &lt;name&gt;AllServers&lt;/name&gt;
/// &lt;/properties&gt;
/// &lt;ruleGroup operator=&quot;All&quot;&gt;
/// &lt;rule&gt;
/// &lt;property&gt;DisplayName&lt;/property&gt;
/// &lt;operator&gt;Matches&lt;/operator&gt;
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string test_rdcman_v2_7_schema3_empty_values {
get {
return ResourceManager.GetString("test_rdcman_v2_7_schema3_empty_values", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
///&lt;RDCMan programVersion=&quot;2.7&quot; schemaVersion=&quot;3&quot;&gt;
/// &lt;file&gt;
/// &lt;credentialsProfiles /&gt;
/// &lt;properties&gt;
/// &lt;expanded&gt;True&lt;/expanded&gt;
/// &lt;name&gt;test_RDCMan_connections&lt;/name&gt;
/// &lt;/properties&gt;
/// &lt;smartGroup&gt;
/// &lt;properties&gt;
/// &lt;expanded&gt;False&lt;/expanded&gt;
/// &lt;name&gt;AllServers&lt;/name&gt;
/// &lt;/properties&gt;
/// &lt;ruleGroup operator=&quot;All&quot;&gt;
/// &lt;rule&gt;
/// &lt;property&gt;DisplayName&lt;/property&gt;
/// &lt;operator&gt;Matches&lt;/operator&gt;
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string test_rdcman_v2_7_schema3_null_values {
get {
return ResourceManager.GetString("test_rdcman_v2_7_schema3_null_values", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to screen mode id:i:1
///use multimon:i:0

View File

@@ -172,6 +172,12 @@
<data name="test_rdcman_v2_7_schema3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\test_RDCMan_v2_7_schema3.rdg;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="test_rdcman_v2_7_schema3_empty_values" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\test_rdcman_v2_7_schema3_empty_values.rdg;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="test_rdcman_v2_7_schema3_null_values" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\test_rdcman_v2_7_schema3_null_values.rdg;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="test_remotedesktopconnection_rdp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\test_remotedesktopconnection.rdp;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<RDCMan programVersion="2.7" schemaVersion="3">
<file>
<credentialsProfiles />
<properties>
<expanded>True</expanded>
<name>test_RDCMan_connections</name>
</properties>
<smartGroup>
<properties>
<expanded>False</expanded>
<name>AllServers</name>
</properties>
<ruleGroup operator="All">
<rule>
<property>DisplayName</property>
<operator>Matches</operator>
<value>server</value>
</rule>
</ruleGroup>
</smartGroup>
<group>
<properties>
<expanded>True</expanded>
<name>Group1</name>
</properties>
<server>
<properties>
<displayName></displayName>
<name></name>
<comment></comment>
</properties>
<logonCredentials inherit="None">
<profileName scope="Local"></profileName>
<userName></userName>
<password></password>
<domain></domain>
</logonCredentials>
<connectionSettings inherit="None">
<connectToConsole></connectToConsole>
<startProgram />
<workingDir />
<port></port>
<loadBalanceInfo />
</connectionSettings>
<gatewaySettings inherit="None">
<enabled></enabled>
<hostName></hostName>
<logonMethod></logonMethod>
<localBypass></localBypass>
<credSharing></credSharing>
<profileName scope="Local"></profileName>
<userName></userName>
<password />
<domain></domain>
</gatewaySettings>
<remoteDesktop inherit="None">
<sameSizeAsClientArea></sameSizeAsClientArea>
<fullScreen></fullScreen>
<colorDepth></colorDepth>
</remoteDesktop>
<localResources inherit="None">
<audioRedirection></audioRedirection>
<audioRedirectionQuality></audioRedirectionQuality>
<audioCaptureRedirection></audioCaptureRedirection>
<keyboardHook></keyboardHook>
<redirectClipboard></redirectClipboard>
<redirectDrives></redirectDrives>
<redirectDrivesList>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</redirectDrivesList>
<redirectPrinters></redirectPrinters>
<redirectPorts></redirectPorts>
<redirectSmartCards></redirectSmartCards>
<redirectPnpDevices></redirectPnpDevices>
</localResources>
<displaySettings inherit="None">
<thumbnailScale></thumbnailScale>
<smartSizeDockedWindows></smartSizeDockedWindows>
<smartSizeUndockedWindows></smartSizeUndockedWindows>
</displaySettings>
<securitySettings inherit="None">
<authentication></authentication>
</securitySettings>
</server>
</group>
</file>
<connected />
<favorites />
<recentlyUsed />
</RDCMan>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<RDCMan programVersion="2.7" schemaVersion="3">
<file>
<credentialsProfiles />
<properties>
<expanded>True</expanded>
<name>test_RDCMan_connections</name>
</properties>
<smartGroup>
<properties>
<expanded>False</expanded>
<name>AllServers</name>
</properties>
<ruleGroup operator="All">
<rule>
<property>DisplayName</property>
<operator>Matches</operator>
<value>server</value>
</rule>
</ruleGroup>
</smartGroup>
<group>
<properties>
<expanded>True</expanded>
<name>Group1</name>
</properties>
<server>
<properties>
</properties>
<logonCredentials inherit="None">
</logonCredentials>
<connectionSettings inherit="None">
</connectionSettings>
<gatewaySettings inherit="None">
</gatewaySettings>
<remoteDesktop inherit="None">
</remoteDesktop>
<localResources inherit="None">
</localResources>
<displaySettings inherit="None">
</displaySettings>
<securitySettings inherit="None">
</securitySettings>
</server>
</group>
</file>
<connected />
<favorites />
<recentlyUsed />
</RDCMan>

View File

@@ -1,4 +1,5 @@
using System.IO;
using mRemoteNG.Tools;
namespace mRemoteNGTests.TestHelpers
{
@@ -18,9 +19,17 @@ namespace mRemoteNGTests.TestHelpers
File.Delete(file);
}
public static string NewTempFilePath()
public static void DeleteDirectory(string directory)
{
if (Directory.Exists(directory))
Directory.Delete(directory, true);
}
public static string NewTempFilePath(string extension = "")
{
var newPath = Path.Combine(GetTestSpecificTempDirectory(), Path.GetRandomFileName());
if (!string.IsNullOrWhiteSpace(extension))
newPath = newPath + extension;
var folderPath = Path.GetDirectoryName(newPath);
if (!Directory.Exists(folderPath))
Directory.CreateDirectory(folderPath);
@@ -35,5 +44,15 @@ namespace mRemoteNGTests.TestHelpers
{
return Path.Combine(Path.GetTempPath(), "mRemoteNGTests", Path.GetRandomFileName());
}
public static DisposableAction DisposableTempFile(out string filePath, string extension = "")
{
var file = NewTempFilePath(extension);
filePath = file;
File.AppendAllText(file, "");
return new DisposableAction(
() => {},
() => DeleteDirectory(Path.GetDirectoryName(file)));
}
}
}

View File

@@ -0,0 +1,42 @@
using mRemoteNG.Tools;
using NUnit.Framework;
namespace mRemoteNGTests.Tools
{
public class DisposableActionTests
{
[Test]
public void InitializerActionRunsWhenObjectIsCreated()
{
var initializerRan = false;
new DisposableAction(() => initializerRan = true, () => { });
Assert.That(initializerRan);
}
[Test]
public void DisposalActionRunsWhenDisposeIsCalled()
{
var disposeActionRan = false;
var action = new DisposableAction(() => {}, () => disposeActionRan = true);
Assert.That(disposeActionRan, Is.False);
action.Dispose();
Assert.That(disposeActionRan, Is.True);
}
[Test]
public void DisposeActionOnlyExecutedOnceWhenCallingDisposeMultipleTimes()
{
var invokeCount = 0;
var action = new DisposableAction(() => { }, () => invokeCount++);
action.Dispose();
action.Dispose();
action.Dispose();
action.Dispose();
action.Dispose();
Assert.That(invokeCount, Is.EqualTo(1));
}
}
}

View File

@@ -108,6 +108,7 @@
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="App\ImportTests.cs" />
<Compile Include="App\UpdaterTests.cs" />
<Compile Include="BinaryFileTests.cs" />
<Compile Include="Config\Connections\Multiuser\ConnectionsUpdateAvailableEventArgsTests.cs" />
@@ -175,6 +176,7 @@
<Compile Include="Security\XmlCryptoProviderBuilderTests.cs" />
<Compile Include="TestHelpers\FileTestHelpers.cs" />
<Compile Include="TestHelpers\SerializableConnectionInfoAllPropertiesOfType.cs" />
<Compile Include="Tools\DisposableActionTests.cs" />
<Compile Include="Tools\ExternalToolsArgumentParserTests.cs" />
<Compile Include="Tools\FullyObservableCollectionTests.cs" />
<Compile Include="Tools\OptionalTests.cs" />
@@ -265,6 +267,8 @@
<None Include="Resources\test_rdcman_v2_2_badschemaversion.rdg" />
<None Include="Resources\test_rdcman_v2_2_schema1.rdg" />
<None Include="Resources\test_RDCMan_v2_7_schema3.rdg" />
<None Include="Resources\test_rdcman_v2_7_schema3_empty_values.rdg" />
<None Include="Resources\test_rdcman_v2_7_schema3_null_values.rdg" />
<None Include="Resources\test_remotedesktopconnection.rdp" />
</ItemGroup>
<ItemGroup>

View File

@@ -19,13 +19,29 @@ namespace mRemoteNG.App
private static void CheckFipsPolicy(MessageCollector messageCollector)
{
if (Settings.Default.OverrideFIPSCheck)
{
messageCollector.AddMessage(MessageClass.InformationMsg, "OverrideFIPSCheck is set. Will skip check...", true);
return;
}
messageCollector.AddMessage(MessageClass.InformationMsg, "Checking FIPS Policy...", true);
if (!FipsPolicyEnabledForServer2003() && !FipsPolicyEnabledForServer2008AndNewer()) return;
var errorText = string.Format(Language.strErrorFipsPolicyIncompatible, GeneralAppInfo.ProductName,
GeneralAppInfo.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
var errorText = string.Format(Language.strErrorFipsPolicyIncompatible, GeneralAppInfo.ProductName);
messageCollector.AddMessage(MessageClass.ErrorMsg, errorText, true);
MessageBox.Show(FrmMain.Default, errorText);
Environment.Exit(1);
var ShouldIStayOrShouldIGo = CTaskDialog.MessageBox(Application.ProductName, Language.strCompatibilityProblemDetected, errorText, "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.OkCancel, ESysIcons.Warning, ESysIcons.Warning);
if (CTaskDialog.VerificationChecked && ShouldIStayOrShouldIGo == DialogResult.OK)
{
messageCollector.AddMessage(MessageClass.ErrorMsg, "User requests that FIPS check be overridden", true);
Settings.Default.OverrideFIPSCheck = true;
Settings.Default.Save();
return;
}
if (ShouldIStayOrShouldIGo == DialogResult.Cancel)
Environment.Exit(1);
}
private static bool FipsPolicyEnabledForServer2003()

View File

@@ -3,13 +3,14 @@ using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using mRemoteNG.Config.Import;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Container;
using mRemoteNG.Tools;
namespace mRemoteNG.App
{
public static class Import
public static class Import
{
public static void ImportFromFile(ContainerInfo importDestinationContainer)
{
@@ -35,22 +36,12 @@ namespace mRemoteNG.App
if (openFileDialog.ShowDialog() != DialogResult.OK)
return;
foreach (var fileName in openFileDialog.FileNames)
{
try
{
var importer = BuildConnectionImporterFromFileExtension(fileName);
importer.Import(fileName, importDestinationContainer);
}
catch (Exception ex)
{
MessageBox.Show(string.Format(Language.strImportFileFailedContent, fileName), Language.strImportFileFailedMainInstruction,
MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
Runtime.MessageCollector.AddExceptionMessage("Unable to import file.", ex);
}
}
Runtime.ConnectionsService.SaveConnectionsAsync();
HeadlessFileImport(
openFileDialog.FileNames,
importDestinationContainer,
Runtime.ConnectionsService,
fileName => MessageBox.Show(string.Format(Language.strImportFileFailedContent, fileName), Language.strImportFileFailedMainInstruction,
MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1));
}
}
catch (Exception ex)
@@ -59,12 +50,38 @@ namespace mRemoteNG.App
}
}
public static void HeadlessFileImport(
IEnumerable<string> filePaths,
ContainerInfo importDestinationContainer,
ConnectionsService connectionsService,
Action<string> exceptionAction = null)
{
using (connectionsService.BatchedSavingContext())
{
foreach (var fileName in filePaths)
{
try
{
var importer = BuildConnectionImporterFromFileExtension(fileName);
importer.Import(fileName, importDestinationContainer);
}
catch (Exception ex)
{
exceptionAction?.Invoke(fileName);
Runtime.MessageCollector.AddExceptionMessage($"Error occurred while importing file '{fileName}'.", ex);
}
}
}
}
public static void ImportFromActiveDirectory(string ldapPath, ContainerInfo importDestinationContainer, bool importSubOu)
{
try
{
ActiveDirectoryImporter.Import(ldapPath, importDestinationContainer, importSubOu);
Runtime.ConnectionsService.SaveConnectionsAsync();
using (Runtime.ConnectionsService.BatchedSavingContext())
{
ActiveDirectoryImporter.Import(ldapPath, importDestinationContainer, importSubOu);
}
}
catch (Exception ex)
{
@@ -76,9 +93,11 @@ namespace mRemoteNG.App
{
try
{
var importer = new PortScanImporter(protocol);
importer.Import(hosts, importDestinationContainer);
Runtime.ConnectionsService.SaveConnectionsAsync();
using (Runtime.ConnectionsService.BatchedSavingContext())
{
var importer = new PortScanImporter(protocol);
importer.Import(hosts, importDestinationContainer);
}
}
catch (Exception ex)
{

View File

@@ -2,14 +2,15 @@
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using mRemoteNG.Connection;
namespace mRemoteNG.App.Info
{
public static class SettingsFileInfo
{
private static readonly string ExePath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
private static readonly string ExePath = Path.GetDirectoryName(Assembly.GetAssembly(typeof(ConnectionInfo))?.Location);
public static string SettingsPath { get; } = Runtime.IsPortableEdition ? ExePath : Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + Application.ProductName;
public static string SettingsPath => Runtime.IsPortableEdition ? ExePath : Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + Application.ProductName;
public static string LayoutFileName { get; } = "pnlLayout.xml";
public static string ExtAppsFilesName { get; } = "extApps.xml";
public static string ThemesFileName { get; } = "Themes.xml";

View File

@@ -1,8 +1,3 @@
using System;
using System.IO;
using System.Security;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.App.Info;
using mRemoteNG.Config.Putty;
using mRemoteNG.Connection;
@@ -15,6 +10,11 @@ using mRemoteNG.Tree.Root;
using mRemoteNG.UI;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.TaskDialog;
using System;
using System.IO;
using System.Security;
using System.Threading;
using System.Windows.Forms;
namespace mRemoteNG.App
{
@@ -43,19 +43,23 @@ namespace mRemoteNG.App
#region Connections Loading/Saving
public static void LoadConnectionsAsync()
{
_withDialog = false;
var t = new Thread(LoadConnectionsBGd);
t.SetApartmentState(ApartmentState.STA);
t.Start();
}
private static bool _withDialog;
private static void LoadConnectionsBGd()
{
LoadConnections(_withDialog);
LoadConnections();
}
/// <summary>
///
/// </summary>
/// <param name="withDialog">
/// Should we show the file selection dialog to allow the user to select
/// a connection file
/// </param>
public static void LoadConnections(bool withDialog = false)
{
var connectionFileName = "";
@@ -65,18 +69,19 @@ namespace mRemoteNG.App
// disable sql update checking while we are loading updates
ConnectionsService.RemoteConnectionsSyncronizer?.Disable();
if (!Settings.Default.UseSQLServer)
if (withDialog)
{
if (withDialog)
{
var loadDialog = DialogFactory.BuildLoadConnectionsDialog();
if (loadDialog.ShowDialog() != DialogResult.OK) return;
connectionFileName = loadDialog.FileName;
}
else
{
connectionFileName = ConnectionsService.GetStartupConnectionFileName();
}
var loadDialog = DialogFactory.BuildLoadConnectionsDialog();
if (loadDialog.ShowDialog() != DialogResult.OK)
return;
connectionFileName = loadDialog.FileName;
Settings.Default.UseSQLServer = false;
Settings.Default.Save();
}
else if (!Settings.Default.UseSQLServer)
{
connectionFileName = ConnectionsService.GetStartupConnectionFileName();
}
ConnectionsService.LoadConnections(Settings.Default.UseSQLServer, false, connectionFileName);

View File

@@ -24,7 +24,7 @@ namespace mRemoteNG.Config.Connections
_saveFilter = saveFilter;
}
public void Save(ConnectionTreeModel connectionTreeModel)
public void Save(ConnectionTreeModel connectionTreeModel, string propertyNameTrigger = "")
{
var csvConnectionsSerializer = new CsvConnectionsSerializerMremotengFormat(_saveFilter, Runtime.CredentialProviderCatalog);
var dataProvider = new FileDataProvider(_connectionFileName);

View File

@@ -0,0 +1,9 @@
using mRemoteNG.Tree;
namespace mRemoteNG.Config.Connections
{
public interface IConnectionsLoader
{
ConnectionTreeModel Load();
}
}

View File

@@ -1,6 +1,7 @@
using System;
using mRemoteNG.App;
using System;
using System.Timers;
using mRemoteNG.App;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.Connections.Multiuser

View File

@@ -1,11 +1,11 @@
using mRemoteNG.App;
using mRemoteNG.Config.Connections.Multiuser;
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Threading;
using mRemoteNG.Config.Connections.Multiuser;
using mRemoteNG.Config.DatabaseConnectors;
namespace mRemoteNG.Config.Connections
{
@@ -13,7 +13,7 @@ namespace mRemoteNG.Config.Connections
{
private readonly SqlDatabaseConnector _sqlConnector;
private readonly SqlCommand _sqlQuery;
private DateTime _lastUpdateTime;
private DateTime LastUpdateTime => Runtime.ConnectionsService.LastSqlUpdate;
private DateTime _lastDatabaseUpdateTime;
@@ -21,7 +21,6 @@ namespace mRemoteNG.Config.Connections
{
_sqlConnector = DatabaseConnectorFactory.SqlDatabaseConnectorFromSettings();
_sqlQuery = new SqlCommand("SELECT * FROM tblUpdate", _sqlConnector.SqlConnection);
_lastUpdateTime = default(DateTime);
_lastDatabaseUpdateTime = default(DateTime);
}
@@ -58,14 +57,14 @@ namespace mRemoteNG.Config.Connections
private bool DatabaseIsMoreUpToDateThanUs()
{
var lastUpdateInDb = GetLastUpdateTimeFromDbResponse();
var IAmTheLastoneUpdated = CheckIfIAmTheLastOneUpdated(lastUpdateInDb);
return (lastUpdateInDb > _lastUpdateTime && !IAmTheLastoneUpdated);
var amTheLastoneUpdated = CheckIfIAmTheLastOneUpdated(lastUpdateInDb);
return (lastUpdateInDb > LastUpdateTime && !amTheLastoneUpdated);
}
private bool CheckIfIAmTheLastOneUpdated(DateTime lastUpdateInDb)
{
DateTime LastSqlUpdateWithoutMilliseconds = new DateTime(Runtime.ConnectionsService.LastSqlUpdate.Ticks - (Runtime.ConnectionsService.LastSqlUpdate.Ticks % TimeSpan.TicksPerSecond), Runtime.ConnectionsService.LastSqlUpdate.Kind);
return lastUpdateInDb == LastSqlUpdateWithoutMilliseconds;
DateTime lastSqlUpdateWithoutMilliseconds = new DateTime(LastUpdateTime.Ticks - (LastUpdateTime.Ticks % TimeSpan.TicksPerSecond), LastUpdateTime.Kind);
return lastUpdateInDb == lastSqlUpdateWithoutMilliseconds;
}
private DateTime GetLastUpdateTimeFromDbResponse()
@@ -104,10 +103,9 @@ namespace mRemoteNG.Config.Connections
public event ConnectionsUpdateAvailableEventHandler ConnectionsUpdateAvailable;
private void RaiseConnectionsUpdateAvailableEvent()
{
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, "Remote connection update is available");
var args = new ConnectionsUpdateAvailableEventArgs(_sqlConnector, _lastDatabaseUpdateTime);
ConnectionsUpdateAvailable?.Invoke(this, args);
if(args.Handled)
_lastUpdateTime = _lastDatabaseUpdateTime;
}
public void Dispose()

View File

@@ -2,6 +2,7 @@
using System.Collections.Specialized;
using System.ComponentModel;
using mRemoteNG.Connection;
using mRemoteNG.UI.Forms;
namespace mRemoteNG.Config.Connections
{
@@ -32,7 +33,7 @@ namespace mRemoteNG.Config.Connections
private void ConnectionTreeModelOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
{
SaveConnectionOnEdit();
SaveConnectionOnEdit(propertyChangedEventArgs.PropertyName);
}
private void ConnectionTreeModelOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
@@ -40,12 +41,14 @@ namespace mRemoteNG.Config.Connections
SaveConnectionOnEdit();
}
private void SaveConnectionOnEdit()
private void SaveConnectionOnEdit(string propertyName = "")
{
if (!mRemoteNG.Settings.Default.SaveConnectionsAfterEveryEdit)
return;
if (FrmMain.Default.IsClosing)
return;
_connectionsService.SaveConnectionsAsync();
_connectionsService.SaveConnectionsAsync(propertyName);
}
}
}

View File

@@ -1,22 +1,96 @@
using mRemoteNG.Config.DatabaseConnectors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Config.DataProviders;
using mRemoteNG.Config.Serializers;
using mRemoteNG.Config.Serializers.MsSql;
using mRemoteNG.Config.Serializers.Versioning;
using mRemoteNG.Container;
using mRemoteNG.Security;
using mRemoteNG.Security.Authentication;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Connections
{
public class SqlConnectionsLoader
public class SqlConnectionsLoader : IConnectionsLoader
{
private readonly IDeserializer<string, IEnumerable<LocalConnectionPropertiesModel>> _localConnectionPropertiesDeserializer;
private readonly IDataProvider<string> _dataProvider;
public Func<Optional<SecureString>> AuthenticationRequestor { get; set; } =
() => MiscTools.PasswordDialog("", false);
public SqlConnectionsLoader(
IDeserializer<string, IEnumerable<LocalConnectionPropertiesModel>> localConnectionPropertiesDeserializer,
IDataProvider<string> dataProvider)
{
_localConnectionPropertiesDeserializer = localConnectionPropertiesDeserializer.ThrowIfNull(nameof(localConnectionPropertiesDeserializer));
_dataProvider = dataProvider.ThrowIfNull(nameof(dataProvider));
}
public ConnectionTreeModel Load()
{
var connector = DatabaseConnectorFactory.SqlDatabaseConnectorFromSettings();
var dataProvider = new SqlDataProvider(connector);
var metaDataRetriever = new SqlDatabaseMetaDataRetriever();
var databaseVersionVerifier = new SqlDatabaseVersionVerifier(connector);
databaseVersionVerifier.VerifyDatabaseVersion();
var cryptoProvider = new LegacyRijndaelCryptographyProvider();
var metaData = metaDataRetriever.GetDatabaseMetaData(connector) ??
HandleFirstRun(metaDataRetriever, connector);
var decryptionKey = GetDecryptionKey(metaData);
if (!decryptionKey.Any())
throw new Exception("Could not load SQL connections");
databaseVersionVerifier.VerifyDatabaseVersion(metaData.ConfVersion);
var dataTable = dataProvider.Load();
var deserializer = new DataTableDeserializer();
return deserializer.Deserialize(dataTable);
var deserializer = new DataTableDeserializer(cryptoProvider, decryptionKey.First());
var connectionTree = deserializer.Deserialize(dataTable);
ApplyLocalConnectionProperties(connectionTree.RootNodes.First(i => i is RootNodeInfo));
return connectionTree;
}
private Optional<SecureString> GetDecryptionKey(SqlConnectionListMetaData metaData)
{
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
var cipherText = metaData.Protected;
var authenticator = new PasswordAuthenticator(cryptographyProvider, cipherText, AuthenticationRequestor);
var authenticated = authenticator.Authenticate(new RootNodeInfo(RootNodeType.Connection).DefaultPassword.ConvertToSecureString());
if (authenticated)
return authenticator.LastAuthenticatedPassword;
return Optional<SecureString>.Empty;
}
private void ApplyLocalConnectionProperties(ContainerInfo rootNode)
{
var localPropertiesXml = _dataProvider.Load();
var localConnectionProperties = _localConnectionPropertiesDeserializer.Deserialize(localPropertiesXml);
rootNode
.GetRecursiveChildList()
.Join(localConnectionProperties,
con => con.ConstantID,
locals => locals.ConnectionId,
(con, locals) => new {Connection = con, LocalProperties = locals})
.ForEach(x =>
{
x.Connection.PleaseConnect = x.LocalProperties.Connected;
if (x.Connection is ContainerInfo container)
container.IsExpanded = x.LocalProperties.Expanded;
});
}
private SqlConnectionListMetaData HandleFirstRun(SqlDatabaseMetaDataRetriever metaDataRetriever, SqlDatabaseConnector connector)
{
metaDataRetriever.WriteDatabaseMetaData(new RootNodeInfo(RootNodeType.Connection), connector);
return metaDataRetriever.GetDatabaseMetaData(connector);
}
}
}

View File

@@ -1,14 +1,16 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Security;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Config.DataProviders;
using mRemoteNG.Config.Serializers;
using mRemoteNG.Config.Serializers.MsSql;
using mRemoteNG.Config.Serializers.Versioning;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Messages;
using mRemoteNG.Security;
@@ -19,44 +21,90 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Connections
{
public class SqlConnectionsSaver : ISaver<ConnectionTreeModel>
public class SqlConnectionsSaver : ISaver<ConnectionTreeModel>
{
private SecureString _password = Runtime.EncryptionKey;
private readonly SaveFilter _saveFilter;
private readonly ISerializer<IEnumerable<LocalConnectionPropertiesModel>, string> _localPropertiesSerializer;
private readonly IDataProvider<string> _dataProvider;
public SqlConnectionsSaver(SaveFilter saveFilter)
public SqlConnectionsSaver(
SaveFilter saveFilter,
ISerializer<IEnumerable<LocalConnectionPropertiesModel>, string> localPropertieSerializer,
IDataProvider<string> localPropertiesDataProvider)
{
if (saveFilter == null)
throw new ArgumentNullException(nameof(saveFilter));
_saveFilter = saveFilter;
_localPropertiesSerializer = localPropertieSerializer.ThrowIfNull(nameof(localPropertieSerializer));
_dataProvider = localPropertiesDataProvider.ThrowIfNull(nameof(localPropertiesDataProvider));
}
public void Save(ConnectionTreeModel connectionTreeModel)
public void Save(ConnectionTreeModel connectionTreeModel, string propertyNameTrigger = "")
{
var rootTreeNode = connectionTreeModel.RootNodes.OfType<RootNodeInfo>().First();
UpdateLocalConnectionProperties(rootTreeNode);
if (PropertyIsLocalOnly(propertyNameTrigger))
{
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg,
$"Property {propertyNameTrigger} is local only. Not saving to database.");
return;
}
if (SqlUserIsReadOnly())
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Trying to save connection tree but the SQL read only checkbox is checked, aborting!");
return;
}
using (var sqlConnector = DatabaseConnectorFactory.SqlDatabaseConnectorFromSettings())
{
sqlConnector.Connect();
var databaseVersionVerifier = new SqlDatabaseVersionVerifier(sqlConnector);
var metaDataRetriever = new SqlDatabaseMetaDataRetriever();
var metaData = metaDataRetriever.GetDatabaseMetaData(sqlConnector);
if (!databaseVersionVerifier.VerifyDatabaseVersion())
if (!databaseVersionVerifier.VerifyDatabaseVersion(metaData.ConfVersion))
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strErrorConnectionListSaveFailed);
return;
}
var rootTreeNode = connectionTreeModel.RootNodes.OfType<RootNodeInfo>().First();
UpdateRootNodeTable(rootTreeNode, sqlConnector);
metaDataRetriever.WriteDatabaseMetaData(rootTreeNode, sqlConnector);
UpdateConnectionsTable(rootTreeNode, sqlConnector);
UpdateUpdatesTable(sqlConnector);
}
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, "Saved connections to database");
}
/// <summary>
/// Determines if a given property name should be only saved
/// locally.
/// </summary>
/// <param name="property">
/// The name of the property that triggered the save event
/// </param>
/// <returns></returns>
private bool PropertyIsLocalOnly(string property)
{
return property == nameof(ConnectionInfo.OpenConnections) ||
property == nameof(ContainerInfo.IsExpanded);
}
private void UpdateLocalConnectionProperties(ContainerInfo rootNode)
{
var a = rootNode.GetRecursiveChildList().Select(info => new LocalConnectionPropertiesModel
{
ConnectionId = info.ConstantID,
Connected = info.OpenConnections.Count > 0,
Expanded = info is ContainerInfo c && c.IsExpanded
});
var serializedProperties = _localPropertiesSerializer.Serialize(a);
_dataProvider.Save(serializedProperties);
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, "Saved local connection properties");
}
private void UpdateRootNodeTable(RootNodeInfo rootTreeNode, SqlDatabaseConnector sqlDatabaseConnector)
@@ -67,17 +115,17 @@ namespace mRemoteNG.Config.Connections
{
if (rootTreeNode.Password)
{
_password = rootTreeNode.PasswordString.ConvertToSecureString();
strProtected = cryptographyProvider.Encrypt("ThisIsProtected", _password);
var password = rootTreeNode.PasswordString.ConvertToSecureString();
strProtected = cryptographyProvider.Encrypt("ThisIsProtected", password);
}
else
{
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", _password);
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", Runtime.EncryptionKey);
}
}
else
{
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", _password);
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", Runtime.EncryptionKey);
}
var sqlQuery = new SqlCommand("DELETE FROM tblRoot", sqlDatabaseConnector.SqlConnection);
@@ -99,13 +147,15 @@ namespace mRemoteNG.Config.Connections
}
}
private void UpdateConnectionsTable(ContainerInfo rootTreeNode, SqlDatabaseConnector sqlDatabaseConnector)
private void UpdateConnectionsTable(RootNodeInfo rootTreeNode, SqlDatabaseConnector sqlDatabaseConnector)
{
var sqlQuery = new SqlCommand("DELETE FROM tblCons", sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
var serializer = new DataTableSerializer(_saveFilter);
var cryptoProvider = new LegacyRijndaelCryptographyProvider();
var serializer = new DataTableSerializer(_saveFilter, cryptoProvider, rootTreeNode.PasswordString.ConvertToSecureString());
var dataTable = serializer.Serialize(rootTreeNode);
var dataProvider = new SqlDataProvider(sqlDatabaseConnector);
var sqlQuery = new SqlCommand("DELETE FROM tblCons", sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
dataProvider.Save(dataTable);
}

View File

@@ -1,14 +1,14 @@
using System;
using System.IO;
using System.Security;
using mRemoteNG.Config.DataProviders;
using mRemoteNG.Config.DataProviders;
using mRemoteNG.Config.Serializers.Xml;
using mRemoteNG.Tools;
using mRemoteNG.Tree;
using System;
using System.IO;
using System.Security;
namespace mRemoteNG.Config.Connections
{
public class XmlConnectionsLoader
public class XmlConnectionsLoader : IConnectionsLoader
{
private readonly string _connectionFilePath;

View File

@@ -27,7 +27,7 @@ namespace mRemoteNG.Config.Connections
_saveFilter = saveFilter;
}
public void Save(ConnectionTreeModel connectionTreeModel)
public void Save(ConnectionTreeModel connectionTreeModel, string propertyNameTrigger = "")
{
try
{

View File

@@ -18,7 +18,7 @@ namespace mRemoteNG.Config
_dataProvider = dataProvider;
}
public void Save(IEnumerable<ICredentialRepository> repositories)
public void Save(IEnumerable<ICredentialRepository> repositories, string propertyNameTrigger = "")
{
var serializer = new CredentialRepositoryListSerializer();
var data = serializer.Serialize(repositories);

View File

@@ -2,6 +2,6 @@
{
public interface ISaver<in T>
{
void Save(T model);
void Save(T model, string propertyNameTrigger = "");
}
}

View File

@@ -1,13 +1,13 @@
using mRemoteNG.Tools;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using mRemoteNG.Tools;
using mRemoteNG.Tree.Root;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.Putty
{
public class PuttySessionsManager
public class PuttySessionsManager
{
public static PuttySessionsManager Instance { get; } = new PuttySessionsManager();
@@ -35,10 +35,12 @@ namespace mRemoteNG.Config.Putty
}
}
private void AddSessionsFromProvider(AbstractPuttySessionsProvider provider)
private void AddSessionsFromProvider(AbstractPuttySessionsProvider puttySessionProvider)
{
var rootTreeNode = provider.RootInfo;
provider.GetSessions();
puttySessionProvider.ThrowIfNull(nameof(puttySessionProvider));
var rootTreeNode = puttySessionProvider.RootInfo;
puttySessionProvider.GetSessions();
if (!RootPuttySessionsNodes.Contains(rootTreeNode) && rootTreeNode.HasChildren())
RootPuttySessionsNodes.Add(rootTreeNode);

View File

@@ -1,19 +1,19 @@
using Microsoft.Win32;
using mRemoteNG.App;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Messages;
using System;
using System.Collections.Generic;
using System.Management;
using System.Security.Principal;
using System.Text;
using System.Web;
using Microsoft.Win32;
using mRemoteNG.App;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Messages;
namespace mRemoteNG.Config.Putty
{
public class PuttySessionsRegistryProvider : AbstractPuttySessionsProvider
public class PuttySessionsRegistryProvider : AbstractPuttySessionsProvider
{
private const string PuttySessionsKey = "Software\\SimonTatham\\PuTTY\\Sessions";
private static ManagementEventWatcher _eventWatcher;
@@ -39,7 +39,10 @@ namespace mRemoteNG.Config.Putty
}
public override PuttySessionInfo GetSession(string sessionName)
{
{
if (string.IsNullOrEmpty(sessionName))
return null;
var sessionsKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey);
var sessionKey = sessionsKey?.OpenSubKey(sessionName);
if (sessionKey == null) return null;
@@ -50,10 +53,15 @@ namespace mRemoteNG.Config.Putty
{
PuttySession = sessionName,
Name = sessionName,
Hostname = sessionKey.GetValue("HostName").ToString(),
Username = sessionKey.GetValue("UserName").ToString()
Hostname = sessionKey.GetValue("HostName")?.ToString() ?? "",
Username = sessionKey.GetValue("UserName")?.ToString() ?? ""
};
var protocol = string.IsNullOrEmpty(sessionKey.GetValue("Protocol").ToString()) ? sessionKey.GetValue("Protocol").ToString() : "ssh";
var protocol = string.IsNullOrEmpty(sessionKey.GetValue("Protocol")?.ToString())
? "ssh"
: sessionKey.GetValue("Protocol").ToString();
switch (protocol.ToLowerInvariant())
{
case "raw":
@@ -65,7 +73,7 @@ namespace mRemoteNG.Config.Putty
case "serial":
return null;
case "ssh":
int.TryParse(sessionKey.GetValue("SshProt").ToString(), out var sshVersion);
int.TryParse(sessionKey.GetValue("SshProt")?.ToString(), out var sshVersion);
/* Per PUTTY.H in PuTTYNG & PuTTYNG Upstream (PuTTY proper currently)
* expect 0 for SSH1, 3 for SSH2 ONLY
* 1 for SSH1 with a 2 fallback
@@ -81,7 +89,12 @@ namespace mRemoteNG.Config.Putty
default:
return null;
}
sessionInfo.Port = Convert.ToInt32(sessionKey.GetValue("PortNumber"));
int.TryParse(sessionKey.GetValue("PortNumber")?.ToString(), out var portNumber);
if (portNumber == default(int))
sessionInfo.SetDefaultPort();
else
sessionInfo.Port = portNumber;
return sessionInfo;
}

View File

@@ -33,6 +33,7 @@ namespace mRemoteNG.Config.Putty
foreach (var sessionName in Directory.GetFiles(sessionsFolderPath))
{
var sessionFileName = Path.GetFileName(sessionName);
// ReSharper disable once ConstantConditionalAccessQualifier
sessionNames.Add(raw ? sessionFileName : System.Web.HttpUtility.UrlDecode(sessionFileName?.Replace("+", "%2B")));
}
@@ -174,7 +175,8 @@ namespace mRemoteNG.Config.Putty
private static string GetPuttyConfPath()
{
var puttyPath = mRemoteNG.Settings.Default.UseCustomPuttyPath ? mRemoteNG.Settings.Default.CustomPuttyPath : App.Info.GeneralAppInfo.PuttyPath;
return Path.Combine(Path.GetDirectoryName(puttyPath), "putty.conf");
puttyPath = Path.GetDirectoryName(puttyPath);
return string.IsNullOrEmpty(puttyPath) ? null : Path.Combine(puttyPath, "putty.conf");
}
private static string GetSessionsFolderPath()
@@ -201,6 +203,9 @@ namespace mRemoteNG.Config.Putty
private static PuttySessionInfo ModifyRegistrySessionInfo(PuttySessionInfo sessionInfo)
{
if (sessionInfo == null)
return null;
sessionInfo.Name = string.Format(RegistrySessionNameFormat, sessionInfo.Name);
sessionInfo.PuttySession = string.Format(RegistrySessionNameFormat, sessionInfo.PuttySession);
return sessionInfo;

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using mRemoteNG.App;
using mRemoteNG.App;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.Http;
@@ -12,11 +8,28 @@ using mRemoteNG.Connection.Protocol.VNC;
using mRemoteNG.Container;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Security;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
namespace mRemoteNG.Config.Serializers
namespace mRemoteNG.Config.Serializers.MsSql
{
public class DataTableDeserializer : IDeserializer<DataTable, ConnectionTreeModel>
public class DataTableDeserializer : IDeserializer<DataTable, ConnectionTreeModel>
{
private readonly ICryptographyProvider _cryptographyProvider;
private readonly SecureString _decryptionKey;
public DataTableDeserializer(ICryptographyProvider cryptographyProvider, SecureString decryptionKey)
{
_cryptographyProvider = cryptographyProvider.ThrowIfNull(nameof(cryptographyProvider));
_decryptionKey = decryptionKey.ThrowIfNull(nameof(decryptionKey));
}
public ConnectionTreeModel Deserialize(DataTable table)
{
var connectionList = CreateNodesFromTable(table);
@@ -34,10 +47,10 @@ namespace mRemoteNG.Config.Serializers
switch ((string)row["Type"])
{
case "Connection":
nodeList.Add(DeserializeConnectionInfo(row));
nodeList.Add(DeserializeConnectionInfo(row));
break;
case "Container":
nodeList.Add(DeserializeContainerInfo(row));
nodeList.Add(DeserializeContainerInfo(row));
break;
}
}
@@ -68,16 +81,12 @@ namespace mRemoteNG.Config.Serializers
// The Parent object is linked properly later in CreateNodeHierarchy()
//connectionInfo.Parent.ConstantID = (string)dataRow["ParentID"];
var info = connectionInfo as ContainerInfo;
if(info != null)
info.IsExpanded = (bool)dataRow["Expanded"];
connectionInfo.Description = (string)dataRow["Description"];
connectionInfo.Icon = (string)dataRow["Icon"];
connectionInfo.Panel = (string)dataRow["Panel"];
connectionInfo.Username = (string)dataRow["Username"];
connectionInfo.Domain = (string)dataRow["DomainName"];
connectionInfo.Password = (string)dataRow["Password"];
connectionInfo.Password = DecryptValue((string)dataRow["Password"]);
connectionInfo.Hostname = (string)dataRow["Hostname"];
connectionInfo.Protocol = (ProtocolType)Enum.Parse(typeof(ProtocolType), (string)dataRow["Protocol"]);
connectionInfo.PuttySession = (string)dataRow["PuttySession"];
@@ -105,7 +114,6 @@ namespace mRemoteNG.Config.Serializers
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"];
connectionInfo.PostExtApp = (string)dataRow["PostExtApp"];
connectionInfo.MacAddress = (string)dataRow["MacAddress"];
@@ -118,7 +126,7 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.VNCProxyIP = (string)dataRow["VNCProxyIP"];
connectionInfo.VNCProxyPort = (int)dataRow["VNCProxyPort"];
connectionInfo.VNCProxyUsername = (string)dataRow["VNCProxyUsername"];
connectionInfo.VNCProxyPassword = (string)dataRow["VNCProxyPassword"];
connectionInfo.VNCProxyPassword = DecryptValue((string)dataRow["VNCProxyPassword"]);
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"];
@@ -126,7 +134,7 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.RDGatewayHostname = (string)dataRow["RDGatewayHostname"];
connectionInfo.RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), (string)dataRow["RDGatewayUseConnectionCredentials"]);
connectionInfo.RDGatewayUsername = (string)dataRow["RDGatewayUsername"];
connectionInfo.RDGatewayPassword = (string)dataRow["RDGatewayPassword"];
connectionInfo.RDGatewayPassword = DecryptValue((string)dataRow["RDGatewayPassword"]);
connectionInfo.RDGatewayDomain = (string)dataRow["RDGatewayDomain"];
connectionInfo.Inheritance.CacheBitmaps = (bool)dataRow["InheritCacheBitmaps"];
@@ -185,10 +193,26 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.Inheritance.RDGatewayDomain = (bool)dataRow["InheritRDGatewayDomain"];
}
private string DecryptValue(string cipherText)
{
try
{
return _cryptographyProvider.Decrypt(cipherText, _decryptionKey);
}
catch (EncryptionException)
{
// value may not be encrypted
return cipherText;
}
}
private ConnectionTreeModel CreateNodeHierarchy(List<ConnectionInfo> connectionList, DataTable dataTable)
{
var connectionTreeModel = new ConnectionTreeModel();
var rootNode = new RootNodeInfo(RootNodeType.Connection, "0");
var rootNode = new RootNodeInfo(RootNodeType.Connection, "0")
{
PasswordString = _decryptionKey.ConvertToUnsecureString()
};
connectionTreeModel.AddRootNode(rootNode);
foreach (DataRow row in dataTable.Rows)

View File

@@ -1,25 +1,31 @@
using System;
using System.Data;
using System.Data.SqlTypes;
using System.Linq;
using mRemoteNG.Connection;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Security;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using System;
using System.Data;
using System.Data.SqlTypes;
using System.Linq;
using System.Security;
using mRemoteNG.Tools;
namespace mRemoteNG.Config.Serializers
namespace mRemoteNG.Config.Serializers.MsSql
{
public class DataTableSerializer : ISerializer<ConnectionInfo,DataTable>
{
private readonly ICryptographyProvider _cryptographyProvider;
private readonly SecureString _encryptionKey;
private DataTable _dataTable;
private const string TableName = "tblCons";
private readonly SaveFilter _saveFilter;
private int _currentNodeIndex;
public DataTableSerializer(SaveFilter saveFilter)
public DataTableSerializer(SaveFilter saveFilter, ICryptographyProvider cryptographyProvider, SecureString encryptionKey)
{
_saveFilter = saveFilter;
_saveFilter = saveFilter.ThrowIfNull(nameof(saveFilter));
_cryptographyProvider = cryptographyProvider.ThrowIfNull(nameof(cryptographyProvider));
_encryptionKey = encryptionKey.ThrowIfNull(nameof(encryptionKey));
}
@@ -204,14 +210,15 @@ namespace mRemoteNG.Config.Serializers
dataRow["ParentID"] = connectionInfo.Parent?.ConstantID ?? "";
dataRow["PositionID"] = _currentNodeIndex;
dataRow["LastChange"] = (SqlDateTime)DateTime.Now;
var info = connectionInfo as ContainerInfo;
dataRow["Expanded"] = info != null && info.IsExpanded;
dataRow["Expanded"] = false; // TODO: this column can eventually be removed. we now save this property locally
dataRow["Description"] = connectionInfo.Description;
dataRow["Icon"] = connectionInfo.Icon;
dataRow["Panel"] = connectionInfo.Panel;
dataRow["Username"] = _saveFilter.SaveUsername ? connectionInfo.Username : "";
dataRow["DomainName"] = _saveFilter.SaveDomain ? connectionInfo.Domain : "";
dataRow["Password"] = _saveFilter.SavePassword ? connectionInfo.Password : "";
dataRow["Password"] = _saveFilter.SavePassword
? _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)
: "";
dataRow["Hostname"] = connectionInfo.Hostname;
dataRow["Protocol"] = connectionInfo.Protocol;
dataRow["PuttySession"] = connectionInfo.PuttySession;
@@ -239,7 +246,7 @@ namespace mRemoteNG.Config.Serializers
dataRow["RedirectSound"] = connectionInfo.RedirectSound;
dataRow["SoundQuality"] = connectionInfo.SoundQuality;
dataRow["RedirectKeys"] = connectionInfo.RedirectKeys;
dataRow["Connected"] = connectionInfo.OpenConnections.Count > 0;
dataRow["Connected"] = false; // TODO: this column can eventually be removed. we now save this property locally
dataRow["PreExtApp"] = connectionInfo.PreExtApp;
dataRow["PostExtApp"] = connectionInfo.PostExtApp;
dataRow["MacAddress"] = connectionInfo.MacAddress;
@@ -252,7 +259,7 @@ namespace mRemoteNG.Config.Serializers
dataRow["VNCProxyIP"] = connectionInfo.VNCProxyIP;
dataRow["VNCProxyPort"] = connectionInfo.VNCProxyPort;
dataRow["VNCProxyUsername"] = connectionInfo.VNCProxyUsername;
dataRow["VNCProxyPassword"] = connectionInfo.VNCProxyPassword;
dataRow["VNCProxyPassword"] = _cryptographyProvider.Encrypt(connectionInfo.VNCProxyPassword, _encryptionKey);
dataRow["VNCColors"] = connectionInfo.VNCColors;
dataRow["VNCSmartSizeMode"] = connectionInfo.VNCSmartSizeMode;
dataRow["VNCViewOnly"] = connectionInfo.VNCViewOnly;
@@ -260,7 +267,7 @@ namespace mRemoteNG.Config.Serializers
dataRow["RDGatewayHostname"] = connectionInfo.RDGatewayHostname;
dataRow["RDGatewayUseConnectionCredentials"] = connectionInfo.RDGatewayUseConnectionCredentials;
dataRow["RDGatewayUsername"] = connectionInfo.RDGatewayUsername;
dataRow["RDGatewayPassword"] = connectionInfo.RDGatewayPassword;
dataRow["RDGatewayPassword"] = _cryptographyProvider.Encrypt(connectionInfo.RDGatewayPassword, _encryptionKey);
dataRow["RDGatewayDomain"] = connectionInfo.RDGatewayDomain;
if (_saveFilter.SaveInheritance)
{

View File

@@ -0,0 +1,20 @@
namespace mRemoteNG.Config.Serializers.MsSql
{
public class LocalConnectionPropertiesModel
{
/// <summary>
/// The unique Id of this tree node
/// </summary>
public string ConnectionId { get; set; }
/// <summary>
/// Indicates whether this connection is connected
/// </summary>
public bool Connected { get; set; }
/// <summary>
/// Indicates whether this container is expanded in the tree
/// </summary>
public bool Expanded { get; set; }
}
}

View File

@@ -0,0 +1,60 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace mRemoteNG.Config.Serializers.MsSql
{
public class LocalConnectionPropertiesXmlSerializer :
ISerializer<IEnumerable<LocalConnectionPropertiesModel>, string>,
IDeserializer<string, IEnumerable<LocalConnectionPropertiesModel>>
{
public string Serialize(IEnumerable<LocalConnectionPropertiesModel> models)
{
var localConnections = models
.Select(m => new XElement("Node",
new XAttribute("ConnectionId", m.ConnectionId),
new XAttribute("Connected", m.Connected),
new XAttribute("Expanded", m.Expanded)));
var root = new XElement("LocalConnections", localConnections);
var xdoc = new XDocument(new XDeclaration("1.0", "utf-8", null), root);
return WriteXmlToString(xdoc);
}
public IEnumerable<LocalConnectionPropertiesModel> Deserialize(string serializedData)
{
if (string.IsNullOrWhiteSpace(serializedData))
return Enumerable.Empty<LocalConnectionPropertiesModel>();
var xdoc = XDocument.Parse(serializedData);
return xdoc
.Descendants("Node")
.Where(e => e.Attribute("ConnectionId") != null)
.Select(e => new LocalConnectionPropertiesModel
{
ConnectionId = e.Attribute("ConnectionId")?.Value,
Connected = bool.Parse(e.Attribute("Connected")?.Value ?? "False"),
Expanded = bool.Parse(e.Attribute("Expanded")?.Value ?? "False")
});
}
private static string WriteXmlToString(XNode xmlDocument)
{
string xmlString;
var xmlWriterSettings = new XmlWriterSettings { Indent = true, IndentChars = " ", Encoding = Encoding.UTF8 };
var memoryStream = new MemoryStream();
using (var xmlTextWriter = XmlWriter.Create(memoryStream, xmlWriterSettings))
{
xmlDocument.WriteTo(xmlTextWriter);
xmlTextWriter.Flush();
var streamReader = new StreamReader(memoryStream, Encoding.UTF8, true);
memoryStream.Seek(0, SeekOrigin.Begin);
xmlString = streamReader.ReadToEnd();
}
return xmlString;
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Security;
namespace mRemoteNG.Config.Serializers.MsSql
{
public class SqlConnectionListMetaData
{
public string Name { get; set; }
public string Protected { get; set; }
public bool Export { get; set; }
public Version ConfVersion { get; set; }
}
}

View File

@@ -0,0 +1,93 @@
using System;
using System.Data.SqlClient;
using System.Globalization;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.MsSql
{
public class SqlDatabaseMetaDataRetriever
{
public SqlConnectionListMetaData GetDatabaseMetaData(SqlDatabaseConnector sqlDatabaseConnector)
{
SqlConnectionListMetaData metaData;
SqlDataReader sqlDataReader = null;
try
{
var sqlCommand = new SqlCommand("SELECT * FROM tblRoot", sqlDatabaseConnector.SqlConnection);
if (!sqlDatabaseConnector.IsConnected)
sqlDatabaseConnector.Connect();
sqlDataReader = sqlCommand.ExecuteReader();
if (!sqlDataReader.HasRows)
return null; // assume new empty database
else
sqlDataReader.Read();
metaData = new SqlConnectionListMetaData
{
Name = sqlDataReader["Name"] as string ?? "",
Protected = sqlDataReader["Protected"] as string ?? "",
Export = (bool)sqlDataReader["Export"],
ConfVersion = new Version(Convert.ToString(sqlDataReader["confVersion"], CultureInfo.InvariantCulture))
};
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, $"Retrieving database version failed. {ex}");
throw;
}
finally
{
if (sqlDataReader != null && !sqlDataReader.IsClosed)
sqlDataReader.Close();
}
return metaData;
}
public void WriteDatabaseMetaData(RootNodeInfo rootTreeNode, SqlDatabaseConnector sqlDatabaseConnector)
{
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
string strProtected;
if (rootTreeNode != null)
{
if (rootTreeNode.Password)
{
var password = rootTreeNode.PasswordString.ConvertToSecureString();
strProtected = cryptographyProvider.Encrypt("ThisIsProtected", password);
}
else
{
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", Runtime.EncryptionKey);
}
}
else
{
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", Runtime.EncryptionKey);
}
var sqlQuery = new SqlCommand("DELETE FROM tblRoot", sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
if (rootTreeNode != null)
{
sqlQuery =
new SqlCommand(
"INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" +
MiscTools.PrepareValueForDB(rootTreeNode.Name) + "\', 0, \'" + strProtected + "\'," +
ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")",
sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
}
else
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, $"UpdateRootNodeTable: rootTreeNode was null. Could not insert!");
}
}
}
}

View File

@@ -205,7 +205,9 @@ namespace mRemoteNG.Config.Serializers.Xml
{
if (xmlnode.Attributes == null) return null;
var connectionId = xmlnode.Attributes["Id"]?.Value ?? Guid.NewGuid().ToString();
var connectionId = xmlnode.Attributes["Id"]?.Value;
if (string.IsNullOrWhiteSpace(connectionId))
connectionId = Guid.NewGuid().ToString();
var connectionInfo = new ConnectionInfo(connectionId);
try

View File

@@ -13,7 +13,7 @@ using mRemoteNG.Tree.Root;
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 */
@@ -40,11 +40,15 @@ namespace mRemoteNG.Config.Serializers
private static void VerifySchemaVersion(XmlNode rdcManNode)
{
_schemaVersion = Convert.ToInt32(rdcManNode?.Attributes?["schemaVersion"].Value);
if (_schemaVersion != 1 && _schemaVersion != 3)
if (!int.TryParse(rdcManNode?.Attributes?["schemaVersion"]?.Value, out var version))
throw new FileFormatException("Could not find schema version attribute.");
if (version != 1 && version != 3)
{
throw (new FileFormatException($"Unsupported schema version ({_schemaVersion})."));
throw new FileFormatException($"Unsupported schema version ({version}).");
}
_schemaVersion = version;
}
private static void VerifyFileVersion(XmlNode rdcManNode)
@@ -114,7 +118,8 @@ namespace mRemoteNG.Config.Serializers
containerPropertiesNode = containerPropertiesNode.SelectSingleNode("./properties");
}
newContainer.Name = containerPropertiesNode?.SelectSingleNode("./name")?.InnerText ?? Language.strNewFolder;
newContainer.IsExpanded = bool.Parse(containerPropertiesNode?.SelectSingleNode("./expanded")?.InnerText ?? "false");
if (bool.TryParse(containerPropertiesNode?.SelectSingleNode("./expanded")?.InnerText, out var expanded))
newContainer.IsExpanded = expanded;
parentContainer.AddChild(newContainer);
return newContainer;
}
@@ -129,17 +134,25 @@ namespace mRemoteNG.Config.Serializers
{
var connectionInfo = new ConnectionInfo {Protocol = ProtocolType.RDP};
var propertiesNode = xmlNode.SelectSingleNode("./properties");
if (_schemaVersion == 1) propertiesNode = xmlNode; // Version 2.2 defines the container name at the root instead
if (_schemaVersion == 1)
propertiesNode = xmlNode; // Version 2.2 defines the container name at the root instead
connectionInfo.Hostname = propertiesNode?.SelectSingleNode("./name")?.InnerText ?? "";
connectionInfo.Name = propertiesNode?.SelectSingleNode("./displayName")?.InnerText ?? connectionInfo.Hostname;
var connectionDisplayName = propertiesNode?.SelectSingleNode("./displayName")?.InnerText;
connectionInfo.Name = !string.IsNullOrWhiteSpace(connectionDisplayName)
? connectionDisplayName
: string.IsNullOrWhiteSpace(connectionInfo.Hostname)
? connectionInfo.Name
: connectionInfo.Hostname;
connectionInfo.Description = propertiesNode?.SelectSingleNode("./comment")?.InnerText ?? string.Empty;
var logonCredentialsNode = xmlNode.SelectSingleNode("./logonCredentials");
if (logonCredentialsNode?.Attributes?["inherit"]?.Value == "None")
{
connectionInfo.Username = logonCredentialsNode.SelectSingleNode("userName")?.InnerText;
connectionInfo.Username = logonCredentialsNode.SelectSingleNode("userName")?.InnerText ?? string.Empty;
var passwordNode = logonCredentialsNode.SelectSingleNode("./password");
if (_schemaVersion == 1) // Version 2.2 allows clear text passwords
@@ -153,7 +166,7 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.Password = DecryptRdcManPassword(passwordNode?.InnerText);
}
connectionInfo.Domain = logonCredentialsNode.SelectSingleNode("./domain")?.InnerText;
connectionInfo.Domain = logonCredentialsNode.SelectSingleNode("./domain")?.InnerText ?? string.Empty;
}
else
{
@@ -165,10 +178,12 @@ namespace mRemoteNG.Config.Serializers
var connectionSettingsNode = xmlNode.SelectSingleNode("./connectionSettings");
if (connectionSettingsNode?.Attributes?["inherit"]?.Value == "None")
{
connectionInfo.UseConsoleSession = bool.Parse(connectionSettingsNode.SelectSingleNode("./connectToConsole")?.InnerText ?? "false");
if (bool.TryParse(connectionSettingsNode.SelectSingleNode("./connectToConsole")?.InnerText, out var useConsole))
connectionInfo.UseConsoleSession = useConsole;
// ./startProgram
// ./workingDir
connectionInfo.Port = Convert.ToInt32(connectionSettingsNode.SelectSingleNode("./port")?.InnerText);
if (int.TryParse(connectionSettingsNode.SelectSingleNode("./port")?.InnerText, out var port))
connectionInfo.Port = port;
}
else
{
@@ -179,14 +194,18 @@ namespace mRemoteNG.Config.Serializers
var gatewaySettingsNode = xmlNode.SelectSingleNode("./gatewaySettings");
if (gatewaySettingsNode?.Attributes?["inherit"]?.Value == "None")
{
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;
connectionInfo.RDGatewayUsageMethod = gatewaySettingsNode.SelectSingleNode("./enabled")?.InnerText == "True"
? RdpProtocol.RDGatewayUsageMethod.Always
: RdpProtocol.RDGatewayUsageMethod.Never;
connectionInfo.RDGatewayHostname = gatewaySettingsNode.SelectSingleNode("./hostName")?.InnerText ?? string.Empty;
connectionInfo.RDGatewayUsername = gatewaySettingsNode.SelectSingleNode("./userName")?.InnerText ?? string.Empty;
var passwordNode = gatewaySettingsNode.SelectSingleNode("./password");
connectionInfo.RDGatewayPassword = passwordNode?.Attributes?["storeAsClearText"]?.Value == "True" ? passwordNode.InnerText : DecryptRdcManPassword(passwordNode?.InnerText);
connectionInfo.RDGatewayPassword = passwordNode?.Attributes?["storeAsClearText"]?.Value == "True"
? passwordNode.InnerText
: DecryptRdcManPassword(passwordNode?.InnerText);
connectionInfo.RDGatewayDomain = gatewaySettingsNode.SelectSingleNode("./domain")?.InnerText;
connectionInfo.RDGatewayDomain = gatewaySettingsNode.SelectSingleNode("./domain")?.InnerText ?? string.Empty;
// ./logonMethod
// ./localBypass
// ./credSharing
@@ -203,15 +222,10 @@ namespace mRemoteNG.Config.Serializers
var remoteDesktopNode = xmlNode.SelectSingleNode("./remoteDesktop");
if (remoteDesktopNode?.Attributes?["inherit"]?.Value == "None")
{
var resolutionString = remoteDesktopNode.SelectSingleNode("./size")?.InnerText.Replace(" ", "");
try
{
connectionInfo.Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions), "Res" + resolutionString);
}
catch (ArgumentException)
{
connectionInfo.Resolution = RdpProtocol.RDPResolutions.FitToWindow;
}
connectionInfo.Resolution =
Enum.TryParse<RdpProtocol.RDPResolutions>(remoteDesktopNode.SelectSingleNode("./size")?.InnerText.Replace(" ", ""), true, out var rdpResolution)
? rdpResolution
: RdpProtocol.RDPResolutions.FitToWindow;
if (remoteDesktopNode.SelectSingleNode("./sameSizeAsClientArea")?.InnerText == "True")
{
@@ -223,9 +237,8 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.Resolution = RdpProtocol.RDPResolutions.Fullscreen;
}
var colorDepth = remoteDesktopNode.SelectSingleNode("./colorDepth")?.InnerText;
if (colorDepth != null)
connectionInfo.Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors), colorDepth);
if (Enum.TryParse<RdpProtocol.RDPColors>(remoteDesktopNode.SelectSingleNode("./colorDepth")?.InnerText, true, out var rdpColors))
connectionInfo.Colors = rdpColors;
}
else
{
@@ -274,10 +287,17 @@ namespace mRemoteNG.Config.Serializers
}
// ./redirectClipboard
connectionInfo.RedirectDiskDrives = bool.Parse(localResourcesNode?.SelectSingleNode("./redirectDrives")?.InnerText ?? "false");
connectionInfo.RedirectPorts = bool.Parse(localResourcesNode?.SelectSingleNode("./redirectPorts")?.InnerText ?? "false");
connectionInfo.RedirectPrinters = bool.Parse(localResourcesNode?.SelectSingleNode("./redirectPrinters")?.InnerText ?? "false");
connectionInfo.RedirectSmartCards = bool.Parse(localResourcesNode?.SelectSingleNode("./redirectSmartCards")?.InnerText ?? "false");
if (bool.TryParse(localResourcesNode?.SelectSingleNode("./redirectDrives")?.InnerText, out var redirectDisks))
connectionInfo.RedirectDiskDrives = redirectDisks;
if (bool.TryParse(localResourcesNode?.SelectSingleNode("./redirectPorts")?.InnerText, out var redirectPorts))
connectionInfo.RedirectPorts = redirectPorts;
if (bool.TryParse(localResourcesNode?.SelectSingleNode("./redirectPrinters")?.InnerText, out var redirectPrinters))
connectionInfo.RedirectPrinters = redirectPrinters;
if (bool.TryParse(localResourcesNode?.SelectSingleNode("./redirectSmartCards")?.InnerText, out var redirectSmartCards))
connectionInfo.RedirectSmartCards = redirectSmartCards;
}
else
{

View File

@@ -1,41 +0,0 @@
using System;
using System.Data.SqlClient;
using System.Globalization;
using mRemoteNG.App;
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
namespace mRemoteNG.Config.Serializers.Versioning
{
public class SqlDatabaseVersionRetriever
{
public Version GetDatabaseVersion(SqlDatabaseConnector sqlDatabaseConnector)
{
Version databaseVersion;
SqlDataReader sqlDataReader = null;
try
{
var sqlCommand = new SqlCommand("SELECT * FROM tblRoot", sqlDatabaseConnector.SqlConnection);
if (!sqlDatabaseConnector.IsConnected)
sqlDatabaseConnector.Connect();
sqlDataReader = sqlCommand.ExecuteReader();
if (!sqlDataReader.HasRows)
return new Version(); // assume new empty database
else
sqlDataReader.Read();
databaseVersion = new Version(Convert.ToString(sqlDataReader["confVersion"], CultureInfo.InvariantCulture));
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, $"Retrieving database version failed. {ex}");
throw;
}
finally
{
if (sqlDataReader != null && !sqlDataReader.IsClosed)
sqlDataReader.Close();
}
return databaseVersion;
}
}
}

View File

@@ -9,7 +9,6 @@ namespace mRemoteNG.Config.Serializers.Versioning
public class SqlDatabaseVersionVerifier
{
private readonly SqlDatabaseConnector _sqlDatabaseConnector;
private readonly SqlDatabaseVersionRetriever _versionRetriever;
public SqlDatabaseVersionVerifier(SqlDatabaseConnector sqlDatabaseConnector)
{
@@ -17,15 +16,14 @@ namespace mRemoteNG.Config.Serializers.Versioning
throw new ArgumentNullException(nameof(sqlDatabaseConnector));
_sqlDatabaseConnector = sqlDatabaseConnector;
_versionRetriever = new SqlDatabaseVersionRetriever();
}
public bool VerifyDatabaseVersion()
public bool VerifyDatabaseVersion(Version dbVersion)
{
var isVerified = false;
try
{
var databaseVersion = _versionRetriever.GetDatabaseVersion(_sqlDatabaseConnector);
var databaseVersion = dbVersion;
if (databaseVersion.Equals(new Version()))
{

View File

@@ -19,6 +19,7 @@ namespace mRemoteNG.Config.Settings
{
private readonly ExternalAppsLoader _externalAppsLoader;
private readonly MessageCollector _messageCollector;
private readonly MenuStrip _mainMenu;
private readonly QuickConnectToolStrip _quickConnectToolStrip;
private readonly ExternalToolsToolStrip _externalToolsToolStrip;
private readonly MultiSshToolStrip _multiSshToolStrip;
@@ -31,7 +32,8 @@ namespace mRemoteNG.Config.Settings
MessageCollector messageCollector,
QuickConnectToolStrip quickConnectToolStrip,
ExternalToolsToolStrip externalToolsToolStrip,
MultiSshToolStrip multiSshToolStrip)
MultiSshToolStrip multiSshToolStrip,
MenuStrip mainMenu)
{
if (mainForm == null)
throw new ArgumentNullException(nameof(mainForm));
@@ -43,13 +45,16 @@ namespace mRemoteNG.Config.Settings
throw new ArgumentNullException(nameof(externalToolsToolStrip));
if (multiSshToolStrip == null)
throw new ArgumentNullException(nameof(multiSshToolStrip));
if (mainMenu == null)
throw new ArgumentNullException(nameof(mainMenu));
MainForm = mainForm;
_messageCollector = messageCollector;
_quickConnectToolStrip = quickConnectToolStrip;
_externalToolsToolStrip = externalToolsToolStrip;
_multiSshToolStrip = multiSshToolStrip;
_externalAppsLoader = new ExternalAppsLoader(MainForm, messageCollector, _externalToolsToolStrip);
_mainMenu = mainMenu;
_externalAppsLoader = new ExternalAppsLoader(MainForm, messageCollector, _externalToolsToolStrip);
}
#region Public Methods
@@ -197,6 +202,7 @@ namespace mRemoteNG.Config.Settings
private void LoadToolbarsFromSettings()
{
ResetAllToolbarLocations();
AddMainMenuPanel();
AddExternalAppsPanel();
AddQuickConnectPanel();
AddMultiSshPanel();
@@ -210,31 +216,49 @@ namespace mRemoteNG.Config.Settings
private void ResetAllToolbarLocations()
{
var tempToolStrip = new ToolStripPanel();
tempToolStrip.Join(_mainMenu);
tempToolStrip.Join(_quickConnectToolStrip);
tempToolStrip.Join(_externalToolsToolStrip);
tempToolStrip.Join(_multiSshToolStrip);
}
private void AddMainMenuPanel()
{
SetToolstripGripStyle(_mainMenu);
var toolStripPanel = ToolStripPanelFromString("top");
toolStripPanel.Join(_mainMenu, new Point(3, 0));
}
private void AddQuickConnectPanel()
{
SetToolstripGripStyle(_quickConnectToolStrip);
_quickConnectToolStrip.Visible = mRemoteNG.Settings.Default.QuickyTBVisible;
var toolStripPanel = ToolStripPanelFromString(mRemoteNG.Settings.Default.QuickyTBParentDock);
toolStripPanel.Join(_quickConnectToolStrip, mRemoteNG.Settings.Default.QuickyTBLocation);
_quickConnectToolStrip.Visible = mRemoteNG.Settings.Default.QuickyTBVisible;
}
private void AddExternalAppsPanel()
{
var toolStripPanel = ToolStripPanelFromString(mRemoteNG.Settings.Default.ExtAppsTBParentDock);
toolStripPanel.Join(_externalToolsToolStrip, mRemoteNG.Settings.Default.ExtAppsTBLocation);
SetToolstripGripStyle(_externalToolsToolStrip);
_externalToolsToolStrip.Visible = mRemoteNG.Settings.Default.ExtAppsTBVisible;
var toolStripPanel = ToolStripPanelFromString(mRemoteNG.Settings.Default.ExtAppsTBParentDock);
toolStripPanel.Join(_externalToolsToolStrip, mRemoteNG.Settings.Default.ExtAppsTBLocation);
}
private void AddMultiSshPanel()
{
var toolStripPanel = ToolStripPanelFromString(mRemoteNG.Settings.Default.ExtAppsTBParentDock);
toolStripPanel.Join(_multiSshToolStrip, mRemoteNG.Settings.Default.MultiSshToolbarLocation);
SetToolstripGripStyle(_multiSshToolStrip);
_multiSshToolStrip.Visible = mRemoteNG.Settings.Default.MultiSshToolbarVisible;
var toolStripPanel = ToolStripPanelFromString(mRemoteNG.Settings.Default.MultiSshToolbarParentDock);
toolStripPanel.Join(_multiSshToolStrip, mRemoteNG.Settings.Default.MultiSshToolbarLocation);
}
private void SetToolstripGripStyle(ToolStrip toolbar)
{
toolbar.GripStyle = mRemoteNG.Settings.Default.LockToolbars
? ToolStripGripStyle.Hidden
: ToolStripGripStyle.Visible;
}
private ToolStripPanel ToolStripPanelFromString(string panel)
{

View File

@@ -674,7 +674,7 @@ namespace mRemoteNG.Connection
PropertyChanged?.Invoke(sender, new PropertyChangedEventArgs(args.PropertyName));
}
private void SetField<T>(ref T field, T value, string propertyName = null)
protected void SetField<T>(ref T field, T value, string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return;
field = value;

View File

@@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using mRemoteNG.App;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.Http;
@@ -15,11 +10,16 @@ using mRemoteNG.Connection.Protocol.Telnet;
using mRemoteNG.Connection.Protocol.VNC;
using mRemoteNG.Container;
using mRemoteNG.Tree;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace mRemoteNG.Connection
{
[DefaultProperty("Name")]
[DefaultProperty("Name")]
public class ConnectionInfo : AbstractConnectionRecord, IHasParent, IInheritable
{
#region Public Properties
@@ -78,7 +78,8 @@ namespace mRemoteNG.Connection
var newConnectionInfo = new ConnectionInfo();
newConnectionInfo.CopyFrom(this);
newConnectionInfo.Inheritance = Inheritance.Clone();
return newConnectionInfo;
newConnectionInfo.Inheritance.Parent = newConnectionInfo;
return newConnectionInfo;
}
public void CopyFrom(ConnectionInfo sourceConnectionInfo)
@@ -172,8 +173,11 @@ namespace mRemoteNG.Connection
if (!ShouldThisPropertyBeInherited(propertyName))
return value;
var inheritedValue = GetInheritedPropertyValue<TPropertyType>(propertyName);
return inheritedValue.Equals(default(TPropertyType)) ? value : inheritedValue;
var couldGetInheritedValue = TryGetInheritedPropertyValue<TPropertyType>(propertyName, out var inheritedValue);
return couldGetInheritedValue
? inheritedValue
: value;
}
private bool ShouldThisPropertyBeInherited(string propertyName)
@@ -194,22 +198,23 @@ namespace mRemoteNG.Connection
return inheritPropertyValue;
}
private TPropertyType GetInheritedPropertyValue<TPropertyType>(string propertyName)
private bool TryGetInheritedPropertyValue<TPropertyType>(string propertyName, out TPropertyType inheritedValue)
{
try
{
var connectionInfoType = Parent.GetType();
var parentPropertyInfo = connectionInfoType.GetProperty(propertyName);
if (parentPropertyInfo == null)
return default(TPropertyType); // shouldn't get here...
var parentPropertyValue = (TPropertyType)parentPropertyInfo.GetValue(Parent, null);
throw new NullReferenceException($"Could not retrieve property data for property '{propertyName}' on parent node '{Parent?.Name}'");
return parentPropertyValue;
inheritedValue = (TPropertyType)parentPropertyInfo.GetValue(Parent, null);
return true;
}
catch (Exception e)
{
Runtime.MessageCollector.AddExceptionStackTrace($"Error retrieving inherited property '{propertyName}'", e);
return default(TPropertyType);
inheritedValue = default(TPropertyType);
return false;
}
}

View File

@@ -1,6 +1,4 @@
using System;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.App;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Container;
@@ -8,14 +6,23 @@ using mRemoteNG.Messages;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.Panels;
using mRemoteNG.UI.Window;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using TabPage = Crownwood.Magic.Controls.TabPage;
namespace mRemoteNG.Connection
{
public class ConnectionInitiator : IConnectionInitiator
public class ConnectionInitiator : IConnectionInitiator
{
private readonly PanelAdder _panelAdder = new PanelAdder();
private readonly List<string> _activeConnections = new List<string>();
/// <summary>
/// List of unique IDs of the currently active connections
/// </summary>
public IEnumerable<string> ActiveConnections => _activeConnections;
public void OpenConnection(ContainerInfo containerInfo, ConnectionInfo.Force force = ConnectionInfo.Force.None)
{
@@ -118,6 +125,7 @@ namespace mRemoteNG.Connection
}
connectionInfo.OpenConnections.Add(newProtocol);
_activeConnections.Add(connectionInfo.ConstantID);
FrmMain.Default.SelectedConnection = connectionInfo;
}
catch (Exception ex)
@@ -210,7 +218,7 @@ namespace mRemoteNG.Connection
newProtocol.Closed += ((ConnectionWindow)connectionForm).Prot_Event_Closed;
}
private static void SetConnectionEventHandlers(ProtocolBase newProtocol)
private void SetConnectionEventHandlers(ProtocolBase newProtocol)
{
newProtocol.Disconnected += Prot_Event_Disconnected;
newProtocol.Connected += Prot_Event_Connected;
@@ -251,7 +259,7 @@ namespace mRemoteNG.Connection
}
}
private static void Prot_Event_Closed(object sender)
private void Prot_Event_Closed(object sender)
{
try
{
@@ -267,6 +275,8 @@ namespace mRemoteNG.Connection
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strConnenctionClosedByUser, connDetail, prot.InterfaceControl.Info.Protocol, Environment.UserName));
prot.InterfaceControl.Info.OpenConnections.Remove(prot);
if (_activeConnections.Contains(prot.InterfaceControl.Info.ConstantID))
_activeConnections.Remove(prot.InterfaceControl.Info.ConstantID);
if (prot.InterfaceControl.Info.PostExtApp == "") return;
var extA = Runtime.ExternalToolsService.GetExtAppByName(prot.InterfaceControl.Info.PostExtApp);

View File

@@ -4,9 +4,12 @@ using System.Threading;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Config;
using mRemoteNG.Config.Connections;
using mRemoteNG.Config.Connections.Multiuser;
using mRemoteNG.Config.DataProviders;
using mRemoteNG.Config.Putty;
using mRemoteNG.Config.Serializers.MsSql;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Messages;
using mRemoteNG.Security;
@@ -17,10 +20,12 @@ using mRemoteNG.UI;
namespace mRemoteNG.Connection
{
public class ConnectionsService
public class ConnectionsService
{
private static readonly object SaveLock = new object();
private readonly PuttySessionsManager _puttySessionsManager;
private readonly IDataProvider<string> _localConnectionPropertiesDataProvider;
private readonly LocalConnectionPropertiesXmlSerializer _localConnectionPropertiesSerializer;
private bool _batchingSaves = false;
private bool _saveRequested = false;
private bool _saveAsyncRequested = false;
@@ -39,12 +44,16 @@ namespace mRemoteNG.Connection
throw new ArgumentNullException(nameof(puttySessionsManager));
_puttySessionsManager = puttySessionsManager;
var path = SettingsFileInfo.SettingsPath;
_localConnectionPropertiesDataProvider = new FileDataProvider(Path.Combine(path, "LocalConnectionProperties.xml"));
_localConnectionPropertiesSerializer = new LocalConnectionPropertiesXmlSerializer();
}
public void NewConnectionsFile(string filename)
{
try
{
filename.ThrowIfNullOrEmpty(nameof(filename));
var newConnectionsModel = new ConnectionTreeModel();
newConnectionsModel.AddRootNode(new RootNodeInfo(RootNodeType.Connection));
SaveConnections(newConnectionsModel, false, new SaveFilter(), filename, true);
@@ -105,9 +114,14 @@ namespace mRemoteNG.Connection
var oldConnectionTreeModel = ConnectionTreeModel;
var oldIsUsingDatabaseValue = UsingDatabase;
var newConnectionTreeModel = useDatabase
? new SqlConnectionsLoader().Load()
: new XmlConnectionsLoader(connectionFileName).Load();
var connectionLoader = useDatabase
? (IConnectionsLoader)new SqlConnectionsLoader(_localConnectionPropertiesSerializer, _localConnectionPropertiesDataProvider)
: new XmlConnectionsLoader(connectionFileName);
var newConnectionTreeModel = connectionLoader.Load();
if (useDatabase)
LastSqlUpdate = DateTime.Now;
if (newConnectionTreeModel == null)
{
@@ -128,13 +142,25 @@ namespace mRemoteNG.Connection
ConnectionTreeModel = newConnectionTreeModel;
UpdateCustomConsPathSetting(connectionFileName);
RaiseConnectionsLoadedEvent(oldConnectionTreeModel, newConnectionTreeModel, oldIsUsingDatabaseValue, useDatabase, connectionFileName);
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, $"Connections loaded using {connectionLoader.GetType().Name}");
}
/// <summary>
/// When turned on, calls to <see cref="SaveConnections()"/> or
/// <see cref="SaveConnectionsAsync"/> will not immediately execute.
/// Instead, they will be deferred until <see cref="EndBatchingSaves"/>
/// is called.
/// </summary>
public void BeginBatchingSaves()
{
_batchingSaves = true;
}
/// <summary>
/// Immediately executes a single <see cref="SaveConnections()"/> or
/// <see cref="SaveConnectionsAsync"/> if one has been requested
/// since calling <see cref="BeginBatchingSaves"/>.
/// </summary>
public void EndBatchingSaves()
{
_batchingSaves = false;
@@ -145,6 +171,19 @@ namespace mRemoteNG.Connection
SaveConnections();
}
/// <summary>
/// All calls to <see cref="SaveConnections()"/> or <see cref="SaveConnectionsAsync"/>
/// will be deferred until the returned <see cref="DisposableAction"/> is disposed.
/// Once disposed, this will immediately executes a single <see cref="SaveConnections()"/>
/// or <see cref="SaveConnectionsAsync"/> if one has been requested.
/// Place this call in a 'using' block to represent a batched saving context.
/// </summary>
/// <returns></returns>
public DisposableAction BatchedSavingContext()
{
return new DisposableAction(BeginBatchingSaves, EndBatchingSaves);
}
/// <summary>
/// Saves the currently loaded <see cref="ConnectionTreeModel"/> with
/// no <see cref="SaveFilter"/>.
@@ -163,7 +202,17 @@ namespace mRemoteNG.Connection
/// <param name="saveFilter"></param>
/// <param name="connectionFileName"></param>
/// <param name="forceSave">Bypasses safety checks that prevent saving if a connection file isn't loaded.</param>
public void SaveConnections(ConnectionTreeModel connectionTreeModel, bool useDatabase, SaveFilter saveFilter, string connectionFileName, bool forceSave = false)
/// <param name="propertyNameTrigger">
/// Optional. The name of the property that triggered
/// this save.
/// </param>
public void SaveConnections(
ConnectionTreeModel connectionTreeModel,
bool useDatabase,
SaveFilter saveFilter,
string connectionFileName,
bool forceSave = false,
string propertyNameTrigger = "")
{
if (connectionTreeModel == null)
return;
@@ -183,10 +232,13 @@ namespace mRemoteNG.Connection
RemoteConnectionsSyncronizer?.Disable();
var previouslyUsingDatabase = UsingDatabase;
if (useDatabase)
new SqlConnectionsSaver(saveFilter).Save(connectionTreeModel);
else
new XmlConnectionsSaver(connectionFileName, saveFilter).Save(connectionTreeModel);
var saver = useDatabase
? (ISaver<ConnectionTreeModel>)new SqlConnectionsSaver(saveFilter, _localConnectionPropertiesSerializer,
_localConnectionPropertiesDataProvider)
: new XmlConnectionsSaver(connectionFileName, saveFilter);
saver.Save(connectionTreeModel, propertyNameTrigger);
if (UsingDatabase)
LastSqlUpdate = DateTime.Now;
@@ -206,7 +258,14 @@ namespace mRemoteNG.Connection
}
}
public void SaveConnectionsAsync()
/// <summary>
/// Save the currently loaded connections asynchronously
/// </summary>
/// <param name="propertyNameTrigger">
/// Optional. The name of the property that triggered
/// this save.
/// </param>
public void SaveConnectionsAsync(string propertyNameTrigger = "")
{
if (_batchingSaves)
{
@@ -214,18 +273,22 @@ namespace mRemoteNG.Connection
return;
}
var t = new Thread(SaveConnectionsBGd);
var t = new Thread(() =>
{
lock (SaveLock)
{
SaveConnections(
ConnectionTreeModel,
UsingDatabase,
new SaveFilter(),
ConnectionFileName,
propertyNameTrigger: propertyNameTrigger);
}
});
t.SetApartmentState(ApartmentState.STA);
t.Start();
}
private void SaveConnectionsBGd()
{
Monitor.Enter(SaveLock);
SaveConnections();
Monitor.Exit(SaveLock);
}
public string GetStartupConnectionFileName()
{
return Settings.Default.LoadConsFromCustomLocation == false

View File

@@ -31,9 +31,14 @@ namespace mRemoteNG.Connection
throw new SettingsPropertyNotFoundException($"No property with name '{expectedPropertyName}' found.");
var valueFromSource = propertyFromSource.GetValue(sourceInstance, null);
var value = Convert.ChangeType(valueFromSource, property.PropertyType);
if (property.PropertyType.IsEnum)
{
property.SetValue(Instance, Enum.Parse(property.PropertyType, valueFromSource.ToString()), null);
continue;
}
property.SetValue(Instance, value, null);
property.SetValue(Instance, Convert.ChangeType(valueFromSource, property.PropertyType), null);
}
catch (Exception ex)
{

View File

@@ -1,9 +1,12 @@
using mRemoteNG.Container;
using System.Collections.Generic;
namespace mRemoteNG.Connection
{
public interface IConnectionInitiator
{
IEnumerable<string> ActiveConnections { get; }
void OpenConnection(ConnectionInfo connectionInfo);
void OpenConnection(ContainerInfo containerInfo, ConnectionInfo.Force force = ConnectionInfo.Force.None);

View File

@@ -13,7 +13,7 @@ using mRemoteNG.Tools.Cmdline;
namespace mRemoteNG.Connection.Protocol
{
public class PuttyBase : ProtocolBase
{
{
private const int IDM_RECONF = 0x50; // PuTTY Settings Menu ID
private bool _isPuttyNg;
@@ -42,7 +42,7 @@ namespace mRemoteNG.Connection.Protocol
Event_Closed(this);
}
#endregion
#region Public Methods
public override bool Connect()
{
@@ -62,11 +62,11 @@ namespace mRemoteNG.Connection.Protocol
var arguments = new CommandLineArguments {EscapeForShell = false};
arguments.Add("-load", InterfaceControl.Info.PuttySession);
if (!(InterfaceControl.Info is PuttySessionInfo))
{
arguments.Add("-" + PuttyProtocol);
if (PuttyProtocol == Putty_Protocol.ssh)
{
var username = "";
@@ -89,7 +89,7 @@ namespace mRemoteNG.Connection.Protocol
break;
}
}
if (!string.IsNullOrEmpty(InterfaceControl.Info?.Password))
{
password = InterfaceControl.Info.Password;
@@ -102,9 +102,9 @@ namespace mRemoteNG.Connection.Protocol
password = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey);
}
}
arguments.Add("-" + (int)PuttySSHVersion);
if (((int)Force & (int)ConnectionInfo.Force.NoCredentials) != (int)ConnectionInfo.Force.NoCredentials)
{
if (!string.IsNullOrEmpty(username))
@@ -117,24 +117,24 @@ namespace mRemoteNG.Connection.Protocol
}
}
}
arguments.Add("-P", InterfaceControl.Info.Port.ToString());
arguments.Add(InterfaceControl.Info.Hostname);
}
if (_isPuttyNg)
{
arguments.Add("-hwndparent", InterfaceControl.Handle.ToString());
}
PuttyProcess.StartInfo.Arguments = arguments.ToString();
PuttyProcess.EnableRaisingEvents = true;
PuttyProcess.Exited += ProcessExited;
PuttyProcess.Start();
PuttyProcess.WaitForInputIdle(Settings.Default.MaxPuttyWaitTime * 1000);
var startTicks = Environment.TickCount;
while (PuttyHandle.ToInt32() == 0 & Environment.TickCount < startTicks + Settings.Default.MaxPuttyWaitTime * 1000)
{
@@ -153,17 +153,17 @@ namespace mRemoteNG.Connection.Protocol
Thread.Sleep(0);
}
}
if (!_isPuttyNg)
{
NativeMethods.SetParent(PuttyHandle, InterfaceControl.Handle);
}
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strPuttyStuff, true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strPuttyHandle, PuttyHandle), true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strPuttyTitle, PuttyProcess.MainWindowTitle), true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strPuttyParentHandle, InterfaceControl.Parent.Handle), true);
Resize(this, new EventArgs());
base.Connect();
return true;
@@ -174,7 +174,7 @@ namespace mRemoteNG.Connection.Protocol
return false;
}
}
public override void Focus()
{
try
@@ -190,7 +190,7 @@ namespace mRemoteNG.Connection.Protocol
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyFocusFailed + Environment.NewLine + ex.Message, true);
}
}
public override void Resize(object sender, EventArgs e)
{
try
@@ -199,14 +199,29 @@ namespace mRemoteNG.Connection.Protocol
{
return;
}
NativeMethods.MoveWindow(PuttyHandle, -SystemInformation.FrameBorderSize.Width, -(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height), InterfaceControl.Width + SystemInformation.FrameBorderSize.Width * 2, InterfaceControl.Height + SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height * 2, true);
}
if (_isPuttyNg)
{
// PuTTYNG 0.70.0.1 and later doesn't have any window borders
NativeMethods.MoveWindow(PuttyHandle, 0, 0, InterfaceControl.Width, InterfaceControl.Height, true);
}
else
{
var left = -(SystemInformation.FrameBorderSize.Width + SystemInformation.HorizontalResizeBorderThickness);
var top = -(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height + SystemInformation.VerticalResizeBorderThickness);
var width = InterfaceControl.Width + (SystemInformation.FrameBorderSize.Width + SystemInformation.HorizontalResizeBorderThickness) * 2;
var height = InterfaceControl.Height + SystemInformation.CaptionHeight + (SystemInformation.FrameBorderSize.Height +
SystemInformation.VerticalResizeBorderThickness) * 2;
NativeMethods.MoveWindow(PuttyHandle, left, top, width, height, true);
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyResizeFailed + Environment.NewLine + ex.Message, true);
}
}
public override void Close()
{
try
@@ -220,7 +235,7 @@ namespace mRemoteNG.Connection.Protocol
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyKillFailed + Environment.NewLine + ex.Message, true);
}
try
{
PuttyProcess.Dispose();
@@ -229,10 +244,10 @@ namespace mRemoteNG.Connection.Protocol
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyDisposeFailed + Environment.NewLine + ex.Message, true);
}
base.Close();
}
public void ShowSettingsDialog()
{
try
@@ -246,7 +261,7 @@ namespace mRemoteNG.Connection.Protocol
}
}
#endregion
#region Enums
protected enum Putty_Protocol

View File

@@ -316,10 +316,19 @@ namespace mRemoteNG.Connection.Protocol.RDP
return;
}
var size = !Fullscreen ? Control.Size : Screen.FromControl(Control).Bounds.Size;
try
{
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, $"Resizing RDP connection to host '{_connectionInfo.Hostname}'");
var size = !Fullscreen ? Control.Size : Screen.FromControl(Control).Bounds.Size;
IMsRdpClient8 msRdpClient8 = _rdpClient;
msRdpClient8.Reconnect((uint)size.Width, (uint)size.Height);
IMsRdpClient8 msRdpClient8 = _rdpClient;
msRdpClient8.Reconnect((uint)size.Width, (uint)size.Height);
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(string.Format(Language.ChangeConnectionResolutionError, _connectionInfo.Hostname),
ex, MessageClass.WarningMsg, false);
}
}
private void SetRdGateway()
@@ -916,17 +925,25 @@ namespace mRemoteNG.Connection.Protocol.RDP
#region Reconnect Stuff
public void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
var srvReady = PortScanner.IsPortOpen(_connectionInfo.Hostname, Convert.ToString(_connectionInfo.Port));
try
{
var srvReady = PortScanner.IsPortOpen(_connectionInfo.Hostname, Convert.ToString(_connectionInfo.Port));
ReconnectGroup.ServerReady = srvReady;
ReconnectGroup.ServerReady = srvReady;
if (ReconnectGroup.ReconnectWhenReady && srvReady)
{
tmrReconnect.Enabled = false;
ReconnectGroup.DisposeReconnectGroup();
//SetProps()
_rdpClient.Connect();
}
if (ReconnectGroup.ReconnectWhenReady && srvReady)
{
tmrReconnect.Enabled = false;
ReconnectGroup.DisposeReconnectGroup();
//SetProps()
_rdpClient.Connect();
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(string.Format(Language.AutomaticReconnectError, _connectionInfo.Hostname),
ex, MessageClass.WarningMsg, false);
}
}
#endregion
}

View File

@@ -12,13 +12,19 @@ namespace mRemoteNG.Container
[DefaultProperty("Name")]
public class ContainerInfo : ConnectionInfo, INotifyCollectionChanged
{
[Browsable(false)]
private bool _isExpanded;
[Browsable(false)]
public List<ConnectionInfo> Children { get; } = new List<ConnectionInfo>();
[Category(""), Browsable(false), ReadOnly(false), Bindable(false), DefaultValue(""), DesignOnly(false)]
public bool IsExpanded { get; set; }
[Category(""), Browsable(false), ReadOnly(false), Bindable(false), DefaultValue(""), DesignOnly(false)]
public bool IsExpanded
{
get => _isExpanded;
set => SetField(ref _isExpanded, value, "IsExpanded");
}
[Browsable(false)]
[Browsable(false)]
public override bool IsContainer { get { return true; } set {} }
public ContainerInfo(string uniqueId)

View File

@@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("Multi-protocol remote connections manager")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("mRemoteNG")]
[assembly: AssemblyCopyright("Copyright © 2018 mRemoteNG Dev Team; 2010-2013 Riley McArdle; 2007-2009 Felix Deimel")]
[assembly: AssemblyCopyright("Copyright © 2019 mRemoteNG Dev Team; 2010-2013 Riley McArdle; 2007-2009 Felix Deimel")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// <Assembly: AssemblyVersion("1.0.*")>
[assembly: AssemblyVersion("1.76.5.*")]
[assembly: AssemblyVersion("1.76.20.*")]
[assembly: NeutralResourcesLanguage("en")]

View File

@@ -12,7 +12,7 @@ namespace mRemoteNG {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -2722,5 +2722,17 @@ namespace mRemoteNG {
this["StartUpPanelName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool OverrideFIPSCheck {
get {
return ((bool)(this["OverrideFIPSCheck"]));
}
set {
this["OverrideFIPSCheck"] = value;
}
}
}
}

View File

@@ -677,5 +677,8 @@
<Setting Name="StartUpPanelName" Type="System.String" Scope="User">
<Value Profile="(Default)">General</Value>
</Setting>
<Setting Name="OverrideFIPSCheck" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@@ -60,6 +60,24 @@ namespace mRemoteNG {
}
}
/// <summary>
/// Looks up a localized string similar to An error occurred while trying to reconnect to RDP host &apos;{0}&apos;.
/// </summary>
internal static string AutomaticReconnectError {
get {
return ResourceManager.GetString("AutomaticReconnectError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An error occurred while trying to change the connection resolution to host &apos;{0}&apos;.
/// </summary>
internal static string ChangeConnectionResolutionError {
get {
return ResourceManager.GetString("ChangeConnectionResolutionError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create a New Connection File.
/// </summary>
@@ -1982,11 +2000,11 @@ namespace mRemoteNG {
}
/// <summary>
/// Looks up a localized string similar to The Windows security setting, &quot;System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing&quot;, is enabled. This setting is not compatible with {0}.
/// Looks up a localized string similar to The Windows security setting, &quot;System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing&quot;, is enabled.
///
///See the Microsoft Support article at http://support.microsoft.com/kb/811833 for more information.
///
///{0} will now close..
///{0} is not fully FIPS compliant. Click OK to proceed at your own discretion, or Cancel to Exit..
/// </summary>
internal static string strErrorFipsPolicyIncompatible {
get {

View File

@@ -59,7 +59,7 @@
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
@@ -105,17 +105,17 @@
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="strAbout" xml:space="preserve">
<value>Acerca de</value>
@@ -1224,7 +1224,7 @@ Ver el articulo de soporte de Microsoft en http://support.microsoft.com/kb/81183
<value>Introduzca su dominio.</value>
</data>
<data name="strPropertyDescriptionEnableDesktopComposition" xml:space="preserve">
<value>Seleccione si emplear composición de escrotorio o no.</value>
<value>Seleccione si emplear composición de escritorio o no.</value>
</data>
<data name="strPropertyDescriptionEnableFontSmoothing" xml:space="preserve">
<value>Seleccione si emplear suavizado de fuentes o no.</value>
@@ -2069,4 +2069,4 @@ mRemoteNG ahora se cerrará y comenzará la instalación.</value>
<data name="strYes" xml:space="preserve">
<value>Sí</value>
</data>
</root>
</root>

View File

@@ -655,11 +655,11 @@ Starting with new connections file.</value>
<value>Encryption failed. {0}</value>
</data>
<data name="strErrorFipsPolicyIncompatible" xml:space="preserve">
<value>The Windows security setting, "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing", is enabled. This setting is not compatible with {0}.
<value>The Windows security setting, "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing", is enabled.
See the Microsoft Support article at http://support.microsoft.com/kb/811833 for more information.
{0} will now close.</value>
{0} is not fully FIPS compliant. Click OK to proceed at your own discretion, or Cancel to Exit.</value>
</data>
<data name="strErrors" xml:space="preserve">
<value>Errors</value>
@@ -2694,4 +2694,10 @@ This page will walk you through the process of upgrading your connections file o
<data name="strUltraVNCSingleClick" xml:space="preserve">
<value>UltraVNC SingleClick</value>
</data>
<data name="AutomaticReconnectError" xml:space="preserve">
<value>An error occurred while trying to reconnect to RDP host '{0}'</value>
</data>
<data name="ChangeConnectionResolutionError" xml:space="preserve">
<value>An error occurred while trying to change the connection resolution to host '{0}'</value>
</data>
</root>

Binary file not shown.

View File

@@ -0,0 +1,45 @@
using System;
namespace mRemoteNG.Tools
{
/// <summary>
/// Represents an action that will be executed when the <see cref="Dispose"/>
/// method is called. Useful for creating Using blocks around logical start/end
/// actions.
/// </summary>
public class DisposableAction : IDisposable
{
private bool _isDisposed;
private readonly Action _disposeAction;
/// <summary>
///
/// </summary>
/// <param name="initializeAction">
/// An <see cref="Action"/> that should be performed immediately
/// when this object is initialized. It should return quickly.
/// </param>
/// <param name="disposeAction">
/// An <see cref="Action"/> to be executed when this object is disposed.
/// </param>
public DisposableAction(Action initializeAction, Action disposeAction)
{
initializeAction();
_disposeAction = disposeAction;
}
public void Dispose()
{
Dispose(true);
}
protected virtual void Dispose(bool disposing)
{
if (!disposing || _isDisposed)
return;
_isDisposed = true;
_disposeAction();
}
}
}

View File

@@ -1,9 +1,11 @@

using System;
using System.Collections.Generic;
using System.Linq;
namespace mRemoteNG.Tools
{
public static class Extensions
public static class Extensions
{
public static Optional<T> Maybe<T>(this T value)
{
@@ -50,5 +52,23 @@ namespace mRemoteNG.Tools
throw new ArgumentException("Value cannot be null or empty", argName);
return value;
}
/// <summary>
/// Perform an action for each item in the given collection. The item
/// is the pass along the processing chain.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="collection"></param>
/// <param name="action"></param>
/// <returns></returns>
public static IEnumerable<T> ForEach<T>(this IEnumerable<T> collection, Action<T> action)
{
collection = collection.ToList();
foreach (var item in collection)
action(item);
return collection;
}
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.AccessControl;
using Microsoft.Win32;
using mRemoteNG.App;
@@ -38,14 +39,16 @@ namespace mRemoteNG.Tools
{
using (var key = Registry.CurrentUser.OpenSubKey(string.Concat("Software\\Wow6432Node\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\", feature), RegistryKeyPermissionCheck.ReadWriteSubTree))
{
key?.DeleteValue(appName);
if (key?.GetValueNames().Contains(appName) ?? false)
key.DeleteValue(appName);
}
}
using (var key = Registry.CurrentUser.CreateSubKey(string.Concat("Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\", feature), RegistryKeyPermissionCheck.ReadWriteSubTree))
{
key?.DeleteValue(appName);
if (key?.GetValueNames().Contains(appName) ?? false)
key.DeleteValue(appName);
}
}
#endif

View File

@@ -1,8 +1,8 @@
using System;
using System.Linq;
using mRemoteNG.Connection;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.UI.Controls;
using System;
using System.Linq;
namespace mRemoteNG.Tree
@@ -21,7 +21,12 @@ namespace mRemoteNG.Tree
public void Execute(IConnectionTree connectionTree)
{
var connectionInfoList = connectionTree.GetRootConnectionNode().GetRecursiveChildList().Where(node => !(node is ContainerInfo));
var previouslyOpenedConnections = connectionInfoList.Where(item => item.PleaseConnect);
var previouslyOpenedConnections = connectionInfoList
.Where(item =>
item.PleaseConnect &&
// ignore items that have already connected
!_connectionInitiator.ActiveConnections.Contains(item.ConstantID));
foreach (var connectionInfo in previouslyOpenedConnections)
{
_connectionInitiator.OpenConnection(connectionInfo);

View File

@@ -23,10 +23,12 @@ namespace mRemoteNG.UI.Controls.Base
{
base.OnCreateControl();
_themeManager = ThemeManager.getInstance();
if (_themeManager.ThemingActive)
{
Invalidate();
}
if (!_themeManager.ThemingActive) return;
// Use the Dialog_* colors since Labels generally have the same colors as panels/dialogs/windows/etc...
BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
FontOverrider.FontOverride(this);
Invalidate();
}
@@ -38,8 +40,9 @@ namespace mRemoteNG.UI.Controls.Base
return;
}
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
// let's use the defaults - this looks terrible in my testing....
//e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
//e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
if (Enabled)
{
TextRenderer.DrawText(e.Graphics, Text, Font, ClientRectangle, ForeColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter);

View File

@@ -1,16 +1,16 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using BrightIdeasSoftware;
using BrightIdeasSoftware;
using mRemoteNG.App;
using mRemoteNG.Config.Putty;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.UI.Controls
@@ -43,8 +43,12 @@ namespace mRemoteNG.UI.Controls
get { return _connectionTreeModel; }
set
{
if (_connectionTreeModel == value)
return;
UnregisterModelUpdateHandlers(_connectionTreeModel);
_connectionTreeModel = value;
PopulateTreeView();
PopulateTreeView(value);
}
}
@@ -156,28 +160,31 @@ namespace mRemoteNG.UI.Controls
padding;
}
private void PopulateTreeView()
private void PopulateTreeView(ConnectionTreeModel newModel)
{
UnregisterModelUpdateHandlers();
SetObjects(ConnectionTreeModel.RootNodes);
RegisterModelUpdateHandlers();
NodeSearcher = new NodeSearcher(ConnectionTreeModel);
SetObjects(newModel.RootNodes);
RegisterModelUpdateHandlers(newModel);
NodeSearcher = new NodeSearcher(newModel);
ExecutePostSetupActions();
AutoResizeColumn(Columns[0]);
}
private void RegisterModelUpdateHandlers()
private void RegisterModelUpdateHandlers(ConnectionTreeModel newModel)
{
_puttySessionsManager.PuttySessionsCollectionChanged += OnPuttySessionsCollectionChanged;
ConnectionTreeModel.CollectionChanged += HandleCollectionChanged;
ConnectionTreeModel.PropertyChanged += HandleCollectionPropertyChanged;
newModel.CollectionChanged += HandleCollectionChanged;
newModel.PropertyChanged += HandleCollectionPropertyChanged;
}
private void UnregisterModelUpdateHandlers()
private void UnregisterModelUpdateHandlers(ConnectionTreeModel oldConnectionTreeModel)
{
_puttySessionsManager.PuttySessionsCollectionChanged -= OnPuttySessionsCollectionChanged;
ConnectionTreeModel.CollectionChanged -= HandleCollectionChanged;
ConnectionTreeModel.PropertyChanged -= HandleCollectionPropertyChanged;
if (oldConnectionTreeModel == null)
return;
oldConnectionTreeModel.CollectionChanged -= HandleCollectionChanged;
oldConnectionTreeModel.PropertyChanged -= HandleCollectionPropertyChanged;
}
private void OnPuttySessionsCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
@@ -220,14 +227,19 @@ namespace mRemoteNG.UI.Controls
return (RootNodeInfo)ConnectionTreeModel.RootNodes.First(item => item is RootNodeInfo);
}
public void Invoke(Action action)
{
Invoke((Delegate)action);
}
public void InvokeExpand(object model)
{
Invoke((MethodInvoker)(() => Expand(model)));
Invoke(() => Expand(model));
}
public void InvokeRebuildAll(bool preserveState)
{
Invoke((MethodInvoker)(() => RebuildAll(preserveState)));
Invoke(() => RebuildAll(preserveState));
}
public IEnumerable<RootPuttySessionsNodeInfo> GetRootPuttyNodes()

View File

@@ -1,5 +1,6 @@
using System.ComponentModel;
using System.Windows.Forms;
using mRemoteNG.Themes;
using mRemoteNG.Tools;
namespace mRemoteNG.UI.Controls
@@ -10,12 +11,16 @@ namespace mRemoteNG.UI.Controls
private ToolStripLabel _lblMultiSsh;
private ToolStripTextBox _txtMultiSsh;
private MultiSSHController _multiSshController;
private ThemeManager _themeManager;
public MultiSshToolStrip()
public MultiSshToolStrip()
{
InitializeComponent();
_multiSshController = new MultiSSHController(_txtMultiSsh);
_themeManager = ThemeManager.getInstance();
_themeManager.ThemeChanged += ApplyTheme;
ApplyTheme();
_multiSshController = new MultiSSHController(_txtMultiSsh);
}
private void InitializeComponent()
@@ -43,7 +48,14 @@ namespace mRemoteNG.UI.Controls
ResumeLayout(true);
}
protected override void Dispose(bool disposing)
private void ApplyTheme()
{
if (!_themeManager.ThemingActive) return;
_txtMultiSsh.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
_txtMultiSsh.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{

View File

@@ -79,7 +79,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
Runtime.ConnectionsService.RemoteConnectionsSyncronizer?.Dispose();
Runtime.ConnectionsService.RemoteConnectionsSyncronizer = new RemoteConnectionsSyncronizer(new SqlConnectionsUpdateChecker());
Runtime.ConnectionsService.RemoteConnectionsSyncronizer.Enable();
Runtime.ConnectionsService.LoadConnections(true, false, "");
}
private void DisableSql()

View File

@@ -11,15 +11,34 @@ namespace mRemoteNG.UI.Forms
private readonly string _passwordName;
private SecureString _password = new SecureString();
private bool Verify { get; }
/// <summary>
/// Puts the dialog into the New Password mode. An extra
/// password box is shown which must match the first password
/// to continue.
/// </summary>
private bool NewPasswordMode { get; }
public PasswordForm(string passwordName = null, bool verify = true)
/// <summary>
/// Creates a new password form for entering or setting a password.
/// </summary>
/// <param name="passwordName"></param>
/// <param name="newPasswordMode">
/// Puts the dialog into the New Password mode. An extra
/// password box is shown which must match the first password
/// to continue.
/// </param>
public PasswordForm(string passwordName = null, bool newPasswordMode = true)
{
InitializeComponent();
_passwordName = passwordName;
Verify = verify;
NewPasswordMode = newPasswordMode;
}
/// <summary>
/// Dispaly a dialog box requesting that the user
/// enter their password.
/// </summary>
/// <returns></returns>
public Optional<SecureString> GetKey()
{
var dialog = ShowDialog();
@@ -33,7 +52,7 @@ namespace mRemoteNG.UI.Forms
{
ApplyLanguage();
if (Verify) return;
if (NewPasswordMode) return;
Height = Height - (txtVerify.Top - txtPassword.Top);
lblVerify.Visible = false;
txtVerify.Visible = false;
@@ -44,7 +63,7 @@ namespace mRemoteNG.UI.Forms
_password = txtPassword.Text.ConvertToSecureString();
txtPassword.Text = "";
txtVerify.Text = "";
if (Verify) return;
if (NewPasswordMode) return;
Height = Height + (txtVerify.Top - txtPassword.Top);
}
@@ -56,10 +75,10 @@ namespace mRemoteNG.UI.Forms
private void btnOK_Click(object sender, EventArgs e)
{
if (Verify && VerifyPassword())
DialogResult = DialogResult.OK;
else
DialogResult = DialogResult.None;
if (NewPasswordMode)
VerifyNewPassword();
DialogResult = DialogResult.OK;
}
private void txtPassword_TextChanged(object sender, EventArgs e)
@@ -79,7 +98,7 @@ namespace mRemoteNG.UI.Forms
btnOK.Text = Language.strButtonOK;
}
private bool VerifyPassword()
private bool VerifyNewPassword()
{
if (txtPassword.Text.Length >= 3)
{

View File

@@ -63,7 +63,7 @@ namespace mRemoteNG.UI.Forms
//Theming support
_themeManager = ThemeManager.getInstance();
vsToolStripExtender.DefaultRenderer = _toolStripProfessionalRenderer;
SetSchema();
ApplyTheme();
_screenSystemMenu = new ScreenSelectionSystemMenu(this);
}
@@ -140,7 +140,7 @@ namespace mRemoteNG.UI.Forms
Startup.Instance.InitializeProgram(messageCollector);
msMain.Location = Point.Empty;
var settingsLoader = new SettingsLoader(this, messageCollector, _quickConnectToolStrip, _externalToolsToolStrip, _multiSshToolStrip);
var settingsLoader = new SettingsLoader(this, messageCollector, _quickConnectToolStrip, _externalToolsToolStrip, _multiSshToolStrip, msMain);
settingsLoader.LoadSettings();
SetMenuDependencies();
@@ -184,7 +184,10 @@ namespace mRemoteNG.UI.Forms
var panelName = !string.IsNullOrEmpty(Settings.Default.StartUpPanelName)
? Settings.Default.StartUpPanelName
: Language.strNewPanel;
new PanelAdder().AddPanel(panelName);
var panelAdder = new PanelAdder();
if (!panelAdder.DoesPanelExist(panelName))
panelAdder.AddPanel(panelName);
}
}
@@ -247,22 +250,37 @@ namespace mRemoteNG.UI.Forms
}
//Theming support
private void SetSchema()
{
if (!_themeManager.ThemingActive) return;
// Persist settings when rebuilding UI
pnlDock.Theme = _themeManager.ActiveTheme.Theme;
ApplyTheme();
}
private void ApplyTheme()
{
if (!_themeManager.ThemingActive) return;
vsToolStripExtender.SetStyle(msMain, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
vsToolStripExtender.SetStyle(_quickConnectToolStrip, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
vsToolStripExtender.SetStyle(_externalToolsToolStrip, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
vsToolStripExtender.SetStyle(_multiSshToolStrip, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
tsContainer.TopToolStripPanel.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("CommandBarMenuDefault_Background");
}
try
{
// this will always throw when turning themes on from
// the options menu.
pnlDock.Theme = _themeManager.ActiveTheme.Theme;
}
catch (Exception)
{
// intentionally ignore exception
}
// Persist settings when rebuilding UI
try
{
vsToolStripExtender.SetStyle(msMain, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
vsToolStripExtender.SetStyle(_quickConnectToolStrip, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
vsToolStripExtender.SetStyle(_externalToolsToolStrip, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
vsToolStripExtender.SetStyle(_multiSshToolStrip, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
tsContainer.TopToolStripPanel.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("CommandBarMenuDefault_Background");
BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace("Error applying theme", ex, MessageClass.WarningMsg);
}
}
private void frmMain_Shown(object sender, EventArgs e)
{
@@ -411,7 +429,8 @@ namespace mRemoteNG.UI.Forms
// Only handle this msg if it was triggered by a click
if (NativeMethods.LOWORD(m.WParam) == NativeMethods.WA_CLICKACTIVE)
{
var controlThatWasClicked = FromChildHandle(NativeMethods.WindowFromPoint(MousePosition));
var controlThatWasClicked = FromChildHandle(NativeMethods.WindowFromPoint(MousePosition))
?? GetChildAtPoint(MousePosition);
if (controlThatWasClicked != null)
{
if (controlThatWasClicked is TreeView ||
@@ -426,9 +445,14 @@ namespace mRemoteNG.UI.Forms
controlThatWasClicked is Crownwood.Magic.Controls.TabControl ||
controlThatWasClicked is Crownwood.Magic.Controls.InertButton)
{
// Simulate a mouse event since one wasn't generated by Windows
SimulateClick(controlThatWasClicked);
controlThatWasClicked.Focus();
// Simulate a mouse event since one wasn't generated by Windows
SimulateClick(controlThatWasClicked);
controlThatWasClicked.Focus();
}
else if (controlThatWasClicked is AutoHideStripBase)
{
// only focus the autohide toolstrip
controlThatWasClicked.Focus();
}
else
{

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Linq;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Messages;
@@ -30,6 +31,12 @@ namespace mRemoteNG.UI.Panels
}
}
public bool DoesPanelExist(string panelName)
{
return Runtime.WindowList?.OfType<ConnectionWindow>().Any(w => w.TabText == panelName)
?? false;
}
private static void ShowConnectionWindow(ConnectionWindow connectionForm)
{
connectionForm.Show(FrmMain.Default.pnlDock, DockState.Document);

View File

@@ -25,24 +25,22 @@ namespace mRemoteNG.UI.Window
internal Controls.Base.NGLabel lblEdition;
internal Controls.Base.NGLabel lblCredits;
internal Controls.Base.NGTextBox txtCredits;
private Controls.Base.NGTextBox verText;
internal Panel pnlTop;
private void InitializeComponent()
{
this.pnlTop = new System.Windows.Forms.Panel();
this.lblEdition = new Controls.Base.NGLabel();
this.lblEdition = new mRemoteNG.UI.Controls.Base.NGLabel();
this.pbLogo = new System.Windows.Forms.PictureBox();
this.pnlBottom = new System.Windows.Forms.Panel();
this.verText = new Controls.Base.NGTextBox();
this.lblCredits = new Controls.Base.NGLabel();
this.txtCredits = new Controls.Base.NGTextBox();
this.txtChangeLog = new Controls.Base.NGTextBox();
this.lblTitle = new Controls.Base.NGLabel();
this.lblVersion = new Controls.Base.NGLabel();
this.lblChangeLog = new Controls.Base.NGLabel();
this.lblLicense = new Controls.Base.NGLabel();
this.lblCopyright = new Controls.Base.NGLabel();
this.lblCredits = new mRemoteNG.UI.Controls.Base.NGLabel();
this.txtCredits = new mRemoteNG.UI.Controls.Base.NGTextBox();
this.txtChangeLog = new mRemoteNG.UI.Controls.Base.NGTextBox();
this.lblTitle = new mRemoteNG.UI.Controls.Base.NGLabel();
this.lblVersion = new mRemoteNG.UI.Controls.Base.NGLabel();
this.lblChangeLog = new mRemoteNG.UI.Controls.Base.NGLabel();
this.lblLicense = new mRemoteNG.UI.Controls.Base.NGLabel();
this.lblCopyright = new mRemoteNG.UI.Controls.Base.NGLabel();
this.pnlTop.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbLogo)).BeginInit();
this.pnlBottom.SuspendLayout();
@@ -91,7 +89,6 @@ namespace mRemoteNG.UI.Window
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlBottom.BackColor = System.Drawing.SystemColors.Control;
this.pnlBottom.Controls.Add(this.verText);
this.pnlBottom.Controls.Add(this.lblCredits);
this.pnlBottom.Controls.Add(this.txtCredits);
this.pnlBottom.Controls.Add(this.txtChangeLog);
@@ -106,18 +103,6 @@ namespace mRemoteNG.UI.Window
this.pnlBottom.Size = new System.Drawing.Size(1121, 559);
this.pnlBottom.TabIndex = 1;
//
// verText
//
this.verText.BackColor = System.Drawing.SystemColors.Control;
this.verText.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.verText.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.verText.Location = new System.Drawing.Point(69, 51);
this.verText.Name = "verText";
this.verText.Size = new System.Drawing.Size(147, 20);
this.verText.TabIndex = 12;
this.verText.TabStop = false;
this.verText.Text = "w.x.y.z";
//
// lblCredits
//
this.lblCredits.AutoSize = true;
@@ -275,14 +260,16 @@ namespace mRemoteNG.UI.Window
private new void ApplyTheme()
{
if (Themes.ThemeManager.getInstance().ThemingActive)
{
base.ApplyTheme();
pnlBottom.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlBottom.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
pnlTop.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlTop.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
}
if (!Themes.ThemeManager.getInstance().ThemingActive) return;
base.ApplyTheme();
BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
pnlBottom.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlBottom.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
pnlTop.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlTop.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
lblEdition.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
lblEdition.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
}
private void ApplyEditions()
@@ -329,8 +316,7 @@ namespace mRemoteNG.UI.Window
{
lblCopyright.Text = GeneralAppInfo.Copyright;
lblVersion.Text = @"Version ";
verText.Text = GeneralAppInfo.ApplicationVersion;
lblVersion.Text = $@"Version {GeneralAppInfo.ApplicationVersion}";
if (File.Exists(GeneralAppInfo.HomePath + "\\CHANGELOG.TXT"))
{

View File

@@ -399,6 +399,8 @@ namespace mRemoteNG.UI.Window
WindowType = WindowType.ComponentsCheck;
DockPnl = new DockContent();
InitializeComponent();
FontOverrider.FontOverride(this);
Themes.ThemeManager.getInstance().ThemeChanged += ApplyTheme;
}
#endregion
@@ -406,6 +408,7 @@ namespace mRemoteNG.UI.Window
private void ComponentsCheck_Load(object sender, EventArgs e)
{
ApplyLanguage();
ApplyTheme();
chkAlwaysShow.Checked = Settings.Default.StartupComponentsCheck;
CheckComponents();
}
@@ -418,6 +421,24 @@ namespace mRemoteNG.UI.Window
btnCheckAgain.Text = Language.strCcCheckAgain;
}
private new void ApplyTheme()
{
if (!Themes.ThemeManager.getInstance().ThemingActive) return;
base.ApplyTheme();
pnlCheck1.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlCheck1.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
pnlCheck2.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlCheck2.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
pnlCheck3.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlCheck3.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
pnlCheck4.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlCheck4.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
pnlCheck5.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlCheck5.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
pnlChecks.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background");
pnlChecks.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground");
}
private void btnCheckAgain_Click(object sender, EventArgs e)
{
CheckComponents();

View File

@@ -706,7 +706,6 @@ namespace mRemoteNG.UI.Window
UpdateRootInfoNode(e);
UpdateInheritanceNode();
ShowHideGridItems();
Runtime.ConnectionsService.SaveConnectionsAsync();
}
catch (Exception ex)
{

View File

@@ -1,9 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Config.Connections;
using mRemoteNG.Connection;
@@ -11,6 +5,12 @@ using mRemoteNG.Themes;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
// ReSharper disable ArrangeAccessorOwnerBody
@@ -18,7 +18,6 @@ namespace mRemoteNG.UI.Window
{
public partial class ConnectionTreeWindow
{
private readonly ConnectionContextMenu _contextMenu;
private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
private ThemeManager _themeManager;
@@ -39,8 +38,6 @@ namespace mRemoteNG.UI.Window
WindowType = WindowType.Tree;
DockPnl = panel;
InitializeComponent();
_contextMenu = new ConnectionContextMenu(olvConnections);
olvConnections.ContextMenuStrip = _contextMenu;
SetMenuEventHandlers();
SetConnectionTreeEventHandlers();
Settings.Default.PropertyChanged += OnAppSettingsChanged;
@@ -53,8 +50,6 @@ namespace mRemoteNG.UI.Window
ConnectionTree.UseFiltering = Settings.Default.UseFilterSearch;
ApplyFiltering();
}
SetConnectionTreeEventHandlers();
}
@@ -92,7 +87,7 @@ namespace mRemoteNG.UI.Window
{
if (!_themeManager.ThemingActive) return;
vsToolStripExtender.SetStyle(msMain, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
vsToolStripExtender.SetStyle(_contextMenu, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
vsToolStripExtender.SetStyle(olvConnections.ContextMenuStrip, _themeManager.ActiveTheme.Version, _themeManager.ActiveTheme.Theme);
//Treelistview need to be manually themed
olvConnections.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TreeView_Background");
olvConnections.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TreeView_Foreground");
@@ -158,6 +153,12 @@ namespace mRemoteNG.UI.Window
private void ConnectionsServiceOnConnectionsLoaded(object o, ConnectionsLoadedEventArgs connectionsLoadedEventArgs)
{
if (olvConnections.InvokeRequired)
{
olvConnections.Invoke(() => ConnectionsServiceOnConnectionsLoaded(o, connectionsLoadedEventArgs));
return;
}
olvConnections.ConnectionTreeModel = connectionsLoadedEventArgs.NewConnectionTreeModel;
olvConnections.SelectedObject = connectionsLoadedEventArgs.NewConnectionTreeModel.RootNodes
.OfType<RootNodeInfo>().FirstOrDefault();

View File

@@ -134,6 +134,19 @@ namespace mRemoteNG.UI.Window
RunElevatedCheckBox.Checked = selectedTool?.RunElevated ?? false;
WaitForExitCheckBox.Enabled = !TryToIntegrateCheckBox.Checked;
}
private void UpdateToolstipControls()
{
_currentlySelectedExternalTools.Clear();
_currentlySelectedExternalTools.AddRange(ToolsListObjView.SelectedObjects.OfType<ExternalTool>());
PropertiesGroupBox.Enabled = _currentlySelectedExternalTools.Count == 1;
var atleastOneToolSelected = _currentlySelectedExternalTools.Count > 0;
DeleteToolMenuItem.Enabled = atleastOneToolSelected;
DeleteToolToolstripButton.Enabled = atleastOneToolSelected;
LaunchToolMenuItem.Enabled = atleastOneToolSelected;
LaunchToolToolstripButton.Enabled = atleastOneToolSelected;
}
#endregion
#region Event Handlers
@@ -193,6 +206,8 @@ namespace mRemoteNG.UI.Window
ToolsListObjView.SelectedIndex = oldSelectedIndex <= maxIndex
? oldSelectedIndex
: maxIndex;
UpdateToolstipControls();
}
catch (Exception ex)
{
@@ -209,15 +224,7 @@ namespace mRemoteNG.UI.Window
{
try
{
_currentlySelectedExternalTools.Clear();
_currentlySelectedExternalTools.AddRange(ToolsListObjView.SelectedObjects.OfType<ExternalTool>());
PropertiesGroupBox.Enabled = _currentlySelectedExternalTools.Count == 1;
var atleastOneToolSelected = _currentlySelectedExternalTools.Count > 0;
DeleteToolMenuItem.Enabled = atleastOneToolSelected;
DeleteToolToolstripButton.Enabled = atleastOneToolSelected;
LaunchToolMenuItem.Enabled = atleastOneToolSelected;
LaunchToolToolstripButton.Enabled = atleastOneToolSelected;
UpdateToolstipControls();
}
catch (Exception ex)
{

View File

@@ -698,6 +698,9 @@
<setting name="StartUpPanelName" serializeAs="String">
<value>General</value>
</setting>
<setting name="OverrideFIPSCheck" serializeAs="String">
<value>False</value>
</setting>
</mRemoteNG.Settings>
</userSettings>
<applicationSettings>

View File

@@ -136,6 +136,7 @@
<Compile Include="Config\Connections\ConnectionsLoadedEventArgs.cs" />
<Compile Include="Config\Connections\ConnectionsSavedEventArgs.cs" />
<Compile Include="Config\Connections\CsvConnectionsSaver.cs" />
<Compile Include="Config\Connections\IConnectionsLoader.cs" />
<Compile Include="Config\Connections\SaveConnectionsOnEdit.cs" />
<Compile Include="Config\Connections\SaveFormat.cs" />
<Compile Include="Config\Connections\Multiuser\ConnectionsUpdateCheckFinishedEventArgs.cs" />
@@ -159,6 +160,9 @@
<Compile Include="Config\ILoader.cs" />
<Compile Include="Config\Import\MRemoteNGCsvImporter.cs" />
<Compile Include="Config\ISaver.cs" />
<Compile Include="Config\Serializers\ConnectionSerializers\MsSql\LocalConnectionPropertiesModel.cs" />
<Compile Include="Config\Serializers\ConnectionSerializers\MsSql\LocalConnectionPropertiesXmlSerializer.cs" />
<Compile Include="Config\Serializers\ConnectionSerializers\MsSql\SqlConnectionListMetaData.cs" />
<Compile Include="Config\Serializers\CredentialProviderSerializer\CredentialRepositoryListDeserializer.cs" />
<Compile Include="Config\CredentialRepositoryListLoader.cs" />
<Compile Include="Config\Serializers\CredentialSerializer\XmlCredentialPasswordDecryptorDecorator.cs" />
@@ -169,14 +173,14 @@
<Compile Include="Config\Serializers\CredentialProviderSerializer\CredentialRepositoryListSerializer.cs" />
<Compile Include="Config\Serializers\ConnectionSerializers\Csv\CsvConnectionsDeserializerMremotengFormat.cs" />
<Compile Include="Config\Serializers\ConnectionSerializers\Csv\CsvConnectionsSerializerMremotengFormat.cs" />
<Compile Include="Config\Serializers\DataTableDeserializer.cs" />
<Compile Include="Config\Serializers\DataTableSerializer.cs" />
<Compile Include="Config\Serializers\ConnectionSerializers\MsSql\DataTableDeserializer.cs" />
<Compile Include="Config\Serializers\ConnectionSerializers\MsSql\DataTableSerializer.cs" />
<Compile Include="Config\Serializers\MiscSerializers\PortScanDeserializer.cs" />
<Compile Include="Config\Serializers\MiscSerializers\PuttyConnectionManagerDeserializer.cs" />
<Compile Include="Config\Serializers\MiscSerializers\RemoteDesktopConnectionDeserializer.cs" />
<Compile Include="Config\Serializers\MiscSerializers\RemoteDesktopConnectionManagerDeserializer.cs" />
<Compile Include="Config\Serializers\ConnectionSerializers\Xml\XmlConnectionNodeSerializer26.cs" />
<Compile Include="Config\Serializers\Versioning\SqlDatabaseVersionRetriever.cs" />
<Compile Include="Config\Serializers\ConnectionSerializers\MsSql\SqlDatabaseMetaDataRetriever.cs" />
<Compile Include="Config\Serializers\Versioning\IVersionUpgrader.cs" />
<Compile Include="Config\Serializers\Versioning\SqlVersion22To23Upgrader.cs" />
<Compile Include="Config\Serializers\Versioning\SqlVersion23To24Upgrader.cs" />
@@ -314,6 +318,7 @@
<Compile Include="Tools\Cmdline\StartupArgumentsInterpreter.cs" />
<Compile Include="Tools\CustomCollections\CollectionUpdatedEventArgs.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Tools\DisposableAction.cs" />
<Compile Include="Tools\Extensions.cs" />
<Compile Include="Tools\ExternalToolArgumentParser.cs" />
<Compile Include="Tools\Cmdline\CmdArgumentsInterpreter.cs" />