From 76da9c3247f0d80fd7d0b582933fb1870238436d Mon Sep 17 00:00:00 2001 From: Dimitrij Date: Wed, 17 Nov 2021 23:30:57 +0000 Subject: [PATCH] -fix fix serializers for OpeningCommand --- .../MsSql/DataTableDeserializer.cs | 53 ++++++------------- .../MsSql/DataTableSerializer.cs | 9 +++- ...ectionsDeserializerMremotengFormatTests.cs | 1 + 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/mRemoteNG/Config/Serializers/ConnectionSerializers/MsSql/DataTableDeserializer.cs b/mRemoteNG/Config/Serializers/ConnectionSerializers/MsSql/DataTableDeserializer.cs index ecf7a6ab..8ae934a8 100644 --- a/mRemoteNG/Config/Serializers/ConnectionSerializers/MsSql/DataTableDeserializer.cs +++ b/mRemoteNG/Config/Serializers/ConnectionSerializers/MsSql/DataTableDeserializer.cs @@ -98,19 +98,13 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql connectionInfo.UseConsoleSession = (bool)dataRow["ConnectToConsole"]; connectionInfo.UseCredSsp = (bool)dataRow["UseCredSsp"]; connectionInfo.UseVmId = (bool)dataRow["UseVmId"]; - connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine), - (string)dataRow["RenderingEngine"]); - connectionInfo.RDPAuthenticationLevel = - (AuthenticationLevel)Enum.Parse(typeof(AuthenticationLevel), - (string)dataRow["RDPAuthenticationLevel"]); + connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine), (string)dataRow["RenderingEngine"]); + connectionInfo.RDPAuthenticationLevel = (AuthenticationLevel)Enum.Parse(typeof(AuthenticationLevel), (string)dataRow["RDPAuthenticationLevel"]); connectionInfo.RDPMinutesToIdleTimeout = (int)dataRow["RDPMinutesToIdleTimeout"]; connectionInfo.RDPAlertIdleTimeout = (bool)dataRow["RDPAlertIdleTimeout"]; connectionInfo.LoadBalanceInfo = (string)dataRow["LoadBalanceInfo"]; - connectionInfo.Colors = - (RDPColors)Enum.Parse(typeof(RDPColors), (string)dataRow["Colors"]); - connectionInfo.Resolution = - (RDPResolutions)Enum.Parse(typeof(RDPResolutions), - (string)dataRow["Resolution"]); + connectionInfo.Colors = (RDPColors)Enum.Parse(typeof(RDPColors), (string)dataRow["Colors"]); + connectionInfo.Resolution = (RDPResolutions)Enum.Parse(typeof(RDPResolutions), (string)dataRow["Resolution"]); connectionInfo.AutomaticResize = (bool)dataRow["AutomaticResize"]; connectionInfo.DisplayWallpaper = (bool)dataRow["DisplayWallpaper"]; connectionInfo.DisplayThemes = (bool)dataRow["DisplayThemes"]; @@ -126,43 +120,30 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql connectionInfo.RedirectPrinters = (bool)dataRow["RedirectPrinters"]; connectionInfo.RedirectClipboard = (bool)dataRow["RedirectClipboard"]; connectionInfo.RedirectSmartCards = (bool)dataRow["RedirectSmartCards"]; - connectionInfo.RedirectSound = - (RDPSounds)Enum.Parse(typeof(RDPSounds), (string)dataRow["RedirectSound"]); - connectionInfo.SoundQuality = (RDPSoundQuality)Enum.Parse(typeof(RDPSoundQuality), - (string)dataRow["SoundQuality"]); + connectionInfo.RedirectSound = (RDPSounds)Enum.Parse(typeof(RDPSounds), (string)dataRow["RedirectSound"]); + connectionInfo.SoundQuality = (RDPSoundQuality)Enum.Parse(typeof(RDPSoundQuality), (string)dataRow["SoundQuality"]); connectionInfo.RedirectAudioCapture = (bool)dataRow["RedirectAudioCapture"]; - connectionInfo.RedirectKeys = (bool)dataRow["RedirectKeys"]; + connectionInfo.OpeningCommand = (string)dataRow["OpeningCommand"]; connectionInfo.PreExtApp = (string)dataRow["PreExtApp"]; connectionInfo.PostExtApp = (string)dataRow["PostExtApp"]; connectionInfo.MacAddress = (string)dataRow["MacAddress"]; connectionInfo.UserField = (string)dataRow["UserField"]; connectionInfo.ExtApp = (string)dataRow["ExtApp"]; - connectionInfo.VNCCompression = (ProtocolVNC.Compression)Enum.Parse(typeof(ProtocolVNC.Compression), - (string)dataRow["VNCCompression"]); - connectionInfo.VNCEncoding = - (ProtocolVNC.Encoding)Enum.Parse(typeof(ProtocolVNC.Encoding), (string)dataRow["VNCEncoding"]); - connectionInfo.VNCAuthMode = - (ProtocolVNC.AuthMode)Enum.Parse(typeof(ProtocolVNC.AuthMode), (string)dataRow["VNCAuthMode"]); - connectionInfo.VNCProxyType = - (ProtocolVNC.ProxyType)Enum.Parse(typeof(ProtocolVNC.ProxyType), (string)dataRow["VNCProxyType"]); + connectionInfo.VNCCompression = (ProtocolVNC.Compression)Enum.Parse(typeof(ProtocolVNC.Compression), (string)dataRow["VNCCompression"]); + connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Enum.Parse(typeof(ProtocolVNC.Encoding), (string)dataRow["VNCEncoding"]); + connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Enum.Parse(typeof(ProtocolVNC.AuthMode), (string)dataRow["VNCAuthMode"]); + connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Enum.Parse(typeof(ProtocolVNC.ProxyType), (string)dataRow["VNCProxyType"]); connectionInfo.VNCProxyIP = (string)dataRow["VNCProxyIP"]; connectionInfo.VNCProxyPort = (int)dataRow["VNCProxyPort"]; connectionInfo.VNCProxyUsername = (string)dataRow["VNCProxyUsername"]; 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.VNCColors = (ProtocolVNC.Colors)Enum.Parse(typeof(ProtocolVNC.Colors), (string)dataRow["VNCColors"]); + connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), (string)dataRow["VNCSmartSizeMode"]); connectionInfo.VNCViewOnly = (bool)dataRow["VNCViewOnly"]; - connectionInfo.RDGatewayUsageMethod = - (RDGatewayUsageMethod)Enum.Parse(typeof(RDGatewayUsageMethod), - (string)dataRow["RDGatewayUsageMethod"]); + connectionInfo.RDGatewayUsageMethod = (RDGatewayUsageMethod)Enum.Parse(typeof(RDGatewayUsageMethod), (string)dataRow["RDGatewayUsageMethod"]); connectionInfo.RDGatewayHostname = (string)dataRow["RDGatewayHostname"]; - connectionInfo.RDGatewayUseConnectionCredentials = - (RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RDGatewayUseConnectionCredentials), - (string)dataRow["RDGatewayUseConnectionCredentials"]); + connectionInfo.RDGatewayUseConnectionCredentials = (RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RDGatewayUseConnectionCredentials), (string)dataRow["RDGatewayUseConnectionCredentials"]); connectionInfo.RDGatewayUsername = (string)dataRow["RDGatewayUsername"]; connectionInfo.RDGatewayPassword = DecryptValue((string)dataRow["RDGatewayPassword"]); connectionInfo.RDGatewayDomain = (string)dataRow["RDGatewayDomain"]; @@ -214,6 +195,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql connectionInfo.Inheritance.RDPAlertIdleTimeout = (bool)dataRow["InheritRDPAlertIdleTimeout"]; connectionInfo.Inheritance.RDPMinutesToIdleTimeout = (bool)dataRow["InheritRDPMinutesToIdleTimeout"]; connectionInfo.Inheritance.LoadBalanceInfo = (bool)dataRow["InheritLoadBalanceInfo"]; + connectionInfo.Inheritance.OpeningCommand = (bool)dataRow["InheritOpeningCommand"]; connectionInfo.Inheritance.PreExtApp = (bool)dataRow["InheritPreExtApp"]; connectionInfo.Inheritance.PostExtApp = (bool)dataRow["InheritPostExtApp"]; connectionInfo.Inheritance.MacAddress = (bool)dataRow["InheritMacAddress"]; @@ -232,8 +214,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql connectionInfo.Inheritance.VNCViewOnly = (bool)dataRow["InheritVNCViewOnly"]; connectionInfo.Inheritance.RDGatewayUsageMethod = (bool)dataRow["InheritRDGatewayUsageMethod"]; connectionInfo.Inheritance.RDGatewayHostname = (bool)dataRow["InheritRDGatewayHostname"]; - connectionInfo.Inheritance.RDGatewayUseConnectionCredentials = - (bool)dataRow["InheritRDGatewayUseConnectionCredentials"]; + connectionInfo.Inheritance.RDGatewayUseConnectionCredentials = (bool)dataRow["InheritRDGatewayUseConnectionCredentials"]; connectionInfo.Inheritance.RDGatewayUsername = (bool)dataRow["InheritRDGatewayUsername"]; connectionInfo.Inheritance.RDGatewayPassword = (bool)dataRow["InheritRDGatewayPassword"]; connectionInfo.Inheritance.RDGatewayDomain = (bool)dataRow["InheritRDGatewayDomain"]; diff --git a/mRemoteNG/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs b/mRemoteNG/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs index af1c7b7e..34a4834a 100644 --- a/mRemoteNG/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs +++ b/mRemoteNG/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs @@ -138,6 +138,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql dataTable.Columns.Add("RedirectAudioCapture", typeof(bool)); dataTable.Columns.Add("RedirectKeys", typeof(bool)); dataTable.Columns.Add("Connected", typeof(bool)); + dataTable.Columns.Add("OpeningCommand", typeof(string)); dataTable.Columns.Add("PreExtApp", typeof(string)); dataTable.Columns.Add("PostExtApp", typeof(string)); dataTable.Columns.Add("MacAddress", typeof(string)); @@ -194,6 +195,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql dataTable.Columns.Add("InheritRenderingEngine", typeof(bool)); dataTable.Columns.Add("InheritRDPAuthenticationLevel", typeof(bool)); dataTable.Columns.Add("InheritUsername", typeof(bool)); + dataTable.Columns.Add("InheritOpeningCommand", typeof(bool)); dataTable.Columns.Add("InheritPreExtApp", typeof(bool)); dataTable.Columns.Add("InheritPostExtApp", typeof(bool)); dataTable.Columns.Add("InheritMacAddress", typeof(bool)); @@ -318,6 +320,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql isFieldNotChange = isFieldNotChange && dataRow["Connected"].Equals(false) && // TODO: this column can eventually be removed. we now save this property locally + dataRow["OpeningCommand"].Equals(connectionInfo.OpeningCommand) && dataRow["PreExtApp"].Equals(connectionInfo.PreExtApp) && dataRow["PostExtApp"].Equals(connectionInfo.PostExtApp) && dataRow["MacAddress"].Equals(connectionInfo.MacAddress) && @@ -337,7 +340,6 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql dataRow["RDGatewayHostname"].Equals(connectionInfo.RDGatewayHostname) && dataRow["RDGatewayUseConnectionCredentials"].Equals(connectionInfo.RDGatewayUseConnectionCredentials.ToString()) && dataRow["RDGatewayUsername"].Equals(connectionInfo.RDGatewayUsername) && - dataRow["RDGatewayDomain"].Equals(connectionInfo.RDGatewayDomain) && dataRow["RdpVersion"].Equals(connectionInfo.RdpVersion.ToString()); @@ -384,6 +386,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql dataRow["InheritRDPMinutesToIdleTimeout"].Equals(connectionInfo.Inheritance.RDPMinutesToIdleTimeout) && dataRow["InheritRDPAlertIdleTimeout"].Equals(connectionInfo.Inheritance.RDPAlertIdleTimeout) && dataRow["InheritLoadBalanceInfo"].Equals(connectionInfo.Inheritance.LoadBalanceInfo) && + dataRow["InheritOpeningCommand"].Equals(connectionInfo.Inheritance.OpeningCommand) && dataRow["InheritPreExtApp"].Equals(connectionInfo.Inheritance.PreExtApp) && dataRow["InheritPostExtApp"].Equals(connectionInfo.Inheritance.PostExtApp) && dataRow["InheritMacAddress"].Equals(connectionInfo.Inheritance.MacAddress) && @@ -447,6 +450,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql dataRow["InheritRDPMinutesToIdleTimeout"].Equals(false) && dataRow["InheritRDPAlertIdleTimeout"].Equals(false) && dataRow["InheritLoadBalanceInfo"].Equals(false) && + dataRow["InheritOpeningCommand"].Equals(false) && dataRow["InheritPreExtApp"].Equals(false) && dataRow["InheritPostExtApp"].Equals(false) && dataRow["InheritMacAddress"].Equals(false) && @@ -551,6 +555,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql dataRow["RedirectAudioCapture"] = connectionInfo.RedirectAudioCapture; dataRow["RedirectKeys"] = connectionInfo.RedirectKeys; dataRow["Connected"] = false; // TODO: this column can eventually be removed. we now save this property locally + dataRow["OpeningCommand"] = connectionInfo.OpeningCommand; dataRow["PreExtApp"] = connectionInfo.PreExtApp; dataRow["PostExtApp"] = connectionInfo.PostExtApp; dataRow["MacAddress"] = connectionInfo.MacAddress; @@ -622,6 +627,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql dataRow["InheritRDPMinutesToIdleTimeout"] = connectionInfo.Inheritance.RDPMinutesToIdleTimeout; dataRow["InheritRDPAlertIdleTimeout"] = connectionInfo.Inheritance.RDPAlertIdleTimeout; dataRow["InheritLoadBalanceInfo"] = connectionInfo.Inheritance.LoadBalanceInfo; + dataRow["InheritOpeningCommand"] = connectionInfo.Inheritance.OpeningCommand; dataRow["InheritPreExtApp"] = connectionInfo.Inheritance.PreExtApp; dataRow["InheritPostExtApp"] = connectionInfo.Inheritance.PostExtApp; dataRow["InheritMacAddress"] = connectionInfo.Inheritance.MacAddress; @@ -687,6 +693,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql dataRow["InheritRDPMinutesToIdleTimeout"] = false; dataRow["InheritRDPAlertIdleTimeout"] = false; dataRow["InheritLoadBalanceInfo"] = false; + dataRow["InheritOpeningCommand"] = false; dataRow["InheritPreExtApp"] = false; dataRow["InheritPostExtApp"] = false; dataRow["InheritMacAddress"] = false; diff --git a/mRemoteNGTests/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsDeserializerMremotengFormatTests.cs b/mRemoteNGTests/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsDeserializerMremotengFormatTests.cs index 6505ec4c..3258164c 100644 --- a/mRemoteNGTests/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsDeserializerMremotengFormatTests.cs +++ b/mRemoteNGTests/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsDeserializerMremotengFormatTests.cs @@ -78,6 +78,7 @@ namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Csv Hostname = "SomeHostname", PuttySession = "SomePuttySession", LoadBalanceInfo = "SomeLoadBalanceInfo", + OpeningCommand = "SomeOpeningCommand", PreExtApp = "SomePreExtApp", PostExtApp = "SomePostExtApp", MacAddress = "SomeMacAddress",