mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Merge pull request #2400 from BlueBlock/fix_database_columns_and_some_tests
Fix database columns and some tests
This commit is contained in:
6
mRemoteNG.lutconfig
Normal file
6
mRemoteNG.lutconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
<LUTConfig Version="1.0">
|
||||
<Repository />
|
||||
<ParallelBuilds>true</ParallelBuilds>
|
||||
<ParallelTestRuns>true</ParallelTestRuns>
|
||||
<TestCaseTimeout>180000</TestCaseTimeout>
|
||||
</LUTConfig>
|
||||
@@ -9,6 +9,6 @@ namespace mRemoteNG.App.Info
|
||||
public static readonly string DefaultConnectionsPath = SettingsFileInfo.SettingsPath;
|
||||
public static readonly string DefaultConnectionsFile = "confCons.xml";
|
||||
public static readonly string DefaultConnectionsFileNew = "confConsNew.xml";
|
||||
public static readonly Version ConnectionFileVersion = new Version(3, 0);
|
||||
public static readonly Version ConnectionFileVersion = new Version(2, 8);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace mRemoteNG.App.Info
|
||||
public const string UrlDocumentation = "https://mremoteng.readthedocs.io/en/latest/";
|
||||
public static string ApplicationVersion = Application.ProductVersion;
|
||||
public static readonly string ProductName = Application.ProductName;
|
||||
public static readonly string Copyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute), false)).Copyright;
|
||||
public static readonly string Copyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute), false))?.Copyright;
|
||||
public static readonly string HomePath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
||||
|
||||
//public static string ReportingFilePath = "";
|
||||
|
||||
@@ -15,10 +15,7 @@ namespace mRemoteNG.App.Initialization
|
||||
|
||||
public StartupDataLogger(MessageCollector messageCollector)
|
||||
{
|
||||
if (messageCollector == null)
|
||||
throw new ArgumentNullException(nameof(messageCollector));
|
||||
|
||||
_messageCollector = messageCollector;
|
||||
_messageCollector = messageCollector ?? throw new ArgumentNullException(nameof(messageCollector));
|
||||
}
|
||||
|
||||
public void LogStartupData()
|
||||
@@ -50,7 +47,7 @@ namespace mRemoteNG.App.Initialization
|
||||
.Get())
|
||||
{
|
||||
var managementObject = (ManagementObject)o;
|
||||
osVersion = Convert.ToString(managementObject.GetPropertyValue("Caption")).Trim();
|
||||
osVersion = Convert.ToString(managementObject.GetPropertyValue("Caption"))?.Trim();
|
||||
servicePack = GetOSServicePack(servicePack, managementObject);
|
||||
}
|
||||
}
|
||||
@@ -79,8 +76,7 @@ namespace mRemoteNG.App.Initialization
|
||||
var architecture = string.Empty;
|
||||
try
|
||||
{
|
||||
foreach (var o in new ManagementObjectSearcher("SELECT AddressWidth FROM Win32_Processor WHERE DeviceID=\'CPU0\'")
|
||||
.Get())
|
||||
foreach (var o in new ManagementObjectSearcher("SELECT AddressWidth FROM Win32_Processor WHERE DeviceID=\'CPU0\'").Get())
|
||||
{
|
||||
var managementObject = (ManagementObject)o;
|
||||
var addressWidth = Convert.ToInt32(managementObject.GetPropertyValue("AddressWidth"));
|
||||
@@ -118,8 +114,7 @@ namespace mRemoteNG.App.Initialization
|
||||
|
||||
private void LogCultureData()
|
||||
{
|
||||
var data =
|
||||
$"System Culture: {Thread.CurrentThread.CurrentUICulture.Name}/{Thread.CurrentThread.CurrentUICulture.NativeName}";
|
||||
var data = $"System Culture: {Thread.CurrentThread.CurrentUICulture.Name}/{Thread.CurrentThread.CurrentUICulture.NativeName}";
|
||||
_messageCollector.AddMessage(MessageClass.InformationMsg, data, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ namespace mRemoteNG.Config.Connections.Multiuser
|
||||
{
|
||||
_updateChecker.UpdateCheckStarted += OnUpdateCheckStarted;
|
||||
_updateChecker.UpdateCheckFinished += OnUpdateCheckFinished;
|
||||
_updateChecker.ConnectionsUpdateAvailable +=
|
||||
(sender, args) => ConnectionsUpdateAvailable?.Invoke(sender, args);
|
||||
_updateChecker.ConnectionsUpdateAvailable += (sender, args) => ConnectionsUpdateAvailable?.Invoke(sender, args);
|
||||
_updateTimer.Elapsed += (sender, args) => _updateChecker.IsUpdateAvailableAsync();
|
||||
ConnectionsUpdateAvailable += Load;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
private void ConnectionsServiceOnConnectionsLoaded(object sender, ConnectionsLoadedEventArgs connectionsLoadedEventArgs)
|
||||
{
|
||||
connectionsLoadedEventArgs.NewConnectionTreeModel.CollectionChanged +=
|
||||
ConnectionTreeModelOnCollectionChanged;
|
||||
connectionsLoadedEventArgs.NewConnectionTreeModel.CollectionChanged += ConnectionTreeModelOnCollectionChanged;
|
||||
connectionsLoadedEventArgs.NewConnectionTreeModel.PropertyChanged += ConnectionTreeModelOnPropertyChanged;
|
||||
|
||||
foreach (var oldTree in connectionsLoadedEventArgs.PreviousConnectionTreeModel)
|
||||
|
||||
@@ -146,6 +146,10 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Sql
|
||||
|
||||
if (databaseConnector.GetType() == typeof(MSSqlDatabaseConnector))
|
||||
{
|
||||
// *********************************
|
||||
// ********* MICROSOFT SQL *********
|
||||
// *********************************
|
||||
|
||||
sql = @"
|
||||
if exists (select * from dbo.sysobjects
|
||||
where id = object_id(N'[dbo].[tblCons]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
|
||||
@@ -322,6 +326,7 @@ CREATE TABLE [dbo].[tblCons] (
|
||||
[EC2InstanceId] varchar(32) NULL,
|
||||
[ExternalCredentialProvider] varchar(256) NULL,
|
||||
[ExternalAddressProvider] varchar(256) NULL,
|
||||
[UserViaAPI] varchar(512) NOT NULL,
|
||||
) ON [PRIMARY]
|
||||
|
||||
CREATE TABLE [dbo].[tblRoot] (
|
||||
@@ -338,6 +343,10 @@ CREATE TABLE [dbo].[tblUpdate] (
|
||||
}
|
||||
else if (databaseConnector.GetType() == typeof(MySqlDatabaseConnector))
|
||||
{
|
||||
// **************************
|
||||
// ********* MY SQL *********
|
||||
// **************************
|
||||
|
||||
sql = @"
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
@@ -520,6 +529,7 @@ CREATE TABLE `tblCons` (
|
||||
`EC2InstanceId` varchar(32) DEFAULT NULL,
|
||||
`ExternalCredentialProvider` varchar(256) DEFAULT NULL,
|
||||
`ExternalAddressProvider` varchar(256) DEFAULT NULL,
|
||||
`UserViaAPI` varchar(512) NOT NULL,
|
||||
PRIMARY KEY (`ConstantID`),
|
||||
UNIQUE KEY `ID_UNIQUE` (`ID`),
|
||||
UNIQUE KEY `ConstantID_UNIQUE` (`ConstantID`)
|
||||
@@ -564,227 +574,6 @@ CREATE TABLE `tblUpdate` (
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// sql = @"
|
||||
///*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
///*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
///*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
///*!40101 SET NAMES utf8 */;
|
||||
///*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
///*!40103 SET TIME_ZONE='+00:00' */;
|
||||
///*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
///*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
///*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
///*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
//--
|
||||
//-- Table structure for table `tblCons`
|
||||
//--
|
||||
|
||||
//DROP TABLE IF EXISTS `tblCons`;
|
||||
///*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
///*!40101 SET character_set_client = utf8 */;
|
||||
//CREATE TABLE `tblCons` (
|
||||
// `ID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
// `ConstantID` varchar(128) NOT NULL,
|
||||
// `PositionID` int(11) NOT NULL,
|
||||
// `ParentID` varchar(128) DEFAULT NULL,
|
||||
// `LastChange` datetime NOT NULL,
|
||||
// `Name` varchar(128) NOT NULL,
|
||||
// `Type` varchar(32) NOT NULL,
|
||||
// `Expanded` tinyint NOT NULL,
|
||||
// `AutomaticResize` tinyint NOT NULL DEFAULT 1,
|
||||
// `CacheBitmaps` tinyint NOT NULL,
|
||||
// `Colors` varchar(32) NOT NULL,
|
||||
// `ConnectToConsole` tinyint NOT NULL,
|
||||
// `Connected` tinyint NOT NULL,
|
||||
// `Description` varchar(1024) DEFAULT NULL,
|
||||
// `DisableCursorBlinking` tinyint NOT NULL,
|
||||
// `DisableCursorShadow` tinyint NOT NULL,
|
||||
// `DisableFullWindowDrag` tinyint NOT NULL,
|
||||
// `DisableMenuAnimations` tinyint NOT NULL,
|
||||
// `DisplayThemes` tinyint NOT NULL,
|
||||
// `DisplayWallpaper` tinyint NOT NULL,
|
||||
// `Domain` varchar(512) DEFAULT NULL,
|
||||
// `EnableDesktopComposition` tinyint NOT NULL,
|
||||
// `EnableFontSmoothing` tinyint NOT NULL,
|
||||
// `ExtApp` varchar(256) DEFAULT NULL,
|
||||
// `Favorite` tinyint NOT NULL,
|
||||
// `Hostname` varchar(512) DEFAULT NULL,
|
||||
// `LoadBalanceInfo` varchar(1024) DEFAULT NULL,
|
||||
// `MacAddress` varchar(32) DEFAULT NULL,
|
||||
// `Panel` varchar(128) NOT NULL,
|
||||
// `Password` varchar(1024) DEFAULT NULL,
|
||||
// `Port` int(11) NOT NULL,
|
||||
// `PostExtApp` varchar(256) DEFAULT NULL,
|
||||
// `PreExtApp` varchar(256) DEFAULT NULL,
|
||||
// `Protocol` varchar(32) NOT NULL,
|
||||
// `PuttySession` varchar(128) DEFAULT NULL,
|
||||
// `RDGatewayDomain` varchar(512) DEFAULT NULL,
|
||||
// `RDGatewayHostname` varchar(512) DEFAULT NULL,
|
||||
// `RDGatewayPassword` varchar(1024) DEFAULT NULL,
|
||||
// `RDGatewayUsageMethod` varchar(32) NOT NULL,
|
||||
// `RDGatewayUseConnectionCredentials` varchar(32) NOT NULL,
|
||||
// `RDGatewayUsername` varchar(512) DEFAULT NULL,
|
||||
// `RDPAlertIdleTimeout` tinyint NOT NULL,
|
||||
// `RDPAuthenticationLevel` varchar(32) NOT NULL,
|
||||
// `RDPMinutesToIdleTimeout` int(11) NOT NULL,
|
||||
// `RdpVersion` varchar(10) DEFAULT NULL,
|
||||
// `RedirectAudioCapture` tinyint NOT NULL,
|
||||
// `RedirectClipboard` tinyint NOT NULL DEFAULT 0,
|
||||
// `RedirectDiskDrives` tinyint NOT NULL,
|
||||
// `RedirectKeys` tinyint NOT NULL,
|
||||
// `RedirectPorts` tinyint NOT NULL,
|
||||
// `RedirectPrinters` tinyint NOT NULL,
|
||||
// `RedirectSmartCards` tinyint NOT NULL,
|
||||
// `RedirectSound` varchar(64) NOT NULL,
|
||||
// `RenderingEngine` varchar(10) DEFAULT NULL,
|
||||
// `Resolution` varchar(32) NOT NULL,
|
||||
// `SSHOptions` varchar(1024) NOT NULL,
|
||||
// `SSHTunnelConnectionName` varchar(128) NOT NULL,
|
||||
// `SoundQuality` varchar(20) NOT NULL,
|
||||
// `UseCredSsp` tinyint NOT NULL,
|
||||
// `UseEnhancedMode` tinyint DEFAULT NULL,
|
||||
// `UseVmId` tinyint DEFAULT NULL,
|
||||
// `UserField` varchar(256) DEFAULT NULL,
|
||||
// `Username` varchar(512) DEFAULT NULL,
|
||||
// `VNCAuthMode` varchar(10) DEFAULT NULL,
|
||||
// `VNCColors` varchar(10) DEFAULT NULL,
|
||||
// `VNCCompression` varchar(10) DEFAULT NULL,
|
||||
// `VNCEncoding` varchar(20) DEFAULT NULL,
|
||||
// `VNCProxyIP` varchar(128) DEFAULT NULL,
|
||||
// `VNCProxyPassword` varchar(1024) DEFAULT NULL,
|
||||
// `VNCProxyPort` int(11) DEFAULT NULL,
|
||||
// `VNCProxyType` varchar(20) DEFAULT NULL,
|
||||
// `VNCProxyUsername` varchar(512) DEFAULT NULL,
|
||||
// `VNCSmartSizeMode` varchar(20) DEFAULT NULL,
|
||||
// `VNCViewOnly` tinyint NOT NULL,
|
||||
// `VmId` varchar(512) DEFAULT NULL,
|
||||
// `ICAEncryptionStrength` varchar(32) NOT NULL,
|
||||
// `Icon` varchar(128) NOT NULL,
|
||||
// `InheritAutomaticResize` tinyint NOT NULL DEFAULT 0,
|
||||
// `InheritCacheBitmaps` tinyint NOT NULL,
|
||||
// `InheritColors` tinyint NOT NULL,
|
||||
// `InheritDescription` tinyint NOT NULL,
|
||||
// `InheritDisableCursorBlinking` tinyint NOT NULL,
|
||||
// `InheritDisableCursorShadow` tinyint NOT NULL,
|
||||
// `InheritDisableFullWindowDrag` tinyint NOT NULL,
|
||||
// `InheritDisableMenuAnimations` tinyint NOT NULL,
|
||||
// `InheritDisplayThemes` tinyint NOT NULL,
|
||||
// `InheritDisplayWallpaper` tinyint NOT NULL,
|
||||
// `InheritDomain` tinyint NOT NULL,
|
||||
// `InheritEnableDesktopComposition` tinyint NOT NULL,
|
||||
// `InheritEnableFontSmoothing` tinyint NOT NULL,
|
||||
// `InheritExtApp` tinyint NOT NULL,
|
||||
// `InheritFavorite` tinyint NOT NULL,
|
||||
// `InheritICAEncryptionStrength` tinyint NOT NULL,
|
||||
// `InheritIcon` tinyint NOT NULL,
|
||||
// `InheritLoadBalanceInfo` tinyint NOT NULL DEFAULT 0,
|
||||
// `InheritMacAddress` tinyint NOT NULL,
|
||||
// `InheritPanel` tinyint NOT NULL,
|
||||
// `InheritPassword` tinyint NOT NULL,
|
||||
// `InheritPort` tinyint NOT NULL,
|
||||
// `InheritPostExtApp` tinyint NOT NULL,
|
||||
// `InheritPreExtApp` tinyint NOT NULL,
|
||||
// `InheritProtocol` tinyint NOT NULL,
|
||||
// `InheritPuttySession` tinyint NOT NULL,
|
||||
// `InheritRDGatewayDomain` tinyint NOT NULL,
|
||||
// `InheritRDGatewayHostname` tinyint NOT NULL,
|
||||
// `InheritRDGatewayPassword` tinyint NOT NULL,
|
||||
// `InheritRDGatewayUsageMethod` tinyint NOT NULL,
|
||||
// `InheritRDGatewayUseConnectionCredentials` tinyint NOT NULL,
|
||||
// `InheritRDGatewayUsername` tinyint NOT NULL,
|
||||
// `InheritRDPAlertIdleTimeout` tinyint NOT NULL,
|
||||
// `InheritRDPAuthenticationLevel` tinyint NOT NULL,
|
||||
// `InheritRDPMinutesToIdleTimeout` tinyint NOT NULL,
|
||||
// `InheritRdpVersion` tinyint NOT NULL DEFAULT 0,
|
||||
// `InheritRedirectAudioCapture` tinyint NOT NULL,
|
||||
// `InheritRedirectClipboard` tinyint NOT NULL DEFAULT 0,
|
||||
// `InheritRedirectDiskDrives` tinyint NOT NULL,
|
||||
// `InheritRedirectKeys` tinyint NOT NULL,
|
||||
// `InheritRedirectPorts` tinyint NOT NULL,
|
||||
// `InheritRedirectPrinters` tinyint NOT NULL,
|
||||
// `InheritRedirectSmartCards` tinyint NOT NULL,
|
||||
// `InheritRedirectSound` tinyint NOT NULL,
|
||||
// `InheritRenderingEngine` tinyint NOT NULL,
|
||||
// `InheritResolution` tinyint NOT NULL,
|
||||
// `InheritSSHOptions` tinyint NOT NULL,
|
||||
// `InheritSSHTunnelConnectionName` tinyint NOT NULL,
|
||||
// `InheritSoundQuality` tinyint NOT NULL,
|
||||
// `InheritUseConsoleSession` tinyint NOT NULL,
|
||||
// `InheritUseCredSsp` tinyint NOT NULL,
|
||||
// `InheritUseEnhancedMode` tinyint DEFAULT NULL,
|
||||
// `InheritUseVmId` tinyint DEFAULT NULL,
|
||||
// `InheritUserField` tinyint NOT NULL,
|
||||
// `InheritUsername` tinyint NOT NULL,
|
||||
// `InheritVNCAuthMode` tinyint NOT NULL,
|
||||
// `InheritVNCColors` tinyint NOT NULL,
|
||||
// `InheritVNCCompression` tinyint NOT NULL,
|
||||
// `InheritVNCEncoding` tinyint NOT NULL,
|
||||
// `InheritVNCProxyIP` tinyint NOT NULL,
|
||||
// `InheritVNCProxyPassword` tinyint NOT NULL,
|
||||
// `InheritVNCProxyPort` tinyint NOT NULL,
|
||||
// `InheritVNCProxyType` tinyint NOT NULL,
|
||||
// `InheritVNCProxyUsername` tinyint NOT NULL,
|
||||
// `InheritVNCSmartSizeMode` tinyint NOT NULL,
|
||||
// `InheritVNCViewOnly` tinyint NOT NULL,
|
||||
// `InheritVmId` tinyint DEFAULT NULL,
|
||||
// PRIMARY KEY (`ConstantID`),
|
||||
// UNIQUE (`ID`)
|
||||
//) ENGINE=InnoDB AUTO_INCREMENT=3324 DEFAULT CHARSET=latin1;
|
||||
///*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
//--
|
||||
//-- Table structure for table `tblRoot`
|
||||
//--
|
||||
|
||||
//DROP TABLE IF EXISTS `tblRoot`;
|
||||
///*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
///*!40101 SET character_set_client = utf8 */;
|
||||
//CREATE TABLE `tblRoot` (
|
||||
// `Name` varchar(2048) NOT NULL,
|
||||
// `Export` tinyint NOT NULL,
|
||||
// `Protected` varchar(4048) NOT NULL,
|
||||
// `ConfVersion` double NOT NULL
|
||||
//) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
///*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
//--
|
||||
//-- Table structure for table `tblUpdate`
|
||||
//--
|
||||
|
||||
//DROP TABLE IF EXISTS `tblUpdate`;
|
||||
///*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
///*!40101 SET character_set_client = utf8 */;
|
||||
//CREATE TABLE `tblUpdate` (
|
||||
// `LastUpdate` datetime(3) DEFAULT NULL
|
||||
//) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
///*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
||||
///*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
///*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
///*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
///*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
///*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
///*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
///*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
///*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
//";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -23,16 +23,9 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
|
||||
SecureString encryptionKey,
|
||||
SaveFilter saveFilter)
|
||||
{
|
||||
if (cryptographyProvider == null)
|
||||
throw new ArgumentNullException(nameof(cryptographyProvider));
|
||||
if (encryptionKey == null)
|
||||
throw new ArgumentNullException(nameof(encryptionKey));
|
||||
if (saveFilter == null)
|
||||
throw new ArgumentNullException(nameof(saveFilter));
|
||||
|
||||
_cryptographyProvider = cryptographyProvider;
|
||||
_encryptionKey = encryptionKey;
|
||||
_saveFilter = saveFilter;
|
||||
_cryptographyProvider = cryptographyProvider ?? throw new ArgumentNullException(nameof(cryptographyProvider));
|
||||
_encryptionKey = encryptionKey ?? throw new ArgumentNullException(nameof(encryptionKey));
|
||||
_saveFilter = saveFilter ?? throw new ArgumentNullException(nameof(saveFilter));
|
||||
}
|
||||
|
||||
public XElement Serialize(ConnectionInfo connectionInfo)
|
||||
|
||||
@@ -23,16 +23,9 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
|
||||
SecureString encryptionKey,
|
||||
SaveFilter saveFilter)
|
||||
{
|
||||
if (cryptographyProvider == null)
|
||||
throw new ArgumentNullException(nameof(cryptographyProvider));
|
||||
if (encryptionKey == null)
|
||||
throw new ArgumentNullException(nameof(encryptionKey));
|
||||
if (saveFilter == null)
|
||||
throw new ArgumentNullException(nameof(saveFilter));
|
||||
|
||||
_cryptographyProvider = cryptographyProvider;
|
||||
_encryptionKey = encryptionKey;
|
||||
_saveFilter = saveFilter;
|
||||
_cryptographyProvider = cryptographyProvider ?? throw new ArgumentNullException(nameof(cryptographyProvider));
|
||||
_encryptionKey = encryptionKey ?? throw new ArgumentNullException(nameof(encryptionKey));
|
||||
_saveFilter = saveFilter ?? throw new ArgumentNullException(nameof(saveFilter));
|
||||
}
|
||||
|
||||
public XElement Serialize(ConnectionInfo connectionInfo)
|
||||
@@ -168,160 +161,159 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
|
||||
|
||||
private void SetInheritanceAttributes(XContainer element, IInheritable connectionInfo)
|
||||
{
|
||||
if (_saveFilter.SaveInheritance)
|
||||
{
|
||||
var inheritance = connectionInfo.Inheritance;
|
||||
if (!_saveFilter.SaveInheritance) return;
|
||||
|
||||
if (inheritance.CacheBitmaps)
|
||||
element.Add(new XAttribute("InheritCacheBitmaps", inheritance.CacheBitmaps.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Colors)
|
||||
element.Add(new XAttribute("InheritColors", inheritance.Colors.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Description)
|
||||
element.Add(new XAttribute("InheritDescription", inheritance.Description.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisplayThemes)
|
||||
element.Add(new XAttribute("InheritDisplayThemes", inheritance.DisplayThemes.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisplayWallpaper)
|
||||
element.Add(new XAttribute("InheritDisplayWallpaper", inheritance.DisplayWallpaper.ToString().ToLowerInvariant()));
|
||||
if (inheritance.EnableFontSmoothing)
|
||||
element.Add(new XAttribute("InheritEnableFontSmoothing", inheritance.EnableFontSmoothing.ToString().ToLowerInvariant()));
|
||||
if (inheritance.EnableDesktopComposition)
|
||||
element.Add(new XAttribute("InheritEnableDesktopComposition", inheritance.EnableDesktopComposition.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisableFullWindowDrag)
|
||||
element.Add(new XAttribute("InheritDisableFullWindowDrag", inheritance.DisableFullWindowDrag.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisableMenuAnimations)
|
||||
element.Add(new XAttribute("InheritDisableMenuAnimations", inheritance.DisableMenuAnimations.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisableCursorShadow)
|
||||
element.Add(new XAttribute("InheritDisableCursorShadow", inheritance.DisableCursorShadow.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisableCursorBlinking)
|
||||
element.Add(new XAttribute("InheritDisableCursorBlinking", inheritance.DisableCursorBlinking.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Domain)
|
||||
element.Add(new XAttribute("InheritDomain", inheritance.Domain.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Icon)
|
||||
element.Add(new XAttribute("InheritIcon", inheritance.Icon.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Panel)
|
||||
element.Add(new XAttribute("InheritPanel", inheritance.Panel.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Password)
|
||||
element.Add(new XAttribute("InheritPassword", inheritance.Password.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Port)
|
||||
element.Add(new XAttribute("InheritPort", inheritance.Port.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Protocol)
|
||||
element.Add(new XAttribute("InheritProtocol", inheritance.Protocol.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RdpVersion)
|
||||
element.Add(new XAttribute("InheritRdpVersion", inheritance.RdpVersion.ToString().ToLowerInvariant()));
|
||||
if (inheritance.SSHTunnelConnectionName)
|
||||
element.Add(new XAttribute("InheritSSHTunnelConnectionName", inheritance.SSHTunnelConnectionName.ToString().ToLowerInvariant()));
|
||||
if (inheritance.OpeningCommand)
|
||||
element.Add(new XAttribute("InheritOpeningCommand", inheritance.OpeningCommand.ToString().ToLowerInvariant()));
|
||||
if (inheritance.SSHOptions)
|
||||
element.Add(new XAttribute("InheritSSHOptions", inheritance.SSHOptions.ToString().ToLowerInvariant()));
|
||||
if (inheritance.PuttySession)
|
||||
element.Add(new XAttribute("InheritPuttySession", inheritance.PuttySession.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectDiskDrives)
|
||||
element.Add(new XAttribute("InheritRedirectDiskDrives", inheritance.RedirectDiskDrives.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectDiskDrivesCustom)
|
||||
element.Add(new XAttribute("InheritRedirectDiskDrivesCustom", inheritance.RedirectDiskDrivesCustom.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectKeys)
|
||||
element.Add(new XAttribute("InheritRedirectKeys", inheritance.RedirectKeys.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectPorts)
|
||||
element.Add(new XAttribute("InheritRedirectPorts", inheritance.RedirectPorts.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectPrinters)
|
||||
element.Add(new XAttribute("InheritRedirectPrinters", inheritance.RedirectPrinters.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectClipboard)
|
||||
element.Add(new XAttribute("InheritRedirectClipboard", inheritance.RedirectClipboard.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectSmartCards)
|
||||
element.Add(new XAttribute("InheritRedirectSmartCards", inheritance.RedirectSmartCards.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectSound)
|
||||
element.Add(new XAttribute("InheritRedirectSound", inheritance.RedirectSound.ToString().ToLowerInvariant()));
|
||||
if (inheritance.SoundQuality)
|
||||
element.Add(new XAttribute("InheritSoundQuality", inheritance.SoundQuality.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectAudioCapture)
|
||||
element.Add(new XAttribute("InheritRedirectAudioCapture", inheritance.RedirectAudioCapture.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Resolution)
|
||||
element.Add(new XAttribute("InheritResolution", inheritance.Resolution.ToString().ToLowerInvariant()));
|
||||
if (inheritance.AutomaticResize)
|
||||
element.Add(new XAttribute("InheritAutomaticResize", inheritance.AutomaticResize.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseConsoleSession)
|
||||
element.Add(new XAttribute("InheritUseConsoleSession", inheritance.UseConsoleSession.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseCredSsp)
|
||||
element.Add(new XAttribute("InheritUseCredSsp", inheritance.UseCredSsp.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RenderingEngine)
|
||||
element.Add(new XAttribute("InheritRenderingEngine", inheritance.RenderingEngine.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Username)
|
||||
element.Add(new XAttribute("InheritUsername", inheritance.Username.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDPAuthenticationLevel)
|
||||
element.Add(new XAttribute("InheritRDPAuthenticationLevel", inheritance.RDPAuthenticationLevel.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDPMinutesToIdleTimeout)
|
||||
element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout", inheritance.RDPMinutesToIdleTimeout.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDPAlertIdleTimeout)
|
||||
element.Add(new XAttribute("InheritRDPAlertIdleTimeout", inheritance.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
|
||||
if (inheritance.LoadBalanceInfo)
|
||||
element.Add(new XAttribute("InheritLoadBalanceInfo", inheritance.LoadBalanceInfo.ToString().ToLowerInvariant()));
|
||||
if (inheritance.PreExtApp)
|
||||
element.Add(new XAttribute("InheritPreExtApp", inheritance.PreExtApp.ToString().ToLowerInvariant()));
|
||||
if (inheritance.PostExtApp)
|
||||
element.Add(new XAttribute("InheritPostExtApp", inheritance.PostExtApp.ToString().ToLowerInvariant()));
|
||||
if (inheritance.MacAddress)
|
||||
element.Add(new XAttribute("InheritMacAddress", inheritance.MacAddress.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UserField)
|
||||
element.Add(new XAttribute("InheritUserField", inheritance.UserField.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Favorite)
|
||||
element.Add(new XAttribute("InheritFavorite", inheritance.Favorite.ToString().ToLowerInvariant()));
|
||||
if (inheritance.ExtApp)
|
||||
element.Add(new XAttribute("InheritExtApp", inheritance.ExtApp.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCCompression)
|
||||
element.Add(new XAttribute("InheritVNCCompression", inheritance.VNCCompression.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCEncoding)
|
||||
element.Add(new XAttribute("InheritVNCEncoding", inheritance.VNCEncoding.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCAuthMode)
|
||||
element.Add(new XAttribute("InheritVNCAuthMode", inheritance.VNCAuthMode.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyType)
|
||||
element.Add(new XAttribute("InheritVNCProxyType", inheritance.VNCProxyType.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyIP)
|
||||
element.Add(new XAttribute("InheritVNCProxyIP", inheritance.VNCProxyIP.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyPort)
|
||||
element.Add(new XAttribute("InheritVNCProxyPort", inheritance.VNCProxyPort.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyUsername)
|
||||
element.Add(new XAttribute("InheritVNCProxyUsername", inheritance.VNCProxyUsername.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyPassword)
|
||||
element.Add(new XAttribute("InheritVNCProxyPassword", inheritance.VNCProxyPassword.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCColors)
|
||||
element.Add(new XAttribute("InheritVNCColors", inheritance.VNCColors.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCSmartSizeMode)
|
||||
element.Add(new XAttribute("InheritVNCSmartSizeMode", inheritance.VNCSmartSizeMode.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCViewOnly)
|
||||
element.Add(new XAttribute("InheritVNCViewOnly", inheritance.VNCViewOnly.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayUsageMethod)
|
||||
element.Add(new XAttribute("InheritRDGatewayUsageMethod", inheritance.RDGatewayUsageMethod.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayHostname)
|
||||
element.Add(new XAttribute("InheritRDGatewayHostname", inheritance.RDGatewayHostname.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayUseConnectionCredentials)
|
||||
element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", inheritance.RDGatewayUseConnectionCredentials.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayUsername)
|
||||
element.Add(new XAttribute("InheritRDGatewayUsername", inheritance.RDGatewayUsername.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayPassword)
|
||||
element.Add(new XAttribute("InheritRDGatewayPassword", inheritance.RDGatewayPassword.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayDomain)
|
||||
element.Add(new XAttribute("InheritRDGatewayDomain", inheritance.RDGatewayDomain.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayExternalCredentialProvider)
|
||||
element.Add(new XAttribute("InheritRDGatewayExternalCredentialProvider", inheritance.RDGatewayExternalCredentialProvider.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayUserViaAPI)
|
||||
element.Add(new XAttribute("InheritRDGatewayUserViaAPI", inheritance.RDGatewayUserViaAPI.ToString().ToLowerInvariant()));
|
||||
var inheritance = connectionInfo.Inheritance;
|
||||
|
||||
if (inheritance.VmId)
|
||||
element.Add(new XAttribute("InheritVmId", inheritance.VmId.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseVmId)
|
||||
element.Add(new XAttribute("InheritUseVmId", inheritance.UseVmId.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseEnhancedMode)
|
||||
element.Add(new XAttribute("InheritUseEnhancedMode", inheritance.UseEnhancedMode.ToString().ToLowerInvariant()));
|
||||
if (inheritance.ExternalCredentialProvider)
|
||||
element.Add(new XAttribute("InheritExternalCredentialProvider", inheritance.ExternalCredentialProvider.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UserViaAPI)
|
||||
element.Add(new XAttribute("InheritUserViaAPI", inheritance.UserViaAPI.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseRCG)
|
||||
element.Add(new XAttribute("InheritUseRCG", inheritance.UseRCG.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseRestrictedAdmin)
|
||||
element.Add(new XAttribute("InheritUseRestrictedAdmin", inheritance.UseRestrictedAdmin.ToString().ToLowerInvariant()));
|
||||
}
|
||||
if (inheritance.CacheBitmaps)
|
||||
element.Add(new XAttribute("InheritCacheBitmaps", inheritance.CacheBitmaps.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Colors)
|
||||
element.Add(new XAttribute("InheritColors", inheritance.Colors.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Description)
|
||||
element.Add(new XAttribute("InheritDescription", inheritance.Description.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisplayThemes)
|
||||
element.Add(new XAttribute("InheritDisplayThemes", inheritance.DisplayThemes.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisplayWallpaper)
|
||||
element.Add(new XAttribute("InheritDisplayWallpaper", inheritance.DisplayWallpaper.ToString().ToLowerInvariant()));
|
||||
if (inheritance.EnableFontSmoothing)
|
||||
element.Add(new XAttribute("InheritEnableFontSmoothing", inheritance.EnableFontSmoothing.ToString().ToLowerInvariant()));
|
||||
if (inheritance.EnableDesktopComposition)
|
||||
element.Add(new XAttribute("InheritEnableDesktopComposition", inheritance.EnableDesktopComposition.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisableFullWindowDrag)
|
||||
element.Add(new XAttribute("InheritDisableFullWindowDrag", inheritance.DisableFullWindowDrag.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisableMenuAnimations)
|
||||
element.Add(new XAttribute("InheritDisableMenuAnimations", inheritance.DisableMenuAnimations.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisableCursorShadow)
|
||||
element.Add(new XAttribute("InheritDisableCursorShadow", inheritance.DisableCursorShadow.ToString().ToLowerInvariant()));
|
||||
if (inheritance.DisableCursorBlinking)
|
||||
element.Add(new XAttribute("InheritDisableCursorBlinking", inheritance.DisableCursorBlinking.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Domain)
|
||||
element.Add(new XAttribute("InheritDomain", inheritance.Domain.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Icon)
|
||||
element.Add(new XAttribute("InheritIcon", inheritance.Icon.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Panel)
|
||||
element.Add(new XAttribute("InheritPanel", inheritance.Panel.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Password)
|
||||
element.Add(new XAttribute("InheritPassword", inheritance.Password.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Port)
|
||||
element.Add(new XAttribute("InheritPort", inheritance.Port.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Protocol)
|
||||
element.Add(new XAttribute("InheritProtocol", inheritance.Protocol.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RdpVersion)
|
||||
element.Add(new XAttribute("InheritRdpVersion", inheritance.RdpVersion.ToString().ToLowerInvariant()));
|
||||
if (inheritance.SSHTunnelConnectionName)
|
||||
element.Add(new XAttribute("InheritSSHTunnelConnectionName", inheritance.SSHTunnelConnectionName.ToString().ToLowerInvariant()));
|
||||
if (inheritance.OpeningCommand)
|
||||
element.Add(new XAttribute("InheritOpeningCommand", inheritance.OpeningCommand.ToString().ToLowerInvariant()));
|
||||
if (inheritance.SSHOptions)
|
||||
element.Add(new XAttribute("InheritSSHOptions", inheritance.SSHOptions.ToString().ToLowerInvariant()));
|
||||
if (inheritance.PuttySession)
|
||||
element.Add(new XAttribute("InheritPuttySession", inheritance.PuttySession.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectDiskDrives)
|
||||
element.Add(new XAttribute("InheritRedirectDiskDrives", inheritance.RedirectDiskDrives.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectDiskDrivesCustom)
|
||||
element.Add(new XAttribute("InheritRedirectDiskDrivesCustom", inheritance.RedirectDiskDrivesCustom.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectKeys)
|
||||
element.Add(new XAttribute("InheritRedirectKeys", inheritance.RedirectKeys.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectPorts)
|
||||
element.Add(new XAttribute("InheritRedirectPorts", inheritance.RedirectPorts.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectPrinters)
|
||||
element.Add(new XAttribute("InheritRedirectPrinters", inheritance.RedirectPrinters.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectClipboard)
|
||||
element.Add(new XAttribute("InheritRedirectClipboard", inheritance.RedirectClipboard.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectSmartCards)
|
||||
element.Add(new XAttribute("InheritRedirectSmartCards", inheritance.RedirectSmartCards.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectSound)
|
||||
element.Add(new XAttribute("InheritRedirectSound", inheritance.RedirectSound.ToString().ToLowerInvariant()));
|
||||
if (inheritance.SoundQuality)
|
||||
element.Add(new XAttribute("InheritSoundQuality", inheritance.SoundQuality.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RedirectAudioCapture)
|
||||
element.Add(new XAttribute("InheritRedirectAudioCapture", inheritance.RedirectAudioCapture.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Resolution)
|
||||
element.Add(new XAttribute("InheritResolution", inheritance.Resolution.ToString().ToLowerInvariant()));
|
||||
if (inheritance.AutomaticResize)
|
||||
element.Add(new XAttribute("InheritAutomaticResize", inheritance.AutomaticResize.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseConsoleSession)
|
||||
element.Add(new XAttribute("InheritUseConsoleSession", inheritance.UseConsoleSession.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseCredSsp)
|
||||
element.Add(new XAttribute("InheritUseCredSsp", inheritance.UseCredSsp.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RenderingEngine)
|
||||
element.Add(new XAttribute("InheritRenderingEngine", inheritance.RenderingEngine.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Username)
|
||||
element.Add(new XAttribute("InheritUsername", inheritance.Username.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDPAuthenticationLevel)
|
||||
element.Add(new XAttribute("InheritRDPAuthenticationLevel", inheritance.RDPAuthenticationLevel.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDPMinutesToIdleTimeout)
|
||||
element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout", inheritance.RDPMinutesToIdleTimeout.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDPAlertIdleTimeout)
|
||||
element.Add(new XAttribute("InheritRDPAlertIdleTimeout", inheritance.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
|
||||
if (inheritance.LoadBalanceInfo)
|
||||
element.Add(new XAttribute("InheritLoadBalanceInfo", inheritance.LoadBalanceInfo.ToString().ToLowerInvariant()));
|
||||
if (inheritance.PreExtApp)
|
||||
element.Add(new XAttribute("InheritPreExtApp", inheritance.PreExtApp.ToString().ToLowerInvariant()));
|
||||
if (inheritance.PostExtApp)
|
||||
element.Add(new XAttribute("InheritPostExtApp", inheritance.PostExtApp.ToString().ToLowerInvariant()));
|
||||
if (inheritance.MacAddress)
|
||||
element.Add(new XAttribute("InheritMacAddress", inheritance.MacAddress.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UserField)
|
||||
element.Add(new XAttribute("InheritUserField", inheritance.UserField.ToString().ToLowerInvariant()));
|
||||
if (inheritance.Favorite)
|
||||
element.Add(new XAttribute("InheritFavorite", inheritance.Favorite.ToString().ToLowerInvariant()));
|
||||
if (inheritance.ExtApp)
|
||||
element.Add(new XAttribute("InheritExtApp", inheritance.ExtApp.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCCompression)
|
||||
element.Add(new XAttribute("InheritVNCCompression", inheritance.VNCCompression.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCEncoding)
|
||||
element.Add(new XAttribute("InheritVNCEncoding", inheritance.VNCEncoding.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCAuthMode)
|
||||
element.Add(new XAttribute("InheritVNCAuthMode", inheritance.VNCAuthMode.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyType)
|
||||
element.Add(new XAttribute("InheritVNCProxyType", inheritance.VNCProxyType.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyIP)
|
||||
element.Add(new XAttribute("InheritVNCProxyIP", inheritance.VNCProxyIP.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyPort)
|
||||
element.Add(new XAttribute("InheritVNCProxyPort", inheritance.VNCProxyPort.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyUsername)
|
||||
element.Add(new XAttribute("InheritVNCProxyUsername", inheritance.VNCProxyUsername.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCProxyPassword)
|
||||
element.Add(new XAttribute("InheritVNCProxyPassword", inheritance.VNCProxyPassword.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCColors)
|
||||
element.Add(new XAttribute("InheritVNCColors", inheritance.VNCColors.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCSmartSizeMode)
|
||||
element.Add(new XAttribute("InheritVNCSmartSizeMode", inheritance.VNCSmartSizeMode.ToString().ToLowerInvariant()));
|
||||
if (inheritance.VNCViewOnly)
|
||||
element.Add(new XAttribute("InheritVNCViewOnly", inheritance.VNCViewOnly.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayUsageMethod)
|
||||
element.Add(new XAttribute("InheritRDGatewayUsageMethod", inheritance.RDGatewayUsageMethod.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayHostname)
|
||||
element.Add(new XAttribute("InheritRDGatewayHostname", inheritance.RDGatewayHostname.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayUseConnectionCredentials)
|
||||
element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", inheritance.RDGatewayUseConnectionCredentials.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayUsername)
|
||||
element.Add(new XAttribute("InheritRDGatewayUsername", inheritance.RDGatewayUsername.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayPassword)
|
||||
element.Add(new XAttribute("InheritRDGatewayPassword", inheritance.RDGatewayPassword.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayDomain)
|
||||
element.Add(new XAttribute("InheritRDGatewayDomain", inheritance.RDGatewayDomain.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayExternalCredentialProvider)
|
||||
element.Add(new XAttribute("InheritRDGatewayExternalCredentialProvider", inheritance.RDGatewayExternalCredentialProvider.ToString().ToLowerInvariant()));
|
||||
if (inheritance.RDGatewayUserViaAPI)
|
||||
element.Add(new XAttribute("InheritRDGatewayUserViaAPI", inheritance.RDGatewayUserViaAPI.ToString().ToLowerInvariant()));
|
||||
|
||||
if (inheritance.VmId)
|
||||
element.Add(new XAttribute("InheritVmId", inheritance.VmId.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseVmId)
|
||||
element.Add(new XAttribute("InheritUseVmId", inheritance.UseVmId.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseEnhancedMode)
|
||||
element.Add(new XAttribute("InheritUseEnhancedMode", inheritance.UseEnhancedMode.ToString().ToLowerInvariant()));
|
||||
if (inheritance.ExternalCredentialProvider)
|
||||
element.Add(new XAttribute("InheritExternalCredentialProvider", inheritance.ExternalCredentialProvider.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UserViaAPI)
|
||||
element.Add(new XAttribute("InheritUserViaAPI", inheritance.UserViaAPI.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseRCG)
|
||||
element.Add(new XAttribute("InheritUseRCG", inheritance.UseRCG.ToString().ToLowerInvariant()));
|
||||
if (inheritance.UseRestrictedAdmin)
|
||||
element.Add(new XAttribute("InheritUseRestrictedAdmin", inheritance.UseRestrictedAdmin.ToString().ToLowerInvariant()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
|
||||
.First().PasswordString
|
||||
.ConvertToSecureString();
|
||||
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer27(
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer28(
|
||||
cryptographyProvider,
|
||||
encryptionKey,
|
||||
saveFilter ?? new SaveFilter());
|
||||
|
||||
@@ -569,7 +569,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
|
||||
|
||||
switch (_confVersion)
|
||||
{
|
||||
case >= 3.0:
|
||||
case >= 2.8:
|
||||
connectionInfo.RedirectDiskDrives = xmlnode.GetAttributeAsEnum<RDPDiskDrives>("RedirectDiskDrives");
|
||||
connectionInfo.RedirectDiskDrivesCustom = xmlnode.GetAttributeAsString("RedirectDiskDrivesCustom");
|
||||
connectionInfo.Inheritance.RedirectDiskDrivesCustom = xmlnode.GetAttributeAsBool("InheritRedirectDiskDrivesCustom");
|
||||
|
||||
@@ -107,6 +107,9 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
|
||||
case "redirectdrives":
|
||||
connectionInfo.RedirectDiskDrives = (value == "1" ? RDPDiskDrives.Local : RDPDiskDrives.None);
|
||||
break;
|
||||
case "redirectdrivescustom":
|
||||
connectionInfo.RedirectDiskDrivesCustom = value;
|
||||
break;
|
||||
case "redirectcomports":
|
||||
connectionInfo.RedirectPorts = value == "1";
|
||||
break;
|
||||
|
||||
@@ -37,6 +37,7 @@ ALTER TABLE tblCons MODIFY COLUMN `RenderingEngine` varchar(32) DEFAULT NULL;
|
||||
ALTER TABLE tblCons MODIFY COLUMN `RedirectDiskDrives` varchar(32) DEFAULT NULL;
|
||||
ALTER TABLE tblCons ADD COLUMN `RedirectDiskDrivesCustom` varchar(32) DEFAULT NULL;
|
||||
ALTER TABLE tblCons ADD COLUMN `InheritRedirectDiskDrivesCustom` tinyint NOT NULL;
|
||||
ALTER TABLE tblCons ADD COLUMN `UserViaAPI` varchar(512) NOT NULL;
|
||||
|
||||
-- mysql tinyint(1) is deprecated - modify all tinyint(1) columns to tinyint
|
||||
ALTER TABLE tblCons MODIFY COLUMN `Expanded` tinyint NOT NULL;
|
||||
@@ -151,6 +152,7 @@ ALTER TABLE tblCons ALTER COLUMN RenderingEngine varchar(32) DEFAULT NULL;
|
||||
ALTER TABLE tblCons ALTER COLUMN RedirectDiskDrives varchar(32) DEFAULT NULL;
|
||||
ALTER TABLE tblCons ADD RedirectDiskDrivesCustom varchar(32) DEFAULT NULL;
|
||||
ALTER TABLE tblCons ADD InheritRedirectDiskDrivesCustom bit NOT NULL;
|
||||
ALTER TABLE tblCons ADD `UserViaAPI` varchar(512) NOT NULL;
|
||||
";
|
||||
|
||||
const string msSqlUpdate = @"UPDATE tblRoot SET ConfVersion=@confVersion;";
|
||||
|
||||
@@ -69,8 +69,7 @@ namespace mRemoteNG.Connection
|
||||
throw new SettingsPropertyNotFoundException($"No property with name '{expectedPropertyName}' found.");
|
||||
|
||||
// ensure value is of correct type
|
||||
var value = Convert.ChangeType(property.GetValue(Instance, null),
|
||||
propertyFromDestination.PropertyType);
|
||||
var value = Convert.ChangeType(property.GetValue(Instance, null), propertyFromDestination.PropertyType);
|
||||
|
||||
propertyFromDestination.SetValue(destinationInstance, value, null);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
<xs:attribute name="InheritSSHOptions" type="xs:boolean" use="optional" />
|
||||
<xs:attribute name="InheritPuttySession" type="xs:boolean" use="optional" />
|
||||
<xs:attribute name="InheritRedirectDiskDrives" type="xs:boolean" use="optional" />
|
||||
<xs:attribute name="InheritRedirectDiskDrivesCustom" type="xs:string" use="optional" />
|
||||
<xs:attribute name="InheritRedirectDiskDrivesCustom" type="xs:boolean" use="optional" />
|
||||
<xs:attribute name="InheritRedirectKeys" type="xs:boolean" use="optional" />
|
||||
<xs:attribute name="InheritRedirectPorts" type="xs:boolean" use="optional" />
|
||||
<xs:attribute name="InheritRedirectPrinters" type="xs:boolean" use="optional" />
|
||||
|
||||
@@ -113,13 +113,13 @@ public class CredentialHarvesterTests
|
||||
var map = _credentialHarvester.ConnectionToCredentialMap;
|
||||
Assert.That(map[con1Id], Is.EqualTo(map[con2Id]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private XDocument CreateTestData(ConnectionInfo connectionInfo)
|
||||
{
|
||||
var rootNode = new RootNodeInfo(RootNodeType.Connection) { PasswordString = _key.ConvertToUnsecureString() };
|
||||
rootNode.AddChild(connectionInfo);
|
||||
var nodeSerializer = new XmlConnectionNodeSerializer27(_cryptographyProvider, _key, new SaveFilter());
|
||||
var nodeSerializer = new XmlConnectionNodeSerializer28(_cryptographyProvider, _key, new SaveFilter());
|
||||
var serializer = new XmlConnectionsSerializer(_cryptographyProvider, nodeSerializer);
|
||||
var serializedData = serializer.Serialize(rootNode);
|
||||
return XDocument.Parse(serializedData);
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ValidateXmlSchemas
|
||||
_connectionTreeModel.AddRootNode(root);
|
||||
|
||||
_cryptographyProvider = new AeadCryptographyProvider();
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer27(
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer28(
|
||||
_cryptographyProvider,
|
||||
_connectionTreeModel.RootNodes.OfType<RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
|
||||
new SaveFilter());
|
||||
|
||||
@@ -30,7 +30,7 @@ public class XmlConnectionsDocumentCompilerTests
|
||||
{
|
||||
_connectionTreeModel = SetupConnectionTreeModel();
|
||||
_cryptographyProvider = new CryptoProviderFactory(BlockCipherEngines.AES, BlockCipherModes.GCM).Build();
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer27(
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer28(
|
||||
_cryptographyProvider,
|
||||
_connectionTreeModel.RootNodes.OfType<RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
|
||||
new SaveFilter());
|
||||
|
||||
@@ -21,7 +21,7 @@ public class XmlConnectionsDocumentEncryptorTests
|
||||
{
|
||||
var connectionTreeModel = SetupConnectionTreeModel();
|
||||
var cryptoProvider = new CryptoProviderFactory(BlockCipherEngines.AES, BlockCipherModes.GCM).Build();
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer27(
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer28(
|
||||
cryptoProvider,
|
||||
connectionTreeModel.RootNodes.OfType<RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
|
||||
new SaveFilter());
|
||||
|
||||
@@ -24,7 +24,7 @@ public class XmlConnectionsSerializerTests
|
||||
{
|
||||
_connectionTreeModel = SetupConnectionTreeModel();
|
||||
_cryptographyProvider = new AeadCryptographyProvider();
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer27(
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer28(
|
||||
_cryptographyProvider,
|
||||
_connectionTreeModel.RootNodes.OfType<RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
|
||||
new SaveFilter());
|
||||
@@ -37,8 +37,7 @@ public class XmlConnectionsSerializerTests
|
||||
var serializedConnections = _serializer.Serialize(_connectionTreeModel);
|
||||
var xmlDoc = new XmlDocument();
|
||||
xmlDoc.LoadXml(serializedConnections);
|
||||
var nodeCon4 =
|
||||
xmlDoc.DocumentElement?.SelectSingleNode("Node[@Name='folder2']/Node[@Name='folder3']/Node[@Name='con4']");
|
||||
var nodeCon4 = xmlDoc.DocumentElement?.SelectSingleNode("Node[@Name='folder2']/Node[@Name='folder3']/Node[@Name='con4']");
|
||||
Assert.That(nodeCon4, Is.Not.Null);
|
||||
}
|
||||
|
||||
@@ -59,7 +58,7 @@ public class XmlConnectionsSerializerTests
|
||||
[TestCase("InheritAutomaticResize", null)]
|
||||
public void SerializerRespectsSaveFilterSettings(string attributeName, string expectedValue)
|
||||
{
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer27(
|
||||
var connectionNodeSerializer = new XmlConnectionNodeSerializer28(
|
||||
_cryptographyProvider,
|
||||
_connectionTreeModel.RootNodes.OfType<RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
|
||||
new SaveFilter(true));
|
||||
|
||||
@@ -43,13 +43,13 @@ namespace mRemoteNGTests.Connection
|
||||
{
|
||||
var saveTarget = new SerializableConnectionInfoAllPropertiesOfType<string>();
|
||||
|
||||
// randomize default connnection values to ensure we dont get false passing tests
|
||||
// randomize default connection values to ensure we don't get false passing tests
|
||||
var randomizedValue = property.GetValue(_randomizedConnectionInfo);
|
||||
property.SetValue(DefaultConnectionInfo.Instance, randomizedValue);
|
||||
|
||||
DefaultConnectionInfo.Instance.SaveTo(saveTarget);
|
||||
|
||||
var valueInSource = property.GetValue(DefaultConnectionInfo.Instance).ToString();
|
||||
var valueInSource = property.GetValue(DefaultConnectionInfo.Instance)?.ToString();
|
||||
var valueInDestination = saveTarget.GetType().GetProperty(property.Name)?.GetValue(saveTarget)?.ToString();
|
||||
Assert.That(valueInDestination, Is.EqualTo(valueInSource));
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using mRemoteNG.Config.Serializers.ConnectionSerializers.Xml;
|
||||
|
||||
|
||||
namespace mRemoteNGTests.IntegrationTests
|
||||
{
|
||||
public class XmlSerializationLifeCycleTests
|
||||
@@ -26,7 +25,7 @@ namespace mRemoteNGTests.IntegrationTests
|
||||
{
|
||||
_originalModel = SetupConnectionTreeModel();
|
||||
var cryptoProvider = _cryptoFactory.Build();
|
||||
var nodeSerializer = new XmlConnectionNodeSerializer27(
|
||||
var nodeSerializer = new XmlConnectionNodeSerializer28(
|
||||
cryptoProvider,
|
||||
_originalModel.RootNodes.OfType<RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
|
||||
new SaveFilter());
|
||||
@@ -71,13 +70,12 @@ namespace mRemoteNGTests.IntegrationTests
|
||||
Assert.That(deserializedConnectionInfo.Description, Is.EqualTo(originalConnectionInfo.Description));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void SerializeAndDeserializeWithCustomKdfIterationsValue()
|
||||
{
|
||||
var cryptoProvider = _cryptoFactory.Build();
|
||||
cryptoProvider.KeyDerivationIterations = 5000;
|
||||
var nodeSerializer = new XmlConnectionNodeSerializer27(
|
||||
var nodeSerializer = new XmlConnectionNodeSerializer28(
|
||||
cryptoProvider,
|
||||
_originalModel.RootNodes.OfType<RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
|
||||
new SaveFilter());
|
||||
|
||||
@@ -47,7 +47,8 @@
|
||||
public TType DisableCursorBlinking { get; set; }
|
||||
public TType RedirectKeys { get; set; }
|
||||
public TType RedirectDiskDrives { get; set; }
|
||||
public TType RedirectPrinters { get; set; }
|
||||
public TType RedirectDiskDrivesCustom { get; set; }
|
||||
public TType RedirectPrinters { get; set; }
|
||||
public TType RedirectClipboard { get; set; }
|
||||
public TType RedirectPorts { get; set; }
|
||||
public TType RedirectSmartCards { get; set; }
|
||||
|
||||
@@ -254,6 +254,7 @@ namespace mRemoteNGTests.UI.Window.ConfigWindowTests
|
||||
nameof(ConnectionInfo.DisableCursorBlinking),
|
||||
nameof(ConnectionInfo.RedirectKeys),
|
||||
nameof(ConnectionInfo.RedirectDiskDrives),
|
||||
nameof(ConnectionInfo.RedirectDiskDrivesCustom),
|
||||
nameof(ConnectionInfo.RedirectPrinters),
|
||||
nameof(ConnectionInfo.RedirectClipboard),
|
||||
nameof(ConnectionInfo.RedirectPorts),
|
||||
@@ -267,6 +268,7 @@ namespace mRemoteNGTests.UI.Window.ConfigWindowTests
|
||||
nameof(ConnectionInfo.RDGatewayUserViaAPI),
|
||||
nameof(ConnectionInfo.ExternalCredentialProvider),
|
||||
nameof(ConnectionInfo.ExternalAddressProvider),
|
||||
nameof(ConnectionInfo.UserViaAPI),
|
||||
});
|
||||
break;
|
||||
case ProtocolType.VNC:
|
||||
|
||||
Reference in New Issue
Block a user