rename class from mssql to sql

This class is not dedicated to mssql but is used by all sql databases. Rename to reflect this.
This commit is contained in:
BlueBlock
2023-03-23 16:20:01 -04:00
parent 7cb20b9e28
commit fc8e9c7689
6 changed files with 1420 additions and 1197 deletions

View File

@@ -1,282 +1,282 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Runtime.Versioning; using System.Runtime.Versioning;
using System.Security; using System.Security;
using mRemoteNG.App; using mRemoteNG.App;
using mRemoteNG.Connection; using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol; using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.Http; using mRemoteNG.Connection.Protocol.Http;
using mRemoteNG.Connection.Protocol.RDP; using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Connection.Protocol.VNC; using mRemoteNG.Connection.Protocol.VNC;
using mRemoteNG.Container; using mRemoteNG.Container;
using mRemoteNG.Security; using mRemoteNG.Messages;
using mRemoteNG.Tools; using mRemoteNG.Security;
using mRemoteNG.Tree; using mRemoteNG.Tools;
using mRemoteNG.Tree.Root; using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql
{ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Sql
[SupportedOSPlatform("windows")] {
public class DataTableDeserializer : IDeserializer<DataTable, ConnectionTreeModel> [SupportedOSPlatform("windows")]
{ public class DataTableDeserializer : IDeserializer<DataTable, ConnectionTreeModel>
private readonly ICryptographyProvider _cryptographyProvider; {
private readonly SecureString _decryptionKey; private readonly ICryptographyProvider _cryptographyProvider;
private readonly SecureString _decryptionKey;
public DataTableDeserializer(ICryptographyProvider cryptographyProvider, SecureString decryptionKey)
{ public DataTableDeserializer(ICryptographyProvider cryptographyProvider, SecureString decryptionKey)
_cryptographyProvider = cryptographyProvider.ThrowIfNull(nameof(cryptographyProvider)); {
_decryptionKey = decryptionKey.ThrowIfNull(nameof(decryptionKey)); _cryptographyProvider = cryptographyProvider.ThrowIfNull(nameof(cryptographyProvider));
} _decryptionKey = decryptionKey.ThrowIfNull(nameof(decryptionKey));
}
public ConnectionTreeModel Deserialize(DataTable table)
{ public ConnectionTreeModel Deserialize(DataTable table)
var connectionList = CreateNodesFromTable(table); {
var connectionTreeModel = CreateNodeHierarchy(connectionList, table); var connectionList = CreateNodesFromTable(table);
Runtime.ConnectionsService.IsConnectionsFileLoaded = true; var connectionTreeModel = CreateNodeHierarchy(connectionList, table);
return connectionTreeModel; Runtime.ConnectionsService.IsConnectionsFileLoaded = true;
} return connectionTreeModel;
}
private List<ConnectionInfo> CreateNodesFromTable(DataTable table)
{ private List<ConnectionInfo> CreateNodesFromTable(DataTable table)
var nodeList = new List<ConnectionInfo>(); {
foreach (DataRow row in table.Rows) var nodeList = new List<ConnectionInfo>();
{ foreach (DataRow row in table.Rows)
// ReSharper disable once SwitchStatementMissingSomeCases {
switch ((string)row["Type"]) // ReSharper disable once SwitchStatementMissingSomeCases
{ switch ((string)row["Type"])
case "Connection": {
nodeList.Add(DeserializeConnectionInfo(row)); case "Connection":
break; nodeList.Add(DeserializeConnectionInfo(row));
case "Container": break;
nodeList.Add(DeserializeContainerInfo(row)); case "Container":
break; nodeList.Add(DeserializeContainerInfo(row));
} break;
} }
}
return nodeList;
} return nodeList;
}
private ConnectionInfo DeserializeConnectionInfo(DataRow row)
{ private ConnectionInfo DeserializeConnectionInfo(DataRow row)
var connectionId = row["ConstantID"] as string ?? Guid.NewGuid().ToString(); {
var connectionInfo = new ConnectionInfo(connectionId); var connectionId = row["ConstantID"] as string ?? Guid.NewGuid().ToString();
PopulateConnectionInfoFromDatarow(row, connectionInfo); var connectionInfo = new ConnectionInfo(connectionId);
return connectionInfo; PopulateConnectionInfoFromDatarow(row, connectionInfo);
} return connectionInfo;
}
private ContainerInfo DeserializeContainerInfo(DataRow row)
{ private ContainerInfo DeserializeContainerInfo(DataRow row)
var containerId = row["ConstantID"] as string ?? Guid.NewGuid().ToString(); {
var containerInfo = new ContainerInfo(containerId); var containerId = row["ConstantID"] as string ?? Guid.NewGuid().ToString();
PopulateConnectionInfoFromDatarow(row, containerInfo); var containerInfo = new ContainerInfo(containerId);
return containerInfo; PopulateConnectionInfoFromDatarow(row, containerInfo);
} return containerInfo;
}
private void PopulateConnectionInfoFromDatarow(DataRow dataRow, ConnectionInfo connectionInfo)
{ private void PopulateConnectionInfoFromDatarow(DataRow dataRow, ConnectionInfo connectionInfo)
connectionInfo.Name = (string)dataRow["Name"]; {
connectionInfo.Name = (string)dataRow["Name"];
// This throws a NPE - Parent is a connectionInfo object which will be null at this point.
// The Parent object is linked properly later in CreateNodeHierarchy() // This throws a NPE - Parent is a connectionInfo object which will be null at this point.
//connectionInfo.Parent.ConstantID = (string)dataRow["ParentID"]; // The Parent object is linked properly later in CreateNodeHierarchy()
//connectionInfo.Parent.ConstantID = (string)dataRow["ParentID"];
connectionInfo.Description = (string)dataRow["Description"];
connectionInfo.Icon = (string)dataRow["Icon"]; //connectionInfo.EC2InstanceId = (string)dataRow["EC2InstanceId"];
connectionInfo.Panel = (string)dataRow["Panel"]; //connectionInfo.EC2Region = (string)dataRow["EC2Region"];
//connectionInfo.ExternalCredentialProvider = (ExternalCredentialProvider)Enum.Parse(typeof(ExternalCredentialProvider), (string)dataRow["ExternalCredentialProvider"]); //connectionInfo.ExternalAddressProvider = (ExternalAddressProvider)Enum.Parse(typeof(ExternalAddressProvider), (string)dataRow["ExternalAddressProvider"]);
//connectionInfo.UserViaAPI = (string)dataRow["UserViaAPI"]; //connectionInfo.ExternalCredentialProvider = (ExternalCredentialProvider)Enum.Parse(typeof(ExternalCredentialProvider), (string)dataRow["ExternalCredentialProvider"]);
connectionInfo.Username = (string)dataRow["Username"]; //connectionInfo.RDGatewayExternalCredentialProvider = (ExternalCredentialProvider)Enum.Parse(typeof(ExternalCredentialProvider), (string)dataRow["RDGatewayExternalCredentialProvider"]);
connectionInfo.Domain = (string)dataRow["Domain"]; //connectionInfo.RDGatewayUserViaAPI = (string)dataRow["RDGatewayUserViaAPI"];
connectionInfo.Password = DecryptValue((string)dataRow["Password"]); //connectionInfo.UserViaAPI = (string)dataRow["UserViaAPI"];
connectionInfo.Hostname = (string)dataRow["Hostname"]; connectionInfo.AutomaticResize = MiscTools.GetBooleanValue(dataRow["AutomaticResize"]);
//connectionInfo.ExternalAddressProvider = (ExternalAddressProvider)Enum.Parse(typeof(ExternalAddressProvider), (string)dataRow["ExternalAddressProvider"]); connectionInfo.CacheBitmaps = MiscTools.GetBooleanValue(dataRow["CacheBitmaps"]);
//connectionInfo.EC2Region = (string)dataRow["EC2Region"]; connectionInfo.Colors = (RDPColors)Enum.Parse(typeof(RDPColors), (string)dataRow["Colors"]);
//connectionInfo.EC2InstanceId = (string)dataRow["EC2InstanceId"]; connectionInfo.Description = (string)dataRow["Description"];
connectionInfo.VmId = (string)dataRow["VmId"]; connectionInfo.DisableCursorBlinking = MiscTools.GetBooleanValue(dataRow["DisableCursorBlinking"]);
connectionInfo.UseEnhancedMode = (bool)dataRow["UseEnhancedMode"]; connectionInfo.DisableCursorShadow = MiscTools.GetBooleanValue(dataRow["DisableCursorShadow"]);
connectionInfo.Protocol = (ProtocolType)Enum.Parse(typeof(ProtocolType), (string)dataRow["Protocol"]); connectionInfo.DisableFullWindowDrag = MiscTools.GetBooleanValue(dataRow["DisableFullWindowDrag"]);
connectionInfo.SSHTunnelConnectionName = (string)dataRow["SSHTunnelConnectionName"]; connectionInfo.DisableMenuAnimations = MiscTools.GetBooleanValue(dataRow["DisableMenuAnimations"]);
connectionInfo.OpeningCommand = (string)dataRow["OpeningCommand"]; connectionInfo.DisplayThemes = MiscTools.GetBooleanValue(dataRow["DisplayThemes"]);
connectionInfo.SSHOptions = (string)dataRow["SSHOptions"]; connectionInfo.DisplayWallpaper = MiscTools.GetBooleanValue(dataRow["DisplayWallpaper"]);
connectionInfo.PuttySession = (string)dataRow["PuttySession"]; connectionInfo.Domain = (string)dataRow["Domain"];
connectionInfo.Port = (int)dataRow["Port"]; connectionInfo.EnableDesktopComposition = MiscTools.GetBooleanValue(dataRow["EnableDesktopComposition"]);
connectionInfo.UseConsoleSession = (bool)dataRow["ConnectToConsole"]; connectionInfo.EnableFontSmoothing = MiscTools.GetBooleanValue(dataRow["EnableFontSmoothing"]);
connectionInfo.UseCredSsp = (bool)dataRow["UseCredSsp"]; connectionInfo.ExtApp = (string)dataRow["ExtApp"];
connectionInfo.UseRestrictedAdmin = (bool)dataRow["UseRestrictedAdmin"]; connectionInfo.Hostname = (string)dataRow["Hostname"];
connectionInfo.UseRCG = (bool)dataRow["UseRCG"]; connectionInfo.Icon = (string)dataRow["Icon"];
connectionInfo.UseVmId = (bool)dataRow["UseVmId"]; connectionInfo.LoadBalanceInfo = (string)dataRow["LoadBalanceInfo"];
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine), (string)dataRow["RenderingEngine"]); connectionInfo.MacAddress = (string)dataRow["MacAddress"];
connectionInfo.RDPAuthenticationLevel = (AuthenticationLevel)Enum.Parse(typeof(AuthenticationLevel), (string)dataRow["RDPAuthenticationLevel"]); connectionInfo.OpeningCommand = (string)dataRow["OpeningCommand"];
connectionInfo.RDPMinutesToIdleTimeout = (int)dataRow["RDPMinutesToIdleTimeout"]; connectionInfo.OpeningCommand = (string)dataRow["OpeningCommand"];
connectionInfo.RDPAlertIdleTimeout = (bool)dataRow["RDPAlertIdleTimeout"]; connectionInfo.Panel = (string)dataRow["Panel"];
connectionInfo.LoadBalanceInfo = (string)dataRow["LoadBalanceInfo"]; connectionInfo.Password = DecryptValue((string)dataRow["Password"]);
connectionInfo.Colors = (RDPColors)Enum.Parse(typeof(RDPColors), (string)dataRow["Colors"]); connectionInfo.Port = (int)dataRow["Port"];
connectionInfo.Resolution = (RDPResolutions)Enum.Parse(typeof(RDPResolutions), (string)dataRow["Resolution"]); connectionInfo.PostExtApp = (string)dataRow["PostExtApp"];
connectionInfo.AutomaticResize = (bool)dataRow["AutomaticResize"]; connectionInfo.PreExtApp = (string)dataRow["PreExtApp"];
connectionInfo.DisplayWallpaper = (bool)dataRow["DisplayWallpaper"]; connectionInfo.Protocol = (ProtocolType)Enum.Parse(typeof(ProtocolType), (string)dataRow["Protocol"]);
connectionInfo.DisplayThemes = (bool)dataRow["DisplayThemes"]; connectionInfo.PuttySession = (string)dataRow["PuttySession"];
connectionInfo.EnableFontSmoothing = (bool)dataRow["EnableFontSmoothing"]; connectionInfo.RDGatewayDomain = (string)dataRow["RDGatewayDomain"];
connectionInfo.EnableDesktopComposition = (bool)dataRow["EnableDesktopComposition"]; connectionInfo.RDGatewayHostname = (string)dataRow["RDGatewayHostname"];
connectionInfo.DisableFullWindowDrag = (bool)dataRow["DisableFullWindowDrag"]; connectionInfo.RDGatewayPassword = DecryptValue((string)dataRow["RDGatewayPassword"]);
connectionInfo.DisableMenuAnimations = (bool)dataRow["DisableMenuAnimations"]; connectionInfo.RDGatewayUsageMethod = (RDGatewayUsageMethod)Enum.Parse(typeof(RDGatewayUsageMethod), (string)dataRow["RDGatewayUsageMethod"]);
connectionInfo.DisableCursorShadow = (bool)dataRow["DisableCursorShadow"]; connectionInfo.RDGatewayUseConnectionCredentials = (RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RDGatewayUseConnectionCredentials), (string)dataRow["RDGatewayUseConnectionCredentials"]);
connectionInfo.DisableCursorBlinking = (bool)dataRow["DisableCursorBlinking"]; connectionInfo.RDGatewayUsername = (string)dataRow["RDGatewayUsername"];
connectionInfo.CacheBitmaps = (bool)dataRow["CacheBitmaps"]; connectionInfo.RDPAlertIdleTimeout = MiscTools.GetBooleanValue(dataRow["RDPAlertIdleTimeout"]);
connectionInfo.RedirectDiskDrives = (RDPDiskDrives)Enum.Parse(typeof(RDPDiskDrives), (string)dataRow["RedirectDiskDrives"]); connectionInfo.RDPAuthenticationLevel = (AuthenticationLevel)Enum.Parse(typeof(AuthenticationLevel), (string)dataRow["RDPAuthenticationLevel"]);
connectionInfo.RedirectDiskDrivesCustom = (string)dataRow["RedirectDiskDrivesCustom"]; connectionInfo.RDPMinutesToIdleTimeout = (int)dataRow["RDPMinutesToIdleTimeout"];
connectionInfo.RedirectPorts = (bool)dataRow["RedirectPorts"]; connectionInfo.RDPStartProgram = (string)dataRow["StartProgram"];
connectionInfo.RedirectPrinters = (bool)dataRow["RedirectPrinters"]; connectionInfo.RDPStartProgramWorkDir = (string)dataRow["StartProgramWorkDir"];
connectionInfo.RedirectClipboard = (bool)dataRow["RedirectClipboard"]; connectionInfo.RedirectAudioCapture = MiscTools.GetBooleanValue(dataRow["RedirectAudioCapture"]);
connectionInfo.RedirectSmartCards = (bool)dataRow["RedirectSmartCards"]; connectionInfo.RedirectClipboard = MiscTools.GetBooleanValue(dataRow["RedirectClipboard"]);
connectionInfo.RedirectSound = (RDPSounds)Enum.Parse(typeof(RDPSounds), (string)dataRow["RedirectSound"]); connectionInfo.RedirectDiskDrives = (RDPDiskDrives)Enum.Parse(typeof(RDPDiskDrives), (string)dataRow["RedirectDiskDrives"]);
connectionInfo.SoundQuality = (RDPSoundQuality)Enum.Parse(typeof(RDPSoundQuality), (string)dataRow["SoundQuality"]); connectionInfo.RedirectDiskDrivesCustom = (string)dataRow["RedirectDiskDrivesCustom"];
connectionInfo.RedirectAudioCapture = (bool)dataRow["RedirectAudioCapture"]; connectionInfo.RedirectKeys = MiscTools.GetBooleanValue(dataRow["RedirectKeys"]);
connectionInfo.RDPStartProgram = (string)dataRow["StartProgram"]; connectionInfo.RedirectPorts = MiscTools.GetBooleanValue(dataRow["RedirectPorts"]);
connectionInfo.RDPStartProgramWorkDir = (string)dataRow["StartProgramWorkDir"]; connectionInfo.RedirectPrinters = MiscTools.GetBooleanValue(dataRow["RedirectPrinters"]);
connectionInfo.RedirectKeys = (bool)dataRow["RedirectKeys"]; connectionInfo.RedirectSmartCards = MiscTools.GetBooleanValue(dataRow["RedirectSmartCards"]);
connectionInfo.OpeningCommand = (string)dataRow["OpeningCommand"]; connectionInfo.RedirectSound = (RDPSounds)Enum.Parse(typeof(RDPSounds), (string)dataRow["RedirectSound"]);
connectionInfo.PreExtApp = (string)dataRow["PreExtApp"]; connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine), (string)dataRow["RenderingEngine"]);
connectionInfo.PostExtApp = (string)dataRow["PostExtApp"]; connectionInfo.Resolution = (RDPResolutions)Enum.Parse(typeof(RDPResolutions), (string)dataRow["Resolution"]);
connectionInfo.MacAddress = (string)dataRow["MacAddress"]; connectionInfo.SoundQuality = (RDPSoundQuality)Enum.Parse(typeof(RDPSoundQuality), (string)dataRow["SoundQuality"]);
connectionInfo.UserField = (string)dataRow["UserField"]; connectionInfo.SSHOptions = (string)dataRow["SSHOptions"];
connectionInfo.ExtApp = (string)dataRow["ExtApp"]; connectionInfo.SSHTunnelConnectionName = (string)dataRow["SSHTunnelConnectionName"];
connectionInfo.VNCCompression = (ProtocolVNC.Compression)Enum.Parse(typeof(ProtocolVNC.Compression), (string)dataRow["VNCCompression"]); connectionInfo.UseConsoleSession = MiscTools.GetBooleanValue(dataRow["ConnectToConsole"]);
connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Enum.Parse(typeof(ProtocolVNC.Encoding), (string)dataRow["VNCEncoding"]); connectionInfo.UseCredSsp = MiscTools.GetBooleanValue(dataRow["UseCredSsp"]);
connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Enum.Parse(typeof(ProtocolVNC.AuthMode), (string)dataRow["VNCAuthMode"]); connectionInfo.UseEnhancedMode = MiscTools.GetBooleanValue(dataRow["UseEnhancedMode"]);
connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Enum.Parse(typeof(ProtocolVNC.ProxyType), (string)dataRow["VNCProxyType"]); connectionInfo.UseRCG = MiscTools.GetBooleanValue(dataRow["UseRCG"]);
connectionInfo.VNCProxyIP = (string)dataRow["VNCProxyIP"]; connectionInfo.UseRestrictedAdmin = MiscTools.GetBooleanValue(dataRow["UseRestrictedAdmin"]);
connectionInfo.VNCProxyPort = (int)dataRow["VNCProxyPort"]; connectionInfo.UserField = (string)dataRow["UserField"];
connectionInfo.VNCProxyUsername = (string)dataRow["VNCProxyUsername"]; connectionInfo.Username = (string)dataRow["Username"];
connectionInfo.VNCProxyPassword = DecryptValue((string)dataRow["VNCProxyPassword"]); connectionInfo.UseVmId = MiscTools.GetBooleanValue(dataRow["UseVmId"]);
connectionInfo.VNCColors = (ProtocolVNC.Colors)Enum.Parse(typeof(ProtocolVNC.Colors), (string)dataRow["VNCColors"]); connectionInfo.VmId = (string)dataRow["VmId"];
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), (string)dataRow["VNCSmartSizeMode"]); connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Enum.Parse(typeof(ProtocolVNC.AuthMode), (string)dataRow["VNCAuthMode"]);
connectionInfo.VNCViewOnly = (bool)dataRow["VNCViewOnly"]; connectionInfo.VNCColors = (ProtocolVNC.Colors)Enum.Parse(typeof(ProtocolVNC.Colors), (string)dataRow["VNCColors"]);
connectionInfo.RDGatewayUsageMethod = (RDGatewayUsageMethod)Enum.Parse(typeof(RDGatewayUsageMethod), (string)dataRow["RDGatewayUsageMethod"]); connectionInfo.VNCCompression = (ProtocolVNC.Compression)Enum.Parse(typeof(ProtocolVNC.Compression), (string)dataRow["VNCCompression"]);
connectionInfo.RDGatewayHostname = (string)dataRow["RDGatewayHostname"]; connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Enum.Parse(typeof(ProtocolVNC.Encoding), (string)dataRow["VNCEncoding"]);
connectionInfo.RDGatewayUseConnectionCredentials = (RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RDGatewayUseConnectionCredentials), (string)dataRow["RDGatewayUseConnectionCredentials"]); connectionInfo.VNCProxyIP = (string)dataRow["VNCProxyIP"];
connectionInfo.RDGatewayUsername = (string)dataRow["RDGatewayUsername"]; connectionInfo.VNCProxyPassword = DecryptValue((string)dataRow["VNCProxyPassword"]);
connectionInfo.RDGatewayPassword = DecryptValue((string)dataRow["RDGatewayPassword"]); connectionInfo.VNCProxyPort = (int)dataRow["VNCProxyPort"];
connectionInfo.RDGatewayDomain = (string)dataRow["RDGatewayDomain"]; connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Enum.Parse(typeof(ProtocolVNC.ProxyType), (string)dataRow["VNCProxyType"]);
//connectionInfo.RDGatewayExternalCredentialProvider = (ExternalCredentialProvider)Enum.Parse(typeof(ExternalCredentialProvider), (string)dataRow["RDGatewayExternalCredentialProvider"]); connectionInfo.VNCProxyUsername = (string)dataRow["VNCProxyUsername"];
//connectionInfo.RDGatewayUserViaAPI = (string)dataRow["RDGatewayUserViaAPI"]; connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), (string)dataRow["VNCSmartSizeMode"]);
connectionInfo.VNCViewOnly = MiscTools.GetBooleanValue(dataRow["VNCViewOnly"]);
if (!dataRow.IsNull("RdpVersion")) // table allows null values which must be handled
if (Enum.TryParse((string)dataRow["RdpVersion"], true, out RdpVersion rdpVersion)) if (!dataRow.IsNull("RdpVersion")) // table allows null values which must be handled
connectionInfo.RdpVersion = rdpVersion; if (Enum.TryParse((string)dataRow["RdpVersion"], true, out RdpVersion rdpVersion))
connectionInfo.RdpVersion = rdpVersion;
connectionInfo.Inheritance.CacheBitmaps = (bool)dataRow["InheritCacheBitmaps"];
connectionInfo.Inheritance.Colors = (bool)dataRow["InheritColors"]; //connectionInfo.Inheritance.ExternalCredentialProvider = MiscTools.GetBooleanValue(dataRow["InheritExternalCredentialProvider"]);
connectionInfo.Inheritance.Description = (bool)dataRow["InheritDescription"]; //connectionInfo.Inheritance.RDGatewayExternalCredentialProvider = MiscTools.GetBooleanValue(dataRow["InheritRDGatewayExternalCredentialProvider"]);
connectionInfo.Inheritance.DisplayThemes = (bool)dataRow["InheritDisplayThemes"]; //connectionInfo.Inheritance.RDGatewayUserViaAPI = MiscTools.GetBooleanValue(dataRow["InheritRDGatewayUserViaAPI"]);
connectionInfo.Inheritance.DisplayWallpaper = (bool)dataRow["InheritDisplayWallpaper"]; //connectionInfo.Inheritance.UserViaAPI = MiscTools.GetBooleanValue(dataRow["InheritUserViaAPI"]);
connectionInfo.Inheritance.EnableFontSmoothing = (bool)dataRow["InheritEnableFontSmoothing"]; connectionInfo.Inheritance.AutomaticResize = MiscTools.GetBooleanValue(dataRow["InheritAutomaticResize"]);
connectionInfo.Inheritance.EnableDesktopComposition = (bool)dataRow["InheritEnableDesktopComposition"]; connectionInfo.Inheritance.CacheBitmaps = MiscTools.GetBooleanValue(dataRow["InheritCacheBitmaps"]);
connectionInfo.Inheritance.DisableFullWindowDrag = (bool)dataRow["InheritDisableFullWindowDrag"]; connectionInfo.Inheritance.Colors = MiscTools.GetBooleanValue(dataRow["InheritColors"]);
connectionInfo.Inheritance.DisableMenuAnimations = (bool)dataRow["InheritDisableMenuAnimations"]; connectionInfo.Inheritance.Description = MiscTools.GetBooleanValue(dataRow["InheritDescription"]);
connectionInfo.Inheritance.DisableCursorShadow = (bool)dataRow["InheritDisableCursorShadow"]; connectionInfo.Inheritance.DisableCursorBlinking = MiscTools.GetBooleanValue(dataRow["InheritDisableCursorBlinking"]);
connectionInfo.Inheritance.DisableCursorBlinking = (bool)dataRow["InheritDisableCursorBlinking"]; connectionInfo.Inheritance.DisableCursorShadow = MiscTools.GetBooleanValue(dataRow["InheritDisableCursorShadow"]);
//connectionInfo.Inheritance.ExternalCredentialProvider = (bool)dataRow["InheritExternalCredentialProvider"]; connectionInfo.Inheritance.DisableFullWindowDrag = MiscTools.GetBooleanValue(dataRow["InheritDisableFullWindowDrag"]);
//connectionInfo.Inheritance.UserViaAPI = (bool)dataRow["InheritUserViaAPI"]; connectionInfo.Inheritance.DisableMenuAnimations = MiscTools.GetBooleanValue(dataRow["InheritDisableMenuAnimations"]);
connectionInfo.Inheritance.Domain = (bool)dataRow["InheritDomain"]; connectionInfo.Inheritance.DisplayThemes = MiscTools.GetBooleanValue(dataRow["InheritDisplayThemes"]);
connectionInfo.Inheritance.Icon = (bool)dataRow["InheritIcon"]; connectionInfo.Inheritance.DisplayWallpaper = MiscTools.GetBooleanValue(dataRow["InheritDisplayWallpaper"]);
connectionInfo.Inheritance.Panel = (bool)dataRow["InheritPanel"]; connectionInfo.Inheritance.Domain = MiscTools.GetBooleanValue(dataRow["InheritDomain"]);
connectionInfo.Inheritance.Password = (bool)dataRow["InheritPassword"]; connectionInfo.Inheritance.EnableDesktopComposition = MiscTools.GetBooleanValue(dataRow["InheritEnableDesktopComposition"]);
connectionInfo.Inheritance.Port = (bool)dataRow["InheritPort"]; connectionInfo.Inheritance.EnableFontSmoothing = MiscTools.GetBooleanValue(dataRow["InheritEnableFontSmoothing"]);
connectionInfo.Inheritance.Protocol = (bool)dataRow["InheritProtocol"]; connectionInfo.Inheritance.ExtApp = MiscTools.GetBooleanValue(dataRow["InheritExtApp"]);
connectionInfo.Inheritance.SSHTunnelConnectionName = (bool)dataRow["InheritSSHTunnelConnectionName"]; connectionInfo.Inheritance.Icon = MiscTools.GetBooleanValue(dataRow["InheritIcon"]);
connectionInfo.Inheritance.OpeningCommand = (bool)dataRow["InheritOpeningCommand"]; connectionInfo.Inheritance.LoadBalanceInfo = MiscTools.GetBooleanValue(dataRow["InheritLoadBalanceInfo"]);
connectionInfo.Inheritance.SSHOptions = (bool)dataRow["InheritSSHOptions"]; connectionInfo.Inheritance.MacAddress = MiscTools.GetBooleanValue(dataRow["InheritMacAddress"]);
connectionInfo.Inheritance.PuttySession = (bool)dataRow["InheritPuttySession"]; connectionInfo.Inheritance.OpeningCommand = MiscTools.GetBooleanValue(dataRow["InheritOpeningCommand"]);
connectionInfo.Inheritance.RedirectDiskDrives = (bool)dataRow["InheritRedirectDiskDrives"]; connectionInfo.Inheritance.OpeningCommand = MiscTools.GetBooleanValue(dataRow["InheritOpeningCommand"]);
connectionInfo.Inheritance.RedirectDiskDrivesCustom = (bool)dataRow["InheritRedirectDiskDrivesCustom"]; connectionInfo.Inheritance.Panel = MiscTools.GetBooleanValue(dataRow["InheritPanel"]);
connectionInfo.Inheritance.RedirectKeys = (bool)dataRow["InheritRedirectKeys"]; connectionInfo.Inheritance.Password = MiscTools.GetBooleanValue(dataRow["InheritPassword"]);
connectionInfo.Inheritance.RedirectPorts = (bool)dataRow["InheritRedirectPorts"]; connectionInfo.Inheritance.Port = MiscTools.GetBooleanValue(dataRow["InheritPort"]);
connectionInfo.Inheritance.RedirectPrinters = (bool)dataRow["InheritRedirectPrinters"]; connectionInfo.Inheritance.PostExtApp = MiscTools.GetBooleanValue(dataRow["InheritPostExtApp"]);
connectionInfo.Inheritance.RedirectClipboard = (bool)dataRow["InheritRedirectClipboard"]; connectionInfo.Inheritance.PreExtApp = MiscTools.GetBooleanValue(dataRow["InheritPreExtApp"]);
connectionInfo.Inheritance.RedirectSmartCards = (bool)dataRow["InheritRedirectSmartCards"]; connectionInfo.Inheritance.Protocol = MiscTools.GetBooleanValue(dataRow["InheritProtocol"]);
connectionInfo.Inheritance.RedirectSound = (bool)dataRow["InheritRedirectSound"]; connectionInfo.Inheritance.PuttySession = MiscTools.GetBooleanValue(dataRow["InheritPuttySession"]);
connectionInfo.Inheritance.SoundQuality = (bool)dataRow["InheritSoundQuality"]; connectionInfo.Inheritance.RDGatewayDomain = MiscTools.GetBooleanValue(dataRow["InheritRDGatewayDomain"]);
connectionInfo.Inheritance.RedirectAudioCapture = (bool)dataRow["InheritRedirectAudioCapture"]; connectionInfo.Inheritance.RDGatewayHostname = MiscTools.GetBooleanValue(dataRow["InheritRDGatewayHostname"]);
connectionInfo.Inheritance.Resolution = (bool)dataRow["InheritResolution"]; connectionInfo.Inheritance.RDGatewayPassword = MiscTools.GetBooleanValue(dataRow["InheritRDGatewayPassword"]);
connectionInfo.Inheritance.AutomaticResize = (bool)dataRow["InheritAutomaticResize"]; connectionInfo.Inheritance.RDGatewayUsageMethod = MiscTools.GetBooleanValue(dataRow["InheritRDGatewayUsageMethod"]);
connectionInfo.Inheritance.UseConsoleSession = (bool)dataRow["InheritUseConsoleSession"]; connectionInfo.Inheritance.RDGatewayUseConnectionCredentials = MiscTools.GetBooleanValue(dataRow["InheritRDGatewayUseConnectionCredentials"]);
connectionInfo.Inheritance.UseCredSsp = (bool)dataRow["InheritUseCredSsp"]; connectionInfo.Inheritance.RDGatewayUsername = MiscTools.GetBooleanValue(dataRow["InheritRDGatewayUsername"]);
connectionInfo.Inheritance.UseRestrictedAdmin = (bool)dataRow["InheritUseRestrictedAdmin"]; connectionInfo.Inheritance.RDPAlertIdleTimeout = MiscTools.GetBooleanValue(dataRow["InheritRDPAlertIdleTimeout"]);
connectionInfo.Inheritance.UseRCG = (bool)dataRow["InheritUseRCG"]; connectionInfo.Inheritance.RDPAuthenticationLevel = MiscTools.GetBooleanValue(dataRow["InheritRDPAuthenticationLevel"]);
connectionInfo.Inheritance.UseVmId = (bool)dataRow["InheritUseVmId"]; connectionInfo.Inheritance.RDPMinutesToIdleTimeout = MiscTools.GetBooleanValue(dataRow["InheritRDPMinutesToIdleTimeout"]);
connectionInfo.Inheritance.UseEnhancedMode = (bool)dataRow["InheritUseEnhancedMode"]; connectionInfo.Inheritance.RdpVersion = MiscTools.GetBooleanValue(dataRow["InheritRdpVersion"]);
connectionInfo.Inheritance.VmId = (bool)dataRow["InheritVmId"]; connectionInfo.Inheritance.RedirectAudioCapture = MiscTools.GetBooleanValue(dataRow["InheritRedirectAudioCapture"]);
connectionInfo.Inheritance.RenderingEngine = (bool)dataRow["InheritRenderingEngine"]; connectionInfo.Inheritance.RedirectClipboard = MiscTools.GetBooleanValue(dataRow["InheritRedirectClipboard"]);
connectionInfo.Inheritance.Username = (bool)dataRow["InheritUsername"]; connectionInfo.Inheritance.RedirectDiskDrives = MiscTools.GetBooleanValue(dataRow["InheritRedirectDiskDrives"]);
connectionInfo.Inheritance.RDPAuthenticationLevel = (bool)dataRow["InheritRDPAuthenticationLevel"]; connectionInfo.Inheritance.RedirectDiskDrivesCustom = MiscTools.GetBooleanValue(dataRow["InheritRedirectDiskDrivesCustom"]);
connectionInfo.Inheritance.RDPAlertIdleTimeout = (bool)dataRow["InheritRDPAlertIdleTimeout"]; connectionInfo.Inheritance.RedirectKeys = MiscTools.GetBooleanValue(dataRow["InheritRedirectKeys"]);
connectionInfo.Inheritance.RDPMinutesToIdleTimeout = (bool)dataRow["InheritRDPMinutesToIdleTimeout"]; connectionInfo.Inheritance.RedirectPorts = MiscTools.GetBooleanValue(dataRow["InheritRedirectPorts"]);
connectionInfo.Inheritance.LoadBalanceInfo = (bool)dataRow["InheritLoadBalanceInfo"]; connectionInfo.Inheritance.RedirectPrinters = MiscTools.GetBooleanValue(dataRow["InheritRedirectPrinters"]);
connectionInfo.Inheritance.OpeningCommand = (bool)dataRow["InheritOpeningCommand"]; connectionInfo.Inheritance.RedirectSmartCards = MiscTools.GetBooleanValue(dataRow["InheritRedirectSmartCards"]);
connectionInfo.Inheritance.PreExtApp = (bool)dataRow["InheritPreExtApp"]; connectionInfo.Inheritance.RedirectSound = MiscTools.GetBooleanValue(dataRow["InheritRedirectSound"]);
connectionInfo.Inheritance.PostExtApp = (bool)dataRow["InheritPostExtApp"]; connectionInfo.Inheritance.RenderingEngine = MiscTools.GetBooleanValue(dataRow["InheritRenderingEngine"]);
connectionInfo.Inheritance.MacAddress = (bool)dataRow["InheritMacAddress"]; connectionInfo.Inheritance.Resolution = MiscTools.GetBooleanValue(dataRow["InheritResolution"]);
connectionInfo.Inheritance.UserField = (bool)dataRow["InheritUserField"]; connectionInfo.Inheritance.SoundQuality = MiscTools.GetBooleanValue(dataRow["InheritSoundQuality"]);
connectionInfo.Inheritance.ExtApp = (bool)dataRow["InheritExtApp"]; connectionInfo.Inheritance.SSHOptions = MiscTools.GetBooleanValue(dataRow["InheritSSHOptions"]);
connectionInfo.Inheritance.VNCCompression = (bool)dataRow["InheritVNCCompression"]; connectionInfo.Inheritance.SSHTunnelConnectionName = MiscTools.GetBooleanValue(dataRow["InheritSSHTunnelConnectionName"]);
connectionInfo.Inheritance.VNCEncoding = (bool)dataRow["InheritVNCEncoding"]; connectionInfo.Inheritance.UseConsoleSession = MiscTools.GetBooleanValue(dataRow["InheritUseConsoleSession"]);
connectionInfo.Inheritance.VNCAuthMode = (bool)dataRow["InheritVNCAuthMode"]; connectionInfo.Inheritance.UseCredSsp = MiscTools.GetBooleanValue(dataRow["InheritUseCredSsp"]);
connectionInfo.Inheritance.VNCProxyType = (bool)dataRow["InheritVNCProxyType"]; connectionInfo.Inheritance.UseEnhancedMode = MiscTools.GetBooleanValue(dataRow["InheritUseEnhancedMode"]);
connectionInfo.Inheritance.VNCProxyIP = (bool)dataRow["InheritVNCProxyIP"]; connectionInfo.Inheritance.UseRCG = MiscTools.GetBooleanValue(dataRow["InheritUseRCG"]);
connectionInfo.Inheritance.VNCProxyPort = (bool)dataRow["InheritVNCProxyPort"]; connectionInfo.Inheritance.UseRestrictedAdmin = MiscTools.GetBooleanValue(dataRow["InheritUseRestrictedAdmin"]);
connectionInfo.Inheritance.VNCProxyUsername = (bool)dataRow["InheritVNCProxyUsername"]; connectionInfo.Inheritance.UserField = MiscTools.GetBooleanValue(dataRow["InheritUserField"]);
connectionInfo.Inheritance.VNCProxyPassword = (bool)dataRow["InheritVNCProxyPassword"]; connectionInfo.Inheritance.Username = MiscTools.GetBooleanValue(dataRow["InheritUsername"]);
connectionInfo.Inheritance.VNCColors = (bool)dataRow["InheritVNCColors"]; connectionInfo.Inheritance.UseVmId = MiscTools.GetBooleanValue(dataRow["InheritUseVmId"]);
connectionInfo.Inheritance.VNCSmartSizeMode = (bool)dataRow["InheritVNCSmartSizeMode"]; connectionInfo.Inheritance.VmId = MiscTools.GetBooleanValue(dataRow["InheritVmId"]);
connectionInfo.Inheritance.VNCViewOnly = (bool)dataRow["InheritVNCViewOnly"]; connectionInfo.Inheritance.VNCAuthMode = MiscTools.GetBooleanValue(dataRow["InheritVNCAuthMode"]);
connectionInfo.Inheritance.RDGatewayUsageMethod = (bool)dataRow["InheritRDGatewayUsageMethod"]; connectionInfo.Inheritance.VNCColors = MiscTools.GetBooleanValue(dataRow["InheritVNCColors"]);
connectionInfo.Inheritance.RDGatewayHostname = (bool)dataRow["InheritRDGatewayHostname"]; connectionInfo.Inheritance.VNCCompression = MiscTools.GetBooleanValue(dataRow["InheritVNCCompression"]);
connectionInfo.Inheritance.RDGatewayUseConnectionCredentials = (bool)dataRow["InheritRDGatewayUseConnectionCredentials"]; connectionInfo.Inheritance.VNCEncoding = MiscTools.GetBooleanValue(dataRow["InheritVNCEncoding"]);
connectionInfo.Inheritance.RDGatewayUsername = (bool)dataRow["InheritRDGatewayUsername"]; connectionInfo.Inheritance.VNCProxyIP = MiscTools.GetBooleanValue(dataRow["InheritVNCProxyIP"]);
connectionInfo.Inheritance.RDGatewayPassword = (bool)dataRow["InheritRDGatewayPassword"]; connectionInfo.Inheritance.VNCProxyPassword = MiscTools.GetBooleanValue(dataRow["InheritVNCProxyPassword"]);
connectionInfo.Inheritance.RDGatewayDomain = (bool)dataRow["InheritRDGatewayDomain"]; connectionInfo.Inheritance.VNCProxyPort = MiscTools.GetBooleanValue(dataRow["InheritVNCProxyPort"]);
//connectionInfo.Inheritance.RDGatewayExternalCredentialProvider = (bool)dataRow["InheritRDGatewayExternalCredentialProvider"]; connectionInfo.Inheritance.VNCProxyType = MiscTools.GetBooleanValue(dataRow["InheritVNCProxyType"]);
//connectionInfo.Inheritance.RDGatewayUserViaAPI = (bool)dataRow["InheritRDGatewayUserViaAPI"]; connectionInfo.Inheritance.VNCProxyUsername = MiscTools.GetBooleanValue(dataRow["InheritVNCProxyUsername"]);
connectionInfo.Inheritance.RdpVersion = (bool)dataRow["InheritRdpVersion"]; connectionInfo.Inheritance.VNCSmartSizeMode = MiscTools.GetBooleanValue(dataRow["InheritVNCSmartSizeMode"]);
} connectionInfo.Inheritance.VNCViewOnly = MiscTools.GetBooleanValue(dataRow["InheritVNCViewOnly"]);
}
private string DecryptValue(string cipherText)
{ private string DecryptValue(string cipherText)
try {
{ try
return _cryptographyProvider.Decrypt(cipherText, _decryptionKey); {
} return _cryptographyProvider.Decrypt(cipherText, _decryptionKey);
catch (EncryptionException) }
{ catch (EncryptionException)
// value may not be encrypted {
return cipherText; // value may not be encrypted
} return cipherText;
} }
}
private ConnectionTreeModel CreateNodeHierarchy(List<ConnectionInfo> connectionList, DataTable dataTable)
{ private ConnectionTreeModel CreateNodeHierarchy(List<ConnectionInfo> connectionList, DataTable dataTable)
var connectionTreeModel = new ConnectionTreeModel(); {
var rootNode = new RootNodeInfo(RootNodeType.Connection, "0") var connectionTreeModel = new ConnectionTreeModel();
{ var rootNode = new RootNodeInfo(RootNodeType.Connection, "0")
PasswordString = _decryptionKey.ConvertToUnsecureString() {
}; PasswordString = _decryptionKey.ConvertToUnsecureString()
connectionTreeModel.AddRootNode(rootNode); };
connectionTreeModel.AddRootNode(rootNode);
foreach (DataRow row in dataTable.Rows)
{ foreach (DataRow row in dataTable.Rows)
var id = (string)row["ConstantID"]; {
var connectionInfo = connectionList.First(node => node.ConstantID == id); var id = (string)row["ConstantID"];
var parentId = (string)row["ParentID"]; var connectionInfo = connectionList.First(node => node.ConstantID == id);
if (parentId == "0" || connectionList.All(node => node.ConstantID != parentId)) var parentId = (string)row["ParentID"];
rootNode.AddChild(connectionInfo); if (parentId == "0" || connectionList.All(node => node.ConstantID != parentId))
else rootNode.AddChild(connectionInfo);
(connectionList.First(node => node.ConstantID == parentId) as ContainerInfo)?.AddChild( else
connectionInfo); (connectionList.First(node => node.ConstantID == parentId) as ContainerInfo)?.AddChild(connectionInfo);
} }
return connectionTreeModel; return connectionTreeModel;
} }
} }
} }

View File

@@ -1,4 +1,4 @@
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Sql
{ {
public class LocalConnectionPropertiesModel public class LocalConnectionPropertiesModel
{ {

View File

@@ -6,7 +6,7 @@ using System.Text;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Sql
{ {
public class LocalConnectionPropertiesXmlSerializer : public class LocalConnectionPropertiesXmlSerializer :
ISerializer<IEnumerable<LocalConnectionPropertiesModel>, string>, ISerializer<IEnumerable<LocalConnectionPropertiesModel>, string>,

View File

@@ -1,6 +1,6 @@
using System; using System;
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Sql
{ {
public class SqlConnectionListMetaData public class SqlConnectionListMetaData
{ {

View File

@@ -2,6 +2,7 @@
using System.Data.Common; using System.Data.Common;
using System.Globalization; using System.Globalization;
using System.Runtime.Versioning; using System.Runtime.Versioning;
using System.Security;
using mRemoteNG.App; using mRemoteNG.App;
using mRemoteNG.App.Info; using mRemoteNG.App.Info;
using mRemoteNG.Config.DatabaseConnectors; using mRemoteNG.Config.DatabaseConnectors;
@@ -11,7 +12,7 @@ using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools; using mRemoteNG.Tools;
using mRemoteNG.Tree.Root; using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Sql
{ {
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
public class SqlDatabaseMetaDataRetriever public class SqlDatabaseMetaDataRetriever
@@ -48,7 +49,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql
{ {
Name = dbDataReader["Name"] as string ?? "", Name = dbDataReader["Name"] as string ?? "",
Protected = dbDataReader["Protected"] as string ?? "", Protected = dbDataReader["Protected"] as string ?? "",
Export = (bool)dbDataReader["Export"], Export = dbDataReader["Export"].Equals(1),
ConfVersion = new Version(Convert.ToString(dbDataReader["confVersion"], CultureInfo.InvariantCulture) ?? string.Empty) ConfVersion = new Version(Convert.ToString(dbDataReader["confVersion"], CultureInfo.InvariantCulture) ?? string.Empty)
}; };
} }
@@ -68,13 +69,18 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql
public void WriteDatabaseMetaData(RootNodeInfo rootTreeNode, IDatabaseConnector databaseConnector) public void WriteDatabaseMetaData(RootNodeInfo rootTreeNode, IDatabaseConnector databaseConnector)
{ {
// TODO: use transaction
var cryptographyProvider = new LegacyRijndaelCryptographyProvider(); var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
string strProtected; string strProtected;
if (rootTreeNode != null) if (rootTreeNode != null)
{ {
if (rootTreeNode.Password) if (rootTreeNode.Password)
{ {
var password = rootTreeNode.PasswordString.ConvertToSecureString(); SecureString password = rootTreeNode.PasswordString.ConvertToSecureString();
strProtected = cryptographyProvider.Encrypt("ThisIsProtected", password); strProtected = cryptographyProvider.Encrypt("ThisIsProtected", password);
} }
else else
@@ -87,7 +93,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", Runtime.EncryptionKey); strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", Runtime.EncryptionKey);
} }
var cmd = databaseConnector.DbCommand("DELETE FROM tblRoot"); var cmd = databaseConnector.DbCommand("TRUNCATE TABLE tblRoot");
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
if (rootTreeNode != null) if (rootTreeNode != null)
@@ -95,7 +101,8 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql
cmd = databaseConnector.DbCommand( cmd = databaseConnector.DbCommand(
"INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES('" + "INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES('" +
MiscTools.PrepareValueForDB(rootTreeNode.Name) + "', 0, '" + strProtected + "','" + MiscTools.PrepareValueForDB(rootTreeNode.Name) + "', 0, '" + strProtected + "','" +
ConnectionsFileInfo.ConnectionFileVersion.ToString() + "')"); ConnectionsFileInfo.ConnectionFileVersion + "')");
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
else else
@@ -112,8 +119,8 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql
{ {
// ANSI SQL way. Works in PostgreSQL, MSSQL, MySQL. // ANSI SQL way. Works in PostgreSQL, MSSQL, MySQL.
var cmd = databaseConnector.DbCommand("select case when exists((select * from information_schema.tables where table_name = '" + tableName + "')) then 1 else 0 end"); var cmd = databaseConnector.DbCommand("select case when exists((select * from information_schema.tables where table_name = '" + tableName + "')) then 1 else 0 end");
cmd.ExecuteNonQuery(); var cmdResult = Convert.ToInt16(cmd.ExecuteScalar());
exists = (int)(long)cmd.ExecuteScalar()! == 1; exists = (cmdResult == 1);
} }
catch catch
{ {
@@ -121,7 +128,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql
{ {
// Other RDBMS. Graceful degradation // Other RDBMS. Graceful degradation
exists = true; exists = true;
var cmdOthers = databaseConnector.DbCommand("select 1 from " + tableName + " where 1 = 0"); DbCommand cmdOthers = databaseConnector.DbCommand("select 1 from " + tableName + " where 1 = 0");
cmdOthers.ExecuteNonQuery(); cmdOthers.ExecuteNonQuery();
} }
catch catch
@@ -136,9 +143,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql
private void InitializeDatabaseSchema(IDatabaseConnector databaseConnector) private void InitializeDatabaseSchema(IDatabaseConnector databaseConnector)
{ {
string sql; string sql;
var t = databaseConnector.GetType();
if (databaseConnector.GetType() == typeof(MSSqlDatabaseConnector)) if (databaseConnector.GetType() == typeof(MSSqlDatabaseConnector))
{ {
sql = @" sql = @"
@@ -204,13 +209,14 @@ CREATE TABLE [dbo].[tblCons] (
[RdpVersion] varchar(10) NULL, [RdpVersion] varchar(10) NULL,
[RedirectAudioCapture] bit NOT NULL, [RedirectAudioCapture] bit NOT NULL,
[RedirectClipboard] bit NOT NULL, [RedirectClipboard] bit NOT NULL,
[RedirectDiskDrives] bit NOT NULL, [RedirectDiskDrives] varchar(32) DEFAULT NULL,
[RedirectDiskDrivesCustom] varchar(32) DEFAULT NULL,
[RedirectKeys] bit NOT NULL, [RedirectKeys] bit NOT NULL,
[RedirectPorts] bit NOT NULL, [RedirectPorts] bit NOT NULL,
[RedirectPrinters] bit NOT NULL, [RedirectPrinters] bit NOT NULL,
[RedirectSmartCards] bit NOT NULL, [RedirectSmartCards] bit NOT NULL,
[RedirectSound] varchar(64) NOT NULL, [RedirectSound] varchar(64) NOT NULL,
[RenderingEngine] varchar(16) NULL, [RenderingEngine] varchar(32) NULL,
[Resolution] varchar(32) NOT NULL, [Resolution] varchar(32) NOT NULL,
[SSHOptions] varchar(1024) NOT NULL, [SSHOptions] varchar(1024) NOT NULL,
[SSHTunnelConnectionName] varchar(128) NOT NULL, [SSHTunnelConnectionName] varchar(128) NOT NULL,
@@ -275,6 +281,7 @@ CREATE TABLE [dbo].[tblCons] (
[InheritRedirectAudioCapture] bit NOT NULL, [InheritRedirectAudioCapture] bit NOT NULL,
[InheritRedirectClipboard] bit NOT NULL, [InheritRedirectClipboard] bit NOT NULL,
[InheritRedirectDiskDrives] bit NOT NULL, [InheritRedirectDiskDrives] bit NOT NULL,
[InheritRedirectDiskDrivesCustom] bit NOT NULL,
[InheritRedirectKeys] bit NOT NULL, [InheritRedirectKeys] bit NOT NULL,
[InheritRedirectPorts] bit NOT NULL, [InheritRedirectPorts] bit NOT NULL,
[InheritRedirectPrinters] bit NOT NULL, [InheritRedirectPrinters] bit NOT NULL,
@@ -358,24 +365,24 @@ CREATE TABLE `tblCons` (
`LastChange` datetime NOT NULL, `LastChange` datetime NOT NULL,
`Name` varchar(128) NOT NULL, `Name` varchar(128) NOT NULL,
`Type` varchar(32) NOT NULL, `Type` varchar(32) NOT NULL,
`Expanded` tinyint(1) NOT NULL, `Expanded` tinyint NOT NULL,
`AutomaticResize` tinyint(1) NOT NULL DEFAULT 1, `AutomaticResize` tinyint NOT NULL DEFAULT 1,
`CacheBitmaps` tinyint(1) NOT NULL, `CacheBitmaps` tinyint NOT NULL,
`Colors` varchar(32) NOT NULL, `Colors` varchar(32) NOT NULL,
`ConnectToConsole` tinyint(1) NOT NULL, `ConnectToConsole` tinyint NOT NULL,
`Connected` tinyint(1) NOT NULL, `Connected` tinyint NOT NULL,
`Description` varchar(1024) DEFAULT NULL, `Description` varchar(1024) DEFAULT NULL,
`DisableCursorBlinking` tinyint(1) NOT NULL, `DisableCursorBlinking` tinyint NOT NULL,
`DisableCursorShadow` tinyint(1) NOT NULL, `DisableCursorShadow` tinyint NOT NULL,
`DisableFullWindowDrag` tinyint(1) NOT NULL, `DisableFullWindowDrag` tinyint NOT NULL,
`DisableMenuAnimations` tinyint(1) NOT NULL, `DisableMenuAnimations` tinyint NOT NULL,
`DisplayThemes` tinyint(1) NOT NULL, `DisplayThemes` tinyint NOT NULL,
`DisplayWallpaper` tinyint(1) NOT NULL, `DisplayWallpaper` tinyint NOT NULL,
`Domain` varchar(512) DEFAULT NULL, `Domain` varchar(512) DEFAULT NULL,
`EnableDesktopComposition` tinyint(1) NOT NULL, `EnableDesktopComposition` tinyint NOT NULL,
`EnableFontSmoothing` tinyint(1) NOT NULL, `EnableFontSmoothing` tinyint NOT NULL,
`ExtApp` varchar(256) DEFAULT NULL, `ExtApp` varchar(256) DEFAULT NULL,
`Favorite` tinyint(1) NOT NULL, `Favorite` tinyint NOT NULL,
`Hostname` varchar(512) DEFAULT NULL, `Hostname` varchar(512) DEFAULT NULL,
`Icon` varchar(128) NOT NULL, `Icon` varchar(128) NOT NULL,
`LoadBalanceInfo` varchar(1024) DEFAULT NULL, `LoadBalanceInfo` varchar(1024) DEFAULT NULL,
@@ -394,26 +401,27 @@ CREATE TABLE `tblCons` (
`RDGatewayUsageMethod` varchar(32) NOT NULL, `RDGatewayUsageMethod` varchar(32) NOT NULL,
`RDGatewayUseConnectionCredentials` varchar(32) NOT NULL, `RDGatewayUseConnectionCredentials` varchar(32) NOT NULL,
`RDGatewayUsername` varchar(512) DEFAULT NULL, `RDGatewayUsername` varchar(512) DEFAULT NULL,
`RDPAlertIdleTimeout` tinyint(1) NOT NULL, `RDPAlertIdleTimeout` tinyint NOT NULL,
`RDPAuthenticationLevel` varchar(32) NOT NULL, `RDPAuthenticationLevel` varchar(32) NOT NULL,
`RDPMinutesToIdleTimeout` int(11) NOT NULL, `RDPMinutesToIdleTimeout` int(11) NOT NULL,
`RdpVersion` varchar(10) DEFAULT NULL, `RdpVersion` varchar(10) DEFAULT NULL,
`RedirectAudioCapture` tinyint(1) NOT NULL, `RedirectAudioCapture` tinyint NOT NULL,
`RedirectClipboard` tinyint(1) NOT NULL, `RedirectClipboard` tinyint NOT NULL,
`RedirectDiskDrives` tinyint(1) NOT NULL, `RedirectDiskDrives` varchar(32) DEFAULT NULL,
`RedirectKeys` tinyint(1) NOT NULL, `RedirectDiskDrivesCustom` varchar(32) DEFAULT NULL,
`RedirectPorts` tinyint(1) NOT NULL, `RedirectKeys` tinyint NOT NULL,
`RedirectPrinters` tinyint(1) NOT NULL, `RedirectPorts` tinyint NOT NULL,
`RedirectSmartCards` tinyint(1) NOT NULL, `RedirectPrinters` tinyint NOT NULL,
`RedirectSmartCards` tinyint NOT NULL,
`RedirectSound` varchar(64) NOT NULL, `RedirectSound` varchar(64) NOT NULL,
`RenderingEngine` varchar(16) DEFAULT NULL, `RenderingEngine` varchar(32) DEFAULT NULL,
`Resolution` varchar(32) NOT NULL, `Resolution` varchar(32) NOT NULL,
`SSHOptions` varchar(1024) NOT NULL, `SSHOptions` varchar(1024) NOT NULL,
`SSHTunnelConnectionName` varchar(128) NOT NULL, `SSHTunnelConnectionName` varchar(128) NOT NULL,
`SoundQuality` varchar(20) NOT NULL, `SoundQuality` varchar(20) NOT NULL,
`UseCredSsp` tinyint(1) NOT NULL, `UseCredSsp` tinyint NOT NULL,
`UseEnhancedMode` tinyint(1) NOT NULL, `UseEnhancedMode` tinyint NOT NULL,
`UseVmId` tinyint(1) NOT NULL, `UseVmId` tinyint NOT NULL,
`UserField` varchar(256) DEFAULT NULL, `UserField` varchar(256) DEFAULT NULL,
`Username` varchar(512) DEFAULT NULL, `Username` varchar(512) DEFAULT NULL,
`VNCAuthMode` varchar(10) DEFAULT NULL, `VNCAuthMode` varchar(10) DEFAULT NULL,
@@ -426,85 +434,86 @@ CREATE TABLE `tblCons` (
`VNCProxyType` varchar(20) DEFAULT NULL, `VNCProxyType` varchar(20) DEFAULT NULL,
`VNCProxyUsername` varchar(512) DEFAULT NULL, `VNCProxyUsername` varchar(512) DEFAULT NULL,
`VNCSmartSizeMode` varchar(20) DEFAULT NULL, `VNCSmartSizeMode` varchar(20) DEFAULT NULL,
`VNCViewOnly` tinyint(1) NOT NULL, `VNCViewOnly` tinyint NOT NULL,
`VmId` varchar(512) DEFAULT NULL, `VmId` varchar(512) DEFAULT NULL,
`ICAEncryptionStrength` varchar(32) NOT NULL, `ICAEncryptionStrength` varchar(32) NOT NULL,
`InheritAutomaticResize` tinyint(1) NOT NULL, `InheritAutomaticResize` tinyint NOT NULL,
`InheritCacheBitmaps` tinyint(1) NOT NULL, `InheritCacheBitmaps` tinyint NOT NULL,
`InheritColors` tinyint(1) NOT NULL, `InheritColors` tinyint NOT NULL,
`InheritDescription` tinyint(1) NOT NULL, `InheritDescription` tinyint NOT NULL,
`InheritDisableCursorBlinking` tinyint(1) NOT NULL, `InheritDisableCursorBlinking` tinyint NOT NULL,
`InheritDisableCursorShadow` tinyint(1) NOT NULL, `InheritDisableCursorShadow` tinyint NOT NULL,
`InheritDisableFullWindowDrag` tinyint(1) NOT NULL, `InheritDisableFullWindowDrag` tinyint NOT NULL,
`InheritDisableMenuAnimations` tinyint(1) NOT NULL, `InheritDisableMenuAnimations` tinyint NOT NULL,
`InheritDisplayThemes` tinyint(1) NOT NULL, `InheritDisplayThemes` tinyint NOT NULL,
`InheritDisplayWallpaper` tinyint(1) NOT NULL, `InheritDisplayWallpaper` tinyint NOT NULL,
`InheritDomain` tinyint(1) NOT NULL, `InheritDomain` tinyint NOT NULL,
`InheritEnableDesktopComposition` tinyint(1) NOT NULL, `InheritEnableDesktopComposition` tinyint NOT NULL,
`InheritEnableFontSmoothing` tinyint(1) NOT NULL, `InheritEnableFontSmoothing` tinyint NOT NULL,
`InheritExtApp` tinyint(1) NOT NULL, `InheritExtApp` tinyint NOT NULL,
`InheritFavorite` tinyint(1) NOT NULL, `InheritFavorite` tinyint NOT NULL,
`InheritICAEncryptionStrength` tinyint(1) NOT NULL, `InheritICAEncryptionStrength` tinyint NOT NULL,
`InheritIcon` tinyint(1) NOT NULL, `InheritIcon` tinyint NOT NULL,
`InheritLoadBalanceInfo` tinyint(1) NOT NULL, `InheritLoadBalanceInfo` tinyint NOT NULL,
`InheritMacAddress` tinyint(1) NOT NULL, `InheritMacAddress` tinyint NOT NULL,
`InheritOpeningCommand` tinyint(1) NOT NULL, `InheritOpeningCommand` tinyint NOT NULL,
`InheritPanel` tinyint(1) NOT NULL, `InheritPanel` tinyint NOT NULL,
`InheritPassword` tinyint(1) NOT NULL, `InheritPassword` tinyint NOT NULL,
`InheritPort` tinyint(1) NOT NULL, `InheritPort` tinyint NOT NULL,
`InheritPostExtApp` tinyint(1) NOT NULL, `InheritPostExtApp` tinyint NOT NULL,
`InheritPreExtApp` tinyint(1) NOT NULL, `InheritPreExtApp` tinyint NOT NULL,
`InheritProtocol` tinyint(1) NOT NULL, `InheritProtocol` tinyint NOT NULL,
`InheritPuttySession` tinyint(1) NOT NULL, `InheritPuttySession` tinyint NOT NULL,
`InheritRDGatewayDomain` tinyint(1) NOT NULL, `InheritRDGatewayDomain` tinyint NOT NULL,
`InheritRDGatewayHostname` tinyint(1) NOT NULL, `InheritRDGatewayHostname` tinyint NOT NULL,
`InheritRDGatewayPassword` tinyint(1) NOT NULL, `InheritRDGatewayPassword` tinyint NOT NULL,
`InheritRDGatewayUsageMethod` tinyint(1) NOT NULL, `InheritRDGatewayUsageMethod` tinyint NOT NULL,
`InheritRDGatewayUseConnectionCredentials` tinyint(1) NOT NULL, `InheritRDGatewayUseConnectionCredentials` tinyint NOT NULL,
`InheritRDGatewayExternalCredentialProvider` tinyint(1) NOT NULL, `InheritRDGatewayExternalCredentialProvider` tinyint NOT NULL,
`InheritRDGatewayUsername` tinyint(1) NOT NULL, `InheritRDGatewayUsername` tinyint NOT NULL,
`InheritRDGatewayUserViaAPI` tinyint(1) NOT NULL, `InheritRDGatewayUserViaAPI` tinyint NOT NULL,
`InheritRDPAlertIdleTimeout` tinyint(1) NOT NULL, `InheritRDPAlertIdleTimeout` tinyint NOT NULL,
`InheritRDPAuthenticationLevel` tinyint(1) NOT NULL, `InheritRDPAuthenticationLevel` tinyint NOT NULL,
`InheritRDPMinutesToIdleTimeout` tinyint(1) NOT NULL, `InheritRDPMinutesToIdleTimeout` tinyint NOT NULL,
`InheritRdpVersion` tinyint(1) NOT NULL, `InheritRdpVersion` tinyint NOT NULL,
`InheritRedirectAudioCapture` tinyint(1) NOT NULL, `InheritRedirectAudioCapture` tinyint NOT NULL,
`InheritRedirectClipboard` tinyint(1) NOT NULL, `InheritRedirectClipboard` tinyint NOT NULL,
`InheritRedirectDiskDrives` tinyint(1) NOT NULL, `InheritRedirectDiskDrives` tinyint NOT NULL,
`InheritRedirectKeys` tinyint(1) NOT NULL, `InheritRedirectDiskDrivesCustom` tinyint NOT NULL,
`InheritRedirectPorts` tinyint(1) NOT NULL, `InheritRedirectKeys` tinyint NOT NULL,
`InheritRedirectPrinters` tinyint(1) NOT NULL, `InheritRedirectPorts` tinyint NOT NULL,
`InheritRedirectSmartCards` tinyint(1) NOT NULL, `InheritRedirectPrinters` tinyint NOT NULL,
`InheritRedirectSound` tinyint(1) NOT NULL, `InheritRedirectSmartCards` tinyint NOT NULL,
`InheritRenderingEngine` tinyint(1) NOT NULL, `InheritRedirectSound` tinyint NOT NULL,
`InheritResolution` tinyint(1) NOT NULL, `InheritRenderingEngine` tinyint NOT NULL,
`InheritSSHOptions` tinyint(1) NOT NULL, `InheritResolution` tinyint NOT NULL,
`InheritSSHTunnelConnectionName` tinyint(1) NOT NULL, `InheritSSHOptions` tinyint NOT NULL,
`InheritSoundQuality` tinyint(1) NOT NULL, `InheritSSHTunnelConnectionName` tinyint NOT NULL,
`InheritUseConsoleSession` tinyint(1) NOT NULL, `InheritSoundQuality` tinyint NOT NULL,
`InheritUseCredSsp` tinyint(1) NOT NULL, `InheritUseConsoleSession` tinyint NOT NULL,
`InheritUseRestrictedAdmin` tinyint(1) NOT NULL, `InheritUseCredSsp` tinyint NOT NULL,
`InheritUseRCG` tinyint(1) NOT NULL, `InheritUseRestrictedAdmin` tinyint NOT NULL,
`InheritExternalCredentialProvider` tinyint(1) NOT NULL, `InheritUseRCG` tinyint NOT NULL,
`InheritUserViaAPI` tinyint(1) NOT NULL, `InheritExternalCredentialProvider` tinyint NOT NULL,
`UseRestrictedAdmin` tinyint(1) NOT NULL, `InheritUserViaAPI` tinyint NOT NULL,
`UseRCG` tinyint(1) NOT NULL, `UseRestrictedAdmin` tinyint NOT NULL,
`InheritUseEnhancedMode` tinyint(1) DEFAULT NULL, `UseRCG` tinyint NOT NULL,
`InheritUseVmId` tinyint(1) DEFAULT NULL, `InheritUseEnhancedMode` tinyint DEFAULT NULL,
`InheritUserField` tinyint(1) NOT NULL, `InheritUseVmId` tinyint DEFAULT NULL,
`InheritUsername` tinyint(1) NOT NULL, `InheritUserField` tinyint NOT NULL,
`InheritVNCAuthMode` tinyint(1) NOT NULL, `InheritUsername` tinyint NOT NULL,
`InheritVNCColors` tinyint(1) NOT NULL, `InheritVNCAuthMode` tinyint NOT NULL,
`InheritVNCCompression` tinyint(1) NOT NULL, `InheritVNCColors` tinyint NOT NULL,
`InheritVNCEncoding` tinyint(1) NOT NULL, `InheritVNCCompression` tinyint NOT NULL,
`InheritVNCProxyIP` tinyint(1) NOT NULL, `InheritVNCEncoding` tinyint NOT NULL,
`InheritVNCProxyPassword` tinyint(1) NOT NULL, `InheritVNCProxyIP` tinyint NOT NULL,
`InheritVNCProxyPort` tinyint(1) NOT NULL, `InheritVNCProxyPassword` tinyint NOT NULL,
`InheritVNCProxyType` tinyint(1) NOT NULL, `InheritVNCProxyPort` tinyint NOT NULL,
`InheritVNCProxyUsername` tinyint(1) NOT NULL, `InheritVNCProxyType` tinyint NOT NULL,
`InheritVNCSmartSizeMode` tinyint(1) NOT NULL, `InheritVNCProxyUsername` tinyint NOT NULL,
`InheritVNCViewOnly` tinyint(1) NOT NULL, `InheritVNCSmartSizeMode` tinyint NOT NULL,
`InheritVmId` tinyint(1) NOT NULL, `InheritVNCViewOnly` tinyint NOT NULL,
`InheritVmId` tinyint NOT NULL,
`StartProgram` varchar(512) DEFAULT NULL, `StartProgram` varchar(512) DEFAULT NULL,
`StartProgramWorkDir` varchar(512) DEFAULT NULL, `StartProgramWorkDir` varchar(512) DEFAULT NULL,
`EC2Region` varchar(32) DEFAULT NULL, `EC2Region` varchar(32) DEFAULT NULL,
@@ -526,7 +535,7 @@ DROP TABLE IF EXISTS `tblRoot`;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tblRoot` ( CREATE TABLE `tblRoot` (
`Name` varchar(2048) NOT NULL, `Name` varchar(2048) NOT NULL,
`Export` tinyint(1) NOT NULL, `Export` tinyint NOT NULL,
`Protected` varchar(4048) NOT NULL, `Protected` varchar(4048) NOT NULL,
`ConfVersion` varchar(15) NOT NULL `ConfVersion` varchar(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -555,6 +564,227 @@ CREATE TABLE `tblUpdate` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!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 else
{ {
@@ -567,7 +797,3 @@ CREATE TABLE `tblUpdate` (
} }
} }
//// MySql.Data.MySqlClient.MySqlException: 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(`ConstantID`),
//UNIQUE(`ID`)
// ) ENGINE = InnoDB AUTO_INCREMENT = 3324 DEFAULT ' at line 156'