diff --git a/mRemoteNGTests/Config/Serializers/DataTableSerializerTests.cs b/mRemoteNGTests/Config/Serializers/DataTableSerializerTests.cs index 6fff1b423..223f7985a 100644 --- a/mRemoteNGTests/Config/Serializers/DataTableSerializerTests.cs +++ b/mRemoteNGTests/Config/Serializers/DataTableSerializerTests.cs @@ -11,12 +11,12 @@ namespace mRemoteNGTests.Config.Serializers public class DataTableSerializerTests { private DataTableSerializer _dataTableSerializer; - private Save _saveFilter; + private SaveFilter _saveFilter; [SetUp] public void Setup() { - _saveFilter = new Save(); + _saveFilter = new SaveFilter(); _dataTableSerializer = new DataTableSerializer(_saveFilter); } diff --git a/mRemoteV1/App/Export.cs b/mRemoteV1/App/Export.cs index 3a85ea824..774e07239 100644 --- a/mRemoteV1/App/Export.cs +++ b/mRemoteV1/App/Export.cs @@ -20,7 +20,7 @@ namespace mRemoteNG.App { try { - var saveSecurity = new Save(); + var saveSecurity = new SaveFilter(); using (var exportForm = new ExportForm()) { @@ -65,7 +65,7 @@ namespace mRemoteNG.App } } - private static void SaveExportFile(string fileName, ConnectionsSaver.Format saveFormat, Save saveSecurity, ConnectionInfo exportTarget) + private static void SaveExportFile(string fileName, ConnectionsSaver.Format saveFormat, SaveFilter saveFilter, ConnectionInfo exportTarget) { try { @@ -74,15 +74,15 @@ namespace mRemoteNG.App { case ConnectionsSaver.Format.mRXML: serializer = new XmlConnectionsSerializer(); - ((XmlConnectionsSerializer) serializer).SaveSecurity = saveSecurity; + ((XmlConnectionsSerializer) serializer).SaveFilter = saveFilter; break; case ConnectionsSaver.Format.mRCSV: serializer = new CsvConnectionsSerializerMremotengFormat(); - ((CsvConnectionsSerializerMremotengFormat)serializer).SaveSecurity = saveSecurity; + ((CsvConnectionsSerializerMremotengFormat)serializer).SaveFilter = saveFilter; break; case ConnectionsSaver.Format.vRDCSV: serializer = new CsvConnectionsSerializerRemoteDesktop2008Format(); - ((CsvConnectionsSerializerRemoteDesktop2008Format)serializer).SaveSecurity = saveSecurity; + ((CsvConnectionsSerializerRemoteDesktop2008Format)serializer).SaveFilter = saveFilter; break; default: throw new ArgumentOutOfRangeException(nameof(saveFormat), saveFormat, null); diff --git a/mRemoteV1/App/Runtime.cs b/mRemoteV1/App/Runtime.cs index 3c2b67f42..e9f1bda56 100644 --- a/mRemoteV1/App/Runtime.cs +++ b/mRemoteV1/App/Runtime.cs @@ -451,7 +451,7 @@ namespace mRemoteNG.App connectionsSaver.ConnectionFileName = GetStartupConnectionFileName(); connectionsSaver.Export = false; - connectionsSaver.SaveSecurity = new Save(); + connectionsSaver.SaveFilter = new SaveFilter(); connectionsSaver.ConnectionTreeModel = ConnectionTreeModel; if (Settings.Default.UseSQLServer) @@ -506,7 +506,7 @@ namespace mRemoteNG.App connectionsSave.SaveFormat = ConnectionsSaver.Format.mRXML; connectionsSave.ConnectionFileName = saveFileDialog.FileName; connectionsSave.Export = false; - connectionsSave.SaveSecurity = new Save(); + connectionsSave.SaveFilter = new SaveFilter(); connectionsSave.ConnectionTreeModel = ConnectionTreeModel; connectionsSave.SaveConnections(); diff --git a/mRemoteV1/Config/Connections/ConnectionsSaver.cs b/mRemoteV1/Config/Connections/ConnectionsSaver.cs index f547fd7cc..799d4eecb 100644 --- a/mRemoteV1/Config/Connections/ConnectionsSaver.cs +++ b/mRemoteV1/Config/Connections/ConnectionsSaver.cs @@ -59,7 +59,7 @@ namespace mRemoteNG.Config.Connections public TreeNode RootTreeNode {get; set;} public bool Export {get; set;} public Format SaveFormat {get; set;} - public Save SaveSecurity {get; set;} + public SaveFilter SaveFilter {get; set;} public ConnectionTreeModel ConnectionTreeModel { get; set; } #endregion @@ -221,7 +221,7 @@ namespace mRemoteNG.Config.Connections { var sqlQuery = new SqlCommand("DELETE FROM tblCons", sqlDatabaseConnector.SqlConnection); sqlQuery.ExecuteNonQuery(); - var serializer = new DataTableSerializer(SaveSecurity); + var serializer = new DataTableSerializer(SaveFilter); var dataTable = serializer.Serialize(rootTreeNode); var dataProvider = new SqlDataProvider(sqlDatabaseConnector); dataProvider.Save(dataTable); @@ -243,7 +243,7 @@ namespace mRemoteNG.Config.Connections var xmlConnectionsSerializer = new XmlConnectionsSerializer() { Export = Export, - SaveSecurity = SaveSecurity, + SaveFilter = SaveFilter, UseFullEncryption = mRemoteNG.Settings.Default.EncryptCompleteConnectionsFile }; var xml = xmlConnectionsSerializer.Serialize(ConnectionTreeModel); @@ -259,7 +259,7 @@ namespace mRemoteNG.Config.Connections private void SaveToMremotengFormattedCsv() { - var csvConnectionsSerializer = new CsvConnectionsSerializerMremotengFormat { SaveSecurity = SaveSecurity }; + var csvConnectionsSerializer = new CsvConnectionsSerializerMremotengFormat { SaveFilter = SaveFilter }; var dataProvider = new FileDataProvider(ConnectionFileName); var csvContent = csvConnectionsSerializer.Serialize(ConnectionTreeModel); dataProvider.Save(csvContent); diff --git a/mRemoteV1/Config/Serializers/CsvConnectionsSerializerMremotengFormat.cs b/mRemoteV1/Config/Serializers/CsvConnectionsSerializerMremotengFormat.cs index 9a4f36055..a4d5b081b 100644 --- a/mRemoteV1/Config/Serializers/CsvConnectionsSerializerMremotengFormat.cs +++ b/mRemoteV1/Config/Serializers/CsvConnectionsSerializerMremotengFormat.cs @@ -12,7 +12,7 @@ namespace mRemoteNG.Config.Serializers { private string _csv = ""; - public Save SaveSecurity { get; set; } + public SaveFilter SaveFilter { get; set; } public string Serialize(ConnectionTreeModel connectionTreeModel) { @@ -32,14 +32,14 @@ namespace mRemoteNG.Config.Serializers { var csvHeader = string.Empty; csvHeader += "Name;Folder;Description;Icon;Panel;"; - if (SaveSecurity.Username) + if (SaveFilter.Username) csvHeader += "Username;"; - if (SaveSecurity.Password) + if (SaveFilter.Password) csvHeader += "Password;"; - if (SaveSecurity.Domain) + if (SaveFilter.Domain) csvHeader += "Domain;"; csvHeader += "Hostname;Protocol;PuttySession;Port;ConnectToConsole;UseCredSsp;RenderingEngine;ICAEncryptionStrength;RDPAuthenticationLevel;LoadBalanceInfo;Colors;Resolution;AutomaticResize;DisplayWallpaper;DisplayThemes;EnableFontSmoothing;EnableDesktopComposition;CacheBitmaps;RedirectDiskDrives;RedirectPorts;RedirectPrinters;RedirectSmartCards;RedirectSound;RedirectKeys;PreExtApp;PostExtApp;MacAddress;UserField;ExtApp;VNCCompression;VNCEncoding;VNCAuthMode;VNCProxyType;VNCProxyIP;VNCProxyPort;VNCProxyUsername;VNCProxyPassword;VNCColors;VNCSmartSizeMode;VNCViewOnly;RDGatewayUsageMethod;RDGatewayHostname;RDGatewayUseConnectionCredentials;RDGatewayUsername;RDGatewayPassword;RDGatewayDomain;"; - if (SaveSecurity.Inheritance) + if (SaveFilter.Inheritance) csvHeader += "InheritCacheBitmaps;InheritColors;InheritDescription;InheritDisplayThemes;InheritDisplayWallpaper;InheritEnableFontSmoothing;InheritEnableDesktopComposition;InheritDomain;InheritIcon;InheritPanel;InheritPassword;InheritPort;InheritProtocol;InheritPuttySession;InheritRedirectDiskDrives;InheritRedirectKeys;InheritRedirectPorts;InheritRedirectPrinters;InheritRedirectSmartCards;InheritRedirectSound;InheritResolution;InheritAutomaticResize;InheritUseConsoleSession;InheritUseCredSsp;InheritRenderingEngine;InheritUsername;InheritICAEncryptionStrength;InheritRDPAuthenticationLevel;InheritLoadBalanceInfo;InheritPreExtApp;InheritPostExtApp;InheritMacAddress;InheritUserField;InheritExtApp;InheritVNCCompression;InheritVNCEncoding;InheritVNCAuthMode;InheritVNCProxyType;InheritVNCProxyIP;InheritVNCProxyPort;InheritVNCProxyUsername;InheritVNCProxyPassword;InheritVNCColors;InheritVNCSmartSizeMode;InheritVNCViewOnly;InheritRDGatewayUsageMethod;InheritRDGatewayHostname;InheritRDGatewayUseConnectionCredentials;InheritRDGatewayUsername;InheritRDGatewayPassword;InheritRDGatewayDomain"; _csv += csvHeader; } @@ -75,18 +75,18 @@ namespace mRemoteNG.Config.Serializers csvLine += con.Name + ";" + nodePath + ";" + con.Description + ";" + con.Icon + ";" + con.Panel + ";"; - if (SaveSecurity.Username) + if (SaveFilter.Username) csvLine += con.Username + ";"; - if (SaveSecurity.Password) + if (SaveFilter.Password) csvLine += con.Password + ";"; - if (SaveSecurity.Domain) + if (SaveFilter.Domain) csvLine += con.Domain + ";"; csvLine += con.Hostname + ";" + con.Protocol + ";" + con.PuttySession + ";" + Convert.ToString(con.Port) + ";" + Convert.ToString(con.UseConsoleSession) + ";" + Convert.ToString(con.UseCredSsp) + ";" + con.RenderingEngine + ";" + con.ICAEncryptionStrength + ";" + con.RDPAuthenticationLevel + ";" + con.LoadBalanceInfo + ";" + con.Colors + ";" + con.Resolution + ";" + Convert.ToString(con.AutomaticResize) + ";" + Convert.ToString(con.DisplayWallpaper) + ";" + Convert.ToString(con.DisplayThemes) + ";" + Convert.ToString(con.EnableFontSmoothing) + ";" + Convert.ToString(con.EnableDesktopComposition) + ";" + Convert.ToString(con.CacheBitmaps) + ";" + Convert.ToString(con.RedirectDiskDrives) + ";" + Convert.ToString(con.RedirectPorts) + ";" + Convert.ToString(con.RedirectPrinters) + ";" + Convert.ToString(con.RedirectSmartCards) + ";" + con.RedirectSound + ";" + Convert.ToString(con.RedirectKeys) + ";" + con.PreExtApp + ";" + con.PostExtApp + ";" + con.MacAddress + ";" + con.UserField + ";" + con.ExtApp + ";" + con.VNCCompression + ";" + con.VNCEncoding + ";" + con.VNCAuthMode + ";" + con.VNCProxyType + ";" + con.VNCProxyIP + ";" + Convert.ToString(con.VNCProxyPort) + ";" + con.VNCProxyUsername + ";" + con.VNCProxyPassword + ";" + con.VNCColors + ";" + con.VNCSmartSizeMode + ";" + Convert.ToString(con.VNCViewOnly) + ";"; - if (SaveSecurity.Inheritance) + if (SaveFilter.Inheritance) { csvLine += con.Inheritance.CacheBitmaps + ";" + con.Inheritance.Colors + ";" + diff --git a/mRemoteV1/Config/Serializers/CsvConnectionsSerializerRemoteDesktop2008Format.cs b/mRemoteV1/Config/Serializers/CsvConnectionsSerializerRemoteDesktop2008Format.cs index 471c11ca2..867be5bc1 100644 --- a/mRemoteV1/Config/Serializers/CsvConnectionsSerializerRemoteDesktop2008Format.cs +++ b/mRemoteV1/Config/Serializers/CsvConnectionsSerializerRemoteDesktop2008Format.cs @@ -12,7 +12,7 @@ namespace mRemoteNG.Config.Serializers public class CsvConnectionsSerializerRemoteDesktop2008Format : ISerializer { private string _csv = ""; - public Save SaveSecurity { get; set; } + public SaveFilter SaveFilter { get; set; } public string Serialize(ConnectionTreeModel connectionTreeModel) { diff --git a/mRemoteV1/Config/Serializers/DataTableSerializer.cs b/mRemoteV1/Config/Serializers/DataTableSerializer.cs index f69f5cb82..2ecba6c43 100644 --- a/mRemoteV1/Config/Serializers/DataTableSerializer.cs +++ b/mRemoteV1/Config/Serializers/DataTableSerializer.cs @@ -14,12 +14,12 @@ namespace mRemoteNG.Config.Serializers { private DataTable _dataTable; private const string TableName = "tblCons"; - private readonly Save _saveSecurity; + private readonly SaveFilter _saveFilter; private int _currentNodeIndex; - public DataTableSerializer(Save saveSecurity) + public DataTableSerializer(SaveFilter saveFilter) { - _saveSecurity = saveSecurity; + _saveFilter = saveFilter; } @@ -186,9 +186,9 @@ namespace mRemoteNG.Config.Serializers dataRow["Description"] = connectionInfo.Description; dataRow["Icon"] = connectionInfo.Icon; dataRow["Panel"] = connectionInfo.Panel; - dataRow["Username"] = _saveSecurity.Username ? connectionInfo.Username : ""; - dataRow["DomainName"] = _saveSecurity.Domain ? connectionInfo.Domain : ""; - dataRow["Password"] = _saveSecurity.Password ? connectionInfo.Password : ""; + dataRow["Username"] = _saveFilter.Username ? connectionInfo.Username : ""; + dataRow["DomainName"] = _saveFilter.Domain ? connectionInfo.Domain : ""; + dataRow["Password"] = _saveFilter.Password ? connectionInfo.Password : ""; dataRow["Hostname"] = connectionInfo.Hostname; dataRow["Protocol"] = connectionInfo.Protocol; dataRow["PuttySession"] = connectionInfo.PuttySession; @@ -236,7 +236,7 @@ namespace mRemoteNG.Config.Serializers dataRow["RDGatewayUsername"] = connectionInfo.RDGatewayUsername; dataRow["RDGatewayPassword"] = connectionInfo.RDGatewayPassword; dataRow["RDGatewayDomain"] = connectionInfo.RDGatewayDomain; - if (_saveSecurity.Inheritance) + if (_saveFilter.Inheritance) { dataRow["InheritCacheBitmaps"] = connectionInfo.Inheritance.CacheBitmaps; dataRow["InheritColors"] = connectionInfo.Inheritance.Colors; diff --git a/mRemoteV1/Config/Serializers/XmlConnectionsSerializer.cs b/mRemoteV1/Config/Serializers/XmlConnectionsSerializer.cs index c12543137..537cc60f4 100644 --- a/mRemoteV1/Config/Serializers/XmlConnectionsSerializer.cs +++ b/mRemoteV1/Config/Serializers/XmlConnectionsSerializer.cs @@ -23,7 +23,7 @@ namespace mRemoteNG.Config.Serializers private ICryptographyProvider _cryptographyProvider; public bool Export { get; set; } - public Save SaveSecurity { get; set; } = new Save(); + public SaveFilter SaveFilter { get; set; } = new SaveFilter(); public bool UseFullEncryption { get; set; } @@ -199,17 +199,17 @@ namespace mRemoteNG.Config.Serializers _xmlTextWriter.WriteAttributeString("Icon", "", connectionInfo.Icon); _xmlTextWriter.WriteAttributeString("Panel", "", connectionInfo.Panel); - if (SaveSecurity.Username) + if (SaveFilter.Username) _xmlTextWriter.WriteAttributeString("Username", "", connectionInfo.Username); else _xmlTextWriter.WriteAttributeString("Username", "", ""); - if (SaveSecurity.Domain) + if (SaveFilter.Domain) _xmlTextWriter.WriteAttributeString("Domain", "", connectionInfo.Domain); else _xmlTextWriter.WriteAttributeString("Domain", "", ""); - if (SaveSecurity.Password) + if (SaveFilter.Password) _xmlTextWriter.WriteAttributeString("Password", "", _cryptographyProvider.Encrypt(connectionInfo.Password, _password)); else _xmlTextWriter.WriteAttributeString("Password", "", ""); @@ -266,22 +266,22 @@ namespace mRemoteNG.Config.Serializers _xmlTextWriter.WriteAttributeString("RDGatewayHostname", "", connectionInfo.RDGatewayHostname); _xmlTextWriter.WriteAttributeString("RDGatewayUseConnectionCredentials", "", connectionInfo.RDGatewayUseConnectionCredentials.ToString()); - if (SaveSecurity.Username) + if (SaveFilter.Username) _xmlTextWriter.WriteAttributeString("RDGatewayUsername", "", connectionInfo.RDGatewayUsername); else _xmlTextWriter.WriteAttributeString("RDGatewayUsername", "", ""); - if (SaveSecurity.Password) + if (SaveFilter.Password) _xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", _cryptographyProvider.Encrypt(connectionInfo.RDGatewayPassword, _password)); else _xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", ""); - if (SaveSecurity.Domain) + if (SaveFilter.Domain) _xmlTextWriter.WriteAttributeString("RDGatewayDomain", "", connectionInfo.RDGatewayDomain); else _xmlTextWriter.WriteAttributeString("RDGatewayDomain", "", ""); - if (SaveSecurity.Inheritance) + if (SaveFilter.Inheritance) { _xmlTextWriter.WriteAttributeString("InheritCacheBitmaps", "", Convert.ToString(connectionInfo.Inheritance.CacheBitmaps)); _xmlTextWriter.WriteAttributeString("InheritColors", "", Convert.ToString(connectionInfo.Inheritance.Colors)); diff --git a/mRemoteV1/Security/Security.Save.cs b/mRemoteV1/Security/Security.Save.cs index 91619e676..bc3dc5edc 100644 --- a/mRemoteV1/Security/Security.Save.cs +++ b/mRemoteV1/Security/Security.Save.cs @@ -1,9 +1,9 @@ namespace mRemoteNG.Security { - public class Save + public class SaveFilter { - public Save(bool disableEverything = false) + public SaveFilter(bool disableEverything = false) { if (disableEverything) return; Username = true;