diff --git a/mRemoteV1/App/CompatibilityChecker.cs b/mRemoteV1/App/CompatibilityChecker.cs
index ddb6e517..a5a4d281 100644
--- a/mRemoteV1/App/CompatibilityChecker.cs
+++ b/mRemoteV1/App/CompatibilityChecker.cs
@@ -21,7 +21,8 @@ namespace mRemoteNG.App
{
if (Settings.Default.OverrideFIPSCheck)
{
- messageCollector.AddMessage(MessageClass.InformationMsg, "OverrideFIPSCheck is set. Will skip check...", true);
+ messageCollector.AddMessage(MessageClass.InformationMsg, "OverrideFIPSCheck is set. Will skip check...",
+ true);
return;
}
@@ -34,7 +35,12 @@ namespace mRemoteNG.App
//About to pop up a message, let's not block it...
FrmSplashScreen.getInstance().Close();
- var ShouldIStayOrShouldIGo = CTaskDialog.MessageBox(Application.ProductName, Language.strCompatibilityProblemDetected, errorText, "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.OkCancel, ESysIcons.Warning, ESysIcons.Warning);
+ var ShouldIStayOrShouldIGo = CTaskDialog.MessageBox(Application.ProductName,
+ Language.strCompatibilityProblemDetected, errorText, "",
+ "",
+ Language.strCheckboxDoNotShowThisMessageAgain,
+ ETaskDialogButtons.OkCancel, ESysIcons.Warning,
+ ESysIcons.Warning);
if (CTaskDialog.VerificationChecked && ShouldIStayOrShouldIGo == DialogResult.OK)
{
messageCollector.AddMessage(MessageClass.ErrorMsg, "User requests that FIPS check be overridden", true);
@@ -58,7 +64,8 @@ namespace mRemoteNG.App
private static bool FipsPolicyEnabledForServer2008AndNewer()
{
- var regKey = Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy");
+ var regKey =
+ Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy");
var fipsPolicy = regKey?.GetValue("Enabled");
if (fipsPolicy == null) return false;
fipsPolicy = Convert.ToInt32(fipsPolicy);
@@ -83,9 +90,14 @@ namespace mRemoteNG.App
}
if (proccesses.Length <= 0) return;
- CTaskDialog.MessageBox(Application.ProductName, Language.strCompatibilityProblemDetected, string.Format(Language.strCompatibilityLenovoAutoScrollUtilityDetected, Application.ProductName), "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.Ok, ESysIcons.Warning, ESysIcons.Warning);
+ CTaskDialog.MessageBox(Application.ProductName, Language.strCompatibilityProblemDetected,
+ string.Format(Language.strCompatibilityLenovoAutoScrollUtilityDetected,
+ Application.ProductName), "",
+ "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.Ok,
+ ESysIcons.Warning,
+ ESysIcons.Warning);
if (CTaskDialog.VerificationChecked)
Settings.Default.CompatibilityWarnLenovoAutoScrollUtility = false;
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/App/Export.cs b/mRemoteV1/App/Export.cs
index a6feb229..df8baad3 100644
--- a/mRemoteV1/App/Export.cs
+++ b/mRemoteV1/App/Export.cs
@@ -17,92 +17,101 @@ using mRemoteNG.UI.Forms;
namespace mRemoteNG.App
{
- public static class Export
- {
- public static void ExportToFile(ConnectionInfo selectedNode, ConnectionTreeModel connectionTreeModel)
- {
- try
- {
- var saveFilter = new SaveFilter();
-
- using (var exportForm = new ExportForm())
- {
- if (selectedNode?.GetTreeNodeType() == TreeNodeType.Container)
- exportForm.SelectedFolder = selectedNode as ContainerInfo;
- else if (selectedNode?.GetTreeNodeType() == TreeNodeType.Connection)
- {
- if (selectedNode.Parent.GetTreeNodeType() == TreeNodeType.Container)
- exportForm.SelectedFolder = selectedNode.Parent;
- exportForm.SelectedConnection = selectedNode;
- }
-
- if (exportForm.ShowDialog(FrmMain.Default) != DialogResult.OK)
- return;
+ public static class Export
+ {
+ public static void ExportToFile(ConnectionInfo selectedNode, ConnectionTreeModel connectionTreeModel)
+ {
+ try
+ {
+ var saveFilter = new SaveFilter();
- ConnectionInfo exportTarget;
- switch (exportForm.Scope)
- {
- case ExportForm.ExportScope.SelectedFolder:
- exportTarget = exportForm.SelectedFolder;
- break;
+ using (var exportForm = new ExportForm())
+ {
+ if (selectedNode?.GetTreeNodeType() == TreeNodeType.Container)
+ exportForm.SelectedFolder = selectedNode as ContainerInfo;
+ else if (selectedNode?.GetTreeNodeType() == TreeNodeType.Connection)
+ {
+ if (selectedNode.Parent.GetTreeNodeType() == TreeNodeType.Container)
+ exportForm.SelectedFolder = selectedNode.Parent;
+ exportForm.SelectedConnection = selectedNode;
+ }
+
+ if (exportForm.ShowDialog(FrmMain.Default) != DialogResult.OK)
+ return;
+
+ ConnectionInfo exportTarget;
+ switch (exportForm.Scope)
+ {
+ case ExportForm.ExportScope.SelectedFolder:
+ exportTarget = exportForm.SelectedFolder;
+ break;
case ExportForm.ExportScope.SelectedConnection:
- exportTarget = exportForm.SelectedConnection;
- break;
- default:
- exportTarget = connectionTreeModel.RootNodes.First(node => node is RootNodeInfo);
- break;
- }
-
- saveFilter.SaveUsername = exportForm.IncludeUsername;
- saveFilter.SavePassword = exportForm.IncludePassword;
- saveFilter.SaveDomain = exportForm.IncludeDomain;
- saveFilter.SaveInheritance = exportForm.IncludeInheritance;
- saveFilter.SaveCredentialId = exportForm.IncludeAssignedCredential;
-
- SaveExportFile(exportForm.FileName, exportForm.SaveFormat, saveFilter, exportTarget);
- }
-
- }
- catch (Exception ex)
- {
+ exportTarget = exportForm.SelectedConnection;
+ break;
+ default:
+ exportTarget = connectionTreeModel.RootNodes.First(node => node is RootNodeInfo);
+ break;
+ }
+
+ saveFilter.SaveUsername = exportForm.IncludeUsername;
+ saveFilter.SavePassword = exportForm.IncludePassword;
+ saveFilter.SaveDomain = exportForm.IncludeDomain;
+ saveFilter.SaveInheritance = exportForm.IncludeInheritance;
+ saveFilter.SaveCredentialId = exportForm.IncludeAssignedCredential;
+
+ SaveExportFile(exportForm.FileName, exportForm.SaveFormat, saveFilter, exportTarget);
+ }
+ }
+ catch (Exception ex)
+ {
Runtime.MessageCollector.AddExceptionMessage("App.Export.ExportToFile() failed.", ex);
- }
- }
-
- private static void SaveExportFile(string fileName, SaveFormat saveFormat, SaveFilter saveFilter, ConnectionInfo exportTarget)
- {
- try
- {
- ISerializer serializer;
- switch (saveFormat)
- {
- case SaveFormat.mRXML:
+ }
+ }
+
+ private static void SaveExportFile(string fileName,
+ SaveFormat saveFormat,
+ SaveFilter saveFilter,
+ ConnectionInfo exportTarget)
+ {
+ try
+ {
+ ISerializer serializer;
+ switch (saveFormat)
+ {
+ case SaveFormat.mRXML:
var cryptographyProvider = new CryptoProviderFactoryFromSettings().Build();
- var rootNode = exportTarget.GetRootParent() as RootNodeInfo;
+ var rootNode = exportTarget.GetRootParent() as RootNodeInfo;
var connectionNodeSerializer = new XmlConnectionNodeSerializer27(
- cryptographyProvider,
- rootNode?.PasswordString.ConvertToSecureString() ?? new RootNodeInfo(RootNodeType.Connection).PasswordString.ConvertToSecureString(),
- saveFilter);
- serializer = new XmlConnectionsSerializer(cryptographyProvider, connectionNodeSerializer);
- break;
- case SaveFormat.mRCSV:
- serializer = new CsvConnectionsSerializerMremotengFormat(saveFilter, Runtime.CredentialProviderCatalog);
+ cryptographyProvider,
+ rootNode?.PasswordString
+ .ConvertToSecureString() ??
+ new RootNodeInfo(RootNodeType
+ .Connection)
+ .PasswordString
+ .ConvertToSecureString(),
+ saveFilter);
+ serializer = new XmlConnectionsSerializer(cryptographyProvider, connectionNodeSerializer);
break;
- default:
- throw new ArgumentOutOfRangeException(nameof(saveFormat), saveFormat, null);
- }
- var serializedData = serializer.Serialize(exportTarget);
- var fileDataProvider = new FileDataProvider(fileName);
+ case SaveFormat.mRCSV:
+ serializer =
+ new CsvConnectionsSerializerMremotengFormat(saveFilter, Runtime.CredentialProviderCatalog);
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(saveFormat), saveFormat, null);
+ }
+
+ var serializedData = serializer.Serialize(exportTarget);
+ var fileDataProvider = new FileDataProvider(fileName);
fileDataProvider.Save(serializedData);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace($"Export.SaveExportFile(\"{fileName}\") failed.", ex);
- }
- finally
- {
- Runtime.ConnectionsService.RemoteConnectionsSyncronizer?.Enable();
- }
- }
- }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace($"Export.SaveExportFile(\"{fileName}\") failed.", ex);
+ }
+ finally
+ {
+ Runtime.ConnectionsService.RemoteConnectionsSyncronizer?.Enable();
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/App/Import.cs b/mRemoteV1/App/Import.cs
index 119b9826..0a837cf7 100644
--- a/mRemoteV1/App/Import.cs
+++ b/mRemoteV1/App/Import.cs
@@ -44,8 +44,10 @@ namespace mRemoteNG.App
}
catch (Exception ex)
{
- MessageBox.Show(string.Format(Language.strImportFileFailedContent, fileName), Language.strImportFileFailedMainInstruction,
- MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
+ MessageBox.Show(string.Format(Language.strImportFileFailedContent, fileName),
+ Language.strImportFileFailedMainInstruction,
+ MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
+ MessageBoxDefaultButton.Button1);
Runtime.MessageCollector.AddExceptionMessage("Unable to import file.", ex);
}
}
@@ -59,7 +61,9 @@ namespace mRemoteNG.App
}
}
- public static void ImportFromActiveDirectory(string ldapPath, ContainerInfo importDestinationContainer, bool importSubOu)
+ public static void ImportFromActiveDirectory(string ldapPath,
+ ContainerInfo importDestinationContainer,
+ bool importSubOu)
{
try
{
@@ -72,7 +76,9 @@ namespace mRemoteNG.App
}
}
- public static void ImportFromPortScan(IEnumerable hosts, ProtocolType protocol, ContainerInfo importDestinationContainer)
+ public static void ImportFromPortScan(IEnumerable hosts,
+ ProtocolType protocol,
+ ContainerInfo importDestinationContainer)
{
try
{
diff --git a/mRemoteV1/App/Info/ConnectionsFileInfo.cs b/mRemoteV1/App/Info/ConnectionsFileInfo.cs
index 6017865f..36793e36 100644
--- a/mRemoteV1/App/Info/ConnectionsFileInfo.cs
+++ b/mRemoteV1/App/Info/ConnectionsFileInfo.cs
@@ -1,6 +1,6 @@
namespace mRemoteNG.App.Info
{
- public static class ConnectionsFileInfo
+ public static class ConnectionsFileInfo
{
public static readonly string DefaultConnectionsPath = SettingsFileInfo.SettingsPath;
public static readonly string DefaultConnectionsFile = "confCons.xml";
diff --git a/mRemoteV1/App/Info/GeneralAppInfo.cs b/mRemoteV1/App/Info/GeneralAppInfo.cs
index a6170b4b..fe424beb 100644
--- a/mRemoteV1/App/Info/GeneralAppInfo.cs
+++ b/mRemoteV1/App/Info/GeneralAppInfo.cs
@@ -9,45 +9,53 @@ using static System.Environment;
namespace mRemoteNG.App.Info
{
- public static class GeneralAppInfo
- {
- public const string UrlHome = "https://www.mremoteng.org/";
- public const string UrlDonate = "https://mremoteng.org/contribute/";
- public const string UrlForum = "https://www.reddit.com/r/mRemoteNG/";
- public const string UrlBugs = "https://bugs.mremoteng.org/";
- public static string ApplicationVersion = Application.ProductVersion;
+ public static class GeneralAppInfo
+ {
+ public const string UrlHome = "https://www.mremoteng.org/";
+ public const string UrlDonate = "https://mremoteng.org/contribute/";
+ public const string UrlForum = "https://www.reddit.com/r/mRemoteNG/";
+ public const string UrlBugs = "https://bugs.mremoteng.org/";
+ public static string ApplicationVersion = Application.ProductVersion;
public static readonly string ProductName = Application.ProductName;
- public static readonly string Copyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute), false)).Copyright;
+
+ public static readonly string Copyright =
+ ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
+ typeof(AssemblyCopyrightAttribute), false))
+ .Copyright;
+
public static readonly string HomePath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
- //public static string ReportingFilePath = "";
- public static readonly string PuttyPath = HomePath + "\\PuTTYNG.exe";
+
+ //public static string ReportingFilePath = "";
+ public static readonly string PuttyPath = HomePath + "\\PuTTYNG.exe";
+
public static string UserAgent
- {
- get
- {
- var details = new List
- {
- "compatible",
- OSVersion.Platform == PlatformID.Win32NT
- ? $"Windows NT {OSVersion.Version.Major}.{OSVersion.Version.Minor}"
- : OSVersion.VersionString
- };
- if (Is64BitProcess)
- {
- details.Add("WOW64");
- }
- details.Add(Thread.CurrentThread.CurrentUICulture.Name);
- details.Add($".NET CLR {Environment.Version}");
- var detailsString = string.Join("; ", details.ToArray());
+ {
+ get
+ {
+ var details = new List
+ {
+ "compatible",
+ OSVersion.Platform == PlatformID.Win32NT
+ ? $"Windows NT {OSVersion.Version.Major}.{OSVersion.Version.Minor}"
+ : OSVersion.VersionString
+ };
+ if (Is64BitProcess)
+ {
+ details.Add("WOW64");
+ }
- return $"Mozilla/5.0 ({detailsString}) {ProductName}/{ApplicationVersion}";
- }
- }
+ details.Add(Thread.CurrentThread.CurrentUICulture.Name);
+ details.Add($".NET CLR {Environment.Version}");
+ var detailsString = string.Join("; ", details.ToArray());
- public static Version GetApplicationVersion()
- {
+ return $"Mozilla/5.0 ({detailsString}) {ProductName}/{ApplicationVersion}";
+ }
+ }
+
+ public static Version GetApplicationVersion()
+ {
System.Version.TryParse(ApplicationVersion, out var v);
- return v;
- }
- }
+ return v;
+ }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/App/Info/SettingsFileInfo.cs b/mRemoteV1/App/Info/SettingsFileInfo.cs
index a91d9497..e6007b9f 100644
--- a/mRemoteV1/App/Info/SettingsFileInfo.cs
+++ b/mRemoteV1/App/Info/SettingsFileInfo.cs
@@ -8,13 +8,22 @@ namespace mRemoteNG.App.Info
{
public static class SettingsFileInfo
{
- private static readonly string ExePath = Path.GetDirectoryName(Assembly.GetAssembly(typeof(ConnectionInfo))?.Location);
+ private static readonly string ExePath =
+ Path.GetDirectoryName(Assembly.GetAssembly(typeof(ConnectionInfo))?.Location);
+
+ public static string SettingsPath =>
+ Runtime.IsPortableEdition
+ ? ExePath
+ : Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + Application.ProductName;
- public static string SettingsPath => Runtime.IsPortableEdition ? ExePath : Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + Application.ProductName;
public static string LayoutFileName { get; } = "pnlLayout.xml";
public static string ExtAppsFilesName { get; } = "extApps.xml";
public static string ThemesFileName { get; } = "Themes.xml";
- public static string ThemeFolder { get; } = SettingsPath != null ? Path.Combine(SettingsPath, "Themes") : String.Empty;
- public static string InstalledThemeFolder { get; } = ExePath != null ? Path.Combine(ExePath, "Themes") : String.Empty;
+
+ public static string ThemeFolder { get; } =
+ SettingsPath != null ? Path.Combine(SettingsPath, "Themes") : String.Empty;
+
+ public static string InstalledThemeFolder { get; } =
+ ExePath != null ? Path.Combine(ExePath, "Themes") : String.Empty;
}
}
\ No newline at end of file
diff --git a/mRemoteV1/App/Info/UpdateChannelInfo.cs b/mRemoteV1/App/Info/UpdateChannelInfo.cs
index e3b3f4e2..c5f3ec46 100644
--- a/mRemoteV1/App/Info/UpdateChannelInfo.cs
+++ b/mRemoteV1/App/Info/UpdateChannelInfo.cs
@@ -1,4 +1,5 @@
using System;
+
// ReSharper disable InconsistentNaming
namespace mRemoteNG.App.Info
@@ -27,7 +28,9 @@ namespace mRemoteNG.App.Info
private static string GetChannelFileName(string channel)
{
- return Runtime.IsPortableEdition ? GetChannelFileNamePortableEdition(channel) : GetChannelFileNameNormalEdition(channel);
+ return Runtime.IsPortableEdition
+ ? GetChannelFileNamePortableEdition(channel)
+ : GetChannelFileNameNormalEdition(channel);
}
private static string GetChannelFileNameNormalEdition(string channel)
@@ -62,7 +65,8 @@ namespace mRemoteNG.App.Info
private static Uri GetUpdateTxtUri(string channel)
{
- return new Uri(new Uri(Settings.Default.UpdateAddress), new Uri(GetChannelFileName(channel), UriKind.Relative));
+ return new Uri(new Uri(Settings.Default.UpdateAddress),
+ new Uri(GetChannelFileName(channel), UriKind.Relative));
}
private static bool IsValidChannel(string s)
diff --git a/mRemoteV1/App/Initialization/ConnectionIconLoader.cs b/mRemoteV1/App/Initialization/ConnectionIconLoader.cs
index f9282ff8..b9267f63 100644
--- a/mRemoteV1/App/Initialization/ConnectionIconLoader.cs
+++ b/mRemoteV1/App/Initialization/ConnectionIconLoader.cs
@@ -11,7 +11,7 @@ namespace mRemoteNG.App.Initialization
public ConnectionIconLoader(string folderPath)
{
- if(string.IsNullOrEmpty(folderPath))
+ if (string.IsNullOrEmpty(folderPath))
throw new ArgumentException($"{nameof(folderPath)} must be a valid folder path.");
_path = folderPath;
diff --git a/mRemoteV1/App/Initialization/CredsAndConsSetup.cs b/mRemoteV1/App/Initialization/CredsAndConsSetup.cs
index af4b3329..43a0ac08 100644
--- a/mRemoteV1/App/Initialization/CredsAndConsSetup.cs
+++ b/mRemoteV1/App/Initialization/CredsAndConsSetup.cs
@@ -3,14 +3,16 @@ using mRemoteNG.Config.Connections;
namespace mRemoteNG.App.Initialization
{
- public class CredsAndConsSetup
+ public class CredsAndConsSetup
{
public void LoadCredsAndCons()
{
new SaveConnectionsOnEdit(Runtime.ConnectionsService);
- if (Settings.Default.FirstStart && !Settings.Default.LoadConsFromCustomLocation && !File.Exists(Runtime.ConnectionsService.GetStartupConnectionFileName()))
- Runtime.ConnectionsService.NewConnectionsFile(Runtime.ConnectionsService.GetStartupConnectionFileName());
+ if (Settings.Default.FirstStart && !Settings.Default.LoadConsFromCustomLocation &&
+ !File.Exists(Runtime.ConnectionsService.GetStartupConnectionFileName()))
+ Runtime.ConnectionsService.NewConnectionsFile(Runtime.ConnectionsService
+ .GetStartupConnectionFileName());
Runtime.LoadConnections();
}
diff --git a/mRemoteV1/App/Initialization/MessageCollectorSetup.cs b/mRemoteV1/App/Initialization/MessageCollectorSetup.cs
index 5f110cc7..faf6a394 100644
--- a/mRemoteV1/App/Initialization/MessageCollectorSetup.cs
+++ b/mRemoteV1/App/Initialization/MessageCollectorSetup.cs
@@ -8,7 +8,8 @@ namespace mRemoteNG.App.Initialization
{
public class MessageCollectorSetup
{
- public static void SetupMessageCollector(MessageCollector messageCollector, IList messageWriterList)
+ public static void SetupMessageCollector(MessageCollector messageCollector,
+ IList messageWriterList)
{
messageCollector.CollectionChanged += (o, args) =>
{
@@ -37,34 +38,37 @@ namespace mRemoteNG.App.Initialization
private static IMessageWriter BuildTextLogMessageWriter()
{
return new MessageTypeFilterDecorator(
- new LogMessageTypeFilteringOptions(),
- new TextLogMessageWriter(Logger.Instance)
- );
+ new LogMessageTypeFilteringOptions(),
+ new TextLogMessageWriter(Logger.Instance)
+ );
}
private static IMessageWriter BuildNotificationPanelMessageWriter()
{
-
return new OnlyLogMessageFilter(
- new MessageTypeFilterDecorator(
- new NotificationPanelMessageFilteringOptions(),
- new MessageFocusDecorator(
- Windows.ErrorsForm,
- new NotificationPanelSwitchOnMessageFilteringOptions(),
- new NotificationPanelMessageWriter(Windows.ErrorsForm)
- )
- )
- );
+ new MessageTypeFilterDecorator(
+ new
+ NotificationPanelMessageFilteringOptions(),
+ new MessageFocusDecorator(
+ Windows.ErrorsForm,
+ new
+ NotificationPanelSwitchOnMessageFilteringOptions(),
+ new
+ NotificationPanelMessageWriter(Windows
+ .ErrorsForm)
+ )
+ )
+ );
}
private static IMessageWriter BuildPopupMessageWriter()
{
return new OnlyLogMessageFilter(
- new MessageTypeFilterDecorator(
- new PopupMessageFilteringOptions(),
- new PopupMessageWriter()
- )
- );
+ new MessageTypeFilterDecorator(
+ new PopupMessageFilteringOptions(),
+ new PopupMessageWriter()
+ )
+ );
}
}
}
\ No newline at end of file
diff --git a/mRemoteV1/App/Initialization/StartupDataLogger.cs b/mRemoteV1/App/Initialization/StartupDataLogger.cs
index e5ea3a23..d4bc791e 100644
--- a/mRemoteV1/App/Initialization/StartupDataLogger.cs
+++ b/mRemoteV1/App/Initialization/StartupDataLogger.cs
@@ -43,7 +43,8 @@ namespace mRemoteNG.App.Initialization
try
{
- foreach (var o in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem WHERE Primary=True").Get())
+ foreach (var o in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem WHERE Primary=True")
+ .Get())
{
var managementObject = (ManagementObject)o;
osVersion = Convert.ToString(managementObject.GetPropertyValue("Caption")).Trim();
@@ -54,6 +55,7 @@ namespace mRemoteNG.App.Initialization
{
_messageCollector.AddExceptionMessage("Error retrieving operating system information from WMI.", ex);
}
+
var osData = string.Join(" ", osVersion, servicePack);
return osData;
}
@@ -65,6 +67,7 @@ namespace mRemoteNG.App.Initialization
{
servicePack = $"Service Pack {servicePackNumber}";
}
+
return servicePack;
}
@@ -73,7 +76,8 @@ namespace mRemoteNG.App.Initialization
var architecture = string.Empty;
try
{
- foreach (var o in new ManagementObjectSearcher("SELECT * FROM Win32_Processor WHERE DeviceID=\'CPU0\'").Get())
+ foreach (var o in new ManagementObjectSearcher("SELECT * FROM Win32_Processor WHERE DeviceID=\'CPU0\'")
+ .Get())
{
var managementObject = (ManagementObject)o;
var addressWidth = Convert.ToInt32(managementObject.GetPropertyValue("AddressWidth"));
@@ -84,6 +88,7 @@ namespace mRemoteNG.App.Initialization
{
_messageCollector.AddExceptionMessage("Error retrieving operating system address width from WMI.", ex);
}
+
return architecture;
}
@@ -110,7 +115,8 @@ namespace mRemoteNG.App.Initialization
private void LogCultureData()
{
- var data = $"System Culture: {Thread.CurrentThread.CurrentUICulture.Name}/{Thread.CurrentThread.CurrentUICulture.NativeName}";
+ var data =
+ $"System Culture: {Thread.CurrentThread.CurrentUICulture.Name}/{Thread.CurrentThread.CurrentUICulture.NativeName}";
_messageCollector.AddMessage(MessageClass.InformationMsg, data, true);
}
}
diff --git a/mRemoteV1/App/Logger.cs b/mRemoteV1/App/Logger.cs
index 4031e058..b39fffb4 100644
--- a/mRemoteV1/App/Logger.cs
+++ b/mRemoteV1/App/Logger.cs
@@ -4,11 +4,12 @@ using System.Windows.Forms;
using log4net;
using log4net.Appender;
using log4net.Config;
+
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.App
{
- public class Logger
+ public class Logger
{
public static readonly Logger Instance = new Logger();
@@ -42,6 +43,7 @@ namespace mRemoteNG.App
fileAppender.File = path;
fileAppender.ActivateOptions();
}
+
Log = LogManager.GetLogger("Logger");
}
@@ -56,7 +58,8 @@ namespace mRemoteNG.App
private static string GetLogPathNormalEdition()
{
- return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Application.ProductName);
+ return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
+ Application.ProductName);
}
private static string GetLogPathPortableEdition()
diff --git a/mRemoteV1/App/NativeMethods.cs b/mRemoteV1/App/NativeMethods.cs
index 45b2ba36..0e15954b 100644
--- a/mRemoteV1/App/NativeMethods.cs
+++ b/mRemoteV1/App/NativeMethods.cs
@@ -12,6 +12,7 @@ namespace mRemoteNG.App
public static class NativeMethods
{
#region Functions
+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool AppendMenu(IntPtr hMenu, int uFlags, IntPtr uIDNewItem, string lpNewItem);
@@ -19,7 +20,10 @@ namespace mRemoteNG.App
internal static extern IntPtr CreatePopupMenu();
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
- internal static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);
+ internal static extern IntPtr FindWindowEx(IntPtr parentHandle,
+ IntPtr childAfter,
+ string lclassName,
+ string windowTitle);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern IntPtr GetForegroundWindow();
@@ -28,7 +32,11 @@ namespace mRemoteNG.App
internal static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
- internal static extern bool InsertMenu(IntPtr hMenu, int uPosition, int uFlags, IntPtr uIDNewItem, string lpNewItem);
+ internal static extern bool InsertMenu(IntPtr hMenu,
+ int uPosition,
+ int uFlags,
+ IntPtr uIDNewItem,
+ string lpNewItem);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern int IsIconic(IntPtr hWnd);
@@ -55,7 +63,10 @@ namespace mRemoteNG.App
internal static extern IntPtr SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, string lParam);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
- internal static extern IntPtr SendMessage([In] IntPtr hWnd, [In] uint msg, [Out] StringBuilder wParam, [In] IntPtr lParam);
+ internal static extern IntPtr SendMessage([In] IntPtr hWnd,
+ [In] uint msg,
+ [Out] StringBuilder wParam,
+ [In] IntPtr lParam);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);
@@ -64,7 +75,11 @@ namespace mRemoteNG.App
internal static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
- internal static extern bool SetMenuItemBitmaps(IntPtr hMenu, int uPosition, int uFlags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked);
+ internal static extern bool SetMenuItemBitmaps(IntPtr hMenu,
+ int uPosition,
+ int uFlags,
+ IntPtr hBitmapUnchecked,
+ IntPtr hBitmapChecked);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern long SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
@@ -93,9 +108,11 @@ namespace mRemoteNG.App
[DllImport("kernel32", SetLastError = true)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
internal static extern bool CloseHandle(IntPtr handle);
+
#endregion
#region Structures
+
[StructLayout(LayoutKind.Sequential)]
internal struct WINDOWPOS
{
@@ -131,9 +148,11 @@ namespace mRemoteNG.App
public long right;
public long bottom;
}
+
#endregion
#region Helpers
+
public static int MAKELONG(int wLow, int wHigh)
{
return wLow | wHigh << 16;
@@ -163,28 +182,37 @@ namespace mRemoteNG.App
{
return HIWORD(value.ToInt32());
}
+
#endregion
#region Constants
+
public const int TRUE = 1;
#region GetWindowLong
+
public const int GWL_STYLE = (-16);
+
#endregion
#region AppendMenu / ModifyMenu / DeleteMenu / RemoveMenu
+
public const int MF_BYCOMMAND = 0x0;
public const int MF_BYPOSITION = 0x400;
public const int MF_STRING = 0x0;
public const int MF_POPUP = 0x10;
public const int MF_SEPARATOR = 0x800;
+
#endregion
#region WM_LBUTTONDOWN / WM_LBUTTONUP
+
public const int MK_LBUTTON = 0x1;
+
#endregion
#region ShowWindow
+
public const uint SW_HIDE = 0;
public const uint SW_SHOWNORMAL = 1;
public const uint SW_SHOWMINIMIZED = 2;
@@ -196,9 +224,11 @@ namespace mRemoteNG.App
public const uint SW_SHOWMINNOACTIVE = 7;
public const uint SW_SHOWNA = 8;
public const uint SW_RESTORE = 9;
+
#endregion
#region SetWindowPos / WM_WINDOWPOSCHANGING / WM_WINDOWPOSCHANGED
+
///
/// Retains the current size (ignores the cx and cy parameters).
///
@@ -283,15 +313,19 @@ namespace mRemoteNG.App
///
///
public const int SWP_STATECHANGED = 0x8000;
+
#endregion
#region Window Placement Flags (WPF)
+
public const uint WPF_SETMINPOSITION = 0x1;
public const uint WPF_RESTORETOMAXIMIZED = 0x2;
public const uint WPF_ASYNCWINDOWPLACEMENT = 0x4;
+
#endregion
#region WM_ACTIVATE
+
///
///
///
@@ -309,9 +343,11 @@ namespace mRemoteNG.App
/// windows use different input queues, the message is sent asynchronously, so the window is activated immediately.
///
public const int WA_CLICKACTIVE = 0x2;
+
#endregion
#region Window Messages
+
///
/// Sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. (The message is sent before the function returns.) The window procedure of the new window receives this message after the window is created, but before the window becomes visible.
///
@@ -466,29 +502,38 @@ namespace mRemoteNG.App
/// Sent to the first window in the clipboard viewer chain when a window is being removed from the chain.
///
public const int WM_CHANGECBCHAIN = 0x30D;
+
#endregion
#region Window Styles
+
public const int WS_MAXIMIZE = 0x1000000;
public const int WS_VISIBLE = 0x10000000;
public const int WS_CHILD = 0x40000000;
public const int WS_EX_MDICHILD = 0x40;
+
#endregion
#region Virtual Key Codes
+
public const int VK_CONTROL = 0x11;
public const int VK_C = 0x67;
+
#endregion
#region EM
+
public const uint ECM_FIRST = 0x1500;
public const uint EM_SETCUEBANNER = ECM_FIRST + 1;
public const uint EM_GETCUEBANNER = ECM_FIRST + 2;
+
#endregion
#region LB
+
public const int LB_ERR = -1;
public const int LB_SELECTSTRING = 0x18C;
+
#endregion
#region TCM
diff --git a/mRemoteV1/App/ProgramRoot.cs b/mRemoteV1/App/ProgramRoot.cs
index b2fcd4a7..5906d2e0 100644
--- a/mRemoteV1/App/ProgramRoot.cs
+++ b/mRemoteV1/App/ProgramRoot.cs
@@ -67,9 +67,12 @@ namespace mRemoteNG.App
var currentProcess = Process.GetCurrentProcess();
foreach (var enumeratedProcess in Process.GetProcessesByName(currentProcess.ProcessName))
{
- if (enumeratedProcess.Id != currentProcess.Id && enumeratedProcess.MainModule.FileName == currentProcess.MainModule.FileName && enumeratedProcess.MainWindowHandle != IntPtr.Zero)
+ if (enumeratedProcess.Id != currentProcess.Id &&
+ enumeratedProcess.MainModule.FileName == currentProcess.MainModule.FileName &&
+ enumeratedProcess.MainWindowHandle != IntPtr.Zero)
windowHandle = enumeratedProcess.MainWindowHandle;
}
+
return windowHandle;
}
diff --git a/mRemoteV1/App/Runtime.cs b/mRemoteV1/App/Runtime.cs
index 0481796b..2c86269c 100644
--- a/mRemoteV1/App/Runtime.cs
+++ b/mRemoteV1/App/Runtime.cs
@@ -41,11 +41,17 @@ namespace mRemoteNG.App
public static MessageCollector MessageCollector { get; } = new MessageCollector();
public static NotificationAreaIcon NotificationAreaIcon { get; set; }
public static ExternalToolsService ExternalToolsService { get; } = new ExternalToolsService();
- public static SecureString EncryptionKey { get; set; } = new RootNodeInfo(RootNodeType.Connection).PasswordString.ConvertToSecureString();
+
+ public static SecureString EncryptionKey { get; set; } =
+ new RootNodeInfo(RootNodeType.Connection).PasswordString.ConvertToSecureString();
+
public static ICredentialRepositoryList CredentialProviderCatalog { get; } = new CredentialRepositoryList();
- public static ConnectionsService ConnectionsService { get; } = new ConnectionsService(PuttySessionsManager.Instance);
+
+ public static ConnectionsService ConnectionsService { get; } =
+ new ConnectionsService(PuttySessionsManager.Instance);
#region Connections Loading/Saving
+
public static void LoadConnectionsAsync()
{
var t = new Thread(LoadConnectionsBGd);
@@ -106,8 +112,14 @@ namespace mRemoteNG.App
if (Settings.Default.UseSQLServer)
{
MessageCollector.AddExceptionMessage(Language.strLoadFromSqlFailed, ex);
- var commandButtons = string.Join("|", Language.strCommandTryAgain, Language.strCommandOpenConnectionFile, string.Format(Language.strCommandExitProgram, Application.ProductName));
- CTaskDialog.ShowCommandBox(Application.ProductName, Language.strLoadFromSqlFailed, Language.strLoadFromSqlFailedContent, MiscTools.GetExceptionMessageRecursive(ex), "", "", commandButtons, false, ESysIcons.Error, ESysIcons.Error);
+ var commandButtons = string.Join("|", Language.strCommandTryAgain,
+ Language.strCommandOpenConnectionFile,
+ string.Format(Language.strCommandExitProgram,
+ Application.ProductName));
+ CTaskDialog.ShowCommandBox(Application.ProductName, Language.strLoadFromSqlFailed,
+ Language.strLoadFromSqlFailedContent,
+ MiscTools.GetExceptionMessageRecursive(ex), "", "",
+ commandButtons, false, ESysIcons.Error, ESysIcons.Error);
switch (CTaskDialog.CommandButtonResult)
{
case 0:
@@ -122,9 +134,13 @@ namespace mRemoteNG.App
return;
}
}
+
if (ex is FileNotFoundException && !withDialog)
{
- MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoadedNew, connectionFileName), ex, MessageClass.InformationMsg);
+ MessageCollector.AddExceptionMessage(
+ string.Format(Language.strConnectionsFileCouldNotBeLoadedNew,
+ connectionFileName), ex,
+ MessageClass.InformationMsg);
string[] commandButtons =
{
@@ -140,13 +156,13 @@ namespace mRemoteNG.App
try
{
CTaskDialog.ShowTaskDialogBox(
- GeneralAppInfo.ProductName,
- Language.ConnectionFileNotFound,
- "", "", "", "", "",
- string.Join(" | ", commandButtons),
- ETaskDialogButtons.None,
- ESysIcons.Question,
- ESysIcons.Question);
+ GeneralAppInfo.ProductName,
+ Language.ConnectionFileNotFound,
+ "", "", "", "", "",
+ string.Join(" | ", commandButtons),
+ ETaskDialogButtons.None,
+ ESysIcons.Question,
+ ESysIcons.Question);
switch (CTaskDialog.CommandButtonResult)
{
@@ -167,17 +183,24 @@ namespace mRemoteNG.App
Application.Exit();
answered = true;
break;
- }
+ }
}
catch (Exception exc)
{
- MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoadedNew, connectionFileName), exc, MessageClass.InformationMsg);
+ MessageCollector.AddExceptionMessage(
+ string
+ .Format(Language.strConnectionsFileCouldNotBeLoadedNew,
+ connectionFileName), exc,
+ MessageClass.InformationMsg);
}
}
+
return;
}
- MessageCollector.AddExceptionStackTrace(string.Format(Language.strConnectionsFileCouldNotBeLoaded, connectionFileName), ex);
+ MessageCollector.AddExceptionStackTrace(
+ string.Format(Language.strConnectionsFileCouldNotBeLoaded,
+ connectionFileName), ex);
if (connectionFileName != ConnectionsService.GetStartupConnectionFileName())
{
LoadConnections(withDialog);
@@ -185,12 +208,16 @@ namespace mRemoteNG.App
else
{
MessageBox.Show(FrmMain.Default,
- string.Format(Language.strErrorStartupConnectionFileLoad, Environment.NewLine, Application.ProductName, ConnectionsService.GetStartupConnectionFileName(), MiscTools.GetExceptionMessageRecursive(ex)),
- @"Could not load startup file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ string.Format(Language.strErrorStartupConnectionFileLoad, Environment.NewLine,
+ Application.ProductName,
+ ConnectionsService.GetStartupConnectionFileName(),
+ MiscTools.GetExceptionMessageRecursive(ex)),
+ @"Could not load startup file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
}
}
+
#endregion
}
}
\ No newline at end of file
diff --git a/mRemoteV1/App/Shutdown.cs b/mRemoteV1/App/Shutdown.cs
index 56977bba..817d451a 100644
--- a/mRemoteV1/App/Shutdown.cs
+++ b/mRemoteV1/App/Shutdown.cs
@@ -5,6 +5,7 @@ using System.Windows.Forms;
using mRemoteNG.Config.Putty;
using mRemoteNG.UI.Controls;
using mRemoteNG.UI.Forms;
+
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.App
@@ -25,7 +26,10 @@ namespace mRemoteNG.App
ProgramRoot.CloseSingletonInstanceMutex();
}
- public static void Cleanup(Control quickConnectToolStrip, ExternalToolsToolStrip externalToolsToolStrip, MultiSshToolStrip multiSshToolStrip, FrmMain frmMain)
+ public static void Cleanup(Control quickConnectToolStrip,
+ ExternalToolsToolStrip externalToolsToolStrip,
+ MultiSshToolStrip multiSshToolStrip,
+ FrmMain frmMain)
{
try
{
@@ -58,9 +62,13 @@ namespace mRemoteNG.App
Runtime.ConnectionsService.SaveConnections();
}
- private static void SaveSettings(Control quickConnectToolStrip, ExternalToolsToolStrip externalToolsToolStrip, MultiSshToolStrip multiSshToolStrip, FrmMain frmMain)
+ private static void SaveSettings(Control quickConnectToolStrip,
+ ExternalToolsToolStrip externalToolsToolStrip,
+ MultiSshToolStrip multiSshToolStrip,
+ FrmMain frmMain)
{
- Config.Settings.SettingsSaver.SaveSettings(quickConnectToolStrip, externalToolsToolStrip, multiSshToolStrip, frmMain);
+ Config.Settings.SettingsSaver.SaveSettings(quickConnectToolStrip, externalToolsToolStrip, multiSshToolStrip,
+ frmMain);
}
private static void UnregisterBrowsers()
diff --git a/mRemoteV1/App/Startup.cs b/mRemoteV1/App/Startup.cs
index 77b62b94..531190bf 100644
--- a/mRemoteV1/App/Startup.cs
+++ b/mRemoteV1/App/Startup.cs
@@ -37,15 +37,16 @@ namespace mRemoteNG.App
public void InitializeProgram(MessageCollector messageCollector)
{
- Debug.Print("---------------------------" + Environment.NewLine + "[START] - " + Convert.ToString(DateTime.Now, CultureInfo.InvariantCulture));
+ Debug.Print("---------------------------" + Environment.NewLine + "[START] - " +
+ Convert.ToString(DateTime.Now, CultureInfo.InvariantCulture));
var startupLogger = new StartupDataLogger(messageCollector);
startupLogger.LogStartupData();
CompatibilityChecker.CheckCompatibility(messageCollector);
ParseCommandLineArgs(messageCollector);
IeBrowserEmulation.Register();
_connectionIconLoader.GetConnectionIcons();
- DefaultConnectionInfo.Instance.LoadFrom(Settings.Default, a=>"ConDefault"+a);
- DefaultConnectionInheritance.Instance.LoadFrom(Settings.Default, a=>"InhDefault"+a);
+ DefaultConnectionInfo.Instance.LoadFrom(Settings.Default, a => "ConDefault" + a);
+ DefaultConnectionInheritance.Instance.LoadFrom(Settings.Default, a => "InhDefault" + a);
}
private static void ParseCommandLineArgs(MessageCollector messageCollector)
@@ -59,7 +60,8 @@ namespace mRemoteNG.App
messageCollector.AddMessage(MessageClass.DebugMsg, "Determining if we need a database syncronizer");
if (!Settings.Default.UseSQLServer) return;
messageCollector.AddMessage(MessageClass.DebugMsg, "Creating database syncronizer");
- Runtime.ConnectionsService.RemoteConnectionsSyncronizer = new RemoteConnectionsSyncronizer(new SqlConnectionsUpdateChecker());
+ Runtime.ConnectionsService.RemoteConnectionsSyncronizer =
+ new RemoteConnectionsSyncronizer(new SqlConnectionsUpdateChecker());
Runtime.ConnectionsService.RemoteConnectionsSyncronizer.Enable();
}
@@ -74,7 +76,12 @@ namespace mRemoteNG.App
return;
}
- var nextUpdateCheck = Convert.ToDateTime(Settings.Default.CheckForUpdatesLastCheck.Add(TimeSpan.FromDays(Convert.ToDouble(Settings.Default.CheckForUpdatesFrequencyDays))));
+ var nextUpdateCheck =
+ Convert.ToDateTime(Settings.Default.CheckForUpdatesLastCheck.Add(
+ TimeSpan
+ .FromDays(Convert.ToDouble(Settings
+ .Default
+ .CheckForUpdatesFrequencyDays))));
if (!Settings.Default.UpdatePending && DateTime.UtcNow < nextUpdateCheck)
{
return;
@@ -100,6 +107,7 @@ namespace mRemoteNG.App
{
return;
}
+
if (e.Error != null)
{
throw e.Error;
diff --git a/mRemoteV1/App/SupportedCultures.cs b/mRemoteV1/App/SupportedCultures.cs
index 37ebc34a..1ee52261 100644
--- a/mRemoteV1/App/SupportedCultures.cs
+++ b/mRemoteV1/App/SupportedCultures.cs
@@ -10,7 +10,7 @@ namespace mRemoteNG.App
{
[Serializable]
public sealed class SupportedCultures : Dictionary
- {
+ {
private static SupportedCultures _Instance;
private static SupportedCultures SingletonInstance
@@ -19,7 +19,7 @@ namespace mRemoteNG.App
}
- private SupportedCultures()
+ private SupportedCultures()
{
foreach (var CultureName in Settings.Default.SupportedUICultures.Split(','))
{
@@ -30,7 +30,8 @@ namespace mRemoteNG.App
}
catch (Exception ex)
{
- Debug.Print($"An exception occurred while adding the culture {CultureName} to the list of supported cultures. {ex.StackTrace}");
+ Debug.Print(
+ $"An exception occurred while adding the culture {CultureName} to the list of supported cultures. {ex.StackTrace}");
}
}
}
@@ -41,51 +42,52 @@ namespace mRemoteNG.App
throw new NotImplementedException();
}
- public static bool IsNameSupported(string CultureName)
- {
- return SingletonInstance.ContainsKey(CultureName);
- }
-
- public static bool IsNativeNameSupported(string CultureNativeName)
- {
- return SingletonInstance.ContainsValue(CultureNativeName);
- }
-
- public static string get_CultureName(string CultureNativeName)
- {
- var Names = new string[SingletonInstance.Count + 1];
- var NativeNames = new string[SingletonInstance.Count + 1];
+ public static bool IsNameSupported(string CultureName)
+ {
+ return SingletonInstance.ContainsKey(CultureName);
+ }
+
+ public static bool IsNativeNameSupported(string CultureNativeName)
+ {
+ return SingletonInstance.ContainsValue(CultureNativeName);
+ }
+
+ public static string get_CultureName(string CultureNativeName)
+ {
+ var Names = new string[SingletonInstance.Count + 1];
+ var NativeNames = new string[SingletonInstance.Count + 1];
SingletonInstance.Keys.CopyTo(Names, 0);
SingletonInstance.Values.CopyTo(NativeNames, 0);
-
- for (var Index = 0; Index <= SingletonInstance.Count; Index++)
- {
- if (NativeNames[Index] == CultureNativeName)
- {
- return Names[Index];
- }
- }
-
- throw (new KeyNotFoundException());
- }
-
- public static string get_CultureNativeName(string CultureName)
- {
- return SingletonInstance[CultureName];
- }
-
+
+ for (var Index = 0; Index <= SingletonInstance.Count; Index++)
+ {
+ if (NativeNames[Index] == CultureNativeName)
+ {
+ return Names[Index];
+ }
+ }
+
+ throw (new KeyNotFoundException());
+ }
+
+ public static string get_CultureNativeName(string CultureName)
+ {
+ return SingletonInstance[CultureName];
+ }
+
public static List CultureNativeNames
- {
- get
- {
- var ValueList = new List();
- foreach (var Value in SingletonInstance.Values)
- {
- ValueList.Add(Value);
- }
- return ValueList;
- }
- }
- }
+ {
+ get
+ {
+ var ValueList = new List();
+ foreach (var Value in SingletonInstance.Values)
+ {
+ ValueList.Add(Value);
+ }
+
+ return ValueList;
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/App/Update/AppUpdater.cs b/mRemoteV1/App/Update/AppUpdater.cs
index 2e728291..3532a596 100644
--- a/mRemoteV1/App/Update/AppUpdater.cs
+++ b/mRemoteV1/App/Update/AppUpdater.cs
@@ -10,8 +10,9 @@ using System.Security.Cryptography;
#if !PORTABLE
using mRemoteNG.Tools;
-#else
+#else
using System.Windows.Forms;
+
#endif
// ReSharper disable ArrangeAccessorOwnerBody
@@ -66,7 +67,12 @@ namespace mRemoteNG.App.Update
SetProxySettings(shouldWeUseProxy, proxyAddress, port, useAuthentication, username, password);
}
- public void SetProxySettings(bool useProxy, string address, int port, bool useAuthentication, string username, string password)
+ public void SetProxySettings(bool useProxy,
+ string address,
+ int port,
+ bool useAuthentication,
+ string username,
+ string password)
{
if (useProxy && !string.IsNullOrEmpty(address))
{
@@ -107,7 +113,8 @@ namespace mRemoteNG.App.Update
{
if (CurrentUpdateInfo == null || !CurrentUpdateInfo.IsValid)
{
- throw new InvalidOperationException("CurrentUpdateInfo is not valid. GetUpdateInfoAsync() must be called before calling GetChangeLogAsync().");
+ throw new InvalidOperationException(
+ "CurrentUpdateInfo is not valid. GetUpdateInfoAsync() must be called before calling GetChangeLogAsync().");
}
if (IsGetChangeLogRunning)
@@ -131,27 +138,29 @@ namespace mRemoteNG.App.Update
if (CurrentUpdateInfo == null || !CurrentUpdateInfo.IsValid)
{
throw new InvalidOperationException(
- "CurrentUpdateInfo is not valid. GetUpdateInfoAsync() must be called before calling DownloadUpdateAsync().");
+ "CurrentUpdateInfo is not valid. GetUpdateInfoAsync() must be called before calling DownloadUpdateAsync().");
}
#if !PORTABLE
- CurrentUpdateInfo.UpdateFilePath = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), "msi"));
+ CurrentUpdateInfo.UpdateFilePath =
+ Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), "msi"));
#else
- var sfd = new SaveFileDialog
- {
- InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory),
+ var sfd = new SaveFileDialog
+ {
+ InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory),
FileName = CurrentUpdateInfo.FileName,
- RestoreDirectory = true
- };
- if (sfd.ShowDialog() == DialogResult.OK)
- {
+ RestoreDirectory = true
+ };
+ if (sfd.ShowDialog() == DialogResult.OK)
+ {
CurrentUpdateInfo.UpdateFilePath = sfd.FileName;
}
- else
- {
- return;
- }
+ else
+ {
+ return;
+ }
#endif
- DownloadUpdateWebClient.DownloadFileAsync(CurrentUpdateInfo.DownloadAddress, CurrentUpdateInfo.UpdateFilePath);
+ DownloadUpdateWebClient.DownloadFileAsync(CurrentUpdateInfo.DownloadAddress,
+ CurrentUpdateInfo.UpdateFilePath);
}
#endregion
@@ -191,7 +200,9 @@ namespace mRemoteNG.App.Update
}
private static DownloadStringCompletedEventArgs NewDownloadStringCompletedEventArgs(string result,
- Exception exception, bool cancelled, object userToken)
+ Exception exception,
+ bool cancelled,
+ object userToken)
{
var type = typeof(DownloadStringCompletedEventArgs);
const BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance;
@@ -201,7 +212,7 @@ namespace mRemoteNG.App.Update
if (constructor == null)
return null;
- return (DownloadStringCompletedEventArgs) constructor.Invoke(arguments);
+ return (DownloadStringCompletedEventArgs)constructor.Invoke(arguments);
}
private DownloadStringCompletedEventArgs DownloadString(Uri address)
@@ -326,11 +337,13 @@ namespace mRemoteNG.App.Update
{
add
{
- GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Combine(GetUpdateInfoCompletedEventEvent, value);
+ GetUpdateInfoCompletedEventEvent =
+ (AsyncCompletedEventHandler)Delegate.Combine(GetUpdateInfoCompletedEventEvent, value);
}
remove
{
- GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Remove(GetUpdateInfoCompletedEventEvent, value);
+ GetUpdateInfoCompletedEventEvent =
+ (AsyncCompletedEventHandler)Delegate.Remove(GetUpdateInfoCompletedEventEvent, value);
}
}
@@ -340,11 +353,13 @@ namespace mRemoteNG.App.Update
{
add
{
- GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Combine(GetChangeLogCompletedEventEvent, value);
+ GetChangeLogCompletedEventEvent =
+ (AsyncCompletedEventHandler)Delegate.Combine(GetChangeLogCompletedEventEvent, value);
}
remove
{
- GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Remove(GetChangeLogCompletedEventEvent, value);
+ GetChangeLogCompletedEventEvent =
+ (AsyncCompletedEventHandler)Delegate.Remove(GetChangeLogCompletedEventEvent, value);
}
}
@@ -354,11 +369,15 @@ namespace mRemoteNG.App.Update
{
add
{
- DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)Delegate.Combine(DownloadUpdateProgressChangedEventEvent, value);
+ DownloadUpdateProgressChangedEventEvent =
+ (DownloadProgressChangedEventHandler)Delegate.Combine(DownloadUpdateProgressChangedEventEvent,
+ value);
}
remove
{
- DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)Delegate.Remove(DownloadUpdateProgressChangedEventEvent, value);
+ DownloadUpdateProgressChangedEventEvent =
+ (DownloadProgressChangedEventHandler)Delegate.Remove(DownloadUpdateProgressChangedEventEvent,
+ value);
}
}
@@ -368,11 +387,13 @@ namespace mRemoteNG.App.Update
{
add
{
- DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Combine(DownloadUpdateCompletedEventEvent, value);
+ DownloadUpdateCompletedEventEvent =
+ (AsyncCompletedEventHandler)Delegate.Combine(DownloadUpdateCompletedEventEvent, value);
}
remove
{
- DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Remove(DownloadUpdateCompletedEventEvent, value);
+ DownloadUpdateCompletedEventEvent =
+ (AsyncCompletedEventHandler)Delegate.Remove(DownloadUpdateCompletedEventEvent, value);
}
}
diff --git a/mRemoteV1/App/Update/UpdateFile.cs b/mRemoteV1/App/Update/UpdateFile.cs
index b5ea64e6..fae08418 100644
--- a/mRemoteV1/App/Update/UpdateFile.cs
+++ b/mRemoteV1/App/Update/UpdateFile.cs
@@ -7,12 +7,16 @@ namespace mRemoteNG.App.Update
public class UpdateFile
{
#region Public Properties
+
// ReSharper disable MemberCanBePrivate.Local
// ReSharper disable once MemberCanBePrivate.Global
- public Dictionary Items { get; } = new Dictionary(StringComparer.InvariantCultureIgnoreCase);
+ public Dictionary Items { get; } =
+ new Dictionary(StringComparer.InvariantCultureIgnoreCase);
+
#endregion
#region Public Methods
+
public UpdateFile(string content)
{
FromString(content);
@@ -24,8 +28,8 @@ namespace mRemoteNG.App.Update
{
if (string.IsNullOrEmpty(content)) return;
- char[] keyValueSeparators = { ':', '=' };
- char[] commentCharacters = { '#', ';', '\'' };
+ char[] keyValueSeparators = {':', '='};
+ char[] commentCharacters = {'#', ';', '\''};
// no separators means no valid update data...
if (content.Trim().IndexOfAny(keyValueSeparators) == -1) return;
@@ -47,7 +51,7 @@ namespace mRemoteNG.App.Update
continue;
// make sure we have valid data in both parts before adding to the collection. If either part is empty, then it's not valid data.
- if(string.IsNullOrEmpty(parts[0].Trim()) || string.IsNullOrEmpty(parts[1].Trim()))
+ if (string.IsNullOrEmpty(parts[0].Trim()) || string.IsNullOrEmpty(parts[1].Trim()))
continue;
Items.Add(parts[0].Trim(), parts[1].Trim());
@@ -83,13 +87,14 @@ namespace mRemoteNG.App.Update
{
var value = GetString("dURL");
var sv = value.Split('/');
- return sv[sv.Length-1];
+ return sv[sv.Length - 1];
}
public string GetChecksum(string key = "Checksum")
{
return GetString(key).Replace(" ", "").ToUpperInvariant();
}
+
#endregion
}
}
\ No newline at end of file
diff --git a/mRemoteV1/App/Update/UpdateInfo.cs b/mRemoteV1/App/Update/UpdateInfo.cs
index 9255ef16..0d2ad4c6 100644
--- a/mRemoteV1/App/Update/UpdateInfo.cs
+++ b/mRemoteV1/App/Update/UpdateInfo.cs
@@ -1,4 +1,5 @@
using System;
+
// ReSharper disable UnusedAutoPropertyAccessor.Local
namespace mRemoteNG.App.Update
@@ -43,6 +44,7 @@ namespace mRemoteNG.App.Update
newInfo.Checksum = updateFile.GetChecksum();
newInfo.IsValid = newInfo.CheckIfValid();
}
+
return newInfo;
}
@@ -50,11 +52,11 @@ namespace mRemoteNG.App.Update
{
if (string.IsNullOrEmpty(Version.ToString()))
return false;
- if(string.IsNullOrEmpty(DownloadAddress.AbsoluteUri))
+ if (string.IsNullOrEmpty(DownloadAddress.AbsoluteUri))
return false;
if (string.IsNullOrEmpty(ChangeLogAddress.AbsoluteUri))
return false;
-#if false
+#if false
if (string.IsNullOrEmpty(ImageAddress.AbsoluteUri))
return false;
if (string.IsNullOrEmpty(ImageLinkAddress.AbsoluteUri))
diff --git a/mRemoteV1/App/Windows.cs b/mRemoteV1/App/Windows.cs
index 6304b75b..d4ec8c9a 100644
--- a/mRemoteV1/App/Windows.cs
+++ b/mRemoteV1/App/Windows.cs
@@ -31,7 +31,6 @@ namespace mRemoteNG.App
internal static SSHTransferWindow SshtransferForm { get; private set; } = new SSHTransferWindow();
-
public static void Show(WindowType windowType)
{
try
@@ -55,6 +54,7 @@ namespace mRemoteNG.App
{
optionsForm.ShowDialog(dockPanel);
}
+
break;
case WindowType.SSHTransfer:
if (SshtransferForm == null || SshtransferForm.IsDisposed)
@@ -90,7 +90,8 @@ namespace mRemoteNG.App
_ultravncscForm.Show(dockPanel);
break;
case WindowType.ComponentsCheck:
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Showing ComponentsCheck window", true);
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ "Showing ComponentsCheck window", true);
if (_componentscheckForm == null || _componentscheckForm.IsDisposed)
_componentscheckForm = new ComponentsCheckWindow();
_componentscheckForm.Show(dockPanel);
diff --git a/mRemoteV1/Config/ConfirmCloseEnum.cs b/mRemoteV1/Config/ConfirmCloseEnum.cs
index b990822a..ff4e615e 100644
--- a/mRemoteV1/Config/ConfirmCloseEnum.cs
+++ b/mRemoteV1/Config/ConfirmCloseEnum.cs
@@ -1,11 +1,11 @@
namespace mRemoteNG.Config
{
- public enum ConfirmCloseEnum
- {
- Unspecified = 0,
- Never = 1,
- Exit = 2,
- Multiple = 3,
- All = 4
- }
+ public enum ConfirmCloseEnum
+ {
+ Unspecified = 0,
+ Never = 1,
+ Exit = 2,
+ Multiple = 3,
+ All = 4
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Connections/ConnectionsLoadedEventArgs.cs b/mRemoteV1/Config/Connections/ConnectionsLoadedEventArgs.cs
index f6faaae2..3d136faf 100644
--- a/mRemoteV1/Config/Connections/ConnectionsLoadedEventArgs.cs
+++ b/mRemoteV1/Config/Connections/ConnectionsLoadedEventArgs.cs
@@ -36,10 +36,11 @@ namespace mRemoteNG.Config.Connections
///
public string NewSourcePath { get; }
- public ConnectionsLoadedEventArgs(
- Optional previousTreeModelModel, ConnectionTreeModel newTreeModelModel,
- bool previousSourceWasDatabase, bool newSourceIsDatabase,
- string newSourcePath)
+ public ConnectionsLoadedEventArgs(Optional previousTreeModelModel,
+ ConnectionTreeModel newTreeModelModel,
+ bool previousSourceWasDatabase,
+ bool newSourceIsDatabase,
+ string newSourcePath)
{
if (previousTreeModelModel == null)
throw new ArgumentNullException(nameof(previousTreeModelModel));
@@ -55,4 +56,4 @@ namespace mRemoteNG.Config.Connections
NewSourcePath = newSourcePath;
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Connections/ConnectionsSavedEventArgs.cs b/mRemoteV1/Config/Connections/ConnectionsSavedEventArgs.cs
index a1386b79..0522cd7f 100644
--- a/mRemoteV1/Config/Connections/ConnectionsSavedEventArgs.cs
+++ b/mRemoteV1/Config/Connections/ConnectionsSavedEventArgs.cs
@@ -10,7 +10,10 @@ namespace mRemoteNG.Config.Connections
public bool UsingDatabase { get; }
public string ConnectionFileName { get; }
- public ConnectionsSavedEventArgs(ConnectionTreeModel modelThatWasSaved, bool previouslyUsingDatabase, bool usingDatabase, string connectionFileName)
+ public ConnectionsSavedEventArgs(ConnectionTreeModel modelThatWasSaved,
+ bool previouslyUsingDatabase,
+ bool usingDatabase,
+ string connectionFileName)
{
if (modelThatWasSaved == null)
throw new ArgumentNullException(nameof(modelThatWasSaved));
@@ -21,4 +24,4 @@ namespace mRemoteNG.Config.Connections
ConnectionFileName = connectionFileName;
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Connections/CsvConnectionsSaver.cs b/mRemoteV1/Config/Connections/CsvConnectionsSaver.cs
index 598cea19..e49a293e 100644
--- a/mRemoteV1/Config/Connections/CsvConnectionsSaver.cs
+++ b/mRemoteV1/Config/Connections/CsvConnectionsSaver.cs
@@ -26,10 +26,11 @@ namespace mRemoteNG.Config.Connections
public void Save(ConnectionTreeModel connectionTreeModel, string propertyNameTrigger = "")
{
- var csvConnectionsSerializer = new CsvConnectionsSerializerMremotengFormat(_saveFilter, Runtime.CredentialProviderCatalog);
+ var csvConnectionsSerializer =
+ new CsvConnectionsSerializerMremotengFormat(_saveFilter, Runtime.CredentialProviderCatalog);
var dataProvider = new FileDataProvider(_connectionFileName);
var csvContent = csvConnectionsSerializer.Serialize(connectionTreeModel);
dataProvider.Save(csvContent);
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Connections/Multiuser/ConnectionsUpdateAvailableEventArgs.cs b/mRemoteV1/Config/Connections/Multiuser/ConnectionsUpdateAvailableEventArgs.cs
index 4440d03c..589bd4db 100644
--- a/mRemoteV1/Config/Connections/Multiuser/ConnectionsUpdateAvailableEventArgs.cs
+++ b/mRemoteV1/Config/Connections/Multiuser/ConnectionsUpdateAvailableEventArgs.cs
@@ -3,7 +3,8 @@ using mRemoteNG.Config.DatabaseConnectors;
namespace mRemoteNG.Config.Connections.Multiuser
{
- public delegate void ConnectionsUpdateAvailableEventHandler(object sender, ConnectionsUpdateAvailableEventArgs args);
+ public delegate void
+ ConnectionsUpdateAvailableEventHandler(object sender, ConnectionsUpdateAvailableEventArgs args);
public class ConnectionsUpdateAvailableEventArgs : EventArgs
{
diff --git a/mRemoteV1/Config/Connections/Multiuser/RemoteConnectionsSyncronizer.cs b/mRemoteV1/Config/Connections/Multiuser/RemoteConnectionsSyncronizer.cs
index 1a4c2075..36fd5352 100644
--- a/mRemoteV1/Config/Connections/Multiuser/RemoteConnectionsSyncronizer.cs
+++ b/mRemoteV1/Config/Connections/Multiuser/RemoteConnectionsSyncronizer.cs
@@ -27,7 +27,8 @@ namespace mRemoteNG.Config.Connections.Multiuser
{
_updateChecker.UpdateCheckStarted += OnUpdateCheckStarted;
_updateChecker.UpdateCheckFinished += OnUpdateCheckFinished;
- _updateChecker.ConnectionsUpdateAvailable += (sender, args) => ConnectionsUpdateAvailable?.Invoke(sender, args);
+ _updateChecker.ConnectionsUpdateAvailable +=
+ (sender, args) => ConnectionsUpdateAvailable?.Invoke(sender, args);
_updateTimer.Elapsed += (sender, args) => _updateChecker.IsUpdateAvailableAsync();
ConnectionsUpdateAvailable += Load;
}
@@ -81,6 +82,7 @@ namespace mRemoteNG.Config.Connections.Multiuser
Dispose(true);
GC.SuppressFinalize(this);
}
+
private void Dispose(bool itIsSafeToAlsoFreeManagedObjects)
{
if (!itIsSafeToAlsoFreeManagedObjects) return;
diff --git a/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs b/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs
index af3ab56f..66d8978e 100644
--- a/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs
+++ b/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs
@@ -48,9 +48,11 @@ namespace mRemoteNG.Config.Connections
{
_sqlConnector.Connect();
}
- catch(Exception e)
+ catch (Exception e)
{
- Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "Unable to connect to Sql DB to check for updates." + Environment.NewLine + e.Message, true);
+ Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
+ "Unable to connect to Sql DB to check for updates." +
+ Environment.NewLine + e.Message, true);
}
}
@@ -63,7 +65,9 @@ namespace mRemoteNG.Config.Connections
private bool CheckIfIAmTheLastOneUpdated(DateTime lastUpdateInDb)
{
- DateTime lastSqlUpdateWithoutMilliseconds = new DateTime(LastUpdateTime.Ticks - (LastUpdateTime.Ticks % TimeSpan.TicksPerSecond), LastUpdateTime.Kind);
+ DateTime lastSqlUpdateWithoutMilliseconds =
+ new DateTime(LastUpdateTime.Ticks - (LastUpdateTime.Ticks % TimeSpan.TicksPerSecond),
+ LastUpdateTime.Kind);
return lastUpdateInDb == lastSqlUpdateWithoutMilliseconds;
}
@@ -80,20 +84,25 @@ namespace mRemoteNG.Config.Connections
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "Error executing Sql query to get updates from the DB." + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
+ "Error executing Sql query to get updates from the DB." +
+ Environment.NewLine + ex.Message, true);
}
+
_lastDatabaseUpdateTime = lastUpdateInDb;
return lastUpdateInDb;
}
public event EventHandler UpdateCheckStarted;
+
private void RaiseUpdateCheckStartedEvent()
{
UpdateCheckStarted?.Invoke(this, EventArgs.Empty);
}
public event UpdateCheckFinishedEventHandler UpdateCheckFinished;
+
private void RaiseUpdateCheckFinishedEvent(bool updateAvailable)
{
var args = new ConnectionsUpdateCheckFinishedEventArgs {UpdateAvailable = updateAvailable};
@@ -101,6 +110,7 @@ namespace mRemoteNG.Config.Connections
}
public event ConnectionsUpdateAvailableEventHandler ConnectionsUpdateAvailable;
+
private void RaiseConnectionsUpdateAvailableEvent()
{
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, "Remote connection update is available");
diff --git a/mRemoteV1/Config/Connections/SaveConnectionsOnEdit.cs b/mRemoteV1/Config/Connections/SaveConnectionsOnEdit.cs
index d36648af..cbf001a3 100644
--- a/mRemoteV1/Config/Connections/SaveConnectionsOnEdit.cs
+++ b/mRemoteV1/Config/Connections/SaveConnectionsOnEdit.cs
@@ -19,9 +19,11 @@ namespace mRemoteNG.Config.Connections
connectionsService.ConnectionsLoaded += ConnectionsServiceOnConnectionsLoaded;
}
- private void ConnectionsServiceOnConnectionsLoaded(object sender, ConnectionsLoadedEventArgs connectionsLoadedEventArgs)
+ private void ConnectionsServiceOnConnectionsLoaded(object sender,
+ ConnectionsLoadedEventArgs connectionsLoadedEventArgs)
{
- connectionsLoadedEventArgs.NewConnectionTreeModel.CollectionChanged += ConnectionTreeModelOnCollectionChanged;
+ connectionsLoadedEventArgs.NewConnectionTreeModel.CollectionChanged +=
+ ConnectionTreeModelOnCollectionChanged;
connectionsLoadedEventArgs.NewConnectionTreeModel.PropertyChanged += ConnectionTreeModelOnPropertyChanged;
foreach (var oldTree in connectionsLoadedEventArgs.PreviousConnectionTreeModel)
@@ -31,12 +33,15 @@ namespace mRemoteNG.Config.Connections
}
}
- private void ConnectionTreeModelOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
+ private void ConnectionTreeModelOnPropertyChanged(object sender,
+ PropertyChangedEventArgs propertyChangedEventArgs)
{
SaveConnectionOnEdit(propertyChangedEventArgs.PropertyName);
}
- private void ConnectionTreeModelOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
+ private void ConnectionTreeModelOnCollectionChanged(object sender,
+ NotifyCollectionChangedEventArgs
+ notifyCollectionChangedEventArgs)
{
SaveConnectionOnEdit();
}
@@ -51,4 +56,4 @@ namespace mRemoteNG.Config.Connections
_connectionsService.SaveConnectionsAsync(propertyName);
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Connections/SaveFormat.cs b/mRemoteV1/Config/Connections/SaveFormat.cs
index 0ca1d9b0..fa577f41 100644
--- a/mRemoteV1/Config/Connections/SaveFormat.cs
+++ b/mRemoteV1/Config/Connections/SaveFormat.cs
@@ -7,4 +7,4 @@
mRCSV,
SQL
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Connections/SqlConnectionsLoader.cs b/mRemoteV1/Config/Connections/SqlConnectionsLoader.cs
index ed566424..424fde05 100644
--- a/mRemoteV1/Config/Connections/SqlConnectionsLoader.cs
+++ b/mRemoteV1/Config/Connections/SqlConnectionsLoader.cs
@@ -19,17 +19,20 @@ namespace mRemoteNG.Config.Connections
{
public class SqlConnectionsLoader : IConnectionsLoader
{
- private readonly IDeserializer> _localConnectionPropertiesDeserializer;
+ private readonly IDeserializer>
+ _localConnectionPropertiesDeserializer;
+
private readonly IDataProvider _dataProvider;
public Func> AuthenticationRequestor { get; set; } =
() => MiscTools.PasswordDialog("", false);
public SqlConnectionsLoader(
- IDeserializer> localConnectionPropertiesDeserializer,
+ IDeserializer> localConnectionPropertiesDeserializer,
IDataProvider dataProvider)
{
- _localConnectionPropertiesDeserializer = localConnectionPropertiesDeserializer.ThrowIfNull(nameof(localConnectionPropertiesDeserializer));
+ _localConnectionPropertiesDeserializer =
+ localConnectionPropertiesDeserializer.ThrowIfNull(nameof(localConnectionPropertiesDeserializer));
_dataProvider = dataProvider.ThrowIfNull(nameof(dataProvider));
}
@@ -60,7 +63,9 @@ namespace mRemoteNG.Config.Connections
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
var cipherText = metaData.Protected;
var authenticator = new PasswordAuthenticator(cryptographyProvider, cipherText, AuthenticationRequestor);
- var authenticated = authenticator.Authenticate(new RootNodeInfo(RootNodeType.Connection).DefaultPassword.ConvertToSecureString());
+ var authenticated =
+ authenticator.Authenticate(new RootNodeInfo(RootNodeType.Connection).DefaultPassword
+ .ConvertToSecureString());
if (authenticated)
return authenticator.LastAuthenticatedPassword;
@@ -74,10 +79,10 @@ namespace mRemoteNG.Config.Connections
rootNode
.GetRecursiveChildList()
- .Join(localConnectionProperties,
- con => con.ConstantID,
- locals => locals.ConnectionId,
- (con, locals) => new {Connection = con, LocalProperties = locals})
+ .Join(localConnectionProperties,
+ con => con.ConstantID,
+ locals => locals.ConnectionId,
+ (con, locals) => new {Connection = con, LocalProperties = locals})
.ForEach(x =>
{
x.Connection.PleaseConnect = x.LocalProperties.Connected;
diff --git a/mRemoteV1/Config/Connections/SqlConnectionsSaver.cs b/mRemoteV1/Config/Connections/SqlConnectionsSaver.cs
index 922bee10..69e3caf8 100644
--- a/mRemoteV1/Config/Connections/SqlConnectionsSaver.cs
+++ b/mRemoteV1/Config/Connections/SqlConnectionsSaver.cs
@@ -29,10 +29,10 @@ namespace mRemoteNG.Config.Connections
private readonly ISerializer, string> _localPropertiesSerializer;
private readonly IDataProvider _dataProvider;
- public SqlConnectionsSaver(
- SaveFilter saveFilter,
- ISerializer, string> localPropertieSerializer,
- IDataProvider localPropertiesDataProvider)
+ public SqlConnectionsSaver(SaveFilter saveFilter,
+ ISerializer, string>
+ localPropertieSerializer,
+ IDataProvider localPropertiesDataProvider)
{
if (saveFilter == null)
throw new ArgumentNullException(nameof(saveFilter));
@@ -49,14 +49,15 @@ namespace mRemoteNG.Config.Connections
if (PropertyIsLocalOnly(propertyNameTrigger))
{
- Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg,
- $"Property {propertyNameTrigger} is local only. Not saving to database.");
+ Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg,
+ $"Property {propertyNameTrigger} is local only. Not saving to database.");
return;
}
if (SqlUserIsReadOnly())
{
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Trying to save connection tree but the SQL read only checkbox is checked, aborting!");
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ "Trying to save connection tree but the SQL read only checkbox is checked, aborting!");
return;
}
@@ -69,7 +70,8 @@ namespace mRemoteNG.Config.Connections
if (!databaseVersionVerifier.VerifyDatabaseVersion(metaData.ConfVersion))
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strErrorConnectionListSaveFailed);
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strErrorConnectionListSaveFailed);
return;
}
@@ -137,22 +139,25 @@ namespace mRemoteNG.Config.Connections
{
sqlQuery =
new SqlCommand(
- "INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" +
- MiscTools.PrepareValueForDB(rootTreeNode.Name) + "\', 0, \'" + strProtected + "\'," +
- ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")",
- sqlDatabaseConnector.SqlConnection);
+ "INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" +
+ MiscTools.PrepareValueForDB(rootTreeNode.Name) + "\', 0, \'" + strProtected + "\'," +
+ ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) +
+ ")",
+ sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
}
else
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, $"UpdateRootNodeTable: rootTreeNode was null. Could not insert!");
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ $"UpdateRootNodeTable: rootTreeNode was null. Could not insert!");
}
}
private void UpdateConnectionsTable(RootNodeInfo rootTreeNode, SqlDatabaseConnector sqlDatabaseConnector)
{
var cryptoProvider = new LegacyRijndaelCryptographyProvider();
- var serializer = new DataTableSerializer(_saveFilter, cryptoProvider, rootTreeNode.PasswordString.ConvertToSecureString());
+ var serializer = new DataTableSerializer(_saveFilter, cryptoProvider,
+ rootTreeNode.PasswordString.ConvertToSecureString());
var dataTable = serializer.Serialize(rootTreeNode);
var dataProvider = new SqlDataProvider(sqlDatabaseConnector);
@@ -165,14 +170,16 @@ namespace mRemoteNG.Config.Connections
{
var sqlQuery = new SqlCommand("DELETE FROM tblUpdate", sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
- sqlQuery = new SqlCommand("INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + MiscTools.DBDate(DateTime.Now) + "\')", sqlDatabaseConnector.SqlConnection);
+ sqlQuery = new SqlCommand(
+ "INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + MiscTools.DBDate(DateTime.Now) +
+ "\')",
+ sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
}
private bool SqlUserIsReadOnly()
{
return mRemoteNG.Settings.Default.SQLReadOnly;
-
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Connections/XmlConnectionsLoader.cs b/mRemoteV1/Config/Connections/XmlConnectionsLoader.cs
index 71a02ebe..a02e9f47 100644
--- a/mRemoteV1/Config/Connections/XmlConnectionsLoader.cs
+++ b/mRemoteV1/Config/Connections/XmlConnectionsLoader.cs
@@ -37,4 +37,4 @@ namespace mRemoteNG.Config.Connections
return password;
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Connections/XmlConnectionsSaver.cs b/mRemoteV1/Config/Connections/XmlConnectionsSaver.cs
index 6dad366d..c9d9352d 100644
--- a/mRemoteV1/Config/Connections/XmlConnectionsSaver.cs
+++ b/mRemoteV1/Config/Connections/XmlConnectionsSaver.cs
@@ -33,13 +33,17 @@ namespace mRemoteNG.Config.Connections
{
var cryptographyProvider = new CryptoProviderFactoryFromSettings().Build();
var connectionNodeSerializer = new XmlConnectionNodeSerializer27(
- cryptographyProvider,
- connectionTreeModel.RootNodes.OfType().First().PasswordString.ConvertToSecureString(),
- _saveFilter);
- var xmlConnectionsSerializer = new XmlConnectionsSerializer(cryptographyProvider, connectionNodeSerializer)
- {
- UseFullEncryption = mRemoteNG.Settings.Default.EncryptCompleteConnectionsFile
- };
+ cryptographyProvider,
+ connectionTreeModel
+ .RootNodes.OfType()
+ .First().PasswordString
+ .ConvertToSecureString(),
+ _saveFilter);
+ var xmlConnectionsSerializer =
+ new XmlConnectionsSerializer(cryptographyProvider, connectionNodeSerializer)
+ {
+ UseFullEncryption = mRemoteNG.Settings.Default.EncryptCompleteConnectionsFile
+ };
var xml = xmlConnectionsSerializer.Serialize(connectionTreeModel);
var fileDataProvider = new FileDataProviderWithRollingBackup(_connectionFileName);
@@ -51,4 +55,4 @@ namespace mRemoteNG.Config.Connections
}
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/CredentialHarvester.cs b/mRemoteV1/Config/CredentialHarvester.cs
index 38dd5359..c1e19c42 100644
--- a/mRemoteV1/Config/CredentialHarvester.cs
+++ b/mRemoteV1/Config/CredentialHarvester.cs
@@ -14,13 +14,14 @@ namespace mRemoteNG.Config
private readonly IEqualityComparer _credentialComparer = new CredentialDomainUserComparer();
// maps a connectioninfo (by its id) to the credential object that was harvested
- public Dictionary ConnectionToCredentialMap { get; } = new Dictionary();
+ public Dictionary ConnectionToCredentialMap { get; } =
+ new Dictionary();
public IEnumerable Harvest(XDocument xDocument, SecureString decryptionKey)
{
if (xDocument == null)
throw new ArgumentNullException(nameof(xDocument));
-
+
var cryptoProvider = new CryptoProviderFactoryFromXml(xDocument.Root).Build();
foreach (var element in xDocument.Descendants("Node"))
@@ -37,7 +38,9 @@ namespace mRemoteNG.Config
if (ConnectionToCredentialMap.Values.Contains(newCredential, _credentialComparer))
{
- var existingCredential = ConnectionToCredentialMap.Values.First(record => _credentialComparer.Equals(newCredential, record));
+ var existingCredential =
+ ConnectionToCredentialMap.Values.First(record =>
+ _credentialComparer.Equals(newCredential, record));
ConnectionToCredentialMap.Add(connectionId, existingCredential);
}
else
@@ -47,21 +50,24 @@ namespace mRemoteNG.Config
return ConnectionToCredentialMap.Values.Distinct(_credentialComparer);
}
- private ICredentialRecord BuildCredential(XElement element, ICryptographyProvider cryptographyProvider, SecureString decryptionKey)
+ private ICredentialRecord BuildCredential(XElement element,
+ ICryptographyProvider cryptographyProvider,
+ SecureString decryptionKey)
{
var credential = new CredentialRecord
{
Title = $"{element.Attribute("Username")?.Value}\\{element.Attribute("Domain")?.Value}",
Username = element.Attribute("Username")?.Value,
Domain = element.Attribute("Domain")?.Value,
- Password = cryptographyProvider.Decrypt(element.Attribute("Password")?.Value, decryptionKey).ConvertToSecureString()
+ Password = cryptographyProvider.Decrypt(element.Attribute("Password")?.Value, decryptionKey)
+ .ConvertToSecureString()
};
return credential;
}
private static bool EntryHasSomeCredentialData(XElement e)
{
- return e.Attribute("Username")?.Value != "" ||
+ return e.Attribute("Username")?.Value != "" ||
e.Attribute("Domain")?.Value != "" ||
e.Attribute("Password")?.Value != "";
}
diff --git a/mRemoteV1/Config/CredentialRecordLoader.cs b/mRemoteV1/Config/CredentialRecordLoader.cs
index 8fe6d83e..f74525bd 100644
--- a/mRemoteV1/Config/CredentialRecordLoader.cs
+++ b/mRemoteV1/Config/CredentialRecordLoader.cs
@@ -13,7 +13,8 @@ namespace mRemoteNG.Config
private readonly IDataProvider _dataProvider;
private readonly ISecureDeserializer> _deserializer;
- public CredentialRecordLoader(IDataProvider dataProvider, ISecureDeserializer> deserializer)
+ public CredentialRecordLoader(IDataProvider dataProvider,
+ ISecureDeserializer> deserializer)
{
if (dataProvider == null)
throw new ArgumentNullException(nameof(dataProvider));
diff --git a/mRemoteV1/Config/CredentialRecordSaver.cs b/mRemoteV1/Config/CredentialRecordSaver.cs
index 9a9b52d7..5f7d70ae 100644
--- a/mRemoteV1/Config/CredentialRecordSaver.cs
+++ b/mRemoteV1/Config/CredentialRecordSaver.cs
@@ -13,7 +13,8 @@ namespace mRemoteNG.Config
private readonly IDataProvider _dataProvider;
private readonly ISecureSerializer, string> _serializer;
- public CredentialRecordSaver(IDataProvider dataProvider, ISecureSerializer, string> serializer)
+ public CredentialRecordSaver(IDataProvider dataProvider,
+ ISecureSerializer, string> serializer)
{
if (dataProvider == null)
throw new ArgumentNullException(nameof(dataProvider));
diff --git a/mRemoteV1/Config/CredentialRepositoryListLoader.cs b/mRemoteV1/Config/CredentialRepositoryListLoader.cs
index cd9088f0..be0bd72f 100644
--- a/mRemoteV1/Config/CredentialRepositoryListLoader.cs
+++ b/mRemoteV1/Config/CredentialRepositoryListLoader.cs
@@ -11,7 +11,8 @@ namespace mRemoteNG.Config
private readonly IDataProvider _dataProvider;
private readonly CredentialRepositoryListDeserializer _deserializer;
- public CredentialRepositoryListLoader(IDataProvider dataProvider, CredentialRepositoryListDeserializer deserializer)
+ public CredentialRepositoryListLoader(IDataProvider dataProvider,
+ CredentialRepositoryListDeserializer deserializer)
{
if (dataProvider == null)
throw new ArgumentNullException(nameof(dataProvider));
diff --git a/mRemoteV1/Config/CredentialRepositoryListSaver.cs b/mRemoteV1/Config/CredentialRepositoryListSaver.cs
index 6200eb72..6a4a549d 100644
--- a/mRemoteV1/Config/CredentialRepositoryListSaver.cs
+++ b/mRemoteV1/Config/CredentialRepositoryListSaver.cs
@@ -25,4 +25,4 @@ namespace mRemoteNG.Config
_dataProvider.Save(data);
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/DataProviders/FileBackupCreator.cs b/mRemoteV1/Config/DataProviders/FileBackupCreator.cs
index 25b09b98..453eaeaf 100644
--- a/mRemoteV1/Config/DataProviders/FileBackupCreator.cs
+++ b/mRemoteV1/Config/DataProviders/FileBackupCreator.cs
@@ -14,12 +14,14 @@ namespace mRemoteNG.Config.DataProviders
if (WeDontNeedToBackup(fileName))
return;
- var backupFileName = string.Format(mRemoteNG.Settings.Default.BackupFileNameFormat, fileName, DateTime.Now);
+ var backupFileName =
+ string.Format(mRemoteNG.Settings.Default.BackupFileNameFormat, fileName, DateTime.Now);
File.Copy(fileName, backupFileName);
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage(Language.strConnectionsFileBackupFailed, ex, MessageClass.WarningMsg);
+ Runtime.MessageCollector.AddExceptionMessage(Language.strConnectionsFileBackupFailed, ex,
+ MessageClass.WarningMsg);
throw;
}
}
diff --git a/mRemoteV1/Config/DataProviders/FileBackupPruner.cs b/mRemoteV1/Config/DataProviders/FileBackupPruner.cs
index 5572a345..a85ce1f9 100644
--- a/mRemoteV1/Config/DataProviders/FileBackupPruner.cs
+++ b/mRemoteV1/Config/DataProviders/FileBackupPruner.cs
@@ -20,8 +20,8 @@ namespace mRemoteNG.Config.DataProviders
return;
var filesToDelete = files
- .OrderByDescending(s => s)
- .Skip(maxBackupsToKeep);
+ .OrderByDescending(s => s)
+ .Skip(maxBackupsToKeep);
foreach (var file in filesToDelete)
{
diff --git a/mRemoteV1/Config/DataProviders/FileDataProvider.cs b/mRemoteV1/Config/DataProviders/FileDataProvider.cs
index 4798fee1..093f8105 100644
--- a/mRemoteV1/Config/DataProviders/FileDataProvider.cs
+++ b/mRemoteV1/Config/DataProviders/FileDataProvider.cs
@@ -22,12 +22,15 @@ namespace mRemoteNG.Config.DataProviders
}
catch (FileNotFoundException ex)
{
- Runtime.MessageCollector.AddExceptionStackTrace($"Could not load file. File does not exist '{FilePath}'", ex);
+ Runtime.MessageCollector.AddExceptionStackTrace(
+ $"Could not load file. File does not exist '{FilePath}'",
+ ex);
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace($"Failed to load file {FilePath}", ex);
}
+
return fileContents;
}
diff --git a/mRemoteV1/Config/DataProviders/IDataProvider.cs b/mRemoteV1/Config/DataProviders/IDataProvider.cs
index 1f665f17..b6e52988 100644
--- a/mRemoteV1/Config/DataProviders/IDataProvider.cs
+++ b/mRemoteV1/Config/DataProviders/IDataProvider.cs
@@ -1,5 +1,4 @@
-
-namespace mRemoteNG.Config.DataProviders
+namespace mRemoteNG.Config.DataProviders
{
public interface IDataProvider
{
diff --git a/mRemoteV1/Config/DataProviders/SqlDataProvider.cs b/mRemoteV1/Config/DataProviders/SqlDataProvider.cs
index cb70977c..4b8cbe69 100644
--- a/mRemoteV1/Config/DataProviders/SqlDataProvider.cs
+++ b/mRemoteV1/Config/DataProviders/SqlDataProvider.cs
@@ -34,7 +34,8 @@ namespace mRemoteNG.Config.DataProviders
{
if (SqlUserIsReadOnly())
{
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Trying to save connections but the SQL read only checkbox is checked, aborting!");
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ "Trying to save connections but the SQL read only checkbox is checked, aborting!");
return;
}
@@ -62,7 +63,6 @@ namespace mRemoteNG.Config.DataProviders
private bool SqlUserIsReadOnly()
{
return mRemoteNG.Settings.Default.SQLReadOnly;
-
}
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/DatabaseConnectors/ConnectionTestResult.cs b/mRemoteV1/Config/DatabaseConnectors/ConnectionTestResult.cs
index 0426a2cd..23bcbbb5 100644
--- a/mRemoteV1/Config/DatabaseConnectors/ConnectionTestResult.cs
+++ b/mRemoteV1/Config/DatabaseConnectors/ConnectionTestResult.cs
@@ -8,4 +8,4 @@
CredentialsRejected,
UnknownError
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectorFactory.cs b/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectorFactory.cs
index f8e8a149..39d7bcf4 100644
--- a/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectorFactory.cs
+++ b/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectorFactory.cs
@@ -15,4 +15,4 @@ namespace mRemoteNG.Config.DatabaseConnectors
return new SqlDatabaseConnector(sqlHost, sqlCatalog, sqlUsername, sqlPassword);
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnectionTester.cs b/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnectionTester.cs
index 69c43375..2100920a 100644
--- a/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnectionTester.cs
+++ b/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnectionTester.cs
@@ -9,7 +9,10 @@ namespace mRemoteNG.Config.DatabaseConnectors
///
public class SqlDatabaseConnectionTester
{
- public async Task TestConnectivity(string server, string database, string username, string password)
+ public async Task TestConnectivity(string server,
+ string database,
+ string username,
+ string password)
{
using (var sqlConnector = new SqlDatabaseConnector(server, database, username, password))
{
@@ -35,4 +38,4 @@ namespace mRemoteNG.Config.DatabaseConnectors
}
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnector.cs b/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnector.cs
index 6aaeb413..e55bfb0a 100644
--- a/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnector.cs
+++ b/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnector.cs
@@ -8,7 +8,7 @@ namespace mRemoteNG.Config.DatabaseConnectors
{
public class SqlDatabaseConnector : IDatabaseConnector
{
- public SqlConnection SqlConnection { get; private set; } = default(SqlConnection);
+ public SqlConnection SqlConnection { get; private set; } = default(SqlConnection);
private string _sqlConnectionString = "";
private readonly string _sqlHost;
private readonly string _sqlCatalog;
@@ -45,7 +45,8 @@ namespace mRemoteNG.Config.DatabaseConnectors
private void BuildSqlConnectionStringWithCustomCredentials()
{
- _sqlConnectionString = $"Data Source={_sqlHost};Initial Catalog={_sqlCatalog};User Id={_sqlUsername};Password={_sqlPassword}";
+ _sqlConnectionString =
+ $"Data Source={_sqlHost};Initial Catalog={_sqlCatalog};User Id={_sqlUsername};Password={_sqlPassword}";
}
private void BuildSqlConnectionStringWithDefaultCredentials()
@@ -77,6 +78,7 @@ namespace mRemoteNG.Config.DatabaseConnectors
{
Dispose(true);
}
+
private void Dispose(bool itIsSafeToFreeManagedObjects)
{
if (!itIsSafeToFreeManagedObjects) return;
diff --git a/mRemoteV1/Config/Import/ActiveDirectoryImporter.cs b/mRemoteV1/Config/Import/ActiveDirectoryImporter.cs
index 9c59b385..32b1e9d9 100644
--- a/mRemoteV1/Config/Import/ActiveDirectoryImporter.cs
+++ b/mRemoteV1/Config/Import/ActiveDirectoryImporter.cs
@@ -7,29 +7,29 @@ using mRemoteNG.Tools;
namespace mRemoteNG.Config.Import
{
- public class ActiveDirectoryImporter : IConnectionImporter
- {
+ public class ActiveDirectoryImporter : IConnectionImporter
+ {
public void Import(string ldapPath, ContainerInfo destinationContainer)
{
Import(ldapPath, destinationContainer, false);
}
- public static void Import(string ldapPath, ContainerInfo destinationContainer, bool importSubOu)
- {
- try
- {
- ldapPath.ThrowIfNullOrEmpty(nameof(ldapPath));
- var deserializer = new ActiveDirectoryDeserializer(ldapPath, importSubOu);
- var connectionTreeModel = deserializer.Deserialize();
+ public static void Import(string ldapPath, ContainerInfo destinationContainer, bool importSubOu)
+ {
+ try
+ {
+ ldapPath.ThrowIfNullOrEmpty(nameof(ldapPath));
+ var deserializer = new ActiveDirectoryDeserializer(ldapPath, importSubOu);
+ var connectionTreeModel = deserializer.Deserialize();
var importedRootNode = connectionTreeModel.RootNodes.First();
if (importedRootNode == null) return;
var childrenToAdd = importedRootNode.Children.ToArray();
destinationContainer.AddChildRange(childrenToAdd);
}
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage("Config.Import.ActiveDirectory.Import() failed.", ex);
- }
- }
- }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage("Config.Import.ActiveDirectory.Import() failed.", ex);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Import/MRemoteNGCsvImporter.cs b/mRemoteV1/Config/Import/MRemoteNGCsvImporter.cs
index 821a711a..58f4983d 100644
--- a/mRemoteV1/Config/Import/MRemoteNGCsvImporter.cs
+++ b/mRemoteV1/Config/Import/MRemoteNGCsvImporter.cs
@@ -19,16 +19,17 @@ namespace mRemoteNG.Config.Import
}
if (!File.Exists(filePath))
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, $"Unable to import file. File does not exist. Path: {filePath}");
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ $"Unable to import file. File does not exist. Path: {filePath}");
var dataProvider = new FileDataProvider(filePath);
var xmlString = dataProvider.Load();
var xmlConnectionsDeserializer = new CsvConnectionsDeserializerMremotengFormat();
var connectionTreeModel = xmlConnectionsDeserializer.Deserialize(xmlString);
- var rootImportContainer = new ContainerInfo { Name = Path.GetFileNameWithoutExtension(filePath) };
+ var rootImportContainer = new ContainerInfo {Name = Path.GetFileNameWithoutExtension(filePath)};
rootImportContainer.AddChildRange(connectionTreeModel.RootNodes.First().Children.ToArray());
destinationContainer.AddChild(rootImportContainer);
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Import/MRemoteNGXmlImporter.cs b/mRemoteV1/Config/Import/MRemoteNGXmlImporter.cs
index 13c0fe44..2ee1f5e3 100644
--- a/mRemoteV1/Config/Import/MRemoteNGXmlImporter.cs
+++ b/mRemoteV1/Config/Import/MRemoteNGXmlImporter.cs
@@ -10,28 +10,29 @@ using mRemoteNG.Messages;
namespace mRemoteNG.Config.Import
{
- // ReSharper disable once InconsistentNaming
- public class MRemoteNGXmlImporter : IConnectionImporter
- {
- public void Import(string fileName, ContainerInfo destinationContainer)
- {
- if (fileName == null)
- {
+ // ReSharper disable once InconsistentNaming
+ public class MRemoteNGXmlImporter : IConnectionImporter
+ {
+ public void Import(string fileName, ContainerInfo destinationContainer)
+ {
+ if (fileName == null)
+ {
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Unable to import file. File path is null.");
return;
}
- if(!File.Exists(fileName))
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, $"Unable to import file. File does not exist. Path: {fileName}");
+ if (!File.Exists(fileName))
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ $"Unable to import file. File does not exist. Path: {fileName}");
- var dataProvider = new FileDataProvider(fileName);
- var xmlString = dataProvider.Load();
- var xmlConnectionsDeserializer = new XmlConnectionsDeserializer();
- var connectionTreeModel = xmlConnectionsDeserializer.Deserialize(xmlString, true);
+ var dataProvider = new FileDataProvider(fileName);
+ var xmlString = dataProvider.Load();
+ var xmlConnectionsDeserializer = new XmlConnectionsDeserializer();
+ var connectionTreeModel = xmlConnectionsDeserializer.Deserialize(xmlString, true);
- var rootImportContainer = new ContainerInfo { Name = Path.GetFileNameWithoutExtension(fileName) };
- rootImportContainer.AddChildRange(connectionTreeModel.RootNodes.First().Children.ToArray());
- destinationContainer.AddChild(rootImportContainer);
+ var rootImportContainer = new ContainerInfo {Name = Path.GetFileNameWithoutExtension(fileName)};
+ rootImportContainer.AddChildRange(connectionTreeModel.RootNodes.First().Children.ToArray());
+ destinationContainer.AddChild(rootImportContainer);
}
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Import/PortScanImporter.cs b/mRemoteV1/Config/Import/PortScanImporter.cs
index aa0c9442..738710f1 100644
--- a/mRemoteV1/Config/Import/PortScanImporter.cs
+++ b/mRemoteV1/Config/Import/PortScanImporter.cs
@@ -8,18 +8,18 @@ using mRemoteNG.Tools;
namespace mRemoteNG.Config.Import
{
- public class PortScanImporter : IConnectionImporter>
- {
- private readonly ProtocolType _targetProtocolType;
+ public class PortScanImporter : IConnectionImporter>
+ {
+ private readonly ProtocolType _targetProtocolType;
- public PortScanImporter(ProtocolType targetProtocolType)
- {
- _targetProtocolType = targetProtocolType;
- }
+ public PortScanImporter(ProtocolType targetProtocolType)
+ {
+ _targetProtocolType = targetProtocolType;
+ }
public void Import(IEnumerable hosts, ContainerInfo destinationContainer)
- {
- var deserializer = new PortScanDeserializer(_targetProtocolType);
+ {
+ var deserializer = new PortScanDeserializer(_targetProtocolType);
var connectionTreeModel = deserializer.Deserialize(hosts);
var importedRootNode = connectionTreeModel.RootNodes.First();
@@ -27,5 +27,5 @@ namespace mRemoteNG.Config.Import
var childrenToAdd = importedRootNode.Children.ToArray();
destinationContainer.AddChildRange(childrenToAdd);
}
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Import/PuttyConnectionManagerImporter.cs b/mRemoteV1/Config/Import/PuttyConnectionManagerImporter.cs
index e147556c..594ebe67 100644
--- a/mRemoteV1/Config/Import/PuttyConnectionManagerImporter.cs
+++ b/mRemoteV1/Config/Import/PuttyConnectionManagerImporter.cs
@@ -6,10 +6,10 @@ using mRemoteNG.Container;
namespace mRemoteNG.Config.Import
{
- public class PuttyConnectionManagerImporter : IConnectionImporter
- {
+ public class PuttyConnectionManagerImporter : IConnectionImporter
+ {
public void Import(string filePath, ContainerInfo destinationContainer)
- {
+ {
var dataProvider = new FileDataProvider(filePath);
var xmlContent = dataProvider.Load();
@@ -21,5 +21,5 @@ namespace mRemoteNG.Config.Import
var childrenToAdd = importedRootNode.Children.ToArray();
destinationContainer.AddChildRange(childrenToAdd);
}
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Import/RemoteDesktopConnectionImporter.cs b/mRemoteV1/Config/Import/RemoteDesktopConnectionImporter.cs
index a46da5f6..15af3e52 100644
--- a/mRemoteV1/Config/Import/RemoteDesktopConnectionImporter.cs
+++ b/mRemoteV1/Config/Import/RemoteDesktopConnectionImporter.cs
@@ -7,10 +7,10 @@ using mRemoteNG.Container;
namespace mRemoteNG.Config.Import
{
- public class RemoteDesktopConnectionImporter : IConnectionImporter
- {
+ public class RemoteDesktopConnectionImporter : IConnectionImporter
+ {
public void Import(string fileName, ContainerInfo destinationContainer)
- {
+ {
var dataProvider = new FileDataProvider(fileName);
var content = dataProvider.Load();
@@ -18,10 +18,10 @@ namespace mRemoteNG.Config.Import
var connectionTreeModel = deserializer.Deserialize(content);
var importedConnection = connectionTreeModel.RootNodes.First().Children.First();
-
+
if (importedConnection == null) return;
importedConnection.Name = Path.GetFileNameWithoutExtension(fileName);
destinationContainer.AddChild(importedConnection);
- }
+ }
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Import/RemoteDesktopConnectionManagerImporter.cs b/mRemoteV1/Config/Import/RemoteDesktopConnectionManagerImporter.cs
index fe600191..c4db3252 100644
--- a/mRemoteV1/Config/Import/RemoteDesktopConnectionManagerImporter.cs
+++ b/mRemoteV1/Config/Import/RemoteDesktopConnectionManagerImporter.cs
@@ -6,10 +6,10 @@ using mRemoteNG.Container;
namespace mRemoteNG.Config.Import
{
- public class RemoteDesktopConnectionManagerImporter : IConnectionImporter
- {
- public void Import(string filePath, ContainerInfo destinationContainer)
- {
+ public class RemoteDesktopConnectionManagerImporter : IConnectionImporter
+ {
+ public void Import(string filePath, ContainerInfo destinationContainer)
+ {
var dataProvider = new FileDataProvider(filePath);
var fileContent = dataProvider.Load();
@@ -21,5 +21,5 @@ namespace mRemoteNG.Config.Import
var childrenToAdd = importedRootNode.Children.ToArray();
destinationContainer.AddChildRange(childrenToAdd);
}
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Putty/AbstractPuttySessionsProvider.cs b/mRemoteV1/Config/Putty/AbstractPuttySessionsProvider.cs
index 2c5d55c6..38da3533 100644
--- a/mRemoteV1/Config/Putty/AbstractPuttySessionsProvider.cs
+++ b/mRemoteV1/Config/Putty/AbstractPuttySessionsProvider.cs
@@ -5,37 +5,42 @@ using System.Web;
using mRemoteNG.Connection;
using mRemoteNG.Tree.Root;
using System.Text;
+
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.Putty
{
public abstract class AbstractPuttySessionsProvider
- {
+ {
public virtual RootPuttySessionsNodeInfo RootInfo { get; } = new RootPuttySessionsNodeInfo();
+
protected virtual List Sessions
{
get { return RootInfo.Children.OfType().ToList(); }
}
- #region Public Methods
+ #region Public Methods
+
public abstract string[] GetSessionNames(bool raw = false);
- public abstract PuttySessionInfo GetSession(string sessionName);
-
- public virtual IEnumerable GetSessions()
- {
- var sessionNamesFromProvider = GetSessionNames(true);
+ public abstract PuttySessionInfo GetSession(string sessionName);
+
+ public virtual IEnumerable GetSessions()
+ {
+ var sessionNamesFromProvider = GetSessionNames(true);
foreach (var sessionName in GetSessionNamesToAdd(sessionNamesFromProvider))
- {
- var sessionInfo = GetSession(sessionName);
- AddSession(sessionInfo);
- }
- foreach (var session in GetSessionToRemove(sessionNamesFromProvider))
- {
- RemoveSession(session);
- }
+ {
+ var sessionInfo = GetSession(sessionName);
+ AddSession(sessionInfo);
+ }
+
+ foreach (var session in GetSessionToRemove(sessionNamesFromProvider))
+ {
+ RemoveSession(session);
+ }
+
RootInfo.SortRecursive();
- return Sessions;
- }
+ return Sessions;
+ }
private IEnumerable GetSessionNamesToAdd(IEnumerable sessionNamesFromProvider)
{
@@ -47,7 +52,9 @@ namespace mRemoteNG.Config.Putty
private IEnumerable GetSessionToRemove(IEnumerable sessionNamesFromProvider)
{
var currentlyKnownSessionNames = Sessions.Select(session => session.Name);
- var normalizedSessionNames = sessionNamesFromProvider.Select(name => HttpUtility.UrlDecode(name, Encoding.GetEncoding("iso-8859-1")));
+ var normalizedSessionNames =
+ sessionNamesFromProvider.Select(name =>
+ HttpUtility.UrlDecode(name, Encoding.GetEncoding("iso-8859-1")));
var sessionNamesToRemove = currentlyKnownSessionNames.Except(normalizedSessionNames);
return Sessions.Where(session => sessionNamesToRemove.Contains(session.Name));
}
@@ -57,29 +64,43 @@ namespace mRemoteNG.Config.Putty
if (string.IsNullOrEmpty(sessionInfo?.Name) || Sessions.Any(child => child.Name == sessionInfo.Name))
return;
RootInfo.AddChild(sessionInfo);
- RaisePuttySessionCollectionChangedEvent(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, sessionInfo));
+ RaisePuttySessionCollectionChangedEvent(
+ new
+ NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add,
+ sessionInfo));
}
protected virtual void RemoveSession(PuttySessionInfo sessionInfo)
{
if (!Sessions.Contains(sessionInfo)) return;
RootInfo.RemoveChild(sessionInfo);
- RaisePuttySessionCollectionChangedEvent(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, sessionInfo));
+ RaisePuttySessionCollectionChangedEvent(
+ new
+ NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove,
+ sessionInfo));
}
-
- public virtual void StartWatcher() { }
-
- public virtual void StopWatcher() { }
+
+ public virtual void StartWatcher()
+ {
+ }
+
+ public virtual void StopWatcher()
+ {
+ }
+
#endregion
-
- public delegate void PuttySessionChangedEventHandler(object sender, PuttySessionChangedEventArgs e);
+
+ public delegate void PuttySessionChangedEventHandler(object sender, PuttySessionChangedEventArgs e);
+
public event PuttySessionChangedEventHandler PuttySessionChanged;
- protected virtual void RaiseSessionChangedEvent(PuttySessionChangedEventArgs args)
- {
+
+ protected virtual void RaiseSessionChangedEvent(PuttySessionChangedEventArgs args)
+ {
PuttySessionChanged?.Invoke(this, args);
- }
+ }
public event NotifyCollectionChangedEventHandler PuttySessionsCollectionChanged;
+
protected void RaisePuttySessionCollectionChangedEvent(NotifyCollectionChangedEventArgs args)
{
PuttySessionsCollectionChanged?.Invoke(this, args);
diff --git a/mRemoteV1/Config/Putty/PuttySessionsManager.cs b/mRemoteV1/Config/Putty/PuttySessionsManager.cs
index 72e9a1ce..4286e60d 100644
--- a/mRemoteV1/Config/Putty/PuttySessionsManager.cs
+++ b/mRemoteV1/Config/Putty/PuttySessionsManager.cs
@@ -3,74 +3,80 @@ using System.Collections.Specialized;
using System.ComponentModel;
using mRemoteNG.Tools;
using mRemoteNG.Tree.Root;
+
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.Putty
{
public class PuttySessionsManager
- {
+ {
public static PuttySessionsManager Instance { get; } = new PuttySessionsManager();
private readonly List _providers = new List();
+
public IEnumerable Providers
{
get { return _providers; }
}
- public List RootPuttySessionsNodes { get; } = new List();
+ public List RootPuttySessionsNodes { get; } = new List();
- private PuttySessionsManager()
- {
- AddProvider(new PuttySessionsRegistryProvider());
+ private PuttySessionsManager()
+ {
+ AddProvider(new PuttySessionsRegistryProvider());
AddProvider(new PuttySessionsXmingProvider());
- }
+ }
#region Public Methods
- public void AddSessions()
- {
- foreach (var provider in Providers)
- {
- AddSessionsFromProvider(provider);
- }
- }
- private void AddSessionsFromProvider(AbstractPuttySessionsProvider puttySessionProvider)
- {
- puttySessionProvider.ThrowIfNull(nameof(puttySessionProvider));
+ public void AddSessions()
+ {
+ foreach (var provider in Providers)
+ {
+ AddSessionsFromProvider(provider);
+ }
+ }
+
+ private void AddSessionsFromProvider(AbstractPuttySessionsProvider puttySessionProvider)
+ {
+ puttySessionProvider.ThrowIfNull(nameof(puttySessionProvider));
var rootTreeNode = puttySessionProvider.RootInfo;
- puttySessionProvider.GetSessions();
+ puttySessionProvider.GetSessions();
if (!RootPuttySessionsNodes.Contains(rootTreeNode) && rootTreeNode.HasChildren())
RootPuttySessionsNodes.Add(rootTreeNode);
rootTreeNode.SortRecursive();
}
-
- public void StartWatcher()
- {
- foreach (var provider in Providers)
- {
- provider.StartWatcher();
- provider.PuttySessionChanged += PuttySessionChanged;
- }
- }
-
- public void StopWatcher()
- {
- foreach (var provider in Providers)
- {
- provider.StopWatcher();
- provider.PuttySessionChanged -= PuttySessionChanged;
- }
- }
+
+ public void StartWatcher()
+ {
+ foreach (var provider in Providers)
+ {
+ provider.StartWatcher();
+ provider.PuttySessionChanged += PuttySessionChanged;
+ }
+ }
+
+ public void StopWatcher()
+ {
+ foreach (var provider in Providers)
+ {
+ provider.StopWatcher();
+ provider.PuttySessionChanged -= PuttySessionChanged;
+ }
+ }
public void AddProvider(AbstractPuttySessionsProvider newProvider)
{
if (_providers.Contains(newProvider)) return;
_providers.Add(newProvider);
newProvider.PuttySessionsCollectionChanged += RaisePuttySessionCollectionChangedEvent;
- RaiseSessionProvidersCollectionChangedEvent(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, newProvider));
+ RaiseSessionProvidersCollectionChangedEvent(
+ new
+ NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add,
+ newProvider));
}
public void AddProviders(IEnumerable newProviders)
@@ -84,48 +90,58 @@ namespace mRemoteNG.Config.Putty
if (!_providers.Contains(providerToRemove)) return;
_providers.Remove(providerToRemove);
providerToRemove.PuttySessionsCollectionChanged -= RaisePuttySessionCollectionChangedEvent;
- RaiseSessionProvidersCollectionChangedEvent(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, providerToRemove));
+ RaiseSessionProvidersCollectionChangedEvent(
+ new
+ NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove,
+ providerToRemove));
}
public void PuttySessionChanged(object sender, PuttySessionChangedEventArgs e)
- {
- AddSessions();
- }
+ {
+ AddSessions();
+ }
+
#endregion
#region Private Methods
- private string[] GetSessionNames(bool raw = false)
- {
- var sessionNames = new List();
- foreach (var provider in Providers)
- {
- if (!IsProviderEnabled(provider))
- {
- continue;
- }
- sessionNames.AddRange(provider.GetSessionNames(raw));
- }
- return sessionNames.ToArray();
- }
-
- private bool IsProviderEnabled(AbstractPuttySessionsProvider puttySessionsProvider)
- {
+
+ private string[] GetSessionNames(bool raw = false)
+ {
+ var sessionNames = new List();
+ foreach (var provider in Providers)
+ {
+ if (!IsProviderEnabled(provider))
+ {
+ continue;
+ }
+
+ sessionNames.AddRange(provider.GetSessionNames(raw));
+ }
+
+ return sessionNames.ToArray();
+ }
+
+ private bool IsProviderEnabled(AbstractPuttySessionsProvider puttySessionsProvider)
+ {
var enabled = true;
- if (PuttyTypeDetector.GetPuttyType() == PuttyTypeDetector.PuttyType.Xming)
- {
- if (puttySessionsProvider is PuttySessionsRegistryProvider)
- enabled = false;
- }
- else
- {
- if (puttySessionsProvider is PuttySessionsXmingProvider)
- enabled = false;
- }
- return enabled;
- }
+ if (PuttyTypeDetector.GetPuttyType() == PuttyTypeDetector.PuttyType.Xming)
+ {
+ if (puttySessionsProvider is PuttySessionsRegistryProvider)
+ enabled = false;
+ }
+ else
+ {
+ if (puttySessionsProvider is PuttySessionsXmingProvider)
+ enabled = false;
+ }
+
+ return enabled;
+ }
+
#endregion
-
+
#region Public Classes
+
public class SessionList : StringConverter
{
public static string[] Names
@@ -134,29 +150,32 @@ namespace mRemoteNG.Config.Putty
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
- {
- return new StandardValuesCollection(Names);
- }
-
- public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
- {
- return true;
- }
-
- public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
- {
- return true;
- }
+ {
+ return new StandardValuesCollection(Names);
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
}
+
#endregion
public event NotifyCollectionChangedEventHandler PuttySessionsCollectionChanged;
+
protected void RaisePuttySessionCollectionChangedEvent(object sender, NotifyCollectionChangedEventArgs args)
{
PuttySessionsCollectionChanged?.Invoke(sender, args);
}
public event NotifyCollectionChangedEventHandler SessionProvidersCollectionChanged;
+
protected void RaiseSessionProvidersCollectionChangedEvent(NotifyCollectionChangedEventArgs args)
{
SessionProvidersCollectionChanged?.Invoke(this, args);
diff --git a/mRemoteV1/Config/Putty/PuttySessionsRegistryProvider.cs b/mRemoteV1/Config/Putty/PuttySessionsRegistryProvider.cs
index 929b66be..663279d3 100644
--- a/mRemoteV1/Config/Putty/PuttySessionsRegistryProvider.cs
+++ b/mRemoteV1/Config/Putty/PuttySessionsRegistryProvider.cs
@@ -14,30 +14,34 @@ using mRemoteNG.Messages;
namespace mRemoteNG.Config.Putty
{
public class PuttySessionsRegistryProvider : AbstractPuttySessionsProvider
- {
+ {
private const string PuttySessionsKey = "Software\\SimonTatham\\PuTTY\\Sessions";
private static ManagementEventWatcher _eventWatcher;
#region Public Methods
- public override string[] GetSessionNames(bool raw = false)
- {
+
+ public override string[] GetSessionNames(bool raw = false)
+ {
var sessionsKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey);
- if (sessionsKey == null) return new string[] {};
+ if (sessionsKey == null) return new string[] { };
var sessionNames = new List();
- foreach (var sessionName in sessionsKey.GetSubKeyNames())
- {
- sessionNames.Add(raw ? sessionName : HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"), Encoding.GetEncoding("iso-8859-1")));
- }
-
- if (raw && !sessionNames.Contains("Default%20Settings"))
- sessionNames.Insert(0, "Default%20Settings");
- else if (!raw && !sessionNames.Contains("Default Settings"))
- sessionNames.Insert(0, "Default Settings");
-
- return sessionNames.ToArray();
- }
-
+ foreach (var sessionName in sessionsKey.GetSubKeyNames())
+ {
+ sessionNames.Add(raw
+ ? sessionName
+ : HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"),
+ Encoding.GetEncoding("iso-8859-1")));
+ }
+
+ if (raw && !sessionNames.Contains("Default%20Settings"))
+ sessionNames.Insert(0, "Default%20Settings");
+ else if (!raw && !sessionNames.Contains("Default Settings"))
+ sessionNames.Insert(0, "Default Settings");
+
+ return sessionNames.ToArray();
+ }
+
public override PuttySessionInfo GetSession(string sessionName)
{
if (string.IsNullOrEmpty(sessionName))
@@ -45,35 +49,35 @@ namespace mRemoteNG.Config.Putty
var sessionsKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey);
var sessionKey = sessionsKey?.OpenSubKey(sessionName);
- if (sessionKey == null) return null;
+ if (sessionKey == null) return null;
sessionName = HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"), Encoding.GetEncoding("iso-8859-1"));
-
- var sessionInfo = new PuttySessionInfo
- {
- PuttySession = sessionName,
- Name = sessionName,
- Hostname = sessionKey.GetValue("HostName")?.ToString() ?? "",
- Username = sessionKey.GetValue("UserName")?.ToString() ?? ""
- };
+
+ var sessionInfo = new PuttySessionInfo
+ {
+ PuttySession = sessionName,
+ Name = sessionName,
+ Hostname = sessionKey.GetValue("HostName")?.ToString() ?? "",
+ Username = sessionKey.GetValue("UserName")?.ToString() ?? ""
+ };
- var protocol = string.IsNullOrEmpty(sessionKey.GetValue("Protocol")?.ToString())
- ? "ssh"
+ var protocol = string.IsNullOrEmpty(sessionKey.GetValue("Protocol")?.ToString())
+ ? "ssh"
: sessionKey.GetValue("Protocol").ToString();
- switch (protocol.ToLowerInvariant())
- {
- case "raw":
- sessionInfo.Protocol = ProtocolType.RAW;
- break;
- case "rlogin":
- sessionInfo.Protocol = ProtocolType.Rlogin;
- break;
- case "serial":
- return null;
- case "ssh":
- int.TryParse(sessionKey.GetValue("SshProt")?.ToString(), out var sshVersion);
+ switch (protocol.ToLowerInvariant())
+ {
+ case "raw":
+ sessionInfo.Protocol = ProtocolType.RAW;
+ break;
+ case "rlogin":
+ sessionInfo.Protocol = ProtocolType.Rlogin;
+ break;
+ case "serial":
+ return null;
+ case "ssh":
+ int.TryParse(sessionKey.GetValue("SshProt")?.ToString(), out var sshVersion);
/* Per PUTTY.H in PuTTYNG & PuTTYNG Upstream (PuTTY proper currently)
* expect 0 for SSH1, 3 for SSH2 ONLY
* 1 for SSH1 with a 2 fallback
@@ -82,53 +86,56 @@ namespace mRemoteNG.Config.Putty
* default to SSH2 if any other value is received
*/
sessionInfo.Protocol = sshVersion == 1 || sshVersion == 0 ? ProtocolType.SSH1 : ProtocolType.SSH2;
- break;
- case "telnet":
- sessionInfo.Protocol = ProtocolType.Telnet;
- break;
- default:
- return null;
- }
+ break;
+ case "telnet":
+ sessionInfo.Protocol = ProtocolType.Telnet;
+ break;
+ default:
+ return null;
+ }
int.TryParse(sessionKey.GetValue("PortNumber")?.ToString(), out var portNumber);
if (portNumber == default(int))
sessionInfo.SetDefaultPort();
else
sessionInfo.Port = portNumber;
-
- return sessionInfo;
- }
-
- public override void StartWatcher()
- {
- if (_eventWatcher != null) return;
-
- try
- {
+
+ return sessionInfo;
+ }
+
+ public override void StartWatcher()
+ {
+ if (_eventWatcher != null) return;
+
+ try
+ {
var currentUserSid = WindowsIdentity.GetCurrent().User?.Value;
var key = string.Join("\\", currentUserSid, PuttySessionsKey).Replace("\\", "\\\\");
- var query = new WqlEventQuery($"SELECT * FROM RegistryTreeChangeEvent WHERE Hive = \'HKEY_USERS\' AND RootPath = \'{key}\'");
- _eventWatcher = new ManagementEventWatcher(query);
- _eventWatcher.EventArrived += OnManagementEventArrived;
- _eventWatcher.Start();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage("PuttySessions.Watcher.StartWatching() failed.", ex, MessageClass.WarningMsg);
- }
- }
-
- public override void StopWatcher()
- {
- if (_eventWatcher == null) return;
- _eventWatcher.Stop();
- _eventWatcher.Dispose();
- }
+ var query = new WqlEventQuery(
+ $"SELECT * FROM RegistryTreeChangeEvent WHERE Hive = \'HKEY_USERS\' AND RootPath = \'{key}\'");
+ _eventWatcher = new ManagementEventWatcher(query);
+ _eventWatcher.EventArrived += OnManagementEventArrived;
+ _eventWatcher.Start();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage("PuttySessions.Watcher.StartWatching() failed.", ex,
+ MessageClass.WarningMsg);
+ }
+ }
+
+ public override void StopWatcher()
+ {
+ if (_eventWatcher == null) return;
+ _eventWatcher.Stop();
+ _eventWatcher.Dispose();
+ }
+
#endregion
-
- private void OnManagementEventArrived(object sender, EventArrivedEventArgs e)
- {
- RaiseSessionChangedEvent(new PuttySessionChangedEventArgs());
- }
+
+ private void OnManagementEventArrived(object sender, EventArrivedEventArgs e)
+ {
+ RaiseSessionChangedEvent(new PuttySessionChangedEventArgs());
+ }
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Putty/PuttySessionsXmingProvider.cs b/mRemoteV1/Config/Putty/PuttySessionsXmingProvider.cs
index 4b99a02a..2c4267f0 100644
--- a/mRemoteV1/Config/Putty/PuttySessionsXmingProvider.cs
+++ b/mRemoteV1/Config/Putty/PuttySessionsXmingProvider.cs
@@ -12,339 +12,374 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Putty
{
- public class PuttySessionsXmingProvider : AbstractPuttySessionsProvider
- {
- public override RootPuttySessionsNodeInfo RootInfo { get; } = new RootPuttySessionsNodeInfo { Name = "Xming Putty Sessions" };
+ public class PuttySessionsXmingProvider : AbstractPuttySessionsProvider
+ {
+ public override RootPuttySessionsNodeInfo RootInfo { get; } =
+ new RootPuttySessionsNodeInfo {Name = "Xming Putty Sessions"};
+
private const string RegistrySessionNameFormat = "{0} [registry]";
private const string RegistrySessionNamePattern = "(.*)\\ \\[registry\\]";
- private static readonly PuttySessionsRegistryProvider PuttySessionsRegistryProvider = new PuttySessionsRegistryProvider();
+
+ private static readonly PuttySessionsRegistryProvider PuttySessionsRegistryProvider =
+ new PuttySessionsRegistryProvider();
+
private static FileSystemWatcher _eventWatcher;
#region Public Methods
- public override string[] GetSessionNames(bool raw = false)
- {
- var sessionsFolderPath = GetSessionsFolderPath();
- if (!Directory.Exists(sessionsFolderPath))
- {
- return new string[] {};
- }
+
+ public override string[] GetSessionNames(bool raw = false)
+ {
+ var sessionsFolderPath = GetSessionsFolderPath();
+ if (!Directory.Exists(sessionsFolderPath))
+ {
+ return new string[] { };
+ }
var sessionNames = new List();
- foreach (var sessionName in Directory.GetFiles(sessionsFolderPath))
- {
- var sessionFileName = Path.GetFileName(sessionName);
- // ReSharper disable once ConstantConditionalAccessQualifier
- sessionNames.Add(raw ? sessionFileName : System.Web.HttpUtility.UrlDecode(sessionFileName?.Replace("+", "%2B")));
- }
+ foreach (var sessionName in Directory.GetFiles(sessionsFolderPath))
+ {
+ var sessionFileName = Path.GetFileName(sessionName);
+ // ReSharper disable once ConstantConditionalAccessQualifier
+ sessionNames.Add(raw
+ ? sessionFileName
+ : System.Web.HttpUtility.UrlDecode(sessionFileName?.Replace("+", "%2B")));
+ }
- if (raw)
- {
- if (!sessionNames.Contains("Default%20Settings")) // Do not localize
- {
- sessionNames.Insert(0, "Default%20Settings");
- }
- }
- else
- {
- if (!sessionNames.Contains("Default Settings"))
- {
- sessionNames.Insert(0, "Default Settings");
- }
- }
+ if (raw)
+ {
+ if (!sessionNames.Contains("Default%20Settings")) // Do not localize
+ {
+ sessionNames.Insert(0, "Default%20Settings");
+ }
+ }
+ else
+ {
+ if (!sessionNames.Contains("Default Settings"))
+ {
+ sessionNames.Insert(0, "Default Settings");
+ }
+ }
- var registrySessionNames = PuttySessionsRegistryProvider.GetSessionNames(raw).Select(sessionName => string.Format(RegistrySessionNameFormat, sessionName)).ToList();
+ var registrySessionNames = PuttySessionsRegistryProvider.GetSessionNames(raw)
+ .Select(sessionName =>
+ string
+ .Format(RegistrySessionNameFormat,
+ sessionName)).ToList();
- sessionNames.AddRange(registrySessionNames);
- sessionNames.Sort();
-
- return sessionNames.ToArray();
- }
-
- public override PuttySessionInfo GetSession(string sessionName)
- {
+ sessionNames.AddRange(registrySessionNames);
+ sessionNames.Sort();
+
+ return sessionNames.ToArray();
+ }
+
+ public override PuttySessionInfo GetSession(string sessionName)
+ {
var registrySessionName = GetRegistrySessionName(sessionName);
- if (!string.IsNullOrEmpty(registrySessionName))
- {
- return ModifyRegistrySessionInfo(PuttySessionsRegistryProvider.GetSession(registrySessionName));
- }
+ if (!string.IsNullOrEmpty(registrySessionName))
+ {
+ return ModifyRegistrySessionInfo(PuttySessionsRegistryProvider.GetSession(registrySessionName));
+ }
var sessionsFolderPath = GetSessionsFolderPath();
- if (!Directory.Exists(sessionsFolderPath))
- {
- return null;
- }
+ if (!Directory.Exists(sessionsFolderPath))
+ {
+ return null;
+ }
var sessionFile = Path.Combine(sessionsFolderPath, sessionName);
- if (!File.Exists(sessionFile))
- {
- return null;
- }
-
- sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"));
+ if (!File.Exists(sessionFile))
+ {
+ return null;
+ }
+
+ sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"));
var sessionFileReader = new SessionFileReader(sessionFile);
- var sessionInfo = new PuttySessionInfo
- {
- PuttySession = sessionName,
- Name = sessionName,
- Hostname = sessionFileReader.GetValue("HostName"),
- Username = sessionFileReader.GetValue("UserName")
- };
- var protocol = sessionFileReader.GetValue("Protocol") ?? "ssh";
- switch (protocol.ToLowerInvariant())
- {
- case "raw":
- sessionInfo.Protocol = ProtocolType.RAW;
- break;
- case "rlogin":
- sessionInfo.Protocol = ProtocolType.Rlogin;
- break;
- case "serial":
- return null;
- case "ssh":
- object sshVersionObject = sessionFileReader.GetValue("SshProt");
- if (sshVersionObject != null)
- {
- var sshVersion = Convert.ToInt32(sshVersionObject);
- sessionInfo.Protocol = sshVersion >= 2 ? ProtocolType.SSH2 : ProtocolType.SSH1;
- }
- else
- {
- sessionInfo.Protocol = ProtocolType.SSH2;
- }
- break;
- case "telnet":
- sessionInfo.Protocol = ProtocolType.Telnet;
- break;
- default:
- return null;
- }
- sessionInfo.Port = Convert.ToInt32(sessionFileReader.GetValue("PortNumber"));
-
- return sessionInfo;
- }
-
- public override void StartWatcher()
- {
- if (_eventWatcher != null)
- {
- return;
- }
-
- try
- {
+ var sessionInfo = new PuttySessionInfo
+ {
+ PuttySession = sessionName,
+ Name = sessionName,
+ Hostname = sessionFileReader.GetValue("HostName"),
+ Username = sessionFileReader.GetValue("UserName")
+ };
+ var protocol = sessionFileReader.GetValue("Protocol") ?? "ssh";
+ switch (protocol.ToLowerInvariant())
+ {
+ case "raw":
+ sessionInfo.Protocol = ProtocolType.RAW;
+ break;
+ case "rlogin":
+ sessionInfo.Protocol = ProtocolType.Rlogin;
+ break;
+ case "serial":
+ return null;
+ case "ssh":
+ object sshVersionObject = sessionFileReader.GetValue("SshProt");
+ if (sshVersionObject != null)
+ {
+ var sshVersion = Convert.ToInt32(sshVersionObject);
+ sessionInfo.Protocol = sshVersion >= 2 ? ProtocolType.SSH2 : ProtocolType.SSH1;
+ }
+ else
+ {
+ sessionInfo.Protocol = ProtocolType.SSH2;
+ }
+
+ break;
+ case "telnet":
+ sessionInfo.Protocol = ProtocolType.Telnet;
+ break;
+ default:
+ return null;
+ }
+
+ sessionInfo.Port = Convert.ToInt32(sessionFileReader.GetValue("PortNumber"));
+
+ return sessionInfo;
+ }
+
+ public override void StartWatcher()
+ {
+ if (_eventWatcher != null)
+ {
+ return;
+ }
+
+ try
+ {
var sessionsFolderPath = GetSessionsFolderPath();
- if (!Directory.Exists(sessionsFolderPath))
- {
- Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, $"XmingPortablePuttySessions.Watcher.StartWatching() failed: '{sessionsFolderPath}' does not exist.", true);
- return;
- }
+ if (!Directory.Exists(sessionsFolderPath))
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
+ $"XmingPortablePuttySessions.Watcher.StartWatching() failed: '{sessionsFolderPath}' does not exist.",
+ true);
+ return;
+ }
+
+ _eventWatcher = new FileSystemWatcher(sessionsFolderPath)
+ {
+ NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite
+ };
+ _eventWatcher.Changed += OnFileSystemEventArrived;
+ _eventWatcher.Created += OnFileSystemEventArrived;
+ _eventWatcher.Deleted += OnFileSystemEventArrived;
+ _eventWatcher.Renamed += OnFileSystemEventArrived;
+ _eventWatcher.EnableRaisingEvents = true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage(
+ "XmingPortablePuttySessions.Watcher.StartWatching() failed.",
+ ex, MessageClass.WarningMsg);
+ }
+ }
+
+ public override void StopWatcher()
+ {
+ PuttySessionsRegistryProvider.StopWatcher();
+ PuttySessionsRegistryProvider.PuttySessionChanged -= OnRegistrySessionChanged;
+
+ if (_eventWatcher == null)
+ {
+ return;
+ }
+
+ _eventWatcher.EnableRaisingEvents = false;
+ _eventWatcher.Dispose();
+ }
- _eventWatcher = new FileSystemWatcher(sessionsFolderPath)
- {
- NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite
- };
- _eventWatcher.Changed += OnFileSystemEventArrived;
- _eventWatcher.Created += OnFileSystemEventArrived;
- _eventWatcher.Deleted += OnFileSystemEventArrived;
- _eventWatcher.Renamed += OnFileSystemEventArrived;
- _eventWatcher.EnableRaisingEvents = true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage("XmingPortablePuttySessions.Watcher.StartWatching() failed.", ex, MessageClass.WarningMsg);
- }
- }
-
- public override void StopWatcher()
- {
- PuttySessionsRegistryProvider.StopWatcher();
- PuttySessionsRegistryProvider.PuttySessionChanged -= OnRegistrySessionChanged;
-
- if (_eventWatcher == null)
- {
- return;
- }
- _eventWatcher.EnableRaisingEvents = false;
- _eventWatcher.Dispose();
- }
#endregion
-
+
#region Private Methods
- private static string GetPuttyConfPath()
- {
- var puttyPath = mRemoteNG.Settings.Default.UseCustomPuttyPath ? mRemoteNG.Settings.Default.CustomPuttyPath : App.Info.GeneralAppInfo.PuttyPath;
- puttyPath = Path.GetDirectoryName(puttyPath);
+
+ private static string GetPuttyConfPath()
+ {
+ var puttyPath = mRemoteNG.Settings.Default.UseCustomPuttyPath
+ ? mRemoteNG.Settings.Default.CustomPuttyPath
+ : App.Info.GeneralAppInfo.PuttyPath;
+ puttyPath = Path.GetDirectoryName(puttyPath);
return string.IsNullOrEmpty(puttyPath) ? null : Path.Combine(puttyPath, "putty.conf");
- }
-
- private static string GetSessionsFolderPath()
- {
+ }
+
+ private static string GetSessionsFolderPath()
+ {
var puttyConfPath = GetPuttyConfPath();
var sessionFileReader = new PuttyConfFileReader(puttyConfPath);
var basePath = Environment.ExpandEnvironmentVariables(sessionFileReader.GetValue("sshk&sess"));
- return Path.Combine(basePath, "sessions");
- }
-
- private static string GetRegistrySessionName(string sessionName)
- {
+ return Path.Combine(basePath, "sessions");
+ }
+
+ private static string GetRegistrySessionName(string sessionName)
+ {
var regex = new Regex(RegistrySessionNamePattern);
var matches = regex.Matches(sessionName);
- if (matches.Count < 1)
- {
- return string.Empty;
- }
+ if (matches.Count < 1)
+ {
+ return string.Empty;
+ }
var groups = matches[0].Groups;
- return groups.Count < 1 ? string.Empty : groups[1].Value;
- }
-
- private static PuttySessionInfo ModifyRegistrySessionInfo(PuttySessionInfo sessionInfo)
- {
- if (sessionInfo == null)
- return null;
+ return groups.Count < 1 ? string.Empty : groups[1].Value;
+ }
+
+ private static PuttySessionInfo ModifyRegistrySessionInfo(PuttySessionInfo sessionInfo)
+ {
+ if (sessionInfo == null)
+ return null;
+
+ sessionInfo.Name = string.Format(RegistrySessionNameFormat, sessionInfo.Name);
+ sessionInfo.PuttySession = string.Format(RegistrySessionNameFormat, sessionInfo.PuttySession);
+ return sessionInfo;
+ }
+
+ private void OnFileSystemEventArrived(object sender, FileSystemEventArgs e)
+ {
+ RaiseSessionChangedEvent(new PuttySessionChangedEventArgs());
+ }
+
+ private void OnRegistrySessionChanged(object sender, PuttySessionChangedEventArgs e)
+ {
+ RaiseSessionChangedEvent(new PuttySessionChangedEventArgs());
+ }
- sessionInfo.Name = string.Format(RegistrySessionNameFormat, sessionInfo.Name);
- sessionInfo.PuttySession = string.Format(RegistrySessionNameFormat, sessionInfo.PuttySession);
- return sessionInfo;
- }
-
- private void OnFileSystemEventArrived(object sender, FileSystemEventArgs e)
- {
- RaiseSessionChangedEvent(new PuttySessionChangedEventArgs());
- }
-
- private void OnRegistrySessionChanged(object sender, PuttySessionChangedEventArgs e)
- {
- RaiseSessionChangedEvent(new PuttySessionChangedEventArgs());
- }
#endregion
-
+
#region Private Classes
- private class PuttyConfFileReader
- {
- public PuttyConfFileReader(string puttyConfFile)
- {
- _puttyConfFile = puttyConfFile;
- }
-
- private string _puttyConfFile;
- private bool _configurationLoaded;
- private Dictionary _configuration = new Dictionary();
-
- private void LoadConfiguration()
- {
- _configurationLoaded = true;
- try
- {
- if (!File.Exists(_puttyConfFile))
- {
- return;
- }
- using (var streamReader = new StreamReader(_puttyConfFile))
- {
- do
- {
- var line = streamReader.ReadLine();
- if (line == null)
- {
- break;
- }
- line = line.Trim();
- if (line == string.Empty)
- {
- continue; // Blank line
- }
- if (line.Substring(0, 1) == ";")
- {
- continue; // Comment
- }
+
+ private class PuttyConfFileReader
+ {
+ public PuttyConfFileReader(string puttyConfFile)
+ {
+ _puttyConfFile = puttyConfFile;
+ }
+
+ private string _puttyConfFile;
+ private bool _configurationLoaded;
+ private Dictionary _configuration = new Dictionary();
+
+ private void LoadConfiguration()
+ {
+ _configurationLoaded = true;
+ try
+ {
+ if (!File.Exists(_puttyConfFile))
+ {
+ return;
+ }
+
+ using (var streamReader = new StreamReader(_puttyConfFile))
+ {
+ do
+ {
+ var line = streamReader.ReadLine();
+ if (line == null)
+ {
+ break;
+ }
+
+ line = line.Trim();
+ if (line == string.Empty)
+ {
+ continue; // Blank line
+ }
+
+ if (line.Substring(0, 1) == ";")
+ {
+ continue; // Comment
+ }
+
var parts = line.Split(new[] {'='}, 2);
- if (parts.Length < 2)
- {
- continue;
- }
- if (_configuration.ContainsKey(parts[0]))
- {
- continue; // As per http://www.straightrunning.com/XmingNotes/portableputty.php only first entry is used
- }
- _configuration.Add(parts[0], parts[1]);
- } while (true);
- }
-
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage("PuttyConfFileReader.LoadConfiguration() failed.", ex);
- }
- }
-
- public string GetValue(string setting)
- {
- if (!_configurationLoaded)
- {
- LoadConfiguration();
- }
- return !_configuration.ContainsKey(setting) ? string.Empty : _configuration[setting];
- }
- }
-
- private class SessionFileReader
- {
- public SessionFileReader(string sessionFile)
- {
- _sessionFile = sessionFile;
- }
-
- private string _sessionFile;
- private bool _sessionInfoLoaded;
- private Dictionary _sessionInfo = new Dictionary();
-
- private void LoadSessionInfo()
- {
- _sessionInfoLoaded = true;
- try
- {
- if (!File.Exists(_sessionFile))
- {
- return;
- }
- using (var streamReader = new StreamReader(_sessionFile))
- {
- do
- {
- var line = streamReader.ReadLine();
- if (line == null)
- {
- break;
- }
+ if (parts.Length < 2)
+ {
+ continue;
+ }
+
+ if (_configuration.ContainsKey(parts[0]))
+ {
+ continue; // As per http://www.straightrunning.com/XmingNotes/portableputty.php only first entry is used
+ }
+
+ _configuration.Add(parts[0], parts[1]);
+ } while (true);
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage("PuttyConfFileReader.LoadConfiguration() failed.", ex);
+ }
+ }
+
+ public string GetValue(string setting)
+ {
+ if (!_configurationLoaded)
+ {
+ LoadConfiguration();
+ }
+
+ return !_configuration.ContainsKey(setting) ? string.Empty : _configuration[setting];
+ }
+ }
+
+ private class SessionFileReader
+ {
+ public SessionFileReader(string sessionFile)
+ {
+ _sessionFile = sessionFile;
+ }
+
+ private string _sessionFile;
+ private bool _sessionInfoLoaded;
+ private Dictionary _sessionInfo = new Dictionary();
+
+ private void LoadSessionInfo()
+ {
+ _sessionInfoLoaded = true;
+ try
+ {
+ if (!File.Exists(_sessionFile))
+ {
+ return;
+ }
+
+ using (var streamReader = new StreamReader(_sessionFile))
+ {
+ do
+ {
+ var line = streamReader.ReadLine();
+ if (line == null)
+ {
+ break;
+ }
+
var parts = line.Split('\\');
- if (parts.Length < 2)
- {
- continue;
- }
- _sessionInfo.Add(parts[0], parts[1]);
- } while (true);
- }
-
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage("SessionFileReader.LoadSessionInfo() failed.", ex);
- }
- }
-
- public string GetValue(string setting)
- {
- if (!_sessionInfoLoaded)
- {
- LoadSessionInfo();
- }
- return !_sessionInfo.ContainsKey(setting) ? string.Empty : _sessionInfo[setting];
- }
- }
+ if (parts.Length < 2)
+ {
+ continue;
+ }
+
+ _sessionInfo.Add(parts[0], parts[1]);
+ } while (true);
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage("SessionFileReader.LoadSessionInfo() failed.", ex);
+ }
+ }
+
+ public string GetValue(string setting)
+ {
+ if (!_sessionInfoLoaded)
+ {
+ LoadSessionInfo();
+ }
+
+ return !_sessionInfo.ContainsKey(setting) ? string.Empty : _sessionInfo[setting];
+ }
+ }
+
#endregion
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsDeserializerMremotengFormat.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsDeserializerMremotengFormat.cs
index 0bef1755..afc18bd7 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsDeserializerMremotengFormat.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsDeserializerMremotengFormat.cs
@@ -17,7 +17,7 @@ namespace mRemoteNG.Config.Serializers.Csv
{
public ConnectionTreeModel Deserialize(string serializedData)
{
- var lines = serializedData.Split(new []{"\r\n", "\r", "\n"}, StringSplitOptions.RemoveEmptyEntries);
+ var lines = serializedData.Split(new[] {"\r\n", "\r", "\n"}, StringSplitOptions.RemoveEmptyEntries);
var csvHeaders = new List();
// used to map a connectioninfo to it's parent's GUID
var parentMapping = new Dictionary();
@@ -55,9 +55,9 @@ namespace mRemoteNG.Config.Serializers.Csv
// search for parent in the list by GUID
var parent = parentMapping
- .Keys
- .OfType()
- .FirstOrDefault(info => info.ConstantID == node.Value);
+ .Keys
+ .OfType()
+ .FirstOrDefault(info => info.ConstantID == node.Value);
if (parent != null)
{
@@ -75,7 +75,7 @@ namespace mRemoteNG.Config.Serializers.Csv
private ConnectionInfo ParseConnectionInfo(IList headers, string[] connectionCsv)
{
var nodeType = headers.Contains("NodeType")
- ? (TreeNodeType)Enum.Parse(typeof(TreeNodeType), connectionCsv[headers.IndexOf("NodeType")], true)
+ ? (TreeNodeType)Enum.Parse(typeof(TreeNodeType), connectionCsv[headers.IndexOf("NodeType")], true)
: TreeNodeType.Connection;
var nodeId = headers.Contains("Id")
@@ -87,27 +87,48 @@ namespace mRemoteNG.Config.Serializers.Csv
: new ContainerInfo(nodeId);
connectionRecord.Name = headers.Contains("Name") ? connectionCsv[headers.IndexOf("Name")] : "";
- connectionRecord.Description = headers.Contains("Description") ? connectionCsv[headers.IndexOf("Description")] : "";
+ connectionRecord.Description =
+ headers.Contains("Description") ? connectionCsv[headers.IndexOf("Description")] : "";
connectionRecord.Icon = headers.Contains("Icon") ? connectionCsv[headers.IndexOf("Icon")] : "";
connectionRecord.Panel = headers.Contains("Panel") ? connectionCsv[headers.IndexOf("Panel")] : "";
connectionRecord.Username = headers.Contains("Username") ? connectionCsv[headers.IndexOf("Username")] : "";
connectionRecord.Password = headers.Contains("Password") ? connectionCsv[headers.IndexOf("Password")] : "";
connectionRecord.Domain = headers.Contains("Domain") ? connectionCsv[headers.IndexOf("Domain")] : "";
connectionRecord.Hostname = headers.Contains("Hostname") ? connectionCsv[headers.IndexOf("Hostname")] : "";
- connectionRecord.PuttySession = headers.Contains("PuttySession") ? connectionCsv[headers.IndexOf("PuttySession")] : "";
- connectionRecord.LoadBalanceInfo = headers.Contains("LoadBalanceInfo") ? connectionCsv[headers.IndexOf("LoadBalanceInfo")] : "";
- connectionRecord.PreExtApp = headers.Contains("PreExtApp") ? connectionCsv[headers.IndexOf("PreExtApp")] : "";
- connectionRecord.PostExtApp = headers.Contains("PostExtApp") ? connectionCsv[headers.IndexOf("PostExtApp")] : "";
- connectionRecord.MacAddress = headers.Contains("MacAddress") ? connectionCsv[headers.IndexOf("MacAddress")] : "";
- connectionRecord.UserField = headers.Contains("UserField") ? connectionCsv[headers.IndexOf("UserField")] : "";
+ connectionRecord.PuttySession =
+ headers.Contains("PuttySession") ? connectionCsv[headers.IndexOf("PuttySession")] : "";
+ connectionRecord.LoadBalanceInfo = headers.Contains("LoadBalanceInfo")
+ ? connectionCsv[headers.IndexOf("LoadBalanceInfo")]
+ : "";
+ connectionRecord.PreExtApp =
+ headers.Contains("PreExtApp") ? connectionCsv[headers.IndexOf("PreExtApp")] : "";
+ connectionRecord.PostExtApp =
+ headers.Contains("PostExtApp") ? connectionCsv[headers.IndexOf("PostExtApp")] : "";
+ connectionRecord.MacAddress =
+ headers.Contains("MacAddress") ? connectionCsv[headers.IndexOf("MacAddress")] : "";
+ connectionRecord.UserField =
+ headers.Contains("UserField") ? connectionCsv[headers.IndexOf("UserField")] : "";
connectionRecord.ExtApp = headers.Contains("ExtApp") ? connectionCsv[headers.IndexOf("ExtApp")] : "";
- connectionRecord.VNCProxyUsername = headers.Contains("VNCProxyUsername") ? connectionCsv[headers.IndexOf("VNCProxyUsername")] : "";
- connectionRecord.VNCProxyPassword = headers.Contains("VNCProxyPassword") ? connectionCsv[headers.IndexOf("VNCProxyPassword")] : "";
- connectionRecord.RDGatewayUsername = headers.Contains("RDGatewayUsername") ? connectionCsv[headers.IndexOf("RDGatewayUsername")] : "";
- connectionRecord.RDGatewayPassword = headers.Contains("RDGatewayPassword") ? connectionCsv[headers.IndexOf("RDGatewayPassword")] : "";
- connectionRecord.RDGatewayDomain = headers.Contains("RDGatewayDomain") ? connectionCsv[headers.IndexOf("RDGatewayDomain")] : "";
- connectionRecord.VNCProxyIP = headers.Contains("VNCProxyIP") ? connectionCsv[headers.IndexOf("VNCProxyIP")] : "";
- connectionRecord.RDGatewayHostname = headers.Contains("RDGatewayHostname") ? connectionCsv[headers.IndexOf("RDGatewayHostname")] : "";
+ connectionRecord.VNCProxyUsername = headers.Contains("VNCProxyUsername")
+ ? connectionCsv[headers.IndexOf("VNCProxyUsername")]
+ : "";
+ connectionRecord.VNCProxyPassword = headers.Contains("VNCProxyPassword")
+ ? connectionCsv[headers.IndexOf("VNCProxyPassword")]
+ : "";
+ connectionRecord.RDGatewayUsername = headers.Contains("RDGatewayUsername")
+ ? connectionCsv[headers.IndexOf("RDGatewayUsername")]
+ : "";
+ connectionRecord.RDGatewayPassword = headers.Contains("RDGatewayPassword")
+ ? connectionCsv[headers.IndexOf("RDGatewayPassword")]
+ : "";
+ connectionRecord.RDGatewayDomain = headers.Contains("RDGatewayDomain")
+ ? connectionCsv[headers.IndexOf("RDGatewayDomain")]
+ : "";
+ connectionRecord.VNCProxyIP =
+ headers.Contains("VNCProxyIP") ? connectionCsv[headers.IndexOf("VNCProxyIP")] : "";
+ connectionRecord.RDGatewayHostname = headers.Contains("RDGatewayHostname")
+ ? connectionCsv[headers.IndexOf("RDGatewayHostname")]
+ : "";
if (headers.Contains("Protocol"))
{
@@ -234,6 +255,7 @@ namespace mRemoteNG.Config.Serializers.Csv
if (bool.TryParse(connectionCsv[headers.IndexOf("RedirectPrinters")], out value))
connectionRecord.RedirectPrinters = value;
}
+
if (headers.Contains("RedirectClipboard"))
{
bool value;
@@ -333,6 +355,7 @@ namespace mRemoteNG.Config.Serializers.Csv
}
#region Inheritance
+
if (headers.Contains("InheritCacheBitmaps"))
{
bool value;
@@ -672,7 +695,8 @@ namespace mRemoteNG.Config.Serializers.Csv
if (headers.Contains("InheritRDGatewayUseConnectionCredentials"))
{
bool value;
- if (bool.TryParse(connectionCsv[headers.IndexOf("InheritRDGatewayUseConnectionCredentials")], out value))
+ if (bool.TryParse(connectionCsv[headers.IndexOf("InheritRDGatewayUseConnectionCredentials")],
+ out value))
connectionRecord.Inheritance.RDGatewayUseConnectionCredentials = value;
}
@@ -717,9 +741,10 @@ namespace mRemoteNG.Config.Serializers.Csv
if (bool.TryParse(connectionCsv[headers.IndexOf("InheritSoundQuality")], out value))
connectionRecord.Inheritance.SoundQuality = value;
}
+
#endregion
return connectionRecord;
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsSerializerMremotengFormat.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsSerializerMremotengFormat.cs
index bd0a6f29..62e3afc5 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsSerializerMremotengFormat.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/Csv/CsvConnectionsSerializerMremotengFormat.cs
@@ -11,14 +11,15 @@ using System.Text;
namespace mRemoteNG.Config.Serializers.Csv
{
- public class CsvConnectionsSerializerMremotengFormat : ISerializer
+ public class CsvConnectionsSerializerMremotengFormat : ISerializer
{
private readonly SaveFilter _saveFilter;
private readonly ICredentialRepositoryList _credentialRepositoryList;
public Version Version { get; } = new Version(2, 7);
- public CsvConnectionsSerializerMremotengFormat(SaveFilter saveFilter, ICredentialRepositoryList credentialRepositoryList)
+ public CsvConnectionsSerializerMremotengFormat(SaveFilter saveFilter,
+ ICredentialRepositoryList credentialRepositoryList)
{
saveFilter.ThrowIfNull(nameof(saveFilter));
credentialRepositoryList.ThrowIfNull(nameof(credentialRepositoryList));
@@ -54,9 +55,11 @@ namespace mRemoteNG.Config.Serializers.Csv
sb.Append("Password;");
if (_saveFilter.SaveDomain)
sb.Append("Domain;");
- sb.Append("Hostname;Protocol;PuttySession;Port;ConnectToConsole;UseCredSsp;RenderingEngine;ICAEncryptionStrength;RDPAuthenticationLevel;LoadBalanceInfo;Colors;Resolution;AutomaticResize;DisplayWallpaper;DisplayThemes;EnableFontSmoothing;EnableDesktopComposition;CacheBitmaps;RedirectDiskDrives;RedirectPorts;RedirectPrinters;RedirectClipboard;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;");
+ sb.Append(
+ "Hostname;Protocol;PuttySession;Port;ConnectToConsole;UseCredSsp;RenderingEngine;ICAEncryptionStrength;RDPAuthenticationLevel;LoadBalanceInfo;Colors;Resolution;AutomaticResize;DisplayWallpaper;DisplayThemes;EnableFontSmoothing;EnableDesktopComposition;CacheBitmaps;RedirectDiskDrives;RedirectPorts;RedirectPrinters;RedirectClipboard;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 (_saveFilter.SaveInheritance)
- sb.Append("InheritCacheBitmaps;InheritColors;InheritDescription;InheritDisplayThemes;InheritDisplayWallpaper;InheritEnableFontSmoothing;InheritEnableDesktopComposition;InheritDomain;InheritIcon;InheritPanel;InheritPassword;InheritPort;InheritProtocol;InheritPuttySession;InheritRedirectDiskDrives;InheritRedirectKeys;InheritRedirectPorts;InheritRedirectPrinters;InheritRedirectClipboard;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;InheritRDPAlertIdleTimeout;InheritRDPMinutesToIdleTimeout;InheritSoundQuality");
+ sb.Append(
+ "InheritCacheBitmaps;InheritColors;InheritDescription;InheritDisplayThemes;InheritDisplayWallpaper;InheritEnableFontSmoothing;InheritEnableDesktopComposition;InheritDomain;InheritIcon;InheritPanel;InheritPassword;InheritPort;InheritProtocol;InheritPuttySession;InheritRedirectDiskDrives;InheritRedirectKeys;InheritRedirectPorts;InheritRedirectPrinters;InheritRedirectClipboard;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;InheritRDPAlertIdleTimeout;InheritRDPMinutesToIdleTimeout;InheritSoundQuality");
}
private void SerializeNodesRecursive(ConnectionInfo node, StringBuilder sb)
@@ -81,12 +84,12 @@ namespace mRemoteNG.Config.Serializers.Csv
{
sb.AppendLine();
sb.Append(FormatForCsv(con.Name))
- .Append(FormatForCsv(con.ConstantID))
- .Append(FormatForCsv(con.Parent?.ConstantID ?? ""))
- .Append(FormatForCsv(con.GetTreeNodeType()))
- .Append(FormatForCsv(con.Description))
- .Append(FormatForCsv(con.Icon))
- .Append(FormatForCsv(con.Panel));
+ .Append(FormatForCsv(con.ConstantID))
+ .Append(FormatForCsv(con.Parent?.ConstantID ?? ""))
+ .Append(FormatForCsv(con.GetTreeNodeType()))
+ .Append(FormatForCsv(con.Description))
+ .Append(FormatForCsv(con.Icon))
+ .Append(FormatForCsv(con.Panel));
if (_saveFilter.SaveUsername)
sb.Append(FormatForCsv(con.Username));
@@ -98,112 +101,112 @@ namespace mRemoteNG.Config.Serializers.Csv
sb.Append(FormatForCsv(con.Domain));
sb.Append(FormatForCsv(con.Hostname))
- .Append(FormatForCsv(con.Protocol))
- .Append(FormatForCsv(con.PuttySession))
- .Append(FormatForCsv(con.Port))
- .Append(FormatForCsv(con.UseConsoleSession))
- .Append(FormatForCsv(con.UseCredSsp))
- .Append(FormatForCsv(con.RenderingEngine))
- .Append(FormatForCsv(con.ICAEncryptionStrength))
- .Append(FormatForCsv(con.RDPAuthenticationLevel))
- .Append(FormatForCsv(con.LoadBalanceInfo))
- .Append(FormatForCsv(con.Colors))
- .Append(FormatForCsv(con.Resolution))
- .Append(FormatForCsv(con.AutomaticResize))
- .Append(FormatForCsv(con.DisplayWallpaper))
- .Append(FormatForCsv(con.DisplayThemes))
- .Append(FormatForCsv(con.EnableFontSmoothing))
- .Append(FormatForCsv(con.EnableDesktopComposition))
- .Append(FormatForCsv(con.CacheBitmaps))
- .Append(FormatForCsv(con.RedirectDiskDrives))
- .Append(FormatForCsv(con.RedirectPorts))
- .Append(FormatForCsv(con.RedirectPrinters))
- .Append(FormatForCsv(con.RedirectClipboard))
- .Append(FormatForCsv(con.RedirectSmartCards))
- .Append(FormatForCsv(con.RedirectSound))
- .Append(FormatForCsv(con.RedirectKeys))
- .Append(FormatForCsv(con.PreExtApp))
- .Append(FormatForCsv(con.PostExtApp))
- .Append(FormatForCsv(con.MacAddress))
- .Append(FormatForCsv(con.UserField))
- .Append(FormatForCsv(con.ExtApp))
- .Append(FormatForCsv(con.VNCCompression))
- .Append(FormatForCsv(con.VNCEncoding))
- .Append(FormatForCsv(con.VNCAuthMode))
- .Append(FormatForCsv(con.VNCProxyType))
- .Append(FormatForCsv(con.VNCProxyIP))
- .Append(FormatForCsv(con.VNCProxyPort))
- .Append(FormatForCsv(con.VNCProxyUsername))
- .Append(FormatForCsv(con.VNCProxyPassword))
- .Append(FormatForCsv(con.VNCColors))
- .Append(FormatForCsv(con.VNCSmartSizeMode))
- .Append(FormatForCsv(con.VNCViewOnly))
- .Append(FormatForCsv(con.RDGatewayUsageMethod))
- .Append(FormatForCsv(con.RDGatewayHostname))
- .Append(FormatForCsv(con.RDGatewayUseConnectionCredentials))
- .Append(FormatForCsv(con.RDGatewayUsername))
- .Append(FormatForCsv(con.RDGatewayPassword))
- .Append(FormatForCsv(con.RDGatewayDomain));
+ .Append(FormatForCsv(con.Protocol))
+ .Append(FormatForCsv(con.PuttySession))
+ .Append(FormatForCsv(con.Port))
+ .Append(FormatForCsv(con.UseConsoleSession))
+ .Append(FormatForCsv(con.UseCredSsp))
+ .Append(FormatForCsv(con.RenderingEngine))
+ .Append(FormatForCsv(con.ICAEncryptionStrength))
+ .Append(FormatForCsv(con.RDPAuthenticationLevel))
+ .Append(FormatForCsv(con.LoadBalanceInfo))
+ .Append(FormatForCsv(con.Colors))
+ .Append(FormatForCsv(con.Resolution))
+ .Append(FormatForCsv(con.AutomaticResize))
+ .Append(FormatForCsv(con.DisplayWallpaper))
+ .Append(FormatForCsv(con.DisplayThemes))
+ .Append(FormatForCsv(con.EnableFontSmoothing))
+ .Append(FormatForCsv(con.EnableDesktopComposition))
+ .Append(FormatForCsv(con.CacheBitmaps))
+ .Append(FormatForCsv(con.RedirectDiskDrives))
+ .Append(FormatForCsv(con.RedirectPorts))
+ .Append(FormatForCsv(con.RedirectPrinters))
+ .Append(FormatForCsv(con.RedirectClipboard))
+ .Append(FormatForCsv(con.RedirectSmartCards))
+ .Append(FormatForCsv(con.RedirectSound))
+ .Append(FormatForCsv(con.RedirectKeys))
+ .Append(FormatForCsv(con.PreExtApp))
+ .Append(FormatForCsv(con.PostExtApp))
+ .Append(FormatForCsv(con.MacAddress))
+ .Append(FormatForCsv(con.UserField))
+ .Append(FormatForCsv(con.ExtApp))
+ .Append(FormatForCsv(con.VNCCompression))
+ .Append(FormatForCsv(con.VNCEncoding))
+ .Append(FormatForCsv(con.VNCAuthMode))
+ .Append(FormatForCsv(con.VNCProxyType))
+ .Append(FormatForCsv(con.VNCProxyIP))
+ .Append(FormatForCsv(con.VNCProxyPort))
+ .Append(FormatForCsv(con.VNCProxyUsername))
+ .Append(FormatForCsv(con.VNCProxyPassword))
+ .Append(FormatForCsv(con.VNCColors))
+ .Append(FormatForCsv(con.VNCSmartSizeMode))
+ .Append(FormatForCsv(con.VNCViewOnly))
+ .Append(FormatForCsv(con.RDGatewayUsageMethod))
+ .Append(FormatForCsv(con.RDGatewayHostname))
+ .Append(FormatForCsv(con.RDGatewayUseConnectionCredentials))
+ .Append(FormatForCsv(con.RDGatewayUsername))
+ .Append(FormatForCsv(con.RDGatewayPassword))
+ .Append(FormatForCsv(con.RDGatewayDomain));
if (!_saveFilter.SaveInheritance)
return;
sb.Append(FormatForCsv(con.Inheritance.CacheBitmaps))
- .Append(FormatForCsv(con.Inheritance.Colors))
- .Append(FormatForCsv(con.Inheritance.Description))
- .Append(FormatForCsv(con.Inheritance.DisplayThemes))
- .Append(FormatForCsv(con.Inheritance.DisplayWallpaper))
- .Append(FormatForCsv(con.Inheritance.EnableFontSmoothing))
- .Append(FormatForCsv(con.Inheritance.EnableDesktopComposition))
- .Append(FormatForCsv(con.Inheritance.Domain))
- .Append(FormatForCsv(con.Inheritance.Icon))
- .Append(FormatForCsv(con.Inheritance.Panel))
- .Append(FormatForCsv(con.Inheritance.Password))
- .Append(FormatForCsv(con.Inheritance.Port))
- .Append(FormatForCsv(con.Inheritance.Protocol))
- .Append(FormatForCsv(con.Inheritance.PuttySession))
- .Append(FormatForCsv(con.Inheritance.RedirectDiskDrives))
- .Append(FormatForCsv(con.Inheritance.RedirectKeys))
- .Append(FormatForCsv(con.Inheritance.RedirectPorts))
- .Append(FormatForCsv(con.Inheritance.RedirectPrinters))
- .Append(FormatForCsv(con.Inheritance.RedirectClipboard))
- .Append(FormatForCsv(con.Inheritance.RedirectSmartCards))
- .Append(FormatForCsv(con.Inheritance.RedirectSound))
- .Append(FormatForCsv(con.Inheritance.Resolution))
- .Append(FormatForCsv(con.Inheritance.AutomaticResize))
- .Append(FormatForCsv(con.Inheritance.UseConsoleSession))
- .Append(FormatForCsv(con.Inheritance.UseCredSsp))
- .Append(FormatForCsv(con.Inheritance.RenderingEngine))
- .Append(FormatForCsv(con.Inheritance.Username))
- .Append(FormatForCsv(con.Inheritance.ICAEncryptionStrength))
- .Append(FormatForCsv(con.Inheritance.RDPAuthenticationLevel))
- .Append(FormatForCsv(con.Inheritance.LoadBalanceInfo))
- .Append(FormatForCsv(con.Inheritance.PreExtApp))
- .Append(FormatForCsv(con.Inheritance.PostExtApp))
- .Append(FormatForCsv(con.Inheritance.MacAddress))
- .Append(FormatForCsv(con.Inheritance.UserField))
- .Append(FormatForCsv(con.Inheritance.ExtApp))
- .Append(FormatForCsv(con.Inheritance.VNCCompression))
- .Append(FormatForCsv(con.Inheritance.VNCEncoding))
- .Append(FormatForCsv(con.Inheritance.VNCAuthMode))
- .Append(FormatForCsv(con.Inheritance.VNCProxyType))
- .Append(FormatForCsv(con.Inheritance.VNCProxyIP))
- .Append(FormatForCsv(con.Inheritance.VNCProxyPort))
- .Append(FormatForCsv(con.Inheritance.VNCProxyUsername))
- .Append(FormatForCsv(con.Inheritance.VNCProxyPassword))
- .Append(FormatForCsv(con.Inheritance.VNCColors))
- .Append(FormatForCsv(con.Inheritance.VNCSmartSizeMode))
- .Append(FormatForCsv(con.Inheritance.VNCViewOnly))
- .Append(FormatForCsv(con.Inheritance.RDGatewayUsageMethod))
- .Append(FormatForCsv(con.Inheritance.RDGatewayHostname))
- .Append(FormatForCsv(con.Inheritance.RDGatewayUseConnectionCredentials))
- .Append(FormatForCsv(con.Inheritance.RDGatewayUsername))
- .Append(FormatForCsv(con.Inheritance.RDGatewayPassword))
- .Append(FormatForCsv(con.Inheritance.RDGatewayDomain))
- .Append(FormatForCsv(con.Inheritance.RDPAlertIdleTimeout))
- .Append(FormatForCsv(con.Inheritance.RDPMinutesToIdleTimeout))
- .Append(FormatForCsv(con.Inheritance.SoundQuality));
+ .Append(FormatForCsv(con.Inheritance.Colors))
+ .Append(FormatForCsv(con.Inheritance.Description))
+ .Append(FormatForCsv(con.Inheritance.DisplayThemes))
+ .Append(FormatForCsv(con.Inheritance.DisplayWallpaper))
+ .Append(FormatForCsv(con.Inheritance.EnableFontSmoothing))
+ .Append(FormatForCsv(con.Inheritance.EnableDesktopComposition))
+ .Append(FormatForCsv(con.Inheritance.Domain))
+ .Append(FormatForCsv(con.Inheritance.Icon))
+ .Append(FormatForCsv(con.Inheritance.Panel))
+ .Append(FormatForCsv(con.Inheritance.Password))
+ .Append(FormatForCsv(con.Inheritance.Port))
+ .Append(FormatForCsv(con.Inheritance.Protocol))
+ .Append(FormatForCsv(con.Inheritance.PuttySession))
+ .Append(FormatForCsv(con.Inheritance.RedirectDiskDrives))
+ .Append(FormatForCsv(con.Inheritance.RedirectKeys))
+ .Append(FormatForCsv(con.Inheritance.RedirectPorts))
+ .Append(FormatForCsv(con.Inheritance.RedirectPrinters))
+ .Append(FormatForCsv(con.Inheritance.RedirectClipboard))
+ .Append(FormatForCsv(con.Inheritance.RedirectSmartCards))
+ .Append(FormatForCsv(con.Inheritance.RedirectSound))
+ .Append(FormatForCsv(con.Inheritance.Resolution))
+ .Append(FormatForCsv(con.Inheritance.AutomaticResize))
+ .Append(FormatForCsv(con.Inheritance.UseConsoleSession))
+ .Append(FormatForCsv(con.Inheritance.UseCredSsp))
+ .Append(FormatForCsv(con.Inheritance.RenderingEngine))
+ .Append(FormatForCsv(con.Inheritance.Username))
+ .Append(FormatForCsv(con.Inheritance.ICAEncryptionStrength))
+ .Append(FormatForCsv(con.Inheritance.RDPAuthenticationLevel))
+ .Append(FormatForCsv(con.Inheritance.LoadBalanceInfo))
+ .Append(FormatForCsv(con.Inheritance.PreExtApp))
+ .Append(FormatForCsv(con.Inheritance.PostExtApp))
+ .Append(FormatForCsv(con.Inheritance.MacAddress))
+ .Append(FormatForCsv(con.Inheritance.UserField))
+ .Append(FormatForCsv(con.Inheritance.ExtApp))
+ .Append(FormatForCsv(con.Inheritance.VNCCompression))
+ .Append(FormatForCsv(con.Inheritance.VNCEncoding))
+ .Append(FormatForCsv(con.Inheritance.VNCAuthMode))
+ .Append(FormatForCsv(con.Inheritance.VNCProxyType))
+ .Append(FormatForCsv(con.Inheritance.VNCProxyIP))
+ .Append(FormatForCsv(con.Inheritance.VNCProxyPort))
+ .Append(FormatForCsv(con.Inheritance.VNCProxyUsername))
+ .Append(FormatForCsv(con.Inheritance.VNCProxyPassword))
+ .Append(FormatForCsv(con.Inheritance.VNCColors))
+ .Append(FormatForCsv(con.Inheritance.VNCSmartSizeMode))
+ .Append(FormatForCsv(con.Inheritance.VNCViewOnly))
+ .Append(FormatForCsv(con.Inheritance.RDGatewayUsageMethod))
+ .Append(FormatForCsv(con.Inheritance.RDGatewayHostname))
+ .Append(FormatForCsv(con.Inheritance.RDGatewayUseConnectionCredentials))
+ .Append(FormatForCsv(con.Inheritance.RDGatewayUsername))
+ .Append(FormatForCsv(con.Inheritance.RDGatewayPassword))
+ .Append(FormatForCsv(con.Inheritance.RDGatewayDomain))
+ .Append(FormatForCsv(con.Inheritance.RDPAlertIdleTimeout))
+ .Append(FormatForCsv(con.Inheritance.RDPMinutesToIdleTimeout))
+ .Append(FormatForCsv(con.Inheritance.SoundQuality));
}
private string FormatForCsv(object value)
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableDeserializer.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableDeserializer.cs
index ad01d1a2..d4edaeba 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableDeserializer.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableDeserializer.cs
@@ -54,20 +54,21 @@ namespace mRemoteNG.Config.Serializers.MsSql
break;
}
}
+
return nodeList;
}
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();
+ var connectionInfo = new ConnectionInfo(connectionId);
PopulateConnectionInfoFromDatarow(row, connectionInfo);
return connectionInfo;
}
private ContainerInfo DeserializeContainerInfo(DataRow row)
{
- var containerId = row["ConstantID"] as string ?? Guid.NewGuid().ToString();
+ var containerId = row["ConstantID"] as string ?? Guid.NewGuid().ToString();
var containerInfo = new ContainerInfo(containerId);
PopulateConnectionInfoFromDatarow(row, containerInfo);
return containerInfo;
@@ -93,14 +94,22 @@ namespace mRemoteNG.Config.Serializers.MsSql
connectionInfo.Port = (int)dataRow["Port"];
connectionInfo.UseConsoleSession = (bool)dataRow["ConnectToConsole"];
connectionInfo.UseCredSsp = (bool)dataRow["UseCredSsp"];
- connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine), (string)dataRow["RenderingEngine"]);
- connectionInfo.ICAEncryptionStrength = (IcaProtocol.EncryptionStrength)Enum.Parse(typeof(IcaProtocol.EncryptionStrength), (string)dataRow["ICAEncryptionStrength"]);
- connectionInfo.RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel)Enum.Parse(typeof(RdpProtocol.AuthenticationLevel), (string)dataRow["RDPAuthenticationLevel"]);
+ connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine),
+ (string)dataRow["RenderingEngine"]);
+ connectionInfo.ICAEncryptionStrength =
+ (IcaProtocol.EncryptionStrength)Enum.Parse(typeof(IcaProtocol.EncryptionStrength),
+ (string)dataRow["ICAEncryptionStrength"]);
+ connectionInfo.RDPAuthenticationLevel =
+ (RdpProtocol.AuthenticationLevel)Enum.Parse(typeof(RdpProtocol.AuthenticationLevel),
+ (string)dataRow["RDPAuthenticationLevel"]);
connectionInfo.RDPMinutesToIdleTimeout = (int)dataRow["RDPMinutesToIdleTimeout"];
connectionInfo.RDPAlertIdleTimeout = (bool)dataRow["RDPAlertIdleTimeout"];
connectionInfo.LoadBalanceInfo = (string)dataRow["LoadBalanceInfo"];
- connectionInfo.Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors) ,(string)dataRow["Colors"]);
- connectionInfo.Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions), (string)dataRow["Resolution"]);
+ connectionInfo.Colors =
+ (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors), (string)dataRow["Colors"]);
+ connectionInfo.Resolution =
+ (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions),
+ (string)dataRow["Resolution"]);
connectionInfo.AutomaticResize = (bool)dataRow["AutomaticResize"];
connectionInfo.DisplayWallpaper = (bool)dataRow["DisplayWallpaper"];
connectionInfo.DisplayThemes = (bool)dataRow["DisplayThemes"];
@@ -112,28 +121,44 @@ namespace mRemoteNG.Config.Serializers.MsSql
connectionInfo.RedirectPrinters = (bool)dataRow["RedirectPrinters"];
connectionInfo.RedirectClipboard = (bool)dataRow["RedirectClipboard"];
connectionInfo.RedirectSmartCards = (bool)dataRow["RedirectSmartCards"];
- connectionInfo.RedirectSound = (RdpProtocol.RDPSounds)Enum.Parse(typeof(RdpProtocol.RDPSounds), (string)dataRow["RedirectSound"]);
- connectionInfo.SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality), (string)dataRow["SoundQuality"]);
+ connectionInfo.RedirectSound =
+ (RdpProtocol.RDPSounds)Enum.Parse(typeof(RdpProtocol.RDPSounds), (string)dataRow["RedirectSound"]);
+ connectionInfo.SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality),
+ (string)dataRow["SoundQuality"]);
connectionInfo.RedirectKeys = (bool)dataRow["RedirectKeys"];
connectionInfo.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 = (RdpProtocol.RDGatewayUsageMethod)Enum.Parse(typeof(RdpProtocol.RDGatewayUsageMethod), (string)dataRow["RDGatewayUsageMethod"]);
+ connectionInfo.RDGatewayUsageMethod =
+ (RdpProtocol.RDGatewayUsageMethod)Enum.Parse(typeof(RdpProtocol.RDGatewayUsageMethod),
+ (string)dataRow["RDGatewayUsageMethod"]);
connectionInfo.RDGatewayHostname = (string)dataRow["RDGatewayHostname"];
- connectionInfo.RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), (string)dataRow["RDGatewayUseConnectionCredentials"]);
+ connectionInfo.RDGatewayUseConnectionCredentials =
+ (RdpProtocol.RDGatewayUseConnectionCredentials)Enum.Parse(
+ typeof(RdpProtocol.
+ RDGatewayUseConnectionCredentials),
+ (string)dataRow
+ ["RDGatewayUseConnectionCredentials"]);
connectionInfo.RDGatewayUsername = (string)dataRow["RDGatewayUsername"];
connectionInfo.RDGatewayPassword = DecryptValue((string)dataRow["RDGatewayPassword"]);
connectionInfo.RDGatewayDomain = (string)dataRow["RDGatewayDomain"];
@@ -189,7 +214,8 @@ namespace mRemoteNG.Config.Serializers.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"];
@@ -219,14 +245,16 @@ namespace mRemoteNG.Config.Serializers.MsSql
foreach (DataRow row in dataTable.Rows)
{
- var id = (string) row["ConstantID"];
+ var id = (string)row["ConstantID"];
var connectionInfo = connectionList.First(node => node.ConstantID == id);
- var parentId = (string) row["ParentID"];
+ var parentId = (string)row["ParentID"];
if (parentId == "0" || connectionList.All(node => node.ConstantID != parentId))
rootNode.AddChild(connectionInfo);
else
- (connectionList.First(node => node.ConstantID == parentId) as ContainerInfo)?.AddChild(connectionInfo);
+ (connectionList.First(node => node.ConstantID == parentId) as ContainerInfo)?.AddChild(
+ connectionInfo);
}
+
return connectionTreeModel;
}
}
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs
index 91f8a8f3..944c3bd3 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs
@@ -12,7 +12,7 @@ using System.Security;
namespace mRemoteNG.Config.Serializers.MsSql
{
- public class DataTableSerializer : ISerializer
+ public class DataTableSerializer : ISerializer
{
private readonly ICryptographyProvider _cryptographyProvider;
private readonly SecureString _encryptionKey;
@@ -23,7 +23,9 @@ namespace mRemoteNG.Config.Serializers.MsSql
public Version Version { get; } = new Version(2, 7);
- public DataTableSerializer(SaveFilter saveFilter, ICryptographyProvider cryptographyProvider, SecureString encryptionKey)
+ public DataTableSerializer(SaveFilter saveFilter,
+ ICryptographyProvider cryptographyProvider,
+ SecureString encryptionKey)
{
_saveFilter = saveFilter.ThrowIfNull(nameof(saveFilter));
_cryptographyProvider = cryptographyProvider.ThrowIfNull(nameof(cryptographyProvider));
@@ -190,7 +192,7 @@ namespace mRemoteNG.Config.Serializers.MsSql
private void SetPrimaryKey(DataTable dataTable)
{
- dataTable.PrimaryKey = new[] { dataTable.Columns["ConstantID"] };
+ dataTable.PrimaryKey = new[] {dataTable.Columns["ConstantID"]};
}
private void SerializeNodesRecursive(ConnectionInfo connectionInfo)
@@ -214,14 +216,15 @@ namespace mRemoteNG.Config.Serializers.MsSql
dataRow["ParentID"] = connectionInfo.Parent?.ConstantID ?? "";
dataRow["PositionID"] = _currentNodeIndex;
dataRow["LastChange"] = (SqlDateTime)DateTime.Now;
- dataRow["Expanded"] = false; // TODO: this column can eventually be removed. we now save this property locally
+ dataRow["Expanded"] =
+ false; // TODO: this column can eventually be removed. we now save this property locally
dataRow["Description"] = connectionInfo.Description;
dataRow["Icon"] = connectionInfo.Icon;
dataRow["Panel"] = connectionInfo.Panel;
dataRow["Username"] = _saveFilter.SaveUsername ? connectionInfo.Username : "";
dataRow["DomainName"] = _saveFilter.SaveDomain ? connectionInfo.Domain : "";
- dataRow["Password"] = _saveFilter.SavePassword
- ? _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)
+ dataRow["Password"] = _saveFilter.SavePassword
+ ? _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)
: "";
dataRow["Hostname"] = connectionInfo.Hostname;
dataRow["Protocol"] = connectionInfo.Protocol;
@@ -251,7 +254,8 @@ namespace mRemoteNG.Config.Serializers.MsSql
dataRow["RedirectSound"] = connectionInfo.RedirectSound;
dataRow["SoundQuality"] = connectionInfo.SoundQuality;
dataRow["RedirectKeys"] = connectionInfo.RedirectKeys;
- dataRow["Connected"] = false; // TODO: this column can eventually be removed. we now save this property locally
+ dataRow["Connected"] =
+ false; // TODO: this column can eventually be removed. we now save this property locally
dataRow["PreExtApp"] = connectionInfo.PreExtApp;
dataRow["PostExtApp"] = connectionInfo.PostExtApp;
dataRow["MacAddress"] = connectionInfo.MacAddress;
@@ -264,14 +268,16 @@ namespace mRemoteNG.Config.Serializers.MsSql
dataRow["VNCProxyIP"] = connectionInfo.VNCProxyIP;
dataRow["VNCProxyPort"] = connectionInfo.VNCProxyPort;
dataRow["VNCProxyUsername"] = connectionInfo.VNCProxyUsername;
- dataRow["VNCProxyPassword"] = _cryptographyProvider.Encrypt(connectionInfo.VNCProxyPassword, _encryptionKey);
+ dataRow["VNCProxyPassword"] =
+ _cryptographyProvider.Encrypt(connectionInfo.VNCProxyPassword, _encryptionKey);
dataRow["VNCColors"] = connectionInfo.VNCColors;
dataRow["VNCSmartSizeMode"] = connectionInfo.VNCSmartSizeMode;
dataRow["VNCViewOnly"] = connectionInfo.VNCViewOnly;
dataRow["RDGatewayUsageMethod"] = connectionInfo.RDGatewayUsageMethod;
dataRow["RDGatewayHostname"] = connectionInfo.RDGatewayHostname;
dataRow["RDGatewayUseConnectionCredentials"] = connectionInfo.RDGatewayUseConnectionCredentials;
- dataRow["RDGatewayUsername"] = _cryptographyProvider.Encrypt(connectionInfo.RDGatewayUsername, _encryptionKey);
+ dataRow["RDGatewayUsername"] =
+ _cryptographyProvider.Encrypt(connectionInfo.RDGatewayUsername, _encryptionKey);
dataRow["RDGatewayPassword"] = connectionInfo.RDGatewayPassword;
dataRow["RDGatewayDomain"] = connectionInfo.RDGatewayDomain;
if (_saveFilter.SaveInheritance)
@@ -327,7 +333,8 @@ namespace mRemoteNG.Config.Serializers.MsSql
dataRow["InheritVNCViewOnly"] = connectionInfo.Inheritance.VNCViewOnly;
dataRow["InheritRDGatewayUsageMethod"] = connectionInfo.Inheritance.RDGatewayUsageMethod;
dataRow["InheritRDGatewayHostname"] = connectionInfo.Inheritance.RDGatewayHostname;
- dataRow["InheritRDGatewayUseConnectionCredentials"] = connectionInfo.Inheritance.RDGatewayUseConnectionCredentials;
+ dataRow["InheritRDGatewayUseConnectionCredentials"] =
+ connectionInfo.Inheritance.RDGatewayUseConnectionCredentials;
dataRow["InheritRDGatewayUsername"] = connectionInfo.Inheritance.RDGatewayUsername;
dataRow["InheritRDGatewayPassword"] = connectionInfo.Inheritance.RDGatewayPassword;
dataRow["InheritRDGatewayDomain"] = connectionInfo.Inheritance.RDGatewayDomain;
@@ -390,6 +397,7 @@ namespace mRemoteNG.Config.Serializers.MsSql
dataRow["InheritRDGatewayPassword"] = false;
dataRow["InheritRDGatewayDomain"] = false;
}
+
_dataTable.Rows.Add(dataRow);
}
}
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/LocalConnectionPropertiesModel.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/LocalConnectionPropertiesModel.cs
index f8cdb35f..696c6070 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/LocalConnectionPropertiesModel.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/LocalConnectionPropertiesModel.cs
@@ -17,4 +17,4 @@
///
public bool Expanded { get; set; }
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/LocalConnectionPropertiesXmlSerializer.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/LocalConnectionPropertiesXmlSerializer.cs
index da76a8dc..3af6108d 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/LocalConnectionPropertiesXmlSerializer.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/LocalConnectionPropertiesXmlSerializer.cs
@@ -8,8 +8,8 @@ using System.Xml.Linq;
namespace mRemoteNG.Config.Serializers.MsSql
{
- public class LocalConnectionPropertiesXmlSerializer :
- ISerializer, string>,
+ public class LocalConnectionPropertiesXmlSerializer :
+ ISerializer, string>,
IDeserializer>
{
public Version Version { get; } = new Version(1, 0);
@@ -17,10 +17,10 @@ namespace mRemoteNG.Config.Serializers.MsSql
public string Serialize(IEnumerable models)
{
var localConnections = models
- .Select(m => new XElement("Node",
- new XAttribute("ConnectionId", m.ConnectionId),
- new XAttribute("Connected", m.Connected),
- new XAttribute("Expanded", m.Expanded)));
+ .Select(m => new XElement("Node",
+ new XAttribute("ConnectionId", m.ConnectionId),
+ new XAttribute("Connected", m.Connected),
+ new XAttribute("Expanded", m.Expanded)));
var root = new XElement("LocalConnections", localConnections);
var xdoc = new XDocument(new XDeclaration("1.0", "utf-8", null), root);
@@ -34,20 +34,21 @@ namespace mRemoteNG.Config.Serializers.MsSql
var xdoc = XDocument.Parse(serializedData);
return xdoc
- .Descendants("Node")
- .Where(e => e.Attribute("ConnectionId") != null)
- .Select(e => new LocalConnectionPropertiesModel
- {
- ConnectionId = e.Attribute("ConnectionId")?.Value,
- Connected = bool.Parse(e.Attribute("Connected")?.Value ?? "False"),
- Expanded = bool.Parse(e.Attribute("Expanded")?.Value ?? "False")
- });
+ .Descendants("Node")
+ .Where(e => e.Attribute("ConnectionId") != null)
+ .Select(e => new LocalConnectionPropertiesModel
+ {
+ ConnectionId = e.Attribute("ConnectionId")?.Value,
+ Connected = bool.Parse(e.Attribute("Connected")?.Value ?? "False"),
+ Expanded = bool.Parse(e.Attribute("Expanded")?.Value ?? "False")
+ });
}
private static string WriteXmlToString(XNode xmlDocument)
{
string xmlString;
- var xmlWriterSettings = new XmlWriterSettings { Indent = true, IndentChars = " ", Encoding = Encoding.UTF8 };
+ var xmlWriterSettings = new XmlWriterSettings
+ {Indent = true, IndentChars = " ", Encoding = Encoding.UTF8};
var memoryStream = new MemoryStream();
using (var xmlTextWriter = XmlWriter.Create(memoryStream, xmlWriterSettings))
{
@@ -57,7 +58,8 @@ namespace mRemoteNG.Config.Serializers.MsSql
memoryStream.Seek(0, SeekOrigin.Begin);
xmlString = streamReader.ReadToEnd();
}
+
return xmlString;
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlConnectionListMetaData.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlConnectionListMetaData.cs
index 12e8ce86..98d61ae4 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlConnectionListMetaData.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlConnectionListMetaData.cs
@@ -10,4 +10,4 @@ namespace mRemoteNG.Config.Serializers.MsSql
public bool Export { get; set; }
public Version ConfVersion { get; set; }
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlDatabaseMetaDataRetriever.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlDatabaseMetaDataRetriever.cs
index 8c97292d..2bfa7ef6 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlDatabaseMetaDataRetriever.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlDatabaseMetaDataRetriever.cs
@@ -29,7 +29,8 @@ namespace mRemoteNG.Config.Serializers.MsSql
Name = sqlDataReader["Name"] as string ?? "",
Protected = sqlDataReader["Protected"] as string ?? "",
Export = (bool)sqlDataReader["Export"],
- ConfVersion = new Version(Convert.ToString(sqlDataReader["confVersion"], CultureInfo.InvariantCulture))
+ ConfVersion =
+ new Version(Convert.ToString(sqlDataReader["confVersion"], CultureInfo.InvariantCulture))
};
}
catch (Exception ex)
@@ -42,6 +43,7 @@ namespace mRemoteNG.Config.Serializers.MsSql
if (sqlDataReader != null && !sqlDataReader.IsClosed)
sqlDataReader.Close();
}
+
return metaData;
}
}
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer26.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer26.cs
index f935ae41..59a6fa72 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer26.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer26.cs
@@ -8,7 +8,7 @@ using System.Xml.Linq;
namespace mRemoteNG.Config.Serializers.Xml
{
// ReSharper disable once InconsistentNaming
- public class XmlConnectionNodeSerializer26 : ISerializer
+ public class XmlConnectionNodeSerializer26 : ISerializer
{
private readonly ICryptographyProvider _cryptographyProvider;
private readonly SecureString _encryptionKey;
@@ -16,7 +16,9 @@ namespace mRemoteNG.Config.Serializers.Xml
public Version Version { get; } = new Version(2, 6);
- public XmlConnectionNodeSerializer26(ICryptographyProvider cryptographyProvider, SecureString encryptionKey, SaveFilter saveFilter)
+ public XmlConnectionNodeSerializer26(ICryptographyProvider cryptographyProvider,
+ SecureString encryptionKey,
+ SaveFilter saveFilter)
{
if (cryptographyProvider == null)
throw new ArgumentNullException(nameof(cryptographyProvider));
@@ -51,15 +53,16 @@ namespace mRemoteNG.Config.Serializers.Xml
element.Add(new XAttribute("Id", connectionInfo.ConstantID));
element.Add(_saveFilter.SaveUsername
- ? new XAttribute("Username", connectionInfo.Username)
- : new XAttribute("Username", ""));
+ ? new XAttribute("Username", connectionInfo.Username)
+ : new XAttribute("Username", ""));
element.Add(_saveFilter.SaveDomain
- ? new XAttribute("Domain", connectionInfo.Domain)
- : new XAttribute("Domain", ""));
+ ? new XAttribute("Domain", connectionInfo.Domain)
+ : new XAttribute("Domain", ""));
if (_saveFilter.SavePassword && !connectionInfo.Inheritance.Password)
- element.Add(new XAttribute("Password", _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)));
+ element.Add(new XAttribute("Password",
+ _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)));
else
element.Add(new XAttribute("Password", ""));
@@ -67,31 +70,42 @@ namespace mRemoteNG.Config.Serializers.Xml
element.Add(new XAttribute("Protocol", connectionInfo.Protocol));
element.Add(new XAttribute("PuttySession", connectionInfo.PuttySession));
element.Add(new XAttribute("Port", connectionInfo.Port));
- element.Add(new XAttribute("ConnectToConsole", connectionInfo.UseConsoleSession.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("ConnectToConsole",
+ connectionInfo.UseConsoleSession.ToString().ToLowerInvariant()));
element.Add(new XAttribute("UseCredSsp", connectionInfo.UseCredSsp.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RenderingEngine", connectionInfo.RenderingEngine));
element.Add(new XAttribute("ICAEncryptionStrength", connectionInfo.ICAEncryptionStrength));
element.Add(new XAttribute("RDPAuthenticationLevel", connectionInfo.RDPAuthenticationLevel));
element.Add(new XAttribute("RDPMinutesToIdleTimeout", connectionInfo.RDPMinutesToIdleTimeout));
- element.Add(new XAttribute("RDPAlertIdleTimeout", connectionInfo.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RDPAlertIdleTimeout",
+ connectionInfo.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
element.Add(new XAttribute("LoadBalanceInfo", connectionInfo.LoadBalanceInfo));
element.Add(new XAttribute("Colors", connectionInfo.Colors));
element.Add(new XAttribute("Resolution", connectionInfo.Resolution));
- element.Add(new XAttribute("AutomaticResize", connectionInfo.AutomaticResize.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("DisplayWallpaper", connectionInfo.DisplayWallpaper.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("AutomaticResize",
+ connectionInfo.AutomaticResize.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("DisplayWallpaper",
+ connectionInfo.DisplayWallpaper.ToString().ToLowerInvariant()));
element.Add(new XAttribute("DisplayThemes", connectionInfo.DisplayThemes.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("EnableFontSmoothing", connectionInfo.EnableFontSmoothing.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("EnableDesktopComposition", connectionInfo.EnableDesktopComposition.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("EnableFontSmoothing",
+ connectionInfo.EnableFontSmoothing.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("EnableDesktopComposition",
+ connectionInfo.EnableDesktopComposition.ToString().ToLowerInvariant()));
element.Add(new XAttribute("CacheBitmaps", connectionInfo.CacheBitmaps.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("RedirectDiskDrives", connectionInfo.RedirectDiskDrives.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RedirectDiskDrives",
+ connectionInfo.RedirectDiskDrives.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RedirectPorts", connectionInfo.RedirectPorts.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("RedirectPrinters", connectionInfo.RedirectPrinters.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("RedirectClipboard", connectionInfo.RedirectClipboard.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("RedirectSmartCards", connectionInfo.RedirectSmartCards.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RedirectPrinters",
+ connectionInfo.RedirectPrinters.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RedirectClipboard",
+ connectionInfo.RedirectClipboard.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RedirectSmartCards",
+ connectionInfo.RedirectSmartCards.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RedirectSound", connectionInfo.RedirectSound.ToString()));
element.Add(new XAttribute("SoundQuality", connectionInfo.SoundQuality.ToString()));
element.Add(new XAttribute("RedirectKeys", connectionInfo.RedirectKeys.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("Connected", (connectionInfo.OpenConnections.Count > 0).ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("Connected",
+ (connectionInfo.OpenConnections.Count > 0).ToString().ToLowerInvariant()));
element.Add(new XAttribute("PreExtApp", connectionInfo.PreExtApp));
element.Add(new XAttribute("PostExtApp", connectionInfo.PostExtApp));
element.Add(new XAttribute("MacAddress", connectionInfo.MacAddress));
@@ -105,93 +119,163 @@ namespace mRemoteNG.Config.Serializers.Xml
element.Add(new XAttribute("VNCProxyPort", connectionInfo.VNCProxyPort));
element.Add(_saveFilter.SaveUsername
- ? new XAttribute("VNCProxyUsername", connectionInfo.VNCProxyUsername)
- : new XAttribute("VNCProxyUsername", ""));
+ ? new XAttribute("VNCProxyUsername", connectionInfo.VNCProxyUsername)
+ : new XAttribute("VNCProxyUsername", ""));
element.Add(_saveFilter.SavePassword
- ? new XAttribute("VNCProxyPassword",
- _cryptographyProvider.Encrypt(connectionInfo.VNCProxyPassword, _encryptionKey))
- : new XAttribute("VNCProxyPassword", ""));
+ ? new XAttribute("VNCProxyPassword",
+ _cryptographyProvider.Encrypt(connectionInfo.VNCProxyPassword,
+ _encryptionKey))
+ : new XAttribute("VNCProxyPassword", ""));
element.Add(new XAttribute("VNCColors", connectionInfo.VNCColors));
element.Add(new XAttribute("VNCSmartSizeMode", connectionInfo.VNCSmartSizeMode));
element.Add(new XAttribute("VNCViewOnly", connectionInfo.VNCViewOnly.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RDGatewayUsageMethod", connectionInfo.RDGatewayUsageMethod));
element.Add(new XAttribute("RDGatewayHostname", connectionInfo.RDGatewayHostname));
- element.Add(new XAttribute("RDGatewayUseConnectionCredentials", connectionInfo.RDGatewayUseConnectionCredentials));
+ element.Add(new XAttribute("RDGatewayUseConnectionCredentials",
+ connectionInfo.RDGatewayUseConnectionCredentials));
element.Add(_saveFilter.SaveUsername
- ? new XAttribute("RDGatewayUsername", connectionInfo.RDGatewayUsername)
- : new XAttribute("RDGatewayUsername", ""));
+ ? new XAttribute("RDGatewayUsername", connectionInfo.RDGatewayUsername)
+ : new XAttribute("RDGatewayUsername", ""));
element.Add(_saveFilter.SavePassword
- ? new XAttribute("RDGatewayPassword",
- _cryptographyProvider.Encrypt(connectionInfo.RDGatewayPassword, _encryptionKey))
- : new XAttribute("RDGatewayPassword", ""));
+ ? new XAttribute("RDGatewayPassword",
+ _cryptographyProvider.Encrypt(connectionInfo.RDGatewayPassword,
+ _encryptionKey))
+ : new XAttribute("RDGatewayPassword", ""));
element.Add(_saveFilter.SaveDomain
- ? new XAttribute("RDGatewayDomain", connectionInfo.RDGatewayDomain)
- : new XAttribute("RDGatewayDomain", ""));
+ ? new XAttribute("RDGatewayDomain", connectionInfo.RDGatewayDomain)
+ : new XAttribute("RDGatewayDomain", ""));
}
private void SetInheritanceAttributes(XContainer element, IInheritable connectionInfo)
{
if (_saveFilter.SaveInheritance)
{
- element.Add(new XAttribute("InheritCacheBitmaps", connectionInfo.Inheritance.CacheBitmaps.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritColors", connectionInfo.Inheritance.Colors.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritDescription", connectionInfo.Inheritance.Description.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritDisplayThemes", connectionInfo.Inheritance.DisplayThemes.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritDisplayWallpaper", connectionInfo.Inheritance.DisplayWallpaper.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritEnableFontSmoothing", connectionInfo.Inheritance.EnableFontSmoothing.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritEnableDesktopComposition", connectionInfo.Inheritance.EnableDesktopComposition.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritDomain", connectionInfo.Inheritance.Domain.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritIcon", connectionInfo.Inheritance.Icon.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPanel", connectionInfo.Inheritance.Panel.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPassword", connectionInfo.Inheritance.Password.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPort", connectionInfo.Inheritance.Port.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritProtocol", connectionInfo.Inheritance.Protocol.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPuttySession", connectionInfo.Inheritance.PuttySession.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectDiskDrives", connectionInfo.Inheritance.RedirectDiskDrives.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectKeys", connectionInfo.Inheritance.RedirectKeys.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectPorts", connectionInfo.Inheritance.RedirectPorts.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectPrinters", connectionInfo.Inheritance.RedirectPrinters.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectSmartCards", connectionInfo.Inheritance.RedirectSmartCards.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectSound", connectionInfo.Inheritance.RedirectSound.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritSoundQuality", connectionInfo.Inheritance.SoundQuality.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritResolution", connectionInfo.Inheritance.Resolution.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritAutomaticResize", connectionInfo.Inheritance.AutomaticResize.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritUseConsoleSession", connectionInfo.Inheritance.UseConsoleSession.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritUseCredSsp", connectionInfo.Inheritance.UseCredSsp.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRenderingEngine", connectionInfo.Inheritance.RenderingEngine.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritUsername", connectionInfo.Inheritance.Username.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritICAEncryptionStrength", connectionInfo.Inheritance.ICAEncryptionStrength.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDPAuthenticationLevel", connectionInfo.Inheritance.RDPAuthenticationLevel.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout", connectionInfo.Inheritance.RDPMinutesToIdleTimeout.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDPAlertIdleTimeout", connectionInfo.Inheritance.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritLoadBalanceInfo", connectionInfo.Inheritance.LoadBalanceInfo.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPreExtApp", connectionInfo.Inheritance.PreExtApp.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPostExtApp", connectionInfo.Inheritance.PostExtApp.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritMacAddress", connectionInfo.Inheritance.MacAddress.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritUserField", connectionInfo.Inheritance.UserField.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritExtApp", connectionInfo.Inheritance.ExtApp.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCCompression", connectionInfo.Inheritance.VNCCompression.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCEncoding", connectionInfo.Inheritance.VNCEncoding.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCAuthMode", connectionInfo.Inheritance.VNCAuthMode.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyType", connectionInfo.Inheritance.VNCProxyType.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyIP", connectionInfo.Inheritance.VNCProxyIP.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyPort", connectionInfo.Inheritance.VNCProxyPort.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyUsername", connectionInfo.Inheritance.VNCProxyUsername.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyPassword", connectionInfo.Inheritance.VNCProxyPassword.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCColors", connectionInfo.Inheritance.VNCColors.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCSmartSizeMode", connectionInfo.Inheritance.VNCSmartSizeMode.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCViewOnly", connectionInfo.Inheritance.VNCViewOnly.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayUsageMethod", connectionInfo.Inheritance.RDGatewayUsageMethod.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayHostname", connectionInfo.Inheritance.RDGatewayHostname.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", connectionInfo.Inheritance.RDGatewayUseConnectionCredentials.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayUsername", connectionInfo.Inheritance.RDGatewayUsername.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayPassword", connectionInfo.Inheritance.RDGatewayPassword.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayDomain", connectionInfo.Inheritance.RDGatewayDomain.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritCacheBitmaps",
+ connectionInfo.Inheritance.CacheBitmaps.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritColors",
+ connectionInfo.Inheritance.Colors.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritDescription",
+ connectionInfo.Inheritance.Description.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritDisplayThemes",
+ connectionInfo.Inheritance.DisplayThemes.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritDisplayWallpaper",
+ connectionInfo.Inheritance.DisplayWallpaper.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritEnableFontSmoothing",
+ connectionInfo
+ .Inheritance.EnableFontSmoothing.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritEnableDesktopComposition",
+ connectionInfo
+ .Inheritance.EnableDesktopComposition.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritDomain",
+ connectionInfo.Inheritance.Domain.ToString().ToLowerInvariant()));
+ element.Add(
+ new XAttribute("InheritIcon",
+ connectionInfo.Inheritance.Icon.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPanel",
+ connectionInfo.Inheritance.Panel.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPassword",
+ connectionInfo.Inheritance.Password.ToString().ToLowerInvariant()));
+ element.Add(
+ new XAttribute("InheritPort",
+ connectionInfo.Inheritance.Port.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritProtocol",
+ connectionInfo.Inheritance.Protocol.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPuttySession",
+ connectionInfo.Inheritance.PuttySession.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectDiskDrives",
+ connectionInfo
+ .Inheritance.RedirectDiskDrives.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectKeys",
+ connectionInfo.Inheritance.RedirectKeys.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectPorts",
+ connectionInfo.Inheritance.RedirectPorts.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectPrinters",
+ connectionInfo.Inheritance.RedirectPrinters.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectSmartCards",
+ connectionInfo
+ .Inheritance.RedirectSmartCards.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectSound",
+ connectionInfo.Inheritance.RedirectSound.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritSoundQuality",
+ connectionInfo.Inheritance.SoundQuality.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritResolution",
+ connectionInfo.Inheritance.Resolution.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritAutomaticResize",
+ connectionInfo.Inheritance.AutomaticResize.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritUseConsoleSession",
+ connectionInfo.Inheritance.UseConsoleSession.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritUseCredSsp",
+ connectionInfo.Inheritance.UseCredSsp.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRenderingEngine",
+ connectionInfo.Inheritance.RenderingEngine.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritUsername",
+ connectionInfo.Inheritance.Username.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritICAEncryptionStrength",
+ connectionInfo
+ .Inheritance.ICAEncryptionStrength.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDPAuthenticationLevel",
+ connectionInfo
+ .Inheritance.RDPAuthenticationLevel.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout",
+ connectionInfo
+ .Inheritance.RDPMinutesToIdleTimeout.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDPAlertIdleTimeout",
+ connectionInfo
+ .Inheritance.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritLoadBalanceInfo",
+ connectionInfo.Inheritance.LoadBalanceInfo.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPreExtApp",
+ connectionInfo.Inheritance.PreExtApp.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPostExtApp",
+ connectionInfo.Inheritance.PostExtApp.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritMacAddress",
+ connectionInfo.Inheritance.MacAddress.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritUserField",
+ connectionInfo.Inheritance.UserField.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritExtApp",
+ connectionInfo.Inheritance.ExtApp.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCCompression",
+ connectionInfo.Inheritance.VNCCompression.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCEncoding",
+ connectionInfo.Inheritance.VNCEncoding.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCAuthMode",
+ connectionInfo.Inheritance.VNCAuthMode.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyType",
+ connectionInfo.Inheritance.VNCProxyType.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyIP",
+ connectionInfo.Inheritance.VNCProxyIP.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyPort",
+ connectionInfo.Inheritance.VNCProxyPort.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyUsername",
+ connectionInfo.Inheritance.VNCProxyUsername.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyPassword",
+ connectionInfo.Inheritance.VNCProxyPassword.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCColors",
+ connectionInfo.Inheritance.VNCColors.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCSmartSizeMode",
+ connectionInfo.Inheritance.VNCSmartSizeMode.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCViewOnly",
+ connectionInfo.Inheritance.VNCViewOnly.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayUsageMethod",
+ connectionInfo
+ .Inheritance.RDGatewayUsageMethod.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayHostname",
+ connectionInfo.Inheritance.RDGatewayHostname.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials",
+ connectionInfo
+ .Inheritance.RDGatewayUseConnectionCredentials.ToString()
+ .ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayUsername",
+ connectionInfo.Inheritance.RDGatewayUsername.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayPassword",
+ connectionInfo.Inheritance.RDGatewayPassword.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayDomain",
+ connectionInfo.Inheritance.RDGatewayDomain.ToString().ToLowerInvariant()));
}
else
{
@@ -213,7 +297,7 @@ namespace mRemoteNG.Config.Serializers.Xml
element.Add(new XAttribute("InheritRedirectDiskDrives", falseString));
element.Add(new XAttribute("InheritRedirectKeys", falseString));
element.Add(new XAttribute("InheritRedirectPorts", falseString));
- element.Add(new XAttribute("InheritRedirectPrinters", falseString));
+ element.Add(new XAttribute("InheritRedirectPrinters", falseString));
element.Add(new XAttribute("InheritRedirectSmartCards", falseString));
element.Add(new XAttribute("InheritRedirectSound", falseString));
element.Add(new XAttribute("InheritSoundQuality", falseString));
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer27.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer27.cs
index 1dac76ea..3eb4086d 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer27.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer27.cs
@@ -9,7 +9,7 @@ using System.Xml.Linq;
namespace mRemoteNG.Config.Serializers.Xml
{
// ReSharper disable once InconsistentNaming
- public class XmlConnectionNodeSerializer27 : ISerializer
+ public class XmlConnectionNodeSerializer27 : ISerializer
{
private readonly ICryptographyProvider _cryptographyProvider;
private readonly SecureString _encryptionKey;
@@ -17,7 +17,9 @@ namespace mRemoteNG.Config.Serializers.Xml
public Version Version { get; } = new Version(2, 7);
- public XmlConnectionNodeSerializer27(ICryptographyProvider cryptographyProvider, SecureString encryptionKey, SaveFilter saveFilter)
+ public XmlConnectionNodeSerializer27(ICryptographyProvider cryptographyProvider,
+ SecureString encryptionKey,
+ SaveFilter saveFilter)
{
if (cryptographyProvider == null)
throw new ArgumentNullException(nameof(cryptographyProvider));
@@ -54,15 +56,16 @@ namespace mRemoteNG.Config.Serializers.Xml
if (!Runtime.UseCredentialManager)
{
element.Add(_saveFilter.SaveUsername
- ? new XAttribute("Username", connectionInfo.Username)
- : new XAttribute("Username", ""));
+ ? new XAttribute("Username", connectionInfo.Username)
+ : new XAttribute("Username", ""));
element.Add(_saveFilter.SaveDomain
- ? new XAttribute("Domain", connectionInfo.Domain)
- : new XAttribute("Domain", ""));
+ ? new XAttribute("Domain", connectionInfo.Domain)
+ : new XAttribute("Domain", ""));
if (_saveFilter.SavePassword && !connectionInfo.Inheritance.Password)
- element.Add(new XAttribute("Password", _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)));
+ element.Add(new XAttribute("Password",
+ _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)));
else
element.Add(new XAttribute("Password", ""));
}
@@ -71,31 +74,42 @@ namespace mRemoteNG.Config.Serializers.Xml
element.Add(new XAttribute("Protocol", connectionInfo.Protocol));
element.Add(new XAttribute("PuttySession", connectionInfo.PuttySession));
element.Add(new XAttribute("Port", connectionInfo.Port));
- element.Add(new XAttribute("ConnectToConsole", connectionInfo.UseConsoleSession.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("ConnectToConsole",
+ connectionInfo.UseConsoleSession.ToString().ToLowerInvariant()));
element.Add(new XAttribute("UseCredSsp", connectionInfo.UseCredSsp.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RenderingEngine", connectionInfo.RenderingEngine));
element.Add(new XAttribute("ICAEncryptionStrength", connectionInfo.ICAEncryptionStrength));
element.Add(new XAttribute("RDPAuthenticationLevel", connectionInfo.RDPAuthenticationLevel));
element.Add(new XAttribute("RDPMinutesToIdleTimeout", connectionInfo.RDPMinutesToIdleTimeout));
- element.Add(new XAttribute("RDPAlertIdleTimeout", connectionInfo.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RDPAlertIdleTimeout",
+ connectionInfo.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
element.Add(new XAttribute("LoadBalanceInfo", connectionInfo.LoadBalanceInfo));
element.Add(new XAttribute("Colors", connectionInfo.Colors));
element.Add(new XAttribute("Resolution", connectionInfo.Resolution));
- element.Add(new XAttribute("AutomaticResize", connectionInfo.AutomaticResize.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("DisplayWallpaper", connectionInfo.DisplayWallpaper.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("AutomaticResize",
+ connectionInfo.AutomaticResize.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("DisplayWallpaper",
+ connectionInfo.DisplayWallpaper.ToString().ToLowerInvariant()));
element.Add(new XAttribute("DisplayThemes", connectionInfo.DisplayThemes.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("EnableFontSmoothing", connectionInfo.EnableFontSmoothing.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("EnableDesktopComposition", connectionInfo.EnableDesktopComposition.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("EnableFontSmoothing",
+ connectionInfo.EnableFontSmoothing.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("EnableDesktopComposition",
+ connectionInfo.EnableDesktopComposition.ToString().ToLowerInvariant()));
element.Add(new XAttribute("CacheBitmaps", connectionInfo.CacheBitmaps.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("RedirectDiskDrives", connectionInfo.RedirectDiskDrives.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RedirectDiskDrives",
+ connectionInfo.RedirectDiskDrives.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RedirectPorts", connectionInfo.RedirectPorts.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("RedirectPrinters", connectionInfo.RedirectPrinters.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("RedirectClipboard", connectionInfo.RedirectClipboard.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("RedirectSmartCards", connectionInfo.RedirectSmartCards.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RedirectPrinters",
+ connectionInfo.RedirectPrinters.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RedirectClipboard",
+ connectionInfo.RedirectClipboard.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("RedirectSmartCards",
+ connectionInfo.RedirectSmartCards.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RedirectSound", connectionInfo.RedirectSound.ToString()));
element.Add(new XAttribute("SoundQuality", connectionInfo.SoundQuality.ToString()));
element.Add(new XAttribute("RedirectKeys", connectionInfo.RedirectKeys.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("Connected", (connectionInfo.OpenConnections.Count > 0).ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("Connected",
+ (connectionInfo.OpenConnections.Count > 0).ToString().ToLowerInvariant()));
element.Add(new XAttribute("PreExtApp", connectionInfo.PreExtApp));
element.Add(new XAttribute("PostExtApp", connectionInfo.PostExtApp));
element.Add(new XAttribute("MacAddress", connectionInfo.MacAddress));
@@ -109,94 +123,165 @@ namespace mRemoteNG.Config.Serializers.Xml
element.Add(new XAttribute("VNCProxyPort", connectionInfo.VNCProxyPort));
element.Add(_saveFilter.SaveUsername
- ? new XAttribute("VNCProxyUsername", connectionInfo.VNCProxyUsername)
- : new XAttribute("VNCProxyUsername", ""));
+ ? new XAttribute("VNCProxyUsername", connectionInfo.VNCProxyUsername)
+ : new XAttribute("VNCProxyUsername", ""));
element.Add(_saveFilter.SavePassword
- ? new XAttribute("VNCProxyPassword",
- _cryptographyProvider.Encrypt(connectionInfo.VNCProxyPassword, _encryptionKey))
- : new XAttribute("VNCProxyPassword", ""));
+ ? new XAttribute("VNCProxyPassword",
+ _cryptographyProvider.Encrypt(connectionInfo.VNCProxyPassword,
+ _encryptionKey))
+ : new XAttribute("VNCProxyPassword", ""));
element.Add(new XAttribute("VNCColors", connectionInfo.VNCColors));
element.Add(new XAttribute("VNCSmartSizeMode", connectionInfo.VNCSmartSizeMode));
element.Add(new XAttribute("VNCViewOnly", connectionInfo.VNCViewOnly.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RDGatewayUsageMethod", connectionInfo.RDGatewayUsageMethod));
element.Add(new XAttribute("RDGatewayHostname", connectionInfo.RDGatewayHostname));
- element.Add(new XAttribute("RDGatewayUseConnectionCredentials", connectionInfo.RDGatewayUseConnectionCredentials));
+ element.Add(new XAttribute("RDGatewayUseConnectionCredentials",
+ connectionInfo.RDGatewayUseConnectionCredentials));
element.Add(_saveFilter.SaveUsername
- ? new XAttribute("RDGatewayUsername", connectionInfo.RDGatewayUsername)
- : new XAttribute("RDGatewayUsername", ""));
+ ? new XAttribute("RDGatewayUsername", connectionInfo.RDGatewayUsername)
+ : new XAttribute("RDGatewayUsername", ""));
element.Add(_saveFilter.SavePassword
- ? new XAttribute("RDGatewayPassword",
- _cryptographyProvider.Encrypt(connectionInfo.RDGatewayPassword, _encryptionKey))
- : new XAttribute("RDGatewayPassword", ""));
+ ? new XAttribute("RDGatewayPassword",
+ _cryptographyProvider.Encrypt(connectionInfo.RDGatewayPassword,
+ _encryptionKey))
+ : new XAttribute("RDGatewayPassword", ""));
element.Add(_saveFilter.SaveDomain
- ? new XAttribute("RDGatewayDomain", connectionInfo.RDGatewayDomain)
- : new XAttribute("RDGatewayDomain", ""));
+ ? new XAttribute("RDGatewayDomain", connectionInfo.RDGatewayDomain)
+ : new XAttribute("RDGatewayDomain", ""));
}
private void SetInheritanceAttributes(XContainer element, IInheritable connectionInfo)
{
if (_saveFilter.SaveInheritance)
{
- element.Add(new XAttribute("InheritCacheBitmaps", connectionInfo.Inheritance.CacheBitmaps.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritColors", connectionInfo.Inheritance.Colors.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritDescription", connectionInfo.Inheritance.Description.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritDisplayThemes", connectionInfo.Inheritance.DisplayThemes.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritDisplayWallpaper", connectionInfo.Inheritance.DisplayWallpaper.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritEnableFontSmoothing", connectionInfo.Inheritance.EnableFontSmoothing.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritEnableDesktopComposition", connectionInfo.Inheritance.EnableDesktopComposition.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritDomain", connectionInfo.Inheritance.Domain.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritIcon", connectionInfo.Inheritance.Icon.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPanel", connectionInfo.Inheritance.Panel.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPassword", connectionInfo.Inheritance.Password.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPort", connectionInfo.Inheritance.Port.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritProtocol", connectionInfo.Inheritance.Protocol.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPuttySession", connectionInfo.Inheritance.PuttySession.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectDiskDrives", connectionInfo.Inheritance.RedirectDiskDrives.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectKeys", connectionInfo.Inheritance.RedirectKeys.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectPorts", connectionInfo.Inheritance.RedirectPorts.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectPrinters", connectionInfo.Inheritance.RedirectPrinters.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectClipboard", connectionInfo.Inheritance.RedirectClipboard.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectSmartCards", connectionInfo.Inheritance.RedirectSmartCards.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRedirectSound", connectionInfo.Inheritance.RedirectSound.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritSoundQuality", connectionInfo.Inheritance.SoundQuality.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritResolution", connectionInfo.Inheritance.Resolution.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritAutomaticResize", connectionInfo.Inheritance.AutomaticResize.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritUseConsoleSession", connectionInfo.Inheritance.UseConsoleSession.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritUseCredSsp", connectionInfo.Inheritance.UseCredSsp.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRenderingEngine", connectionInfo.Inheritance.RenderingEngine.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritUsername", connectionInfo.Inheritance.Username.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritICAEncryptionStrength", connectionInfo.Inheritance.ICAEncryptionStrength.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDPAuthenticationLevel", connectionInfo.Inheritance.RDPAuthenticationLevel.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout", connectionInfo.Inheritance.RDPMinutesToIdleTimeout.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDPAlertIdleTimeout", connectionInfo.Inheritance.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritLoadBalanceInfo", connectionInfo.Inheritance.LoadBalanceInfo.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPreExtApp", connectionInfo.Inheritance.PreExtApp.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritPostExtApp", connectionInfo.Inheritance.PostExtApp.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritMacAddress", connectionInfo.Inheritance.MacAddress.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritUserField", connectionInfo.Inheritance.UserField.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritExtApp", connectionInfo.Inheritance.ExtApp.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCCompression", connectionInfo.Inheritance.VNCCompression.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCEncoding", connectionInfo.Inheritance.VNCEncoding.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCAuthMode", connectionInfo.Inheritance.VNCAuthMode.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyType", connectionInfo.Inheritance.VNCProxyType.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyIP", connectionInfo.Inheritance.VNCProxyIP.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyPort", connectionInfo.Inheritance.VNCProxyPort.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyUsername", connectionInfo.Inheritance.VNCProxyUsername.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCProxyPassword", connectionInfo.Inheritance.VNCProxyPassword.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCColors", connectionInfo.Inheritance.VNCColors.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCSmartSizeMode", connectionInfo.Inheritance.VNCSmartSizeMode.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritVNCViewOnly", connectionInfo.Inheritance.VNCViewOnly.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayUsageMethod", connectionInfo.Inheritance.RDGatewayUsageMethod.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayHostname", connectionInfo.Inheritance.RDGatewayHostname.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", connectionInfo.Inheritance.RDGatewayUseConnectionCredentials.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayUsername", connectionInfo.Inheritance.RDGatewayUsername.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayPassword", connectionInfo.Inheritance.RDGatewayPassword.ToString().ToLowerInvariant()));
- element.Add(new XAttribute("InheritRDGatewayDomain", connectionInfo.Inheritance.RDGatewayDomain.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritCacheBitmaps",
+ connectionInfo.Inheritance.CacheBitmaps.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritColors",
+ connectionInfo.Inheritance.Colors.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritDescription",
+ connectionInfo.Inheritance.Description.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritDisplayThemes",
+ connectionInfo.Inheritance.DisplayThemes.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritDisplayWallpaper",
+ connectionInfo.Inheritance.DisplayWallpaper.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritEnableFontSmoothing",
+ connectionInfo
+ .Inheritance.EnableFontSmoothing.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritEnableDesktopComposition",
+ connectionInfo
+ .Inheritance.EnableDesktopComposition.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritDomain",
+ connectionInfo.Inheritance.Domain.ToString().ToLowerInvariant()));
+ element.Add(
+ new XAttribute("InheritIcon",
+ connectionInfo.Inheritance.Icon.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPanel",
+ connectionInfo.Inheritance.Panel.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPassword",
+ connectionInfo.Inheritance.Password.ToString().ToLowerInvariant()));
+ element.Add(
+ new XAttribute("InheritPort",
+ connectionInfo.Inheritance.Port.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritProtocol",
+ connectionInfo.Inheritance.Protocol.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPuttySession",
+ connectionInfo.Inheritance.PuttySession.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectDiskDrives",
+ connectionInfo
+ .Inheritance.RedirectDiskDrives.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectKeys",
+ connectionInfo.Inheritance.RedirectKeys.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectPorts",
+ connectionInfo.Inheritance.RedirectPorts.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectPrinters",
+ connectionInfo.Inheritance.RedirectPrinters.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectClipboard",
+ connectionInfo.Inheritance.RedirectClipboard.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectSmartCards",
+ connectionInfo
+ .Inheritance.RedirectSmartCards.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRedirectSound",
+ connectionInfo.Inheritance.RedirectSound.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritSoundQuality",
+ connectionInfo.Inheritance.SoundQuality.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritResolution",
+ connectionInfo.Inheritance.Resolution.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritAutomaticResize",
+ connectionInfo.Inheritance.AutomaticResize.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritUseConsoleSession",
+ connectionInfo.Inheritance.UseConsoleSession.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritUseCredSsp",
+ connectionInfo.Inheritance.UseCredSsp.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRenderingEngine",
+ connectionInfo.Inheritance.RenderingEngine.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritUsername",
+ connectionInfo.Inheritance.Username.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritICAEncryptionStrength",
+ connectionInfo
+ .Inheritance.ICAEncryptionStrength.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDPAuthenticationLevel",
+ connectionInfo
+ .Inheritance.RDPAuthenticationLevel.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDPMinutesToIdleTimeout",
+ connectionInfo
+ .Inheritance.RDPMinutesToIdleTimeout.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDPAlertIdleTimeout",
+ connectionInfo
+ .Inheritance.RDPAlertIdleTimeout.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritLoadBalanceInfo",
+ connectionInfo.Inheritance.LoadBalanceInfo.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPreExtApp",
+ connectionInfo.Inheritance.PreExtApp.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritPostExtApp",
+ connectionInfo.Inheritance.PostExtApp.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritMacAddress",
+ connectionInfo.Inheritance.MacAddress.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritUserField",
+ connectionInfo.Inheritance.UserField.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritExtApp",
+ connectionInfo.Inheritance.ExtApp.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCCompression",
+ connectionInfo.Inheritance.VNCCompression.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCEncoding",
+ connectionInfo.Inheritance.VNCEncoding.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCAuthMode",
+ connectionInfo.Inheritance.VNCAuthMode.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyType",
+ connectionInfo.Inheritance.VNCProxyType.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyIP",
+ connectionInfo.Inheritance.VNCProxyIP.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyPort",
+ connectionInfo.Inheritance.VNCProxyPort.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyUsername",
+ connectionInfo.Inheritance.VNCProxyUsername.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCProxyPassword",
+ connectionInfo.Inheritance.VNCProxyPassword.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCColors",
+ connectionInfo.Inheritance.VNCColors.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCSmartSizeMode",
+ connectionInfo.Inheritance.VNCSmartSizeMode.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritVNCViewOnly",
+ connectionInfo.Inheritance.VNCViewOnly.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayUsageMethod",
+ connectionInfo
+ .Inheritance.RDGatewayUsageMethod.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayHostname",
+ connectionInfo.Inheritance.RDGatewayHostname.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials",
+ connectionInfo
+ .Inheritance.RDGatewayUseConnectionCredentials.ToString()
+ .ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayUsername",
+ connectionInfo.Inheritance.RDGatewayUsername.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayPassword",
+ connectionInfo.Inheritance.RDGatewayPassword.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute("InheritRDGatewayDomain",
+ connectionInfo.Inheritance.RDGatewayDomain.ToString().ToLowerInvariant()));
}
else
{
@@ -218,8 +303,8 @@ namespace mRemoteNG.Config.Serializers.Xml
element.Add(new XAttribute("InheritRedirectDiskDrives", falseString));
element.Add(new XAttribute("InheritRedirectKeys", falseString));
element.Add(new XAttribute("InheritRedirectPorts", falseString));
- element.Add(new XAttribute("InheritRedirectPrinters", falseString));
- element.Add(new XAttribute("InheritRedirectClipboard", falseString));
+ element.Add(new XAttribute("InheritRedirectPrinters", falseString));
+ element.Add(new XAttribute("InheritRedirectClipboard", falseString));
element.Add(new XAttribute("InheritRedirectSmartCards", falseString));
element.Add(new XAttribute("InheritRedirectSound", falseString));
element.Add(new XAttribute("InheritSoundQuality", falseString));
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDeserializer.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDeserializer.cs
index 2ddf4532..916f1e4c 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDeserializer.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDeserializer.cs
@@ -56,11 +56,12 @@ namespace mRemoteNG.Config.Serializers.Xml
var connectionTreeModel = new ConnectionTreeModel();
connectionTreeModel.AddRootNode(_rootNodeInfo);
-
+
if (_confVersion > 1.3)
{
var protectedString = _xmlDocument.DocumentElement?.Attributes["Protected"].Value;
- if (!_decryptor.ConnectionsFileIsAuthentic(protectedString, _rootNodeInfo.PasswordString.ConvertToSecureString()))
+ if (!_decryptor.ConnectionsFileIsAuthentic(protectedString,
+ _rootNodeInfo.PasswordString.ConvertToSecureString()))
{
return null;
}
@@ -103,7 +104,9 @@ namespace mRemoteNG.Config.Serializers.Xml
private void ValidateConnectionFileVersion()
{
if (_xmlDocument.DocumentElement != null && _xmlDocument.DocumentElement.HasAttribute("ConfVersion"))
- _confVersion = Convert.ToDouble(_xmlDocument.DocumentElement.Attributes["ConfVersion"].Value.Replace(",", "."), CultureInfo.InvariantCulture);
+ _confVersion =
+ Convert.ToDouble(_xmlDocument.DocumentElement.Attributes["ConfVersion"].Value.Replace(",", "."),
+ CultureInfo.InvariantCulture);
else
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, Language.strOldConffile);
@@ -115,19 +118,22 @@ namespace mRemoteNG.Config.Serializers.Xml
private void ShowIncompatibleVersionDialogBox()
{
CTaskDialog.ShowTaskDialogBox(
- FrmMain.Default,
- Application.ProductName,
- "Incompatible connection file format",
- $"The format of this connection file is not supported. Please upgrade to a newer version of {Application.ProductName}.",
- string.Format("{1}{0}File Format Version: {2}{0}Highest Supported Version: {3}", Environment.NewLine, ConnectionFileName, _confVersion, MaxSupportedConfVersion),
- "",
- "",
- "",
- "",
- ETaskDialogButtons.Ok,
- ESysIcons.Error,
- ESysIcons.Error
- );
+ FrmMain.Default,
+ Application.ProductName,
+ "Incompatible connection file format",
+ $"The format of this connection file is not supported. Please upgrade to a newer version of {Application.ProductName}.",
+ string
+ .Format("{1}{0}File Format Version: {2}{0}Highest Supported Version: {3}",
+ Environment.NewLine,
+ ConnectionFileName, _confVersion, MaxSupportedConfVersion),
+ "",
+ "",
+ "",
+ "",
+ ETaskDialogButtons.Ok,
+ ESysIcons.Error,
+ ESysIcons.Error
+ );
}
private void InitializeRootNode(XmlElement connectionsRootElement)
@@ -152,7 +158,8 @@ namespace mRemoteNG.Config.Serializers.Xml
}
else
{
- _decryptor = new XmlConnectionsDecryptor(_rootNodeInfo) { AuthenticationRequestor = AuthenticationRequestor };
+ _decryptor = new XmlConnectionsDecryptor(_rootNodeInfo)
+ {AuthenticationRequestor = AuthenticationRequestor};
}
}
@@ -174,7 +181,7 @@ namespace mRemoteNG.Config.Serializers.Xml
break;
case TreeNodeType.Container:
var containerInfo = new ContainerInfo();
-
+
if (_confVersion >= 0.9)
containerInfo.CopyFrom(GetConnectionInfoFromXml(xmlNode));
if (_confVersion >= 0.8)
@@ -200,10 +207,10 @@ namespace mRemoteNG.Config.Serializers.Xml
if (xmlnode?.Attributes == null)
return null;
- var connectionId = xmlnode.GetAttributeAsString("Id");
+ var connectionId = xmlnode.GetAttributeAsString("Id");
if (string.IsNullOrWhiteSpace(connectionId))
connectionId = Guid.NewGuid().ToString();
- var connectionInfo = new ConnectionInfo(connectionId);
+ var connectionInfo = new ConnectionInfo(connectionId);
try
{
@@ -258,7 +265,7 @@ namespace mRemoteNG.Config.Serializers.Xml
{
if (_confVersion < 0.7)
{
- connectionInfo.Port = xmlnode.GetAttributeAsBool("UseVNC")
+ connectionInfo.Port = xmlnode.GetAttributeAsBool("UseVNC")
? xmlnode.GetAttributeAsInt("VNCPort")
: xmlnode.GetAttributeAsInt("RDPPort");
}
@@ -274,6 +281,7 @@ namespace mRemoteNG.Config.Serializers.Xml
else
connectionInfo.Port = (int)RdpProtocol.Defaults.Port;
}
+
connectionInfo.UseConsoleSession = false;
}
@@ -287,7 +295,7 @@ namespace mRemoteNG.Config.Serializers.Xml
else
{
connectionInfo.RedirectDiskDrives = false;
- connectionInfo.RedirectPrinters = false;
+ connectionInfo.RedirectPrinters = false;
connectionInfo.RedirectPorts = false;
connectionInfo.RedirectSmartCards = false;
}
@@ -352,14 +360,17 @@ namespace mRemoteNG.Config.Serializers.Xml
connectionInfo.Inheritance.Port = xmlnode.GetAttributeAsBool("InheritPort");
connectionInfo.Inheritance.Protocol = xmlnode.GetAttributeAsBool("InheritProtocol");
connectionInfo.Inheritance.PuttySession = xmlnode.GetAttributeAsBool("InheritPuttySession");
- connectionInfo.Inheritance.RedirectDiskDrives = xmlnode.GetAttributeAsBool("InheritRedirectDiskDrives");
+ connectionInfo.Inheritance.RedirectDiskDrives =
+ xmlnode.GetAttributeAsBool("InheritRedirectDiskDrives");
connectionInfo.Inheritance.RedirectKeys = xmlnode.GetAttributeAsBool("InheritRedirectKeys");
connectionInfo.Inheritance.RedirectPorts = xmlnode.GetAttributeAsBool("InheritRedirectPorts");
connectionInfo.Inheritance.RedirectPrinters = xmlnode.GetAttributeAsBool("InheritRedirectPrinters");
- connectionInfo.Inheritance.RedirectSmartCards = xmlnode.GetAttributeAsBool("InheritRedirectSmartCards");
+ connectionInfo.Inheritance.RedirectSmartCards =
+ xmlnode.GetAttributeAsBool("InheritRedirectSmartCards");
connectionInfo.Inheritance.RedirectSound = xmlnode.GetAttributeAsBool("InheritRedirectSound");
connectionInfo.Inheritance.Resolution = xmlnode.GetAttributeAsBool("InheritResolution");
- connectionInfo.Inheritance.UseConsoleSession = xmlnode.GetAttributeAsBool("InheritUseConsoleSession");
+ connectionInfo.Inheritance.UseConsoleSession =
+ xmlnode.GetAttributeAsBool("InheritUseConsoleSession");
if (!Runtime.UseCredentialManager || _confVersion <= 2.6) // 1.3 - 2.6
{
@@ -367,6 +378,7 @@ namespace mRemoteNG.Config.Serializers.Xml
connectionInfo.Inheritance.Password = xmlnode.GetAttributeAsBool("InheritPassword");
connectionInfo.Inheritance.Username = xmlnode.GetAttributeAsBool("InheritUsername");
}
+
connectionInfo.Icon = xmlnode.GetAttributeAsString("Icon");
connectionInfo.Panel = xmlnode.GetAttributeAsString("Panel");
}
@@ -385,8 +397,10 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 1.6)
{
- connectionInfo.ICAEncryptionStrength = xmlnode.GetAttributeAsEnum("ICAEncryptionStrength");
- connectionInfo.Inheritance.ICAEncryptionStrength = xmlnode.GetAttributeAsBool("InheritICAEncryptionStrength");
+ connectionInfo.ICAEncryptionStrength =
+ xmlnode.GetAttributeAsEnum("ICAEncryptionStrength");
+ connectionInfo.Inheritance.ICAEncryptionStrength =
+ xmlnode.GetAttributeAsBool("InheritICAEncryptionStrength");
connectionInfo.PreExtApp = xmlnode.GetAttributeAsString("PreExtApp");
connectionInfo.PostExtApp = xmlnode.GetAttributeAsString("PostExtApp");
connectionInfo.Inheritance.PreExtApp = xmlnode.GetAttributeAsBool("InheritPreExtApp");
@@ -395,16 +409,19 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 1.7)
{
- connectionInfo.VNCCompression = xmlnode.GetAttributeAsEnum("VNCCompression");
+ connectionInfo.VNCCompression =
+ xmlnode.GetAttributeAsEnum("VNCCompression");
connectionInfo.VNCEncoding = xmlnode.GetAttributeAsEnum("VNCEncoding");
connectionInfo.VNCAuthMode = xmlnode.GetAttributeAsEnum("VNCAuthMode");
connectionInfo.VNCProxyType = xmlnode.GetAttributeAsEnum("VNCProxyType");
connectionInfo.VNCProxyIP = xmlnode.GetAttributeAsString("VNCProxyIP");
connectionInfo.VNCProxyPort = xmlnode.GetAttributeAsInt("VNCProxyPort");
connectionInfo.VNCProxyUsername = xmlnode.GetAttributeAsString("VNCProxyUsername");
- connectionInfo.VNCProxyPassword = _decryptor.Decrypt(xmlnode.GetAttributeAsString("VNCProxyPassword"));
+ connectionInfo.VNCProxyPassword =
+ _decryptor.Decrypt(xmlnode.GetAttributeAsString("VNCProxyPassword"));
connectionInfo.VNCColors = xmlnode.GetAttributeAsEnum("VNCColors");
- connectionInfo.VNCSmartSizeMode = xmlnode.GetAttributeAsEnum("VNCSmartSizeMode");
+ connectionInfo.VNCSmartSizeMode =
+ xmlnode.GetAttributeAsEnum("VNCSmartSizeMode");
connectionInfo.VNCViewOnly = xmlnode.GetAttributeAsBool("VNCViewOnly");
connectionInfo.Inheritance.VNCCompression = xmlnode.GetAttributeAsBool("InheritVNCCompression");
connectionInfo.Inheritance.VNCEncoding = xmlnode.GetAttributeAsBool("InheritVNCEncoding");
@@ -421,13 +438,16 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 1.8)
{
- connectionInfo.RDPAuthenticationLevel = xmlnode.GetAttributeAsEnum("RDPAuthenticationLevel");
- connectionInfo.Inheritance.RDPAuthenticationLevel = xmlnode.GetAttributeAsBool("InheritRDPAuthenticationLevel");
+ connectionInfo.RDPAuthenticationLevel =
+ xmlnode.GetAttributeAsEnum("RDPAuthenticationLevel");
+ connectionInfo.Inheritance.RDPAuthenticationLevel =
+ xmlnode.GetAttributeAsBool("InheritRDPAuthenticationLevel");
}
if (_confVersion >= 1.9)
{
- connectionInfo.RenderingEngine = xmlnode.GetAttributeAsEnum("RenderingEngine");
+ connectionInfo.RenderingEngine =
+ xmlnode.GetAttributeAsEnum("RenderingEngine");
connectionInfo.MacAddress = xmlnode.GetAttributeAsString("MacAddress");
connectionInfo.Inheritance.RenderingEngine = xmlnode.GetAttributeAsBool("InheritRenderingEngine");
connectionInfo.Inheritance.MacAddress = xmlnode.GetAttributeAsBool("InheritMacAddress");
@@ -448,19 +468,28 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 2.2)
{
// Get settings
- connectionInfo.RDGatewayUsageMethod = xmlnode.GetAttributeAsEnum("RDGatewayUsageMethod");
+ connectionInfo.RDGatewayUsageMethod =
+ xmlnode.GetAttributeAsEnum("RDGatewayUsageMethod");
connectionInfo.RDGatewayHostname = xmlnode.GetAttributeAsString("RDGatewayHostname");
- connectionInfo.RDGatewayUseConnectionCredentials = xmlnode.GetAttributeAsEnum("RDGatewayUseConnectionCredentials");
+ connectionInfo.RDGatewayUseConnectionCredentials =
+ xmlnode.GetAttributeAsEnum(
+ "RDGatewayUseConnectionCredentials");
connectionInfo.RDGatewayUsername = xmlnode.GetAttributeAsString("RDGatewayUsername");
- connectionInfo.RDGatewayPassword = _decryptor.Decrypt(xmlnode.GetAttributeAsString("RDGatewayPassword"));
+ connectionInfo.RDGatewayPassword =
+ _decryptor.Decrypt(xmlnode.GetAttributeAsString("RDGatewayPassword"));
connectionInfo.RDGatewayDomain = xmlnode.GetAttributeAsString("RDGatewayDomain");
// Get inheritance settings
- connectionInfo.Inheritance.RDGatewayUsageMethod = xmlnode.GetAttributeAsBool("InheritRDGatewayUsageMethod");
- connectionInfo.Inheritance.RDGatewayHostname = xmlnode.GetAttributeAsBool("InheritRDGatewayHostname");
- connectionInfo.Inheritance.RDGatewayUseConnectionCredentials = xmlnode.GetAttributeAsBool("InheritRDGatewayUseConnectionCredentials");
- connectionInfo.Inheritance.RDGatewayUsername = xmlnode.GetAttributeAsBool("InheritRDGatewayUsername");
- connectionInfo.Inheritance.RDGatewayPassword = xmlnode.GetAttributeAsBool("InheritRDGatewayPassword");
+ connectionInfo.Inheritance.RDGatewayUsageMethod =
+ xmlnode.GetAttributeAsBool("InheritRDGatewayUsageMethod");
+ connectionInfo.Inheritance.RDGatewayHostname =
+ xmlnode.GetAttributeAsBool("InheritRDGatewayHostname");
+ connectionInfo.Inheritance.RDGatewayUseConnectionCredentials =
+ xmlnode.GetAttributeAsBool("InheritRDGatewayUseConnectionCredentials");
+ connectionInfo.Inheritance.RDGatewayUsername =
+ xmlnode.GetAttributeAsBool("InheritRDGatewayUsername");
+ connectionInfo.Inheritance.RDGatewayPassword =
+ xmlnode.GetAttributeAsBool("InheritRDGatewayPassword");
connectionInfo.Inheritance.RDGatewayDomain = xmlnode.GetAttributeAsBool("InheritRDGatewayDomain");
}
@@ -471,8 +500,10 @@ namespace mRemoteNG.Config.Serializers.Xml
connectionInfo.EnableDesktopComposition = xmlnode.GetAttributeAsBool("EnableDesktopComposition");
// Get inheritance settings
- connectionInfo.Inheritance.EnableFontSmoothing = xmlnode.GetAttributeAsBool("InheritEnableFontSmoothing");
- connectionInfo.Inheritance.EnableDesktopComposition = xmlnode.GetAttributeAsBool("InheritEnableDesktopComposition");
+ connectionInfo.Inheritance.EnableFontSmoothing =
+ xmlnode.GetAttributeAsBool("InheritEnableFontSmoothing");
+ connectionInfo.Inheritance.EnableDesktopComposition =
+ xmlnode.GetAttributeAsBool("InheritEnableDesktopComposition");
}
if (_confVersion >= 2.4)
@@ -491,22 +522,30 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 2.6)
{
- connectionInfo.SoundQuality = xmlnode.GetAttributeAsEnum("SoundQuality");
+ connectionInfo.SoundQuality =
+ xmlnode.GetAttributeAsEnum("SoundQuality");
connectionInfo.Inheritance.SoundQuality = xmlnode.GetAttributeAsBool("InheritSoundQuality");
connectionInfo.RDPMinutesToIdleTimeout = xmlnode.GetAttributeAsInt("RDPMinutesToIdleTimeout");
- connectionInfo.Inheritance.RDPMinutesToIdleTimeout = xmlnode.GetAttributeAsBool("InheritRDPMinutesToIdleTimeout");
+ connectionInfo.Inheritance.RDPMinutesToIdleTimeout =
+ xmlnode.GetAttributeAsBool("InheritRDPMinutesToIdleTimeout");
connectionInfo.RDPAlertIdleTimeout = xmlnode.GetAttributeAsBool("RDPAlertIdleTimeout");
- connectionInfo.Inheritance.RDPAlertIdleTimeout = xmlnode.GetAttributeAsBool("InheritRDPAlertIdleTimeout");
+ connectionInfo.Inheritance.RDPAlertIdleTimeout =
+ xmlnode.GetAttributeAsBool("InheritRDPAlertIdleTimeout");
}
- if(_confVersion >= 2.7)
+
+ if (_confVersion >= 2.7)
{
connectionInfo.RedirectClipboard = xmlnode.GetAttributeAsBool("RedirectClipboard");
- connectionInfo.Inheritance.RedirectClipboard = xmlnode.GetAttributeAsBool("InheritRedirectClipboard");
+ connectionInfo.Inheritance.RedirectClipboard =
+ xmlnode.GetAttributeAsBool("InheritRedirectClipboard");
}
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, string.Format(Language.strGetConnectionInfoFromXmlFailed, connectionInfo.Name, ConnectionFileName, ex.Message));
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ string.Format(Language.strGetConnectionInfoFromXmlFailed,
+ connectionInfo.Name, ConnectionFileName,
+ ex.Message));
}
return connectionInfo;
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDocumentCompiler.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDocumentCompiler.cs
index 95c35d4b..acdde98c 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDocumentCompiler.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDocumentCompiler.cs
@@ -16,7 +16,8 @@ namespace mRemoteNG.Config.Serializers.Xml
private SecureString _encryptionKey;
private readonly ISerializer _connectionNodeSerializer;
- public XmlConnectionsDocumentCompiler(ICryptographyProvider cryptographyProvider, ISerializer connectionNodeSerializer)
+ public XmlConnectionsDocumentCompiler(ICryptographyProvider cryptographyProvider,
+ ISerializer connectionNodeSerializer)
{
if (cryptographyProvider == null)
throw new ArgumentNullException(nameof(cryptographyProvider));
@@ -43,7 +44,9 @@ namespace mRemoteNG.Config.Serializers.Xml
var xmlDeclaration = new XDeclaration("1.0", "utf-8", null);
var xmlDocument = new XDocument(xmlDeclaration, rootElement);
if (fullFileEncryption)
- xmlDocument = new XmlConnectionsDocumentEncryptor(_cryptographyProvider).EncryptDocument(xmlDocument, _encryptionKey);
+ xmlDocument =
+ new XmlConnectionsDocumentEncryptor(_cryptographyProvider).EncryptDocument(xmlDocument,
+ _encryptionKey);
return xmlDocument;
}
@@ -55,6 +58,7 @@ namespace mRemoteNG.Config.Serializers.Xml
newElement = CompileConnectionInfoNode(serializationTarget);
parentElement.Add(newElement);
}
+
var serializationTargetAsContainer = serializationTarget as ContainerInfo;
if (serializationTargetAsContainer == null) return;
foreach (var child in serializationTargetAsContainer.Children)
@@ -79,7 +83,8 @@ namespace mRemoteNG.Config.Serializers.Xml
private XElement CompileRootNode(RootNodeInfo rootNodeInfo, bool fullFileEncryption)
{
var rootNodeSerializer = new XmlRootNodeSerializer();
- return rootNodeSerializer.SerializeRootNodeInfo(rootNodeInfo, _cryptographyProvider, _connectionNodeSerializer.Version, fullFileEncryption);
+ return rootNodeSerializer.SerializeRootNodeInfo(rootNodeInfo, _cryptographyProvider,
+ _connectionNodeSerializer.Version, fullFileEncryption);
}
private XElement CompileConnectionInfoNode(ConnectionInfo connectionInfo)
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsSerializer.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsSerializer.cs
index d4e32d31..83255876 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsSerializer.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsSerializer.cs
@@ -12,7 +12,8 @@ using System.Xml.Linq;
namespace mRemoteNG.Config.Serializers.Xml
{
- public class XmlConnectionsSerializer : ISerializer, ISerializer
+ public class XmlConnectionsSerializer : ISerializer,
+ ISerializer
{
private readonly ICryptographyProvider _cryptographyProvider;
private readonly ISerializer _connectionNodeSerializer;
@@ -20,7 +21,8 @@ namespace mRemoteNG.Config.Serializers.Xml
public Version Version => _connectionNodeSerializer.Version;
public bool UseFullEncryption { get; set; }
- public XmlConnectionsSerializer(ICryptographyProvider cryptographyProvider, ISerializer connectionNodeSerializer)
+ public XmlConnectionsSerializer(ICryptographyProvider cryptographyProvider,
+ ISerializer connectionNodeSerializer)
{
_cryptographyProvider = cryptographyProvider;
_connectionNodeSerializer = connectionNodeSerializer;
@@ -42,7 +44,8 @@ namespace mRemoteNG.Config.Serializers.Xml
var xml = "";
try
{
- var documentCompiler = new XmlConnectionsDocumentCompiler(_cryptographyProvider, _connectionNodeSerializer);
+ var documentCompiler =
+ new XmlConnectionsDocumentCompiler(_cryptographyProvider, _connectionNodeSerializer);
var xmlDocument = documentCompiler.CompileDocument(serializationTarget, UseFullEncryption);
xml = WriteXmlToString(xmlDocument);
}
@@ -50,13 +53,15 @@ namespace mRemoteNG.Config.Serializers.Xml
{
Runtime.MessageCollector.AddExceptionStackTrace("SaveToXml failed", ex);
}
+
return xml;
}
private static string WriteXmlToString(XNode xmlDocument)
{
string xmlString;
- var xmlWriterSettings = new XmlWriterSettings { Indent = true, IndentChars = " ", Encoding = Encoding.UTF8 };
+ var xmlWriterSettings = new XmlWriterSettings
+ {Indent = true, IndentChars = " ", Encoding = Encoding.UTF8};
var memoryStream = new MemoryStream();
using (var xmlTextWriter = XmlWriter.Create(memoryStream, xmlWriterSettings))
{
@@ -66,6 +71,7 @@ namespace mRemoteNG.Config.Serializers.Xml
memoryStream.Seek(0, SeekOrigin.Begin);
xmlString = streamReader.ReadToEnd();
}
+
return xmlString;
}
}
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlExtensions.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlExtensions.cs
index 71ecbff7..06520b1c 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlExtensions.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlExtensions.cs
@@ -17,7 +17,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
if (string.IsNullOrWhiteSpace(value))
return defaultValue;
- return bool.TryParse(value, out var valueAsBool)
+ return bool.TryParse(value, out var valueAsBool)
? valueAsBool
: defaultValue;
}
@@ -28,8 +28,8 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
if (string.IsNullOrWhiteSpace(value))
return defaultValue;
- return int.TryParse(value, out var valueAsBool)
- ? valueAsBool
+ return int.TryParse(value, out var valueAsBool)
+ ? valueAsBool
: defaultValue;
}
@@ -45,4 +45,4 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
: defaultValue;
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs
index 9a9f9af9..75a4391e 100644
--- a/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs
+++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs
@@ -7,27 +7,28 @@ namespace mRemoteNG.Config.Serializers.Xml
{
public class XmlRootNodeSerializer
{
- public XElement SerializeRootNodeInfo(
- RootNodeInfo rootNodeInfo,
- ICryptographyProvider cryptographyProvider,
- Version version,
- bool fullFileEncryption = false)
+ public XElement SerializeRootNodeInfo(RootNodeInfo rootNodeInfo,
+ ICryptographyProvider cryptographyProvider,
+ Version version,
+ bool fullFileEncryption = false)
{
XNamespace xmlNamespace = "http://mremoteng.org";
var element = new XElement(xmlNamespace + "Connections");
- element.Add(new XAttribute(XNamespace.Xmlns+"mrng", xmlNamespace));
+ element.Add(new XAttribute(XNamespace.Xmlns + "mrng", xmlNamespace));
element.Add(new XAttribute(XName.Get("Name"), rootNodeInfo.Name));
- element.Add(new XAttribute(XName.Get("Export"), "false"));
- element.Add(new XAttribute(XName.Get("EncryptionEngine"), cryptographyProvider.CipherEngine));
+ element.Add(new XAttribute(XName.Get("Export"), "false"));
+ element.Add(new XAttribute(XName.Get("EncryptionEngine"), cryptographyProvider.CipherEngine));
element.Add(new XAttribute(XName.Get("BlockCipherMode"), cryptographyProvider.CipherMode));
element.Add(new XAttribute(XName.Get("KdfIterations"), cryptographyProvider.KeyDerivationIterations));
- element.Add(new XAttribute(XName.Get("FullFileEncryption"), fullFileEncryption.ToString().ToLowerInvariant()));
+ element.Add(new XAttribute(XName.Get("FullFileEncryption"),
+ fullFileEncryption.ToString().ToLowerInvariant()));
element.Add(CreateProtectedAttribute(rootNodeInfo, cryptographyProvider));
element.Add(new XAttribute(XName.Get("ConfVersion"), version.ToString(2)));
return element;
}
- private XAttribute CreateProtectedAttribute(RootNodeInfo rootNodeInfo, ICryptographyProvider cryptographyProvider)
+ private XAttribute CreateProtectedAttribute(RootNodeInfo rootNodeInfo,
+ ICryptographyProvider cryptographyProvider)
{
var attribute = new XAttribute(XName.Get("Protected"), "");
var plainText = rootNodeInfo.Password ? "ThisIsProtected" : "ThisIsNotProtected";
diff --git a/mRemoteV1/Config/Serializers/CredentialProviderSerializer/CredentialRepositoryListDeserializer.cs b/mRemoteV1/Config/Serializers/CredentialProviderSerializer/CredentialRepositoryListDeserializer.cs
index 618fe206..6795d695 100644
--- a/mRemoteV1/Config/Serializers/CredentialProviderSerializer/CredentialRepositoryListDeserializer.cs
+++ b/mRemoteV1/Config/Serializers/CredentialProviderSerializer/CredentialRepositoryListDeserializer.cs
@@ -12,7 +12,9 @@ namespace mRemoteNG.Config.Serializers.CredentialProviderSerializer
private readonly ISecureSerializer, string> _serializer;
private readonly ISecureDeserializer> _deserializer;
- public CredentialRepositoryListDeserializer(ISecureSerializer, string> serializer, ISecureDeserializer> deserializer)
+ public CredentialRepositoryListDeserializer(
+ ISecureSerializer, string> serializer,
+ ISecureDeserializer> deserializer)
{
if (serializer == null)
throw new ArgumentNullException(nameof(serializer));
diff --git a/mRemoteV1/Config/Serializers/CredentialProviderSerializer/CredentialRepositoryListSerializer.cs b/mRemoteV1/Config/Serializers/CredentialProviderSerializer/CredentialRepositoryListSerializer.cs
index 79365228..ea755999 100644
--- a/mRemoteV1/Config/Serializers/CredentialProviderSerializer/CredentialRepositoryListSerializer.cs
+++ b/mRemoteV1/Config/Serializers/CredentialProviderSerializer/CredentialRepositoryListSerializer.cs
@@ -13,14 +13,14 @@ namespace mRemoteNG.Config.Serializers.CredentialProviderSerializer
{
var xmlDocument = new XDocument(new XDeclaration("1.0", "utf-8", null));
var rootElement = new XElement("CredentialRepositories",
- from provider in credentialProviderCatalog
- select new XElement("CredentialRepository",
- new XAttribute("Id", provider.Config.Id),
- new XAttribute("TypeName", provider.Config.TypeName),
- new XAttribute("Title", provider.Config.Title),
- new XAttribute("Source", provider.Config.Source)
- )
- );
+ from provider in credentialProviderCatalog
+ select new XElement("CredentialRepository",
+ new XAttribute("Id", provider.Config.Id),
+ new XAttribute("TypeName", provider.Config.TypeName),
+ new XAttribute("Title", provider.Config.Title),
+ new XAttribute("Source", provider.Config.Source)
+ )
+ );
xmlDocument.Add(rootElement);
var declaration = xmlDocument.Declaration.ToString();
var documentBody = xmlDocument.ToString();
diff --git a/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialPasswordDecryptorDecorator.cs b/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialPasswordDecryptorDecorator.cs
index 3e6d5854..a89ea755 100644
--- a/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialPasswordDecryptorDecorator.cs
+++ b/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialPasswordDecryptorDecorator.cs
@@ -12,7 +12,8 @@ namespace mRemoteNG.Config.Serializers.CredentialSerializer
{
private readonly IDeserializer> _baseDeserializer;
- public XmlCredentialPasswordDecryptorDecorator(IDeserializer> baseDeserializer)
+ public XmlCredentialPasswordDecryptorDecorator(
+ IDeserializer> baseDeserializer)
{
if (baseDeserializer == null)
throw new ArgumentNullException(nameof(baseDeserializer));
@@ -39,10 +40,13 @@ namespace mRemoteNG.Config.Serializers.CredentialSerializer
var decryptedPassword = cryptoProvider.Decrypt(passwordAttribute.Value, key);
passwordAttribute.SetValue(decryptedPassword);
}
+
return xdoc.ToString();
}
- private void DecryptAuthHeader(XElement rootElement, ICryptographyProvider cryptographyProvider, SecureString key)
+ private void DecryptAuthHeader(XElement rootElement,
+ ICryptographyProvider cryptographyProvider,
+ SecureString key)
{
var authAttribute = rootElement.Attribute("Auth");
if (authAttribute == null)
diff --git a/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialPasswordEncryptorDecorator.cs b/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialPasswordEncryptorDecorator.cs
index 8fc38ed8..6b3db03c 100644
--- a/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialPasswordEncryptorDecorator.cs
+++ b/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialPasswordEncryptorDecorator.cs
@@ -12,7 +12,9 @@ namespace mRemoteNG.Config.Serializers.CredentialSerializer
private readonly ISerializer, string> _baseSerializer;
private readonly ICryptographyProvider _cryptographyProvider;
- public XmlCredentialPasswordEncryptorDecorator(ICryptographyProvider cryptographyProvider, ISerializer, string> baseSerializer)
+ public XmlCredentialPasswordEncryptorDecorator(ICryptographyProvider cryptographyProvider,
+ ISerializer, string>
+ baseSerializer)
{
if (baseSerializer == null)
throw new ArgumentNullException(nameof(baseSerializer));
@@ -45,6 +47,7 @@ namespace mRemoteNG.Config.Serializers.CredentialSerializer
var encryptedPassword = _cryptographyProvider.Encrypt(passwordAttribute.Value, encryptionKey);
passwordAttribute.Value = encryptedPassword;
}
+
return xdoc.Declaration + Environment.NewLine + xdoc;
}
@@ -53,7 +56,9 @@ namespace mRemoteNG.Config.Serializers.CredentialSerializer
xdoc.Root?.SetAttributeValue("EncryptionEngine", _cryptographyProvider.CipherEngine);
xdoc.Root?.SetAttributeValue("BlockCipherMode", _cryptographyProvider.CipherMode);
xdoc.Root?.SetAttributeValue("KdfIterations", _cryptographyProvider.KeyDerivationIterations);
- xdoc.Root?.SetAttributeValue("Auth", _cryptographyProvider.Encrypt(RandomGenerator.RandomString(20), encryptionKey));
+ xdoc.Root?.SetAttributeValue("Auth",
+ _cryptographyProvider.Encrypt(RandomGenerator.RandomString(20),
+ encryptionKey));
}
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialRecordDeserializer.cs b/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialRecordDeserializer.cs
index 7a7fe0d9..3f071a9d 100644
--- a/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialRecordDeserializer.cs
+++ b/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialRecordDeserializer.cs
@@ -19,13 +19,14 @@ namespace mRemoteNG.Config.Serializers.CredentialSerializer
ValidateSchemaVersion(rootElement);
var credentials = from element in xdoc.Descendants("Credential")
- select new CredentialRecord(Guid.Parse(element.Attribute("Id")?.Value ?? Guid.NewGuid().ToString()))
- {
- Title = element.Attribute("Title")?.Value ?? "",
- Username = element.Attribute("Username")?.Value ?? "",
- Password = element.Attribute("Password")?.Value.ConvertToSecureString(),
- Domain = element.Attribute("Domain")?.Value ?? ""
- };
+ select new CredentialRecord(Guid.Parse(element.Attribute("Id")?.Value ??
+ Guid.NewGuid().ToString()))
+ {
+ Title = element.Attribute("Title")?.Value ?? "",
+ Username = element.Attribute("Username")?.Value ?? "",
+ Password = element.Attribute("Password")?.Value.ConvertToSecureString(),
+ Domain = element.Attribute("Domain")?.Value ?? ""
+ };
return credentials.ToArray();
}
@@ -33,7 +34,8 @@ namespace mRemoteNG.Config.Serializers.CredentialSerializer
{
var docSchemaVersion = rootElement?.Attribute("SchemaVersion")?.Value;
if (docSchemaVersion != SchemaVersion)
- throw new Exception($"The schema version of this document is not supported by this class. Document Version: {docSchemaVersion} Supported Version: {SchemaVersion}");
+ throw new Exception(
+ $"The schema version of this document is not supported by this class. Document Version: {docSchemaVersion} Supported Version: {SchemaVersion}");
}
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialRecordSerializer.cs b/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialRecordSerializer.cs
index 01d2e0e1..eb421b27 100644
--- a/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialRecordSerializer.cs
+++ b/mRemoteV1/Config/Serializers/CredentialSerializer/XmlCredentialRecordSerializer.cs
@@ -14,18 +14,20 @@ namespace mRemoteNG.Config.Serializers.CredentialSerializer
public string Serialize(IEnumerable credentialRecords)
{
var xdoc = new XDocument(
- new XElement("Credentials",
- new XAttribute("SchemaVersion", Version.ToString(2)),
- from r in credentialRecords
- select new XElement("Credential",
- new XAttribute("Id", r.Id),
- new XAttribute("Title", r.Title),
- new XAttribute("Username", r.Username),
- new XAttribute("Domain", r.Domain),
- new XAttribute("Password", r.Password.ConvertToUnsecureString())
- )
- )
- )
+ new XElement("Credentials",
+ new XAttribute("SchemaVersion", Version.ToString(2)),
+ from r in credentialRecords
+ select new XElement("Credential",
+ new XAttribute("Id", r.Id),
+ new XAttribute("Title", r.Title),
+ new XAttribute("Username", r.Username),
+ new XAttribute("Domain", r.Domain),
+ new XAttribute("Password",
+ r.Password
+ .ConvertToUnsecureString())
+ )
+ )
+ )
{
Declaration = new XDeclaration("1.0", "utf-8", null)
};
diff --git a/mRemoteV1/Config/Serializers/MiscSerializers/ActiveDirectoryDeserializer.cs b/mRemoteV1/Config/Serializers/MiscSerializers/ActiveDirectoryDeserializer.cs
index d9789f0f..a042aa21 100644
--- a/mRemoteV1/Config/Serializers/MiscSerializers/ActiveDirectoryDeserializer.cs
+++ b/mRemoteV1/Config/Serializers/MiscSerializers/ActiveDirectoryDeserializer.cs
@@ -55,7 +55,7 @@ namespace mRemoteNG.Config.Serializers
ldapSearcher.SearchRoot = new DirectoryEntry(ldapPath);
ldapSearcher.Filter = ldapFilter;
ldapSearcher.SearchScope = SearchScope.OneLevel;
- ldapSearcher.PropertiesToLoad.AddRange(new[] { "securityEquals", "cn", "objectClass" });
+ ldapSearcher.PropertiesToLoad.AddRange(new[] {"securityEquals", "cn", "objectClass"});
var ldapResults = ldapSearcher.FindAll();
foreach (SearchResult ldapResult in ldapResults)
@@ -65,7 +65,7 @@ namespace mRemoteNG.Config.Serializers
if (directoryEntry.Properties["objectClass"].Contains("organizationalUnit"))
{
// check/continue here so we don't create empty connection objects
- if(!_importSubOu) continue;
+ if (!_importSubOu) continue;
// TODO - this is a circular call. A deserializer should not call an importer
ActiveDirectoryImporter.Import(ldapResult.Path, parentContainer, _importSubOu);
@@ -79,7 +79,8 @@ namespace mRemoteNG.Config.Serializers
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage("Config.Import.ActiveDirectory.ImportComputers() failed.", ex);
+ Runtime.MessageCollector.AddExceptionMessage("Config.Import.ActiveDirectory.ImportComputers() failed.",
+ ex);
}
}
diff --git a/mRemoteV1/Config/Serializers/MiscSerializers/PuttyConnectionManagerDeserializer.cs b/mRemoteV1/Config/Serializers/MiscSerializers/PuttyConnectionManagerDeserializer.cs
index a434fa57..039f9a09 100644
--- a/mRemoteV1/Config/Serializers/MiscSerializers/PuttyConnectionManagerDeserializer.cs
+++ b/mRemoteV1/Config/Serializers/MiscSerializers/PuttyConnectionManagerDeserializer.cs
@@ -28,7 +28,7 @@ namespace mRemoteNG.Config.Serializers
{
ImportRootOrContainer(rootNode, root);
}
-
+
return connectionTreeModel;
}
@@ -66,16 +66,19 @@ namespace mRemoteNG.Config.Serializers
{
throw (new FileFormatException($"Unrecognized root node type ({xmlNodeType})."));
}
+
break;
case "container":
if (string.Compare(xmlNodeType, "folder", StringComparison.OrdinalIgnoreCase) != 0)
{
throw (new FileFormatException($"Unrecognized root node type ({xmlNodeType})."));
}
+
break;
default:
// ReSharper disable once LocalizableElement
- throw (new ArgumentException("Argument must be either a root or a container node.", nameof(xmlNode)));
+ throw (new ArgumentException("Argument must be either a root or a container node.",
+ nameof(xmlNode)));
}
}
diff --git a/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionDeserializer.cs b/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionDeserializer.cs
index d59bcbc3..ae605f4c 100644
--- a/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionDeserializer.cs
+++ b/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionDeserializer.cs
@@ -18,7 +18,7 @@ namespace mRemoteNG.Config.Serializers
var connectionInfo = new ConnectionInfo();
foreach (var line in rdcFileContent.Split(Environment.NewLine.ToCharArray()))
{
- var parts = line.Split(new[] { ':' }, 3);
+ var parts = line.Split(new[] {':'}, 3);
if (parts.Length < 3)
{
continue;
@@ -29,6 +29,7 @@ namespace mRemoteNG.Config.Serializers
SetConnectionInfoParameter(connectionInfo, key, value);
}
+
root.AddChild(connectionInfo);
return connectionTreeModel;
@@ -74,12 +75,15 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.Colors = RdpProtocol.RDPColors.Colors32Bit;
break;
}
+
break;
case "bitmapcachepersistenable":
connectionInfo.CacheBitmaps = value == "1";
break;
case "screen mode id":
- connectionInfo.Resolution = value == "2" ? RdpProtocol.RDPResolutions.Fullscreen : RdpProtocol.RDPResolutions.FitToWindow;
+ connectionInfo.Resolution = value == "2"
+ ? RdpProtocol.RDPResolutions.Fullscreen
+ : RdpProtocol.RDPResolutions.FitToWindow;
break;
case "connect to console":
connectionInfo.UseConsoleSession = value == "1";
@@ -124,6 +128,7 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.DoNotPlay;
break;
}
+
break;
case "loadbalanceinfo":
connectionInfo.LoadBalanceInfo = value;
diff --git a/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionManagerDeserializer.cs b/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionManagerDeserializer.cs
index 27c2b030..53c1bc37 100644
--- a/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionManagerDeserializer.cs
+++ b/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionManagerDeserializer.cs
@@ -104,6 +104,7 @@ namespace mRemoteNG.Config.Serializers
// Program Version 2.2 wraps all setting inside the Properties tags
containerPropertiesNode = containerPropertiesNode.SelectSingleNode("./properties");
}
+
var newContainer = new ContainerInfo();
var connectionInfo = ConnectionInfoFromXml(containerPropertiesNode);
newContainer.CopyFrom(connectionInfo);
@@ -113,8 +114,10 @@ namespace mRemoteNG.Config.Serializers
// Program Version 2.7 wraps these properties
containerPropertiesNode = containerPropertiesNode.SelectSingleNode("./properties");
}
+
newContainer.Name = containerPropertiesNode?.SelectSingleNode("./name")?.InnerText ?? Language.strNewFolder;
- newContainer.IsExpanded = bool.Parse(containerPropertiesNode?.SelectSingleNode("./expanded")?.InnerText ?? "false");
+ newContainer.IsExpanded =
+ bool.Parse(containerPropertiesNode?.SelectSingleNode("./expanded")?.InnerText ?? "false");
parentContainer.AddChild(newContainer);
return newContainer;
}
@@ -131,9 +134,11 @@ namespace mRemoteNG.Config.Serializers
var propertiesNode = xmlNode.SelectSingleNode("./properties");
- if (_schemaVersion == 1) propertiesNode = xmlNode; // Version 2.2 defines the container name at the root instead
+ if (_schemaVersion == 1)
+ propertiesNode = xmlNode; // Version 2.2 defines the container name at the root instead
connectionInfo.Hostname = propertiesNode?.SelectSingleNode("./name")?.InnerText ?? "";
- connectionInfo.Name = propertiesNode?.SelectSingleNode("./displayName")?.InnerText ?? connectionInfo.Hostname;
+ connectionInfo.Name =
+ propertiesNode?.SelectSingleNode("./displayName")?.InnerText ?? connectionInfo.Hostname;
connectionInfo.Description = propertiesNode?.SelectSingleNode("./comment")?.InnerText ?? string.Empty;
var logonCredentialsNode = xmlNode.SelectSingleNode("./logonCredentials");
@@ -144,8 +149,8 @@ namespace mRemoteNG.Config.Serializers
var passwordNode = logonCredentialsNode.SelectSingleNode("./password");
if (_schemaVersion == 1) // Version 2.2 allows clear text passwords
{
- connectionInfo.Password = passwordNode?.Attributes?["storeAsClearText"]?.Value == "True"
- ? passwordNode.InnerText
+ connectionInfo.Password = passwordNode?.Attributes?["storeAsClearText"]?.Value == "True"
+ ? passwordNode.InnerText
: DecryptRdcManPassword(passwordNode?.InnerText);
}
else
@@ -165,7 +170,8 @@ namespace mRemoteNG.Config.Serializers
var connectionSettingsNode = xmlNode.SelectSingleNode("./connectionSettings");
if (connectionSettingsNode?.Attributes?["inherit"]?.Value == "None")
{
- connectionInfo.UseConsoleSession = bool.Parse(connectionSettingsNode.SelectSingleNode("./connectToConsole")?.InnerText ?? "false");
+ connectionInfo.UseConsoleSession =
+ bool.Parse(connectionSettingsNode.SelectSingleNode("./connectToConsole")?.InnerText ?? "false");
// ./startProgram
// ./workingDir
connectionInfo.Port = Convert.ToInt32(connectionSettingsNode.SelectSingleNode("./port")?.InnerText);
@@ -179,12 +185,17 @@ namespace mRemoteNG.Config.Serializers
var gatewaySettingsNode = xmlNode.SelectSingleNode("./gatewaySettings");
if (gatewaySettingsNode?.Attributes?["inherit"]?.Value == "None")
{
- connectionInfo.RDGatewayUsageMethod = gatewaySettingsNode.SelectSingleNode("./enabled")?.InnerText == "True" ? RdpProtocol.RDGatewayUsageMethod.Always : RdpProtocol.RDGatewayUsageMethod.Never;
+ connectionInfo.RDGatewayUsageMethod =
+ gatewaySettingsNode.SelectSingleNode("./enabled")?.InnerText == "True"
+ ? RdpProtocol.RDGatewayUsageMethod.Always
+ : RdpProtocol.RDGatewayUsageMethod.Never;
connectionInfo.RDGatewayHostname = gatewaySettingsNode.SelectSingleNode("./hostName")?.InnerText;
connectionInfo.RDGatewayUsername = gatewaySettingsNode.SelectSingleNode("./userName")?.InnerText;
var passwordNode = gatewaySettingsNode.SelectSingleNode("./password");
- connectionInfo.RDGatewayPassword = passwordNode?.Attributes?["storeAsClearText"]?.Value == "True" ? passwordNode.InnerText : DecryptRdcManPassword(passwordNode?.InnerText);
+ connectionInfo.RDGatewayPassword = passwordNode?.Attributes?["storeAsClearText"]?.Value == "True"
+ ? passwordNode.InnerText
+ : DecryptRdcManPassword(passwordNode?.InnerText);
connectionInfo.RDGatewayDomain = gatewaySettingsNode.SelectSingleNode("./domain")?.InnerText;
// ./logonMethod
@@ -206,7 +217,9 @@ namespace mRemoteNG.Config.Serializers
var resolutionString = remoteDesktopNode.SelectSingleNode("./size")?.InnerText.Replace(" ", "");
try
{
- connectionInfo.Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions), "Res" + resolutionString);
+ connectionInfo.Resolution =
+ (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions),
+ "Res" + resolutionString);
}
catch (ArgumentException)
{
@@ -225,7 +238,8 @@ namespace mRemoteNG.Config.Serializers
var colorDepth = remoteDesktopNode.SelectSingleNode("./colorDepth")?.InnerText;
if (colorDepth != null)
- connectionInfo.Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors), colorDepth);
+ connectionInfo.Colors =
+ (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors), colorDepth);
}
else
{
@@ -274,11 +288,16 @@ namespace mRemoteNG.Config.Serializers
}
// ./redirectClipboard
- connectionInfo.RedirectDiskDrives = bool.Parse(localResourcesNode?.SelectSingleNode("./redirectDrives")?.InnerText ?? "false");
- connectionInfo.RedirectPorts = bool.Parse(localResourcesNode?.SelectSingleNode("./redirectPorts")?.InnerText ?? "false");
- connectionInfo.RedirectPrinters = bool.Parse(localResourcesNode?.SelectSingleNode("./redirectPrinters")?.InnerText ?? "false");
- connectionInfo.RedirectSmartCards = bool.Parse(localResourcesNode?.SelectSingleNode("./redirectSmartCards")?.InnerText ?? "false");
- connectionInfo.RedirectClipboard = bool.Parse(localResourcesNode?.SelectSingleNode("./redirectClipboard")?.InnerText ?? "false");
+ connectionInfo.RedirectDiskDrives =
+ bool.Parse(localResourcesNode?.SelectSingleNode("./redirectDrives")?.InnerText ?? "false");
+ connectionInfo.RedirectPorts =
+ bool.Parse(localResourcesNode?.SelectSingleNode("./redirectPorts")?.InnerText ?? "false");
+ connectionInfo.RedirectPrinters =
+ bool.Parse(localResourcesNode?.SelectSingleNode("./redirectPrinters")?.InnerText ?? "false");
+ connectionInfo.RedirectSmartCards =
+ bool.Parse(localResourcesNode?.SelectSingleNode("./redirectSmartCards")?.InnerText ?? "false");
+ connectionInfo.RedirectClipboard =
+ bool.Parse(localResourcesNode?.SelectSingleNode("./redirectClipboard")?.InnerText ?? "false");
}
else
{
@@ -330,7 +349,8 @@ namespace mRemoteNG.Config.Serializers
try
{
- var plaintextData = ProtectedData.Unprotect(Convert.FromBase64String(ciphertext), new byte[] { }, DataProtectionScope.LocalMachine);
+ var plaintextData = ProtectedData.Unprotect(Convert.FromBase64String(ciphertext), new byte[] { },
+ DataProtectionScope.LocalMachine);
var charArray = Encoding.Unicode.GetChars(plaintextData);
return new string(charArray);
}
diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlDatabaseVersionVerifier.cs b/mRemoteV1/Config/Serializers/Versioning/SqlDatabaseVersionVerifier.cs
index 232914b0..607512c8 100644
--- a/mRemoteV1/Config/Serializers/Versioning/SqlDatabaseVersionVerifier.cs
+++ b/mRemoteV1/Config/Serializers/Versioning/SqlDatabaseVersionVerifier.cs
@@ -36,7 +36,7 @@ namespace mRemoteNG.Config.Serializers.Versioning
new SqlVersion23To24Upgrader(_sqlDatabaseConnector),
new SqlVersion24To25Upgrader(_sqlDatabaseConnector),
new SqlVersion25To26Upgrader(_sqlDatabaseConnector),
- new SqlVersion26To27Upgrader(_sqlDatabaseConnector),
+ new SqlVersion26To27Upgrader(_sqlDatabaseConnector),
};
foreach (var upgrader in dbUpgraders)
@@ -52,11 +52,16 @@ namespace mRemoteNG.Config.Serializers.Versioning
isVerified = true;
if (isVerified == false)
- Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, string.Format(Language.strErrorBadDatabaseVersion, databaseVersion, GeneralAppInfo.ProductName));
+ Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
+ string.Format(Language.strErrorBadDatabaseVersion,
+ databaseVersion,
+ GeneralAppInfo.ProductName));
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, string.Format(Language.strErrorVerifyDatabaseVersionFailed, ex.Message));
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ string.Format(Language.strErrorVerifyDatabaseVersionFailed,
+ ex.Message));
}
return isVerified;
diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion22To23Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion22To23Upgrader.cs
index cf0e8865..5f8cbbad 100644
--- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion22To23Upgrader.cs
+++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion22To23Upgrader.cs
@@ -25,7 +25,8 @@ namespace mRemoteNG.Config.Serializers.Versioning
public Version Upgrade()
{
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Upgrading database from version 2.2 to version 2.3.");
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ "Upgrading database from version 2.2 to version 2.3.");
const string sqlText = @"
ALTER TABLE tblCons
ADD EnableFontSmoothing bit NOT NULL DEFAULT 0,
diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion23To24Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion23To24Upgrader.cs
index 03085c8a..535dad23 100644
--- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion23To24Upgrader.cs
+++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion23To24Upgrader.cs
@@ -25,7 +25,8 @@ namespace mRemoteNG.Config.Serializers.Versioning
public Version Upgrade()
{
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Upgrading database from version 2.3 to version 2.4.");
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ "Upgrading database from version 2.3 to version 2.4.");
const string sqlText = @"
ALTER TABLE tblCons
ADD UseCredSsp bit NOT NULL DEFAULT 1,
diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion24To25Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion24To25Upgrader.cs
index 704fd8cf..b51615db 100644
--- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion24To25Upgrader.cs
+++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion24To25Upgrader.cs
@@ -25,7 +25,8 @@ namespace mRemoteNG.Config.Serializers.Versioning
public Version Upgrade()
{
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Upgrading database from version 2.4 to version 2.5.");
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ "Upgrading database from version 2.4 to version 2.5.");
const string sqlText = @"
ALTER TABLE tblCons
ADD LoadBalanceInfo varchar (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion25To26Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion25To26Upgrader.cs
index 7e6e232c..cfde93f0 100644
--- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion25To26Upgrader.cs
+++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion25To26Upgrader.cs
@@ -25,7 +25,8 @@ namespace mRemoteNG.Config.Serializers.Versioning
public Version Upgrade()
{
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Upgrading database from version 2.5 to version 2.6.");
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ "Upgrading database from version 2.5 to version 2.6.");
const string sqlText = @"
ALTER TABLE tblCons
ADD RDPMinutesToIdleTimeout int NOT NULL DEFAULT 0,
diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion26To27Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion26To27Upgrader.cs
index 26d66b49..176c295c 100644
--- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion26To27Upgrader.cs
+++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion26To27Upgrader.cs
@@ -25,7 +25,8 @@ namespace mRemoteNG.Config.Serializers.Versioning
public Version Upgrade()
{
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Upgrading database from version 2.6 to version 2.7.");
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ "Upgrading database from version 2.6 to version 2.7.");
const string sqlText = @"
ALTER TABLE tblCons
ADD RedirectClipboard bit NOT NULL DEFAULT 0,
@@ -38,4 +39,4 @@ UPDATE tblRoot
return new Version(2, 7);
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Serializers/XmlConnectionsDecryptor.cs b/mRemoteV1/Config/Serializers/XmlConnectionsDecryptor.cs
index efa0683a..80332729 100644
--- a/mRemoteV1/Config/Serializers/XmlConnectionsDecryptor.cs
+++ b/mRemoteV1/Config/Serializers/XmlConnectionsDecryptor.cs
@@ -29,7 +29,9 @@ namespace mRemoteNG.Config.Serializers
_rootNodeInfo = rootNodeInfo;
}
- public XmlConnectionsDecryptor(BlockCipherEngines blockCipherEngine, BlockCipherModes blockCipherMode, RootNodeInfo rootNodeInfo)
+ public XmlConnectionsDecryptor(BlockCipherEngines blockCipherEngine,
+ BlockCipherModes blockCipherMode,
+ RootNodeInfo rootNodeInfo)
{
_cryptographyProvider = new CryptoProviderFactory(blockCipherEngine, blockCipherMode).Build();
_rootNodeInfo = rootNodeInfo;
@@ -37,7 +39,9 @@ namespace mRemoteNG.Config.Serializers
public string Decrypt(string plainText)
{
- return plainText == "" ? "" : _cryptographyProvider.Decrypt(plainText, _rootNodeInfo.PasswordString.ConvertToSecureString());
+ return plainText == ""
+ ? ""
+ : _cryptographyProvider.Decrypt(plainText, _rootNodeInfo.PasswordString.ConvertToSecureString());
}
public string LegacyFullFileDecrypt(string xml)
@@ -50,7 +54,8 @@ namespace mRemoteNG.Config.Serializers
try
{
- decryptedContent = _cryptographyProvider.Decrypt(xml, _rootNodeInfo.PasswordString.ConvertToSecureString());
+ decryptedContent =
+ _cryptographyProvider.Decrypt(xml, _rootNodeInfo.PasswordString.ConvertToSecureString());
notDecr = decryptedContent == xml;
}
catch (Exception)
@@ -62,7 +67,8 @@ namespace mRemoteNG.Config.Serializers
{
if (Authenticate(xml, _rootNodeInfo.PasswordString.ConvertToSecureString()))
{
- decryptedContent = _cryptographyProvider.Decrypt(xml, _rootNodeInfo.PasswordString.ConvertToSecureString());
+ decryptedContent =
+ _cryptographyProvider.Decrypt(xml, _rootNodeInfo.PasswordString.ConvertToSecureString());
notDecr = false;
}
@@ -82,12 +88,17 @@ namespace mRemoteNG.Config.Serializers
var connectionsFileIsNotEncrypted = false;
try
{
- connectionsFileIsNotEncrypted = _cryptographyProvider.Decrypt(protectedString, _rootNodeInfo.PasswordString.ConvertToSecureString()) == "ThisIsNotProtected";
+ connectionsFileIsNotEncrypted =
+ _cryptographyProvider.Decrypt(protectedString,
+ _rootNodeInfo.PasswordString.ConvertToSecureString()) ==
+ "ThisIsNotProtected";
}
catch (EncryptionException)
{
}
- return connectionsFileIsNotEncrypted || Authenticate(protectedString, _rootNodeInfo.PasswordString.ConvertToSecureString());
+
+ return connectionsFileIsNotEncrypted ||
+ Authenticate(protectedString, _rootNodeInfo.PasswordString.ConvertToSecureString());
}
private bool Authenticate(string cipherText, SecureString password)
diff --git a/mRemoteV1/Config/Settings/DockPanelLayoutLoader.cs b/mRemoteV1/Config/Settings/DockPanelLayoutLoader.cs
index d431a3d1..4995384d 100644
--- a/mRemoteV1/Config/Settings/DockPanelLayoutLoader.cs
+++ b/mRemoteV1/Config/Settings/DockPanelLayoutLoader.cs
@@ -36,7 +36,8 @@ namespace mRemoteNG.Config.Settings
}
#if !PORTABLE
- var oldPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\" + GeneralAppInfo.ProductName + "\\" + SettingsFileInfo.LayoutFileName;
+ var oldPath =
+ Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\" + GeneralAppInfo.ProductName + "\\" + SettingsFileInfo.LayoutFileName;
#endif
var newPath = SettingsFileInfo.SettingsPath + "\\" + SettingsFileInfo.LayoutFileName;
if (File.Exists(newPath))
diff --git a/mRemoteV1/Config/Settings/DockPanelLayoutSaver.cs b/mRemoteV1/Config/Settings/DockPanelLayoutSaver.cs
index 9779a7bd..f5e2aae0 100644
--- a/mRemoteV1/Config/Settings/DockPanelLayoutSaver.cs
+++ b/mRemoteV1/Config/Settings/DockPanelLayoutSaver.cs
@@ -14,7 +14,8 @@ namespace mRemoteNG.Config.Settings
private readonly ISerializer _dockPanelSerializer;
private readonly IDataProvider _dataProvider;
- public DockPanelLayoutSaver(ISerializer dockPanelSerializer, IDataProvider dataProvider)
+ public DockPanelLayoutSaver(ISerializer dockPanelSerializer,
+ IDataProvider dataProvider)
{
if (dockPanelSerializer == null)
throw new ArgumentNullException(nameof(dockPanelSerializer));
diff --git a/mRemoteV1/Config/Settings/DockPanelLayoutSerializer.cs b/mRemoteV1/Config/Settings/DockPanelLayoutSerializer.cs
index 0ee7d3c3..e8e4be84 100644
--- a/mRemoteV1/Config/Settings/DockPanelLayoutSerializer.cs
+++ b/mRemoteV1/Config/Settings/DockPanelLayoutSerializer.cs
@@ -23,6 +23,7 @@ namespace mRemoteNG.Config.Settings
memoryStream.Position = 0;
xdoc = XDocument.Load(memoryStream, LoadOptions.SetBaseUri);
}
+
return $"{xdoc.Declaration}{Environment.NewLine}{xdoc}";
}
}
diff --git a/mRemoteV1/Config/Settings/ExternalAppsLoader.cs b/mRemoteV1/Config/Settings/ExternalAppsLoader.cs
index ee064507..a81d4b09 100644
--- a/mRemoteV1/Config/Settings/ExternalAppsLoader.cs
+++ b/mRemoteV1/Config/Settings/ExternalAppsLoader.cs
@@ -16,7 +16,9 @@ namespace mRemoteNG.Config.Settings
private readonly MessageCollector _messageCollector;
private readonly ExternalToolsToolStrip _externalToolsToolStrip;
- public ExternalAppsLoader(FrmMain mainForm, MessageCollector messageCollector, ExternalToolsToolStrip externalToolsToolStrip)
+ public ExternalAppsLoader(FrmMain mainForm,
+ MessageCollector messageCollector,
+ ExternalToolsToolStrip externalToolsToolStrip)
{
if (mainForm == null)
throw new ArgumentNullException(nameof(mainForm));
@@ -34,13 +36,15 @@ namespace mRemoteNG.Config.Settings
public void LoadExternalAppsFromXML()
{
#if !PORTABLE
- var oldPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), GeneralAppInfo.ProductName, SettingsFileInfo.ExtAppsFilesName);
+ var oldPath =
+ Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), GeneralAppInfo.ProductName, SettingsFileInfo.ExtAppsFilesName);
#endif
var newPath = Path.Combine(SettingsFileInfo.SettingsPath, SettingsFileInfo.ExtAppsFilesName);
var xDom = new XmlDocument();
if (File.Exists(newPath))
{
- _messageCollector.AddMessage(MessageClass.InformationMsg, $"Loading External Apps from: {newPath}", true);
+ _messageCollector.AddMessage(MessageClass.InformationMsg, $"Loading External Apps from: {newPath}",
+ true);
xDom.Load(newPath);
}
#if !PORTABLE
@@ -53,13 +57,15 @@ namespace mRemoteNG.Config.Settings
#endif
else
{
- _messageCollector.AddMessage(MessageClass.WarningMsg, "Loading External Apps failed: Could not FIND file!");
+ _messageCollector.AddMessage(MessageClass.WarningMsg,
+ "Loading External Apps failed: Could not FIND file!");
return;
}
if (xDom.DocumentElement == null)
{
- _messageCollector.AddMessage(MessageClass.WarningMsg, "Loading External Apps failed: Could not LOAD file!");
+ _messageCollector.AddMessage(MessageClass.WarningMsg,
+ "Loading External Apps failed: Could not LOAD file!");
return;
}
@@ -93,7 +99,9 @@ namespace mRemoteNG.Config.Settings
extA.ShowOnToolbar = bool.Parse(xEl.Attributes["ShowOnToolbar"].Value);
}
- _messageCollector.AddMessage(MessageClass.InformationMsg, $"Adding External App: {extA.DisplayName} {extA.FileName} {extA.Arguments}", true);
+ _messageCollector.AddMessage(MessageClass.InformationMsg,
+ $"Adding External App: {extA.DisplayName} {extA.FileName} {extA.Arguments}",
+ true);
Runtime.ExternalToolsService.ExternalTools.Add(extA);
}
diff --git a/mRemoteV1/Config/Settings/ExternalAppsSaver.cs b/mRemoteV1/Config/Settings/ExternalAppsSaver.cs
index 243f330a..000cc4c2 100644
--- a/mRemoteV1/Config/Settings/ExternalAppsSaver.cs
+++ b/mRemoteV1/Config/Settings/ExternalAppsSaver.cs
@@ -22,7 +22,7 @@ namespace mRemoteNG.Config.Settings
var xmlTextWriter =
new XmlTextWriter(SettingsFileInfo.SettingsPath + "\\" + SettingsFileInfo.ExtAppsFilesName,
- Encoding.UTF8)
+ Encoding.UTF8)
{
Formatting = Formatting.Indented,
Indentation = 4
diff --git a/mRemoteV1/Config/Settings/Providers/ChooseProvider.cs b/mRemoteV1/Config/Settings/Providers/ChooseProvider.cs
index 10a1a342..8a58cf8d 100644
--- a/mRemoteV1/Config/Settings/Providers/ChooseProvider.cs
+++ b/mRemoteV1/Config/Settings/Providers/ChooseProvider.cs
@@ -9,5 +9,6 @@ namespace mRemoteNG.Config.Settings.Providers
#else
public class ChooseProvider : LocalFileSettingsProvider
#endif
- { }
+ {
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Settings/Providers/PortableSettingsProvider.cs b/mRemoteV1/Config/Settings/Providers/PortableSettingsProvider.cs
index 28a91025..fa79921f 100644
--- a/mRemoteV1/Config/Settings/Providers/PortableSettingsProvider.cs
+++ b/mRemoteV1/Config/Settings/Providers/PortableSettingsProvider.cs
@@ -31,6 +31,7 @@ using System.Windows.Forms;
using System.Collections.Specialized;
using System.Xml;
using System.IO;
+
//using mRemoteNG.App;
namespace mRemoteNG.Config.Settings.Providers
@@ -43,7 +44,9 @@ namespace mRemoteNG.Config.Settings.Providers
private const string _className = "PortableSettingsProvider";
private XmlDocument _xmlDocument;
- private string _filePath => Path.Combine(Path.GetDirectoryName(Application.ExecutablePath) ?? throw new InvalidOperationException(), $"{ApplicationName}.settings");
+ private string _filePath =>
+ Path.Combine(Path.GetDirectoryName(Application.ExecutablePath) ?? throw new InvalidOperationException(),
+ $"{ApplicationName}.settings");
private XmlNode _localSettingsNode => GetSettingsNode(_localSettingsNodeName);
@@ -109,7 +112,8 @@ namespace mRemoteNG.Config.Settings.Providers
}
}
- public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection collection)
+ public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context,
+ SettingsPropertyCollection collection)
{
var values = new SettingsPropertyValueCollection();
diff --git a/mRemoteV1/Config/Settings/SettingsLoader.cs b/mRemoteV1/Config/Settings/SettingsLoader.cs
index a730dac6..6e250a5b 100644
--- a/mRemoteV1/Config/Settings/SettingsLoader.cs
+++ b/mRemoteV1/Config/Settings/SettingsLoader.cs
@@ -16,25 +16,24 @@ using mRemoteNG.UI.Forms;
namespace mRemoteNG.Config.Settings
{
public class SettingsLoader
- {
+ {
private readonly ExternalAppsLoader _externalAppsLoader;
private readonly MessageCollector _messageCollector;
- private readonly MenuStrip _mainMenu;
+ private readonly MenuStrip _mainMenu;
private readonly QuickConnectToolStrip _quickConnectToolStrip;
private readonly ExternalToolsToolStrip _externalToolsToolStrip;
- private readonly MultiSshToolStrip _multiSshToolStrip;
+ private readonly MultiSshToolStrip _multiSshToolStrip;
private FrmMain MainForm { get; }
- public SettingsLoader(
- FrmMain mainForm,
- MessageCollector messageCollector,
- QuickConnectToolStrip quickConnectToolStrip,
- ExternalToolsToolStrip externalToolsToolStrip,
- MultiSshToolStrip multiSshToolStrip,
- MenuStrip mainMenu)
- {
+ public SettingsLoader(FrmMain mainForm,
+ MessageCollector messageCollector,
+ QuickConnectToolStrip quickConnectToolStrip,
+ ExternalToolsToolStrip externalToolsToolStrip,
+ MultiSshToolStrip multiSshToolStrip,
+ MenuStrip mainMenu)
+ {
if (mainForm == null)
throw new ArgumentNullException(nameof(mainForm));
if (messageCollector == null)
@@ -45,45 +44,46 @@ namespace mRemoteNG.Config.Settings
throw new ArgumentNullException(nameof(externalToolsToolStrip));
if (multiSshToolStrip == null)
throw new ArgumentNullException(nameof(multiSshToolStrip));
- if (mainMenu == null)
- throw new ArgumentNullException(nameof(mainMenu));
+ if (mainMenu == null)
+ throw new ArgumentNullException(nameof(mainMenu));
MainForm = mainForm;
- _messageCollector = messageCollector;
- _quickConnectToolStrip = quickConnectToolStrip;
- _externalToolsToolStrip = externalToolsToolStrip;
- _multiSshToolStrip = multiSshToolStrip;
- _mainMenu = mainMenu;
- _externalAppsLoader = new ExternalAppsLoader(MainForm, messageCollector, _externalToolsToolStrip);
+ _messageCollector = messageCollector;
+ _quickConnectToolStrip = quickConnectToolStrip;
+ _externalToolsToolStrip = externalToolsToolStrip;
+ _multiSshToolStrip = multiSshToolStrip;
+ _mainMenu = mainMenu;
+ _externalAppsLoader = new ExternalAppsLoader(MainForm, messageCollector, _externalToolsToolStrip);
}
-
+
#region Public Methods
+
public void LoadSettings()
- {
- try
- {
+ {
+ try
+ {
EnsureSettingsAreSavedInNewestVersion();
- SetSupportedCulture();
+ SetSupportedCulture();
SetApplicationWindowPositionAndSize();
SetKioskMode();
SetPuttyPath();
SetShowSystemTrayIcon();
SetAutoSave();
- LoadExternalAppsFromXml();
+ LoadExternalAppsFromXml();
SetAlwaysShowPanelTabs();
-
- if (mRemoteNG.Settings.Default.ResetToolbars)
+
+ if (mRemoteNG.Settings.Default.ResetToolbars)
SetToolbarsDefault();
- else
+ else
LoadToolbarsFromSettings();
- }
- catch (Exception ex)
- {
+ }
+ catch (Exception ex)
+ {
_messageCollector.AddExceptionMessage("Loading settings failed", ex);
- }
- }
+ }
+ }
private static void SetAlwaysShowPanelTabs()
{
@@ -91,14 +91,15 @@ namespace mRemoteNG.Config.Settings
FrmMain.Default.pnlDock.DocumentStyle = DocumentStyle.DockingWindow;
}
-
private void SetSupportedCulture()
{
if (mRemoteNG.Settings.Default.OverrideUICulture == "" ||
!SupportedCultures.IsNameSupported(mRemoteNG.Settings.Default.OverrideUICulture)) return;
Thread.CurrentThread.CurrentUICulture = new CultureInfo(mRemoteNG.Settings.Default.OverrideUICulture);
- _messageCollector.AddMessage(MessageClass.InformationMsg, $"Override Culture: {Thread.CurrentThread.CurrentUICulture.Name}/{Thread.CurrentThread.CurrentUICulture.NativeName}", true);
+ _messageCollector.AddMessage(MessageClass.InformationMsg,
+ $"Override Culture: {Thread.CurrentThread.CurrentUICulture.Name}/{Thread.CurrentThread.CurrentUICulture.NativeName}",
+ true);
}
private void SetApplicationWindowPositionAndSize()
@@ -163,7 +164,9 @@ namespace mRemoteNG.Config.Settings
private static void SetPuttyPath()
{
- PuttyBase.PuttyPath = mRemoteNG.Settings.Default.UseCustomPuttyPath ? mRemoteNG.Settings.Default.CustomPuttyPath : GeneralAppInfo.PuttyPath;
+ PuttyBase.PuttyPath = mRemoteNG.Settings.Default.UseCustomPuttyPath
+ ? mRemoteNG.Settings.Default.CustomPuttyPath
+ : GeneralAppInfo.PuttyPath;
}
private void EnsureSettingsAreSavedInNewestVersion()
@@ -183,6 +186,7 @@ namespace mRemoteNG.Config.Settings
{
_messageCollector.AddExceptionMessage("Settings.Upgrade() failed", ex);
}
+
mRemoteNG.Settings.Default.DoUpgrade = false;
// Clear pending update flag
@@ -191,21 +195,21 @@ namespace mRemoteNG.Config.Settings
mRemoteNG.Settings.Default.UpdatePending = false;
}
- private void SetToolbarsDefault()
- {
- ToolStripPanelFromString("top").Join(_quickConnectToolStrip, new Point(300, 0));
+ private void SetToolbarsDefault()
+ {
+ ToolStripPanelFromString("top").Join(_quickConnectToolStrip, new Point(300, 0));
_quickConnectToolStrip.Visible = true;
- ToolStripPanelFromString("bottom").Join(_externalToolsToolStrip, new Point(3, 0));
+ ToolStripPanelFromString("bottom").Join(_externalToolsToolStrip, new Point(3, 0));
_externalToolsToolStrip.Visible = false;
- }
+ }
- private void LoadToolbarsFromSettings()
- {
+ private void LoadToolbarsFromSettings()
+ {
ResetAllToolbarLocations();
- AddMainMenuPanel();
+ AddMainMenuPanel();
AddExternalAppsPanel();
- AddQuickConnectPanel();
- AddMultiSshPanel();
+ AddQuickConnectPanel();
+ AddMultiSshPanel();
}
///
@@ -213,74 +217,75 @@ namespace mRemoteNG.Config.Settings
/// Since all toolbars start in this temp panel, no toolbar load
/// can be blocked by pre-existing toolbars.
///
- private void ResetAllToolbarLocations()
- {
- var tempToolStrip = new ToolStripPanel();
+ private void ResetAllToolbarLocations()
+ {
+ var tempToolStrip = new ToolStripPanel();
tempToolStrip.Join(_mainMenu);
- tempToolStrip.Join(_quickConnectToolStrip);
- tempToolStrip.Join(_externalToolsToolStrip);
- tempToolStrip.Join(_multiSshToolStrip);
+ tempToolStrip.Join(_quickConnectToolStrip);
+ tempToolStrip.Join(_externalToolsToolStrip);
+ tempToolStrip.Join(_multiSshToolStrip);
}
- private void AddMainMenuPanel()
- {
- SetToolstripGripStyle(_mainMenu);
+ private void AddMainMenuPanel()
+ {
+ SetToolstripGripStyle(_mainMenu);
var toolStripPanel = ToolStripPanelFromString("top");
- toolStripPanel.Join(_mainMenu, new Point(3, 0));
+ toolStripPanel.Join(_mainMenu, new Point(3, 0));
}
- private void AddQuickConnectPanel()
- {
- SetToolstripGripStyle(_quickConnectToolStrip);
+ private void AddQuickConnectPanel()
+ {
+ SetToolstripGripStyle(_quickConnectToolStrip);
_quickConnectToolStrip.Visible = mRemoteNG.Settings.Default.QuickyTBVisible;
var toolStripPanel = ToolStripPanelFromString(mRemoteNG.Settings.Default.QuickyTBParentDock);
toolStripPanel.Join(_quickConnectToolStrip, mRemoteNG.Settings.Default.QuickyTBLocation);
- }
-
- private void AddExternalAppsPanel()
- {
- SetToolstripGripStyle(_externalToolsToolStrip);
+ }
+
+ private void AddExternalAppsPanel()
+ {
+ SetToolstripGripStyle(_externalToolsToolStrip);
_externalToolsToolStrip.Visible = mRemoteNG.Settings.Default.ExtAppsTBVisible;
var toolStripPanel = ToolStripPanelFromString(mRemoteNG.Settings.Default.ExtAppsTBParentDock);
toolStripPanel.Join(_externalToolsToolStrip, mRemoteNG.Settings.Default.ExtAppsTBLocation);
- }
+ }
- private void AddMultiSshPanel()
- {
- SetToolstripGripStyle(_multiSshToolStrip);
- _multiSshToolStrip.Visible = mRemoteNG.Settings.Default.MultiSshToolbarVisible;
+ private void AddMultiSshPanel()
+ {
+ SetToolstripGripStyle(_multiSshToolStrip);
+ _multiSshToolStrip.Visible = mRemoteNG.Settings.Default.MultiSshToolbarVisible;
var toolStripPanel = ToolStripPanelFromString(mRemoteNG.Settings.Default.MultiSshToolbarParentDock);
toolStripPanel.Join(_multiSshToolStrip, mRemoteNG.Settings.Default.MultiSshToolbarLocation);
- }
-
- private void SetToolstripGripStyle(ToolStrip toolbar)
- {
- toolbar.GripStyle = mRemoteNG.Settings.Default.LockToolbars
- ? ToolStripGripStyle.Hidden
- : ToolStripGripStyle.Visible;
}
-
- private ToolStripPanel ToolStripPanelFromString(string panel)
- {
- switch (panel.ToLower())
- {
- case "top":
- return MainForm.tsContainer.TopToolStripPanel;
- case "bottom":
- return MainForm.tsContainer.BottomToolStripPanel;
- case "left":
- return MainForm.tsContainer.LeftToolStripPanel;
- case "right":
- return MainForm.tsContainer.RightToolStripPanel;
- default:
- return MainForm.tsContainer.TopToolStripPanel;
- }
- }
- private void LoadExternalAppsFromXml()
- {
+ private void SetToolstripGripStyle(ToolStrip toolbar)
+ {
+ toolbar.GripStyle = mRemoteNG.Settings.Default.LockToolbars
+ ? ToolStripGripStyle.Hidden
+ : ToolStripGripStyle.Visible;
+ }
+
+ private ToolStripPanel ToolStripPanelFromString(string panel)
+ {
+ switch (panel.ToLower())
+ {
+ case "top":
+ return MainForm.tsContainer.TopToolStripPanel;
+ case "bottom":
+ return MainForm.tsContainer.BottomToolStripPanel;
+ case "left":
+ return MainForm.tsContainer.LeftToolStripPanel;
+ case "right":
+ return MainForm.tsContainer.RightToolStripPanel;
+ default:
+ return MainForm.tsContainer.TopToolStripPanel;
+ }
+ }
+
+ private void LoadExternalAppsFromXml()
+ {
_externalAppsLoader.LoadExternalAppsFromXML();
}
+
#endregion
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Config/Settings/SettingsSaver.cs b/mRemoteV1/Config/Settings/SettingsSaver.cs
index 1d4c71d3..b8fe2b6b 100644
--- a/mRemoteV1/Config/Settings/SettingsSaver.cs
+++ b/mRemoteV1/Config/Settings/SettingsSaver.cs
@@ -11,11 +11,10 @@ namespace mRemoteNG.Config.Settings
{
public static class SettingsSaver
{
- public static void SaveSettings(
- Control quickConnectToolStrip,
- ExternalToolsToolStrip externalToolsToolStrip,
- MultiSshToolStrip multiSshToolStrip,
- FrmMain frmMain)
+ public static void SaveSettings(Control quickConnectToolStrip,
+ ExternalToolsToolStrip externalToolsToolStrip,
+ MultiSshToolStrip multiSshToolStrip,
+ FrmMain frmMain)
{
try
{
@@ -100,9 +99,9 @@ namespace mRemoteNG.Config.Settings
{
var panelLayoutXmlFilePath = SettingsFileInfo.SettingsPath + "\\" + SettingsFileInfo.LayoutFileName;
var panelLayoutSaver = new DockPanelLayoutSaver(
- new DockPanelLayoutSerializer(),
- new FileDataProvider(panelLayoutXmlFilePath)
- );
+ new DockPanelLayoutSerializer(),
+ new FileDataProvider(panelLayoutXmlFilePath)
+ );
panelLayoutSaver.Save();
}
diff --git a/mRemoteV1/Connection/AbstractConnectionRecord.cs b/mRemoteV1/Connection/AbstractConnectionRecord.cs
index a7f8c6fb..b5917367 100644
--- a/mRemoteV1/Connection/AbstractConnectionRecord.cs
+++ b/mRemoteV1/Connection/AbstractConnectionRecord.cs
@@ -11,10 +11,11 @@ using mRemoteNG.Tools;
namespace mRemoteNG.Connection
{
- [Obsolete("Valid for mRemoteNG v1.75 (confCons v2.6) or earlier")]
+ [Obsolete("Valid for mRemoteNG v1.75 (confCons v2.6) or earlier")]
public abstract class AbstractConnectionRecord : INotifyPropertyChanged
{
#region Fields
+
private string _name;
private string _description;
private string _icon;
@@ -79,10 +80,13 @@ namespace mRemoteNG.Connection
private ProtocolVNC.Colors _vncColors;
private ProtocolVNC.SmartSizeMode _vncSmartSizeMode;
private bool _vncViewOnly;
+
#endregion
#region Properties
+
#region Display
+
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay"),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameName"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionName")]
@@ -93,8 +97,8 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay"),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameDescription"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDescription")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameDescription"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDescription")]
public virtual string Description
{
get => GetPropertyValue("Description", _description);
@@ -102,9 +106,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay"),
- TypeConverter(typeof(ConnectionIcon)),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameIcon"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionIcon")]
+ TypeConverter(typeof(ConnectionIcon)),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameIcon"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionIcon")]
public virtual string Icon
{
get => GetPropertyValue("Icon", _icon);
@@ -112,19 +116,21 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay"),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNamePanel"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPanel")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNamePanel"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPanel")]
public virtual string Panel
{
get => GetPropertyValue("Panel", _panel);
set => SetField(ref _panel, value, "Panel");
}
+
#endregion
#region Connection
+
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 2),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameAddress"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAddress")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameAddress"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAddress")]
public virtual string Hostname
{
get => _hostname.Trim();
@@ -132,8 +138,8 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 2),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameUsername"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUsername")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameUsername"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUsername")]
public virtual string Username
{
get => GetPropertyValue("Username", _username);
@@ -141,9 +147,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 2),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNamePassword"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPassword"),
- PasswordPropertyText(true)]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNamePassword"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPassword"),
+ PasswordPropertyText(true)]
public virtual string Password
{
get => GetPropertyValue("Password", _password);
@@ -151,20 +157,22 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 2),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameDomain"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDomain")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameDomain"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDomain")]
public string Domain
{
get => GetPropertyValue("Domain", _domain).Trim();
set => SetField(ref _domain, value?.Trim(), "Domain");
}
+
#endregion
#region Protocol
+
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameProtocol"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionProtocol"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameProtocol"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionProtocol"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public virtual ProtocolType Protocol
{
get => GetPropertyValue("Protocol", _protocol);
@@ -172,9 +180,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalTool"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalTool"),
- TypeConverter(typeof(ExternalToolsTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalTool"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalTool"),
+ TypeConverter(typeof(ExternalToolsTypeConverter))]
public string ExtApp
{
get => GetPropertyValue("ExtApp", _extApp);
@@ -182,8 +190,8 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNamePort"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPort")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNamePort"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPort")]
public virtual int Port
{
get => GetPropertyValue("Port", _port);
@@ -191,9 +199,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNamePuttySession"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPuttySession"),
- TypeConverter(typeof(Config.Putty.PuttySessionsManager.SessionList))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNamePuttySession"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPuttySession"),
+ TypeConverter(typeof(Config.Putty.PuttySessionsManager.SessionList))]
public virtual string PuttySession
{
get => GetPropertyValue("PuttySession", _puttySession);
@@ -201,9 +209,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameEncryptionStrength"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEncryptionStrength"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameEncryptionStrength"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEncryptionStrength"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public IcaProtocol.EncryptionStrength ICAEncryptionStrength
{
get => GetPropertyValue("ICAEncryptionStrength", _icaEncryption);
@@ -211,9 +219,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameUseConsoleSession"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUseConsoleSession"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameUseConsoleSession"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUseConsoleSession"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool UseConsoleSession
{
get => GetPropertyValue("UseConsoleSession", _useConsoleSession);
@@ -221,9 +229,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationLevel"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationLevel"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationLevel"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationLevel"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.AuthenticationLevel RDPAuthenticationLevel
{
get => GetPropertyValue("RDPAuthenticationLevel", _rdpAuthenticationLevel);
@@ -231,23 +239,24 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDPMinutesToIdleTimeout"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDPMinutesToIdleTimeout")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDPMinutesToIdleTimeout"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDPMinutesToIdleTimeout")]
public virtual int RDPMinutesToIdleTimeout
{
get => GetPropertyValue("RDPMinutesToIdleTimeout", _rdpMinutesToIdleTimeout);
- set {
- if(value < 0)
+ set
+ {
+ if (value < 0)
value = 0;
- else if(value > 240)
+ else if (value > 240)
value = 240;
SetField(ref _rdpMinutesToIdleTimeout, value, "RDPMinutesToIdleTimeout");
}
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDPAlertIdleTimeout"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDPAlertIdleTimeout")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDPAlertIdleTimeout"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDPAlertIdleTimeout")]
public bool RDPAlertIdleTimeout
{
get => GetPropertyValue("RDPAlertIdleTimeout", _rdpAlertIdleTimeout);
@@ -255,8 +264,8 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameLoadBalanceInfo"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionLoadBalanceInfo")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameLoadBalanceInfo"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionLoadBalanceInfo")]
public string LoadBalanceInfo
{
get => GetPropertyValue("LoadBalanceInfo", _loadBalanceInfo).Trim();
@@ -264,9 +273,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRenderingEngine"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRenderingEngine"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRenderingEngine"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRenderingEngine"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public HTTPBase.RenderingEngine RenderingEngine
{
get => GetPropertyValue("RenderingEngine", _renderingEngine);
@@ -274,21 +283,23 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameUseCredSsp"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUseCredSsp"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameUseCredSsp"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUseCredSsp"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool UseCredSsp
{
get => GetPropertyValue("UseCredSsp", _useCredSsp);
set => SetField(ref _useCredSsp, value, "UseCredSsp");
}
+
#endregion
#region RD Gateway
+
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUsageMethod"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUsageMethod"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUsageMethod"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUsageMethod"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDGatewayUsageMethod RDGatewayUsageMethod
{
get => GetPropertyValue("RDGatewayUsageMethod", _rdGatewayUsageMethod);
@@ -296,8 +307,8 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayHostname"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayHostname")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayHostname"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayHostname")]
public string RDGatewayHostname
{
get => GetPropertyValue("RDGatewayHostname", _rdGatewayHostname).Trim();
@@ -305,9 +316,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUseConnectionCredentials"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUseConnectionCredentials"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUseConnectionCredentials"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUseConnectionCredentials"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDGatewayUseConnectionCredentials RDGatewayUseConnectionCredentials
{
get => GetPropertyValue("RDGatewayUseConnectionCredentials", _rdGatewayUseConnectionCredentials);
@@ -315,8 +326,8 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUsername"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUsername")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUsername"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUsername")]
public string RDGatewayUsername
{
get => GetPropertyValue("RDGatewayUsername", _rdGatewayUsername).Trim();
@@ -324,9 +335,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayPassword"),
- LocalizedAttributes.LocalizedDescription("strPropertyNameRDGatewayPassword"),
- PasswordPropertyText(true)]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayPassword"),
+ LocalizedAttributes.LocalizedDescription("strPropertyNameRDGatewayPassword"),
+ PasswordPropertyText(true)]
public string RDGatewayPassword
{
get => GetPropertyValue("RDGatewayPassword", _rdGatewayPassword);
@@ -334,20 +345,22 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayDomain"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayDomain")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayDomain"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayDomain")]
public string RDGatewayDomain
{
get => GetPropertyValue("RDGatewayDomain", _rdGatewayDomain).Trim();
set => SetField(ref _rdGatewayDomain, value?.Trim(), "RDGatewayDomain");
}
+
#endregion
#region Appearance
+
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameResolution"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionResolution"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameResolution"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionResolution"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDPResolutions Resolution
{
get => GetPropertyValue("Resolution", _resolution);
@@ -355,9 +368,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameAutomaticResize"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAutomaticResize"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameAutomaticResize"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAutomaticResize"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool AutomaticResize
{
get => GetPropertyValue("AutomaticResize", _automaticResize);
@@ -365,9 +378,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDPColors Colors
{
get => GetPropertyValue("Colors", _colors);
@@ -375,9 +388,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameCacheBitmaps"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionCacheBitmaps"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameCacheBitmaps"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionCacheBitmaps"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool CacheBitmaps
{
get => GetPropertyValue("CacheBitmaps", _cacheBitmaps);
@@ -385,9 +398,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameDisplayWallpaper"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDisplayWallpaper"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameDisplayWallpaper"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDisplayWallpaper"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool DisplayWallpaper
{
get => GetPropertyValue("DisplayWallpaper", _displayWallpaper);
@@ -395,9 +408,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameDisplayThemes"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDisplayThemes"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameDisplayThemes"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDisplayThemes"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool DisplayThemes
{
get => GetPropertyValue("DisplayThemes", _displayThemes);
@@ -405,9 +418,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameEnableFontSmoothing"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEnableFontSmoothing"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameEnableFontSmoothing"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEnableFontSmoothing"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool EnableFontSmoothing
{
get => GetPropertyValue("EnableFontSmoothing", _enableFontSmoothing);
@@ -415,21 +428,23 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameEnableDesktopComposition"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEnableDesktopComposition"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameEnableDesktopComposition"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEnableDesktopComposition"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool EnableDesktopComposition
{
get => GetPropertyValue("EnableDesktopComposition", _enableDesktopComposition);
set => SetField(ref _enableDesktopComposition, value, "EnableDesktopComposition");
}
+
#endregion
#region Redirect
+
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectKeys"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectKeys"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectKeys"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectKeys"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectKeys
{
get => GetPropertyValue("RedirectKeys", _redirectKeys);
@@ -437,9 +452,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectDrives"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectDrives"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectDrives"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectDrives"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectDiskDrives
{
get => GetPropertyValue("RedirectDiskDrives", _redirectDiskDrives);
@@ -447,9 +462,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectPrinters"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectPrinters"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectPrinters"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectPrinters"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectPrinters
{
get => GetPropertyValue("RedirectPrinters", _redirectPrinters);
@@ -457,9 +472,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectClipboard"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectClipboard"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectClipboard"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectClipboard"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectClipboard
{
get { return GetPropertyValue("RedirectClipboard", _redirectClipboard); }
@@ -467,9 +482,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectPorts"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectPorts"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectPorts"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectPorts"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectPorts
{
get => GetPropertyValue("RedirectPorts", _redirectPorts);
@@ -477,9 +492,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSmartCards"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSmartCards"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSmartCards"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSmartCards"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectSmartCards
{
get => GetPropertyValue("RedirectSmartCards", _redirectSmartCards);
@@ -487,9 +502,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSounds"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSounds"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSounds"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSounds"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDPSounds RedirectSound
{
get => GetPropertyValue("RedirectSound", _redirectSound);
@@ -497,24 +512,25 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameSoundQuality"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionSoundQuality"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameSoundQuality"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionSoundQuality"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public RdpProtocol.RDPSoundQuality SoundQuality
{
get => GetPropertyValue("SoundQuality", _soundQuality);
set => SetField(ref _soundQuality, value, "SoundQuality");
}
+
#endregion
#region Misc
- [Browsable(false)]
- public string ConstantID { get; /*set;*/ }
+
+ [Browsable(false)] public string ConstantID { get; /*set;*/ }
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolBefore"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolBefore"),
- TypeConverter(typeof(ExternalToolsTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolBefore"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolBefore"),
+ TypeConverter(typeof(ExternalToolsTypeConverter))]
public virtual string PreExtApp
{
get => GetPropertyValue("PreExtApp", _preExtApp);
@@ -522,9 +538,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolAfter"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolAfter"),
- TypeConverter(typeof(ExternalToolsTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolAfter"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolAfter"),
+ TypeConverter(typeof(ExternalToolsTypeConverter))]
public virtual string PostExtApp
{
get => GetPropertyValue("PostExtApp", _postExtApp);
@@ -532,8 +548,8 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameMACAddress"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionMACAddress")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameMACAddress"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionMACAddress")]
public virtual string MacAddress
{
get => GetPropertyValue("MacAddress", _macAddress);
@@ -541,21 +557,23 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameUser1"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUser1")]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameUser1"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUser1")]
public virtual string UserField
{
get => GetPropertyValue("UserField", _userField);
set => SetField(ref _userField, value, "UserField");
}
+
#endregion
#region VNC
+
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- Browsable(false),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameCompression"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionCompression"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ Browsable(false),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameCompression"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionCompression"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.Compression VNCCompression
{
get => GetPropertyValue("VNCCompression", _vncCompression);
@@ -563,10 +581,10 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- Browsable(false),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameEncoding"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEncoding"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ Browsable(false),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameEncoding"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEncoding"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.Encoding VNCEncoding
{
get => GetPropertyValue("VNCEncoding", _vncEncoding);
@@ -574,10 +592,10 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 2),
- Browsable(false),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationMode"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationMode"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ Browsable(false),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationMode"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationMode"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.AuthMode VNCAuthMode
{
get => GetPropertyValue("VNCAuthMode", _vncAuthMode);
@@ -585,10 +603,10 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
- Browsable(false),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyType"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyType"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ Browsable(false),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyType"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyType"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.ProxyType VNCProxyType
{
get => GetPropertyValue("VNCProxyType", _vncProxyType);
@@ -596,9 +614,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
- Browsable(false),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyAddress"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyAddress")]
+ Browsable(false),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyAddress"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyAddress")]
public string VNCProxyIP
{
get => GetPropertyValue("VNCProxyIP", _vncProxyIp);
@@ -606,9 +624,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
- Browsable(false),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyPort"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyPort")]
+ Browsable(false),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyPort"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyPort")]
public int VNCProxyPort
{
get => GetPropertyValue("VNCProxyPort", _vncProxyPort);
@@ -616,9 +634,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
- Browsable(false),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyUsername"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyUsername")]
+ Browsable(false),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyUsername"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyUsername")]
public string VNCProxyUsername
{
get => GetPropertyValue("VNCProxyUsername", _vncProxyUsername);
@@ -626,10 +644,10 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
- Browsable(false),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyPassword"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyPassword"),
- PasswordPropertyText(true)]
+ Browsable(false),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyPassword"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyPassword"),
+ PasswordPropertyText(true)]
public string VNCProxyPassword
{
get => GetPropertyValue("VNCProxyPassword", _vncProxyPassword);
@@ -637,10 +655,10 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- Browsable(false),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ Browsable(false),
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.Colors VNCColors
{
get => GetPropertyValue("VNCColors", _vncColors);
@@ -648,9 +666,9 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameSmartSizeMode"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionSmartSizeMode"),
- TypeConverter(typeof(MiscTools.EnumTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameSmartSizeMode"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionSmartSizeMode"),
+ TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.SmartSizeMode VNCSmartSizeMode
{
get => GetPropertyValue("VNCSmartSizeMode", _vncSmartSizeMode);
@@ -658,21 +676,23 @@ namespace mRemoteNG.Connection
}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
- LocalizedAttributes.LocalizedDisplayName("strPropertyNameViewOnly"),
- LocalizedAttributes.LocalizedDescription("strPropertyDescriptionViewOnly"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayName("strPropertyNameViewOnly"),
+ LocalizedAttributes.LocalizedDescription("strPropertyDescriptionViewOnly"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool VNCViewOnly
{
get => GetPropertyValue("VNCViewOnly", _vncViewOnly);
set => SetField(ref _vncViewOnly, value, "VNCViewOnly");
}
- #endregion
+
#endregion
- protected AbstractConnectionRecord(string uniqueId)
- {
- ConstantID = uniqueId.ThrowIfNullOrEmpty(nameof(uniqueId));
- }
+ #endregion
+
+ protected AbstractConnectionRecord(string uniqueId)
+ {
+ ConstantID = uniqueId.ThrowIfNullOrEmpty(nameof(uniqueId));
+ }
protected virtual TPropertyType GetPropertyValue(string propertyName, TPropertyType value)
{
@@ -680,6 +700,7 @@ namespace mRemoteNG.Connection
}
public event PropertyChangedEventHandler PropertyChanged;
+
protected virtual void RaisePropertyChangedEvent(object sender, PropertyChangedEventArgs args)
{
PropertyChanged?.Invoke(sender, new PropertyChangedEventArgs(args.PropertyName));
diff --git a/mRemoteV1/Connection/ConnectionIcon.cs b/mRemoteV1/Connection/ConnectionIcon.cs
index fc4397c1..60bae3c1 100644
--- a/mRemoteV1/Connection/ConnectionIcon.cs
+++ b/mRemoteV1/Connection/ConnectionIcon.cs
@@ -6,43 +6,45 @@ using mRemoteNG.App.Info;
namespace mRemoteNG.Connection
{
- public class ConnectionIcon : StringConverter
- {
- public static string[] Icons = {};
-
- public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
- {
- return new StandardValuesCollection(Icons);
- }
-
- public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
- {
- return true;
- }
-
- public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
- {
- return true;
- }
-
- public static System.Drawing.Icon FromString(string iconName)
- {
- try
- {
- var iconPath = $"{GeneralAppInfo.HomePath}\\Icons\\{iconName}.ico";
-
- if (System.IO.File.Exists(iconPath))
- {
- var nI = new System.Drawing.Icon(iconPath);
- return nI;
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
- $"Couldn\'t get Icon from String" + Environment.NewLine + ex.Message);
- }
- return null;
- }
- }
-}
+ public class ConnectionIcon : StringConverter
+ {
+ public static string[] Icons = { };
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ return new StandardValuesCollection(Icons);
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+
+ public static System.Drawing.Icon FromString(string iconName)
+ {
+ try
+ {
+ var iconPath = $"{GeneralAppInfo.HomePath}\\Icons\\{iconName}.ico";
+
+ if (System.IO.File.Exists(iconPath))
+ {
+ var nI = new System.Drawing.Icon(iconPath);
+ return nI;
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ $"Couldn\'t get Icon from String" + Environment.NewLine +
+ ex.Message);
+ }
+
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/ConnectionInfo.cs b/mRemoteV1/Connection/ConnectionInfo.cs
index 46fe5ff8..2e1e38ae 100644
--- a/mRemoteV1/Connection/ConnectionInfo.cs
+++ b/mRemoteV1/Connection/ConnectionInfo.cs
@@ -21,22 +21,18 @@ namespace mRemoteNG.Connection
{
[DefaultProperty("Name")]
public class ConnectionInfo : AbstractConnectionRecord, IHasParent, IInheritable
- {
+ {
#region Public Properties
- [Browsable(false)]
- public ConnectionInfoInheritance Inheritance { get; set; }
- [Browsable(false)]
- public ProtocolList OpenConnections { get; protected set; }
+ [Browsable(false)] public ConnectionInfoInheritance Inheritance { get; set; }
- [Browsable(false)]
- public virtual bool IsContainer { get; set; }
+ [Browsable(false)] public ProtocolList OpenConnections { get; protected set; }
- [Browsable(false)]
- public bool IsDefault { get; set; }
+ [Browsable(false)] public virtual bool IsContainer { get; set; }
- [Browsable(false)]
- public ContainerInfo Parent { get; internal set; }
+ [Browsable(false)] public bool IsDefault { get; set; }
+
+ [Browsable(false)] public ContainerInfo Parent { get; internal set; }
//[Browsable(false)]
//private int PositionID { get; set; }
@@ -45,20 +41,20 @@ namespace mRemoteNG.Connection
// ReSharper disable once UnusedAutoPropertyAccessor.Global
public bool IsQuickConnect { get; set; }
- [Browsable(false)]
- public bool PleaseConnect { get; set; }
- #endregion
+ [Browsable(false)] public bool PleaseConnect { get; set; }
+
+ #endregion
#region Constructors
- public ConnectionInfo()
- : this(Guid.NewGuid().ToString())
- {
- }
+ public ConnectionInfo()
+ : this(Guid.NewGuid().ToString())
+ {
+ }
public ConnectionInfo(string uniqueId)
- : base(uniqueId)
- {
+ : base(uniqueId)
+ {
SetTreeDisplayDefaults();
SetConnectionDefaults();
SetProtocolDefaults();
@@ -69,56 +65,59 @@ namespace mRemoteNG.Connection
SetVncDefaults();
SetNonBrowsablePropertiesDefaults();
SetDefaults();
- }
+ }
+
#endregion
-
+
#region Public Methods
- public virtual ConnectionInfo Clone()
- {
- var newConnectionInfo = new ConnectionInfo();
+
+ public virtual ConnectionInfo Clone()
+ {
+ var newConnectionInfo = new ConnectionInfo();
newConnectionInfo.CopyFrom(this);
- newConnectionInfo.Inheritance = Inheritance.Clone();
+ newConnectionInfo.Inheritance = Inheritance.Clone();
newConnectionInfo.Inheritance.Parent = newConnectionInfo;
return newConnectionInfo;
- }
+ }
- public void CopyFrom(ConnectionInfo sourceConnectionInfo)
- {
- var properties = GetType().BaseType?.GetProperties().Where(prop => prop.CanRead && prop.CanWrite);
- if (properties == null) return;
- foreach (var property in properties)
- {
- if (property.Name == nameof(Parent)) continue;
- var remotePropertyValue = property.GetValue(sourceConnectionInfo, null);
+ public void CopyFrom(ConnectionInfo sourceConnectionInfo)
+ {
+ var properties = GetType().BaseType?.GetProperties().Where(prop => prop.CanRead && prop.CanWrite);
+ if (properties == null) return;
+ foreach (var property in properties)
+ {
+ if (property.Name == nameof(Parent)) continue;
+ var remotePropertyValue = property.GetValue(sourceConnectionInfo, null);
property.SetValue(this, remotePropertyValue, null);
- }
+ }
+
var clonedInheritance = sourceConnectionInfo.Inheritance.Clone();
clonedInheritance.Parent = this;
Inheritance = clonedInheritance;
}
- public virtual TreeNodeType GetTreeNodeType()
- {
- return TreeNodeType.Connection;
- }
+ public virtual TreeNodeType GetTreeNodeType()
+ {
+ return TreeNodeType.Connection;
+ }
private void SetDefaults()
- {
- if (Port == 0)
- {
- SetDefaultPort();
- }
- }
-
- public int GetDefaultPort()
- {
- return GetDefaultPort(Protocol);
- }
-
- public void SetDefaultPort()
- {
- Port = GetDefaultPort();
- }
+ {
+ if (Port == 0)
+ {
+ SetDefaultPort();
+ }
+ }
+
+ public int GetDefaultPort()
+ {
+ return GetDefaultPort(Protocol);
+ }
+
+ public void SetDefaultPort()
+ {
+ Port = GetDefaultPort();
+ }
protected virtual IEnumerable GetProperties(string[] excludedPropertyNames)
{
@@ -127,60 +126,67 @@ namespace mRemoteNG.Connection
return filteredProperties;
}
- public virtual IEnumerable GetSerializableProperties()
- {
- var excludedProperties = new[] { "Parent", "Name", "Hostname", "Port", "Inheritance", "OpenConnections",
- "IsContainer", "IsDefault", "PositionID", "ConstantID", "TreeNode", "IsQuickConnect", "PleaseConnect" };
+ public virtual IEnumerable GetSerializableProperties()
+ {
+ var excludedProperties = new[]
+ {
+ "Parent", "Name", "Hostname", "Port", "Inheritance", "OpenConnections",
+ "IsContainer", "IsDefault", "PositionID", "ConstantID", "TreeNode", "IsQuickConnect", "PleaseConnect"
+ };
- return GetProperties(excludedProperties);
- }
+ return GetProperties(excludedProperties);
+ }
- public virtual void SetParent(ContainerInfo newParent)
- {
+ public virtual void SetParent(ContainerInfo newParent)
+ {
RemoveParent();
- newParent?.AddChild(this);
- }
+ newParent?.AddChild(this);
+ }
public void RemoveParent()
{
Parent?.RemoveChild(this);
}
- public ConnectionInfo GetRootParent()
- {
- return Parent != null ? Parent.GetRootParent() : this;
- }
+ public ConnectionInfo GetRootParent()
+ {
+ return Parent != null ? Parent.GetRootParent() : this;
+ }
- #endregion
+ #endregion
#region Public Enumerations
+
[Flags()]
public enum Force
- {
- None = 0,
- UseConsoleSession = 1,
- Fullscreen = 2,
- DoNotJump = 4,
- OverridePanel = 8,
- DontUseConsoleSession = 16,
- NoCredentials = 32
- }
+ {
+ None = 0,
+ UseConsoleSession = 1,
+ Fullscreen = 2,
+ DoNotJump = 4,
+ OverridePanel = 8,
+ DontUseConsoleSession = 16,
+ NoCredentials = 32
+ }
+
#endregion
-
+
#region Private Methods
+
protected override TPropertyType GetPropertyValue(string propertyName, TPropertyType value)
{
if (!ShouldThisPropertyBeInherited(propertyName))
return value;
- var couldGetInheritedValue = TryGetInheritedPropertyValue(propertyName, out var inheritedValue);
+ var couldGetInheritedValue =
+ TryGetInheritedPropertyValue(propertyName, out var inheritedValue);
return couldGetInheritedValue
? inheritedValue
: value;
}
- private bool ShouldThisPropertyBeInherited(string propertyName)
+ private bool ShouldThisPropertyBeInherited(string propertyName)
{
return ParentIsValidInheritanceTarget() && IsInheritanceTurnedOnForThisProperty(propertyName);
}
@@ -194,7 +200,8 @@ namespace mRemoteNG.Connection
{
var inheritType = Inheritance.GetType();
var inheritPropertyInfo = inheritType.GetProperty(propertyName);
- var inheritPropertyValue = inheritPropertyInfo != null && Convert.ToBoolean(inheritPropertyInfo.GetValue(Inheritance, null));
+ var inheritPropertyValue = inheritPropertyInfo != null &&
+ Convert.ToBoolean(inheritPropertyInfo.GetValue(Inheritance, null));
return inheritPropertyValue;
}
@@ -205,24 +212,26 @@ namespace mRemoteNG.Connection
var connectionInfoType = Parent.GetType();
var parentPropertyInfo = connectionInfoType.GetProperty(propertyName);
if (parentPropertyInfo == null)
- throw new NullReferenceException($"Could not retrieve property data for property '{propertyName}' on parent node '{Parent?.Name}'");
+ throw new NullReferenceException(
+ $"Could not retrieve property data for property '{propertyName}' on parent node '{Parent?.Name}'");
inheritedValue = (TPropertyType)parentPropertyInfo.GetValue(Parent, null);
return true;
}
catch (Exception e)
{
- Runtime.MessageCollector.AddExceptionStackTrace($"Error retrieving inherited property '{propertyName}'", e);
+ Runtime.MessageCollector.AddExceptionStackTrace($"Error retrieving inherited property '{propertyName}'",
+ e);
inheritedValue = default(TPropertyType);
return false;
}
}
- private static int GetDefaultPort(ProtocolType protocol)
- {
- try
- {
- // ReSharper disable once SwitchStatementMissingSomeCases
+ private static int GetDefaultPort(ProtocolType protocol)
+ {
+ try
+ {
+ // ReSharper disable once SwitchStatementMissingSomeCases
switch (protocol)
{
case ProtocolType.RDP:
@@ -248,14 +257,15 @@ namespace mRemoteNG.Connection
case ProtocolType.IntApp:
return (int)IntegratedProgram.Defaults.Port;
}
+
return 0;
- }
- catch (Exception ex)
- {
+ }
+ catch (Exception ex)
+ {
Runtime.MessageCollector.AddExceptionMessage(Language.strConnectionSetDefaultPortFailed, ex);
return 0;
- }
- }
+ }
+ }
private void SetTreeDisplayDefaults()
{
@@ -276,31 +286,54 @@ namespace mRemoteNG.Connection
ExtApp = Settings.Default.ConDefaultExtApp;
Port = 0;
PuttySession = Settings.Default.ConDefaultPuttySession;
- ICAEncryptionStrength = (IcaProtocol.EncryptionStrength) Enum.Parse(typeof(IcaProtocol.EncryptionStrength), Settings.Default.ConDefaultICAEncryptionStrength);
+ ICAEncryptionStrength = (IcaProtocol.EncryptionStrength)Enum.Parse(typeof(IcaProtocol.EncryptionStrength),
+ Settings
+ .Default
+ .ConDefaultICAEncryptionStrength);
UseConsoleSession = Settings.Default.ConDefaultUseConsoleSession;
- RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel) Enum.Parse(typeof(RdpProtocol.AuthenticationLevel), Settings.Default.ConDefaultRDPAuthenticationLevel);
+ RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel)Enum.Parse(
+ typeof(RdpProtocol.AuthenticationLevel
+ ),
+ Settings
+ .Default
+ .ConDefaultRDPAuthenticationLevel);
RDPMinutesToIdleTimeout = Settings.Default.ConDefaultRDPMinutesToIdleTimeout;
RDPAlertIdleTimeout = Settings.Default.ConDefaultRDPAlertIdleTimeout;
LoadBalanceInfo = Settings.Default.ConDefaultLoadBalanceInfo;
- RenderingEngine = (HTTPBase.RenderingEngine) Enum.Parse(typeof(HTTPBase.RenderingEngine), Settings.Default.ConDefaultRenderingEngine);
+ RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine),
+ Settings.Default.ConDefaultRenderingEngine);
UseCredSsp = Settings.Default.ConDefaultUseCredSsp;
}
private void SetRdGatewayDefaults()
{
- RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod) Enum.Parse(typeof(RdpProtocol.RDGatewayUsageMethod), Settings.Default.ConDefaultRDGatewayUsageMethod);
+ RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod)Enum.Parse(
+ typeof(RdpProtocol.RDGatewayUsageMethod
+ ),
+ Settings
+ .Default
+ .ConDefaultRDGatewayUsageMethod);
RDGatewayHostname = Settings.Default.ConDefaultRDGatewayHostname;
- RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials) Enum.Parse(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), Settings.Default.ConDefaultRDGatewayUseConnectionCredentials);
+ RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials)Enum.Parse(
+ typeof(
+ RdpProtocol
+ .RDGatewayUseConnectionCredentials
+ ),
+ Settings
+ .Default
+ .ConDefaultRDGatewayUseConnectionCredentials);
RDGatewayUsername = Settings.Default.ConDefaultRDGatewayUsername;
RDGatewayPassword = Settings.Default.ConDefaultRDGatewayPassword;
RDGatewayDomain = Settings.Default.ConDefaultRDGatewayDomain;
}
- private void SetAppearanceDefaults()
+ private void SetAppearanceDefaults()
{
- Resolution = (RdpProtocol.RDPResolutions) Enum.Parse(typeof(RdpProtocol.RDPResolutions), Settings.Default.ConDefaultResolution);
+ Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions),
+ Settings.Default.ConDefaultResolution);
AutomaticResize = Settings.Default.ConDefaultAutomaticResize;
- Colors = (RdpProtocol.RDPColors) Enum.Parse(typeof(RdpProtocol.RDPColors), Settings.Default.ConDefaultColors);
+ Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors),
+ Settings.Default.ConDefaultColors);
CacheBitmaps = Settings.Default.ConDefaultCacheBitmaps;
DisplayWallpaper = Settings.Default.ConDefaultDisplayWallpaper;
DisplayThemes = Settings.Default.ConDefaultDisplayThemes;
@@ -316,8 +349,10 @@ namespace mRemoteNG.Connection
RedirectClipboard = Settings.Default.ConDefaultRedirectClipboard;
RedirectPorts = Settings.Default.ConDefaultRedirectPorts;
RedirectSmartCards = Settings.Default.ConDefaultRedirectSmartCards;
- RedirectSound = (RdpProtocol.RDPSounds) Enum.Parse(typeof(RdpProtocol.RDPSounds), Settings.Default.ConDefaultRedirectSound);
- SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality), Settings.Default.ConDefaultSoundQuality);
+ RedirectSound = (RdpProtocol.RDPSounds)Enum.Parse(typeof(RdpProtocol.RDPSounds),
+ Settings.Default.ConDefaultRedirectSound);
+ SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality),
+ Settings.Default.ConDefaultSoundQuality);
}
private void SetMiscDefaults()
@@ -330,16 +365,22 @@ namespace mRemoteNG.Connection
private void SetVncDefaults()
{
- VNCCompression = (ProtocolVNC.Compression) Enum.Parse(typeof(ProtocolVNC.Compression), Settings.Default.ConDefaultVNCCompression);
- VNCEncoding = (ProtocolVNC.Encoding) Enum.Parse(typeof(ProtocolVNC.Encoding), Settings.Default.ConDefaultVNCEncoding);
- VNCAuthMode = (ProtocolVNC.AuthMode) Enum.Parse(typeof(ProtocolVNC.AuthMode), Settings.Default.ConDefaultVNCAuthMode);
- VNCProxyType = (ProtocolVNC.ProxyType) Enum.Parse(typeof(ProtocolVNC.ProxyType), Settings.Default.ConDefaultVNCProxyType);
+ VNCCompression = (ProtocolVNC.Compression)Enum.Parse(typeof(ProtocolVNC.Compression),
+ Settings.Default.ConDefaultVNCCompression);
+ VNCEncoding =
+ (ProtocolVNC.Encoding)Enum.Parse(typeof(ProtocolVNC.Encoding), Settings.Default.ConDefaultVNCEncoding);
+ VNCAuthMode =
+ (ProtocolVNC.AuthMode)Enum.Parse(typeof(ProtocolVNC.AuthMode), Settings.Default.ConDefaultVNCAuthMode);
+ VNCProxyType = (ProtocolVNC.ProxyType)Enum.Parse(typeof(ProtocolVNC.ProxyType),
+ Settings.Default.ConDefaultVNCProxyType);
VNCProxyIP = Settings.Default.ConDefaultVNCProxyIP;
VNCProxyPort = Settings.Default.ConDefaultVNCProxyPort;
VNCProxyUsername = Settings.Default.ConDefaultVNCProxyUsername;
VNCProxyPassword = Settings.Default.ConDefaultVNCProxyPassword;
- VNCColors = (ProtocolVNC.Colors) Enum.Parse(typeof(ProtocolVNC.Colors), Settings.Default.ConDefaultVNCColors);
- VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode) Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), Settings.Default.ConDefaultVNCSmartSizeMode);
+ VNCColors = (ProtocolVNC.Colors)Enum.Parse(typeof(ProtocolVNC.Colors),
+ Settings.Default.ConDefaultVNCColors);
+ VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Enum.Parse(typeof(ProtocolVNC.SmartSizeMode),
+ Settings.Default.ConDefaultVNCSmartSizeMode);
VNCViewOnly = Settings.Default.ConDefaultVNCViewOnly;
}
@@ -351,10 +392,12 @@ namespace mRemoteNG.Connection
}
private void SetNewOpenConnectionList()
- {
- OpenConnections = new ProtocolList();
- OpenConnections.CollectionChanged += (sender, args) => RaisePropertyChangedEvent(this, new PropertyChangedEventArgs("OpenConnections"));
- }
+ {
+ OpenConnections = new ProtocolList();
+ OpenConnections.CollectionChanged += (sender, args) =>
+ RaisePropertyChangedEvent(this, new PropertyChangedEventArgs("OpenConnections"));
+ }
+
#endregion
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/ConnectionInfoInheritance.cs b/mRemoteV1/Connection/ConnectionInfoInheritance.cs
index c937f72a..c14c7be7 100644
--- a/mRemoteV1/Connection/ConnectionInfoInheritance.cs
+++ b/mRemoteV1/Connection/ConnectionInfoInheritance.cs
@@ -6,339 +6,412 @@ using mRemoteNG.Tools;
namespace mRemoteNG.Connection
{
- public class ConnectionInfoInheritance
- {
+ public class ConnectionInfoInheritance
+ {
private ConnectionInfoInheritance _tempInheritanceStorage;
#region Public Properties
+
#region General
+
[LocalizedAttributes.LocalizedCategory("strCategoryGeneral"),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAll"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAll"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAll"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAll"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool EverythingInherited
- {
- get { return EverythingIsInherited(); }
+ {
+ get { return EverythingIsInherited(); }
set { SetAllValues(value); }
- }
+ }
+
#endregion
+
#region Display
- [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDescription"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDescription"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Description {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameIcon"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionIcon"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Icon {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePanel"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPanel"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Panel {get; set;}
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDescription"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDescription"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool Description { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameIcon"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionIcon"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool Icon { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePanel"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPanel"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool Panel { get; set; }
+
#endregion
+
#region Connection
+
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUsername"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUsername"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUsername"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUsername"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
[Browsable(true)]
public bool Username { get; set; }
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePassword"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPassword"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePassword"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPassword"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
[Browsable(true)]
public bool Password { get; set; }
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDomain"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDomain"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDomain"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDomain"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
[Browsable(true)]
public bool Domain { get; set; }
+
#endregion
+
#region Protocol
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameProtocol"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionProtocol"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Protocol {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalTool"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalTool"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool ExtApp {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePort"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPort"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Port {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePuttySession"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPuttySession"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool PuttySession {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncryptionStrength"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncryptionStrength"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool ICAEncryptionStrength {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationLevel"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationLevel"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RDPAuthenticationLevel {get; set; }
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDPMinutesToIdleTimeout"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDPMinutesToIdleTimeout"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RDPMinutesToIdleTimeout { get; set; }
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameProtocol"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionProtocol"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool Protocol { get; set; }
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDPAlertIdleTimeout"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDPAlertIdleTimeout"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))] public bool RDPAlertIdleTimeout { get; set; }
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalTool"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalTool"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool ExtApp { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePort"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPort"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool Port { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePuttySession"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPuttySession"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool PuttySession { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncryptionStrength"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncryptionStrength"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool ICAEncryptionStrength { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationLevel"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationLevel"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RDPAuthenticationLevel { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDPMinutesToIdleTimeout"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDPMinutesToIdleTimeout"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RDPMinutesToIdleTimeout { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDPAlertIdleTimeout"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDPAlertIdleTimeout"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RDPAlertIdleTimeout { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameLoadBalanceInfo"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionLoadBalanceInfo"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool LoadBalanceInfo { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRenderingEngine"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRenderingEngine"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RenderingEngine { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseConsoleSession"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseConsoleSession"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool UseConsoleSession { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseCredSsp"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseCredSsp"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool UseCredSsp { get; set; }
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameLoadBalanceInfo"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionLoadBalanceInfo"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool LoadBalanceInfo {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRenderingEngine"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRenderingEngine"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RenderingEngine {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseConsoleSession"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseConsoleSession"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool UseConsoleSession {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseCredSsp"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseCredSsp"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool UseCredSsp {get; set;}
#endregion
+
#region RD Gateway
- [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsageMethod"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsageMethod"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
- public bool RDGatewayUsageMethod {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayHostname"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayHostname"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
- public bool RDGatewayHostname {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUseConnectionCredentials"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUseConnectionCredentials"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
- public bool RDGatewayUseConnectionCredentials {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsername"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsername"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
- public bool RDGatewayUsername {get; set;}
- [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayPassword"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayPassword"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
- public bool RDGatewayPassword {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayDomain"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayDomain"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
- public bool RDGatewayDomain {get; set;}
+ [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsageMethod"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsageMethod"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RDGatewayUsageMethod { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayHostname"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayHostname"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RDGatewayHostname { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUseConnectionCredentials"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute(
+ "strPropertyDescriptionRDGatewayUseConnectionCredentials"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RDGatewayUseConnectionCredentials { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsername"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsername"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RDGatewayUsername { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayPassword"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayPassword"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RDGatewayPassword { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayDomain"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayDomain"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RDGatewayDomain { get; set; }
+
#endregion
+
#region Appearance
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameResolution"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionResolution"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Resolution {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAutomaticResize"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAutomaticResize"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool AutomaticResize {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Colors {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCacheBitmaps"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCacheBitmaps"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool CacheBitmaps {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayWallpaper"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayWallpaper"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool DisplayWallpaper {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayThemes"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayThemes"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool DisplayThemes {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableFontSmoothing"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableFontSmoothing"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool EnableFontSmoothing {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableDesktopComposition"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableEnableDesktopComposition"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool EnableDesktopComposition {get; set;}
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameResolution"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionResolution"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool Resolution { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAutomaticResize"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAutomaticResize"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool AutomaticResize { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool Colors { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCacheBitmaps"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCacheBitmaps"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool CacheBitmaps { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayWallpaper"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayWallpaper"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool DisplayWallpaper { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayThemes"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayThemes"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool DisplayThemes { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableFontSmoothing"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableFontSmoothing"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool EnableFontSmoothing { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableDesktopComposition"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute(
+ "strPropertyDescriptionEnableEnableDesktopComposition"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool EnableDesktopComposition { get; set; }
#endregion
+
#region Redirect
- [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectKeys"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectKeys"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectKeys {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectDrives"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectDrives"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectDiskDrives {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPrinters"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPrinters"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectPrinters {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectClipboard"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectClipboard"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectClipboard { get; set; }
-
- [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPorts"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPorts"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectPorts {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSmartCards"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSmartCards"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectSmartCards {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSounds"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSounds"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectSound {get; set;}
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectKeys"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectKeys"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RedirectKeys { get; set; }
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameSoundQuality"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionSoundQuality"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectDrives"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectDrives"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RedirectDiskDrives { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPrinters"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPrinters"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RedirectPrinters { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectClipboard"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectClipboard"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RedirectClipboard { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPorts"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPorts"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RedirectPorts { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSmartCards"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSmartCards"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RedirectSmartCards { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSounds"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSounds"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool RedirectSound { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameSoundQuality"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionSoundQuality"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool SoundQuality { get; set; }
+
#endregion
+
#region Misc
- [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolBefore"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolBefore"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool PreExtApp {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolAfter"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolAfter"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool PostExtApp {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameMACAddress"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionMACAddress"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool MacAddress {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUser1"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUser1"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool UserField {get; set;}
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolBefore"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolBefore"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool PreExtApp { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolAfter"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolAfter"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool PostExtApp { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameMACAddress"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionMACAddress"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool MacAddress { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUser1"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUser1"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool UserField { get; set; }
+
#endregion
+
#region VNC
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCompression"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCompression"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCCompression {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncoding"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncoding"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCEncoding {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationMode"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationMode"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCAuthMode {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyType"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyType"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyType {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyAddress"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyAddress"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyIP {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPort"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPort"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyPort {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyUsername"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyUsername"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyUsername {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPassword"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPassword"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyPassword {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCColors {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameSmartSizeMode"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionSmartSizeMode"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCSmartSizeMode {get; set;}
-
- [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
- LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameViewOnly"),
- LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionViewOnly"),
- TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCViewOnly {get; set;}
- #endregion
-
- [Browsable(false)]
- public object Parent {get; set;}
- #endregion
-
- public ConnectionInfoInheritance(object parent, bool ignoreDefaultInheritance = false)
- {
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCompression"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCompression"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCCompression { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncoding"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncoding"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCEncoding { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationMode"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationMode"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCAuthMode { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyType"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyType"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCProxyType { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyAddress"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyAddress"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCProxyIP { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPort"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPort"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCProxyPort { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyUsername"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyUsername"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCProxyUsername { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPassword"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPassword"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCProxyPassword { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCColors { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameSmartSizeMode"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionSmartSizeMode"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCSmartSizeMode { get; set; }
+
+ [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
+ LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameViewOnly"),
+ LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionViewOnly"),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool VNCViewOnly { get; set; }
+
+ #endregion
+
+ [Browsable(false)] public object Parent { get; set; }
+
+ #endregion
+
+
+ public ConnectionInfoInheritance(object parent, bool ignoreDefaultInheritance = false)
+ {
Parent = parent;
- if (!ignoreDefaultInheritance)
- SetAllValues(DefaultConnectionInheritance.Instance);
- }
+ if (!ignoreDefaultInheritance)
+ SetAllValues(DefaultConnectionInheritance.Instance);
+ }
- public ConnectionInfoInheritance Clone()
- {
- var newInheritance = (ConnectionInfoInheritance) MemberwiseClone();
- newInheritance._tempInheritanceStorage = null;
+ public ConnectionInfoInheritance Clone()
+ {
+ var newInheritance = (ConnectionInfoInheritance)MemberwiseClone();
+ newInheritance._tempInheritanceStorage = null;
return newInheritance;
- }
+ }
public void EnableInheritance()
{
@@ -364,14 +437,14 @@ namespace mRemoteNG.Connection
}
public void TurnOnInheritanceCompletely()
- {
- SetAllValues(true);
- }
-
- public void TurnOffInheritanceCompletely()
- {
- SetAllValues(false);
- }
+ {
+ SetAllValues(true);
+ }
+
+ public void TurnOffInheritanceCompletely()
+ {
+ SetAllValues(false);
+ }
private bool EverythingIsInherited()
{
@@ -389,13 +462,13 @@ namespace mRemoteNG.Connection
private bool FilterProperty(PropertyInfo propertyInfo)
{
- var exclusions = new[] { "EverythingInherited", "Parent" };
+ var exclusions = new[] {"EverythingInherited", "Parent"};
var valueShouldNotBeFiltered = !exclusions.Contains(propertyInfo.Name);
return valueShouldNotBeFiltered;
}
- private void SetAllValues(bool value)
- {
+ private void SetAllValues(bool value)
+ {
var properties = GetProperties();
foreach (var property in properties)
{
@@ -404,7 +477,7 @@ namespace mRemoteNG.Connection
}
}
- private void SetAllValues(ConnectionInfoInheritance otherInheritanceObject)
+ private void SetAllValues(ConnectionInfoInheritance otherInheritanceObject)
{
var properties = GetProperties();
foreach (var property in properties)
diff --git a/mRemoteV1/Connection/ConnectionInitiator.cs b/mRemoteV1/Connection/ConnectionInitiator.cs
index 3e61d381..635ccaed 100644
--- a/mRemoteV1/Connection/ConnectionInitiator.cs
+++ b/mRemoteV1/Connection/ConnectionInitiator.cs
@@ -20,6 +20,7 @@ namespace mRemoteNG.Connection
private readonly List _activeConnections = new List();
public IEnumerable ActiveConnections => _activeConnections;
+
public void OpenConnection(ContainerInfo containerInfo, ConnectionInfo.Force force = ConnectionInfo.Force.None)
{
OpenConnection(containerInfo, force, null);
@@ -61,6 +62,7 @@ namespace mRemoteNG.Connection
}
#region Private
+
private void OpenConnection(ContainerInfo containerInfo, ConnectionInfo.Force force, Form conForm)
{
var children = containerInfo.Children;
@@ -80,7 +82,8 @@ namespace mRemoteNG.Connection
{
if (connectionInfo.Hostname == "" && connectionInfo.Protocol != ProtocolType.IntApp)
{
- Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, Language.strConnectionOpenFailedNoHostname);
+ Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
+ Language.strConnectionOpenFailedNoHostname);
return;
}
@@ -142,24 +145,26 @@ namespace mRemoteNG.Connection
// the new structure is ConnectionWindow.Controls[0].ActiveDocument.Controls[0]
// DockPanel InterfaceControl
if (!(Runtime.WindowList[i] is ConnectionWindow connectionWindow)) continue;
- if(connectionWindow.Controls.Count < 1) continue;
+ if (connectionWindow.Controls.Count < 1) continue;
if (!(connectionWindow.Controls[0] is DockPanel cwDp)) continue;
foreach (var dockContent in cwDp.Documents)
{
- var tab = (ConnectionTab) dockContent;
+ var tab = (ConnectionTab)dockContent;
var ic = InterfaceControl.FindInterfaceControl(tab);
if (ic == null) continue;
if (ic.Info == connectionInfo)
return ic;
}
}
+
return null;
}
private static string SetConnectionPanel(ConnectionInfo connectionInfo, ConnectionInfo.Force force)
{
string connectionPanel;
- if (connectionInfo.Panel == "" || force.HasFlag(ConnectionInfo.Force.OverridePanel) || Settings.Default.AlwaysShowPanelSelectionDlg)
+ if (connectionInfo.Panel == "" || force.HasFlag(ConnectionInfo.Force.OverridePanel) ||
+ Settings.Default.AlwaysShowPanelSelectionDlg)
{
var frmPnl = new FrmChoosePanel();
if (frmPnl.ShowDialog() == DialogResult.OK)
@@ -174,15 +179,16 @@ namespace mRemoteNG.Connection
else
{
//Return the current panel if exist, if not return default panel
- if(TabHelper.Instance.CurrentPanel != null)
+ if (TabHelper.Instance.CurrentPanel != null)
{
connectionPanel = TabHelper.Instance.CurrentPanel.TabText;
}
else
{
connectionPanel = connectionInfo.Panel;
- }
+ }
}
+
return connectionPanel;
}
@@ -207,9 +213,9 @@ namespace mRemoteNG.Connection
var extT = Runtime.ExternalToolsService.GetExtAppByName(connectionInfo.ExtApp);
- if(extT == null) return connectionContainer;
+ if (extT == null) return connectionContainer;
- if(extT.Icon != null)
+ if (extT.Icon != null)
((ConnectionTab)connectionContainer).Icon = extT.Icon;
return connectionContainer;
@@ -220,7 +226,7 @@ namespace mRemoteNG.Connection
newProtocol.Closed += ((ConnectionWindow)connectionForm).Prot_Event_Closed;
}
- private void SetConnectionEventHandlers(ProtocolBase newProtocol)
+ private void SetConnectionEventHandlers(ProtocolBase newProtocol)
{
newProtocol.Disconnected += Prot_Event_Disconnected;
newProtocol.Connected += Prot_Event_Connected;
@@ -228,13 +234,17 @@ namespace mRemoteNG.Connection
newProtocol.ErrorOccured += Prot_Event_ErrorOccured;
}
- private static void BuildConnectionInterfaceController(ConnectionInfo connectionInfo, ProtocolBase newProtocol, Control connectionContainer)
+ private static void BuildConnectionInterfaceController(ConnectionInfo connectionInfo,
+ ProtocolBase newProtocol,
+ Control connectionContainer)
{
newProtocol.InterfaceControl = new InterfaceControl(connectionContainer, newProtocol, connectionInfo);
}
+
#endregion
#region Event handlers
+
private static void Prot_Event_Disconnected(object sender, string disconnectedMessage, int? reasonCode)
{
try
@@ -251,11 +261,11 @@ namespace mRemoteNG.Connection
}
Runtime.MessageCollector.AddMessage(msgClass,
- string.Format(
- Language.strProtocolEventDisconnected,
- disconnectedMessage,
- prot.InterfaceControl.Info.Hostname,
- prot.InterfaceControl.Info.Protocol.ToString()));
+ string.Format(
+ Language.strProtocolEventDisconnected,
+ disconnectedMessage,
+ prot.InterfaceControl.Info.Hostname,
+ prot.InterfaceControl.Info.Protocol.ToString()));
}
catch (Exception ex)
{
@@ -268,16 +278,21 @@ namespace mRemoteNG.Connection
try
{
var prot = (ProtocolBase)sender;
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnenctionCloseEvent, true);
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnenctionCloseEvent,
+ true);
string connDetail;
- if (prot.InterfaceControl.Info.Hostname == "" && prot.InterfaceControl.Info.Protocol == ProtocolType.IntApp)
+ if (prot.InterfaceControl.Info.Hostname == "" &&
+ prot.InterfaceControl.Info.Protocol == ProtocolType.IntApp)
connDetail = prot.InterfaceControl.Info.ExtApp;
else if (prot.InterfaceControl.Info.Hostname != "")
connDetail = prot.InterfaceControl.Info.Hostname;
else
connDetail = "UNKNOWN";
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strConnenctionClosedByUser, connDetail, prot.InterfaceControl.Info.Protocol, Environment.UserName));
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strConnenctionClosedByUser, connDetail,
+ prot.InterfaceControl.Info.Protocol,
+ Environment.UserName));
prot.InterfaceControl.Info.OpenConnections.Remove(prot);
if (_activeConnections.Contains(prot.InterfaceControl.Info.ConstantID))
_activeConnections.Remove(prot.InterfaceControl.Info.ConstantID);
@@ -295,21 +310,27 @@ namespace mRemoteNG.Connection
private static void Prot_Event_Connected(object sender)
{
var prot = (ProtocolBase)sender;
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnectionEventConnected, true);
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strConnectionEventConnectedDetail, prot.InterfaceControl.Info.Hostname, prot.InterfaceControl.Info.Protocol, Environment.UserName, prot.InterfaceControl.Info.Description, prot.InterfaceControl.Info.UserField));
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnectionEventConnected,
+ true);
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strConnectionEventConnectedDetail,
+ prot.InterfaceControl.Info.Hostname,
+ prot.InterfaceControl.Info.Protocol, Environment.UserName,
+ prot.InterfaceControl.Info.Description,
+ prot.InterfaceControl.Info.UserField));
}
private static void Prot_Event_ErrorOccured(object sender, string errorMessage, int? errorCode)
{
try
{
- var prot = (ProtocolBase) sender;
+ var prot = (ProtocolBase)sender;
var msg = string.Format(
- Language.strConnectionEventErrorOccured,
- errorMessage,
- prot.InterfaceControl.Info.Hostname,
- errorCode?.ToString() ?? "-");
+ Language.strConnectionEventErrorOccured,
+ errorMessage,
+ prot.InterfaceControl.Info.Hostname,
+ errorCode?.ToString() ?? "-");
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, msg);
}
catch (Exception ex)
@@ -317,6 +338,7 @@ namespace mRemoteNG.Connection
Runtime.MessageCollector.AddExceptionStackTrace(Language.strConnectionEventConnectionFailed, ex);
}
}
+
#endregion
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/ConnectionsService.cs b/mRemoteV1/Connection/ConnectionsService.cs
index 5fe7c855..fc6382a2 100644
--- a/mRemoteV1/Connection/ConnectionsService.cs
+++ b/mRemoteV1/Connection/ConnectionsService.cs
@@ -45,7 +45,8 @@ namespace mRemoteNG.Connection
_puttySessionsManager = puttySessionsManager;
var path = SettingsFileInfo.SettingsPath;
- _localConnectionPropertiesDataProvider = new FileDataProvider(Path.Combine(path, "LocalConnectionProperties.xml"));
+ _localConnectionPropertiesDataProvider =
+ new FileDataProvider(Path.Combine(path, "LocalConnectionProperties.xml"));
_localConnectionPropertiesSerializer = new LocalConnectionPropertiesXmlSerializer();
}
@@ -76,7 +77,9 @@ namespace mRemoteNG.Connection
var newConnectionInfo = new ConnectionInfo();
newConnectionInfo.CopyFrom(DefaultConnectionInfo.Instance);
- newConnectionInfo.Name = Settings.Default.IdentifyQuickConnectTabs ? string.Format(Language.strQuick, uriBuilder.Host) : uriBuilder.Host;
+ newConnectionInfo.Name = Settings.Default.IdentifyQuickConnectTabs
+ ? string.Format(Language.strQuick, uriBuilder.Host)
+ : uriBuilder.Host;
newConnectionInfo.Protocol = protocol;
newConnectionInfo.Hostname = uriBuilder.Host;
@@ -116,7 +119,8 @@ namespace mRemoteNG.Connection
var oldIsUsingDatabaseValue = UsingDatabase;
var connectionLoader = useDatabase
- ? (IConnectionsLoader)new SqlConnectionsLoader(_localConnectionPropertiesSerializer, _localConnectionPropertiesDataProvider)
+ ? (IConnectionsLoader)new SqlConnectionsLoader(_localConnectionPropertiesSerializer,
+ _localConnectionPropertiesDataProvider)
: new XmlConnectionsLoader(connectionFileName);
var newConnectionTreeModel = connectionLoader.Load();
@@ -126,7 +130,8 @@ namespace mRemoteNG.Connection
if (newConnectionTreeModel == null)
{
- DialogFactory.ShowLoadConnectionsFailedDialog(connectionFileName, "Decrypting connection file failed", IsConnectionsFileLoaded);
+ DialogFactory.ShowLoadConnectionsFailedDialog(connectionFileName, "Decrypting connection file failed",
+ IsConnectionsFileLoaded);
return;
}
@@ -142,8 +147,10 @@ namespace mRemoteNG.Connection
ConnectionTreeModel = newConnectionTreeModel;
UpdateCustomConsPathSetting(connectionFileName);
- RaiseConnectionsLoadedEvent(oldConnectionTreeModel, newConnectionTreeModel, oldIsUsingDatabaseValue, useDatabase, connectionFileName);
- Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, $"Connections loaded using {connectionLoader.GetType().Name}");
+ RaiseConnectionsLoadedEvent(oldConnectionTreeModel, newConnectionTreeModel, oldIsUsingDatabaseValue,
+ useDatabase, connectionFileName);
+ Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg,
+ $"Connections loaded using {connectionLoader.GetType().Name}");
}
///
@@ -168,7 +175,7 @@ namespace mRemoteNG.Connection
if (_saveAsyncRequested)
SaveConnectionsAsync();
- else if(_saveRequested)
+ else if (_saveRequested)
SaveConnections();
}
@@ -194,13 +201,12 @@ namespace mRemoteNG.Connection
/// Optional. The name of the property that triggered
/// this save.
///
- public void SaveConnections(
- ConnectionTreeModel connectionTreeModel,
- bool useDatabase,
- SaveFilter saveFilter,
- string connectionFileName,
- bool forceSave = false,
- string propertyNameTrigger = "")
+ public void SaveConnections(ConnectionTreeModel connectionTreeModel,
+ bool useDatabase,
+ SaveFilter saveFilter,
+ string connectionFileName,
+ bool forceSave = false,
+ string propertyNameTrigger = "")
{
if (connectionTreeModel == null)
return;
@@ -222,8 +228,9 @@ namespace mRemoteNG.Connection
var previouslyUsingDatabase = UsingDatabase;
var saver = useDatabase
- ? (ISaver)new SqlConnectionsSaver(saveFilter, _localConnectionPropertiesSerializer,
- _localConnectionPropertiesDataProvider)
+ ? (ISaver)new SqlConnectionsSaver(saveFilter,
+ _localConnectionPropertiesSerializer,
+ _localConnectionPropertiesDataProvider)
: new XmlConnectionsSaver(connectionFileName, saveFilter);
saver.Save(connectionTreeModel, propertyNameTrigger);
@@ -233,12 +240,15 @@ namespace mRemoteNG.Connection
UsingDatabase = useDatabase;
ConnectionFileName = connectionFileName;
- RaiseConnectionsSavedEvent(connectionTreeModel, previouslyUsingDatabase, UsingDatabase, connectionFileName);
+ RaiseConnectionsSavedEvent(connectionTreeModel, previouslyUsingDatabase, UsingDatabase,
+ connectionFileName);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Successfully saved connections");
}
catch (Exception ex)
{
- Runtime.MessageCollector?.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotSaveAs, connectionFileName), ex, logOnly:false);
+ Runtime.MessageCollector?.AddExceptionMessage(
+ string.Format(Language.strConnectionsFileCouldNotSaveAs,
+ connectionFileName), ex, logOnly: false);
}
finally
{
@@ -266,11 +276,11 @@ namespace mRemoteNG.Connection
lock (SaveLock)
{
SaveConnections(
- ConnectionTreeModel,
- UsingDatabase,
- new SaveFilter(),
- ConnectionFileName,
- propertyNameTrigger: propertyNameTrigger);
+ ConnectionTreeModel,
+ UsingDatabase,
+ new SaveFilter(),
+ ConnectionFileName,
+ propertyNameTrigger: propertyNameTrigger);
}
});
t.SetApartmentState(ApartmentState.STA);
@@ -279,15 +289,15 @@ namespace mRemoteNG.Connection
public string GetStartupConnectionFileName()
{
- return Settings.Default.LoadConsFromCustomLocation == false
- ? GetDefaultStartupConnectionFileName()
+ return Settings.Default.LoadConsFromCustomLocation == false
+ ? GetDefaultStartupConnectionFileName()
: Settings.Default.CustomConsPath;
}
public string GetDefaultStartupConnectionFileName()
{
- return Runtime.IsPortableEdition
- ? GetDefaultStartupConnectionFileNamePortableEdition()
+ return Runtime.IsPortableEdition
+ ? GetDefaultStartupConnectionFileNamePortableEdition()
: GetDefaultStartupConnectionFileNameNormalEdition();
}
@@ -307,9 +317,9 @@ namespace mRemoteNG.Connection
private string GetDefaultStartupConnectionFileNameNormalEdition()
{
var appDataPath = Path.Combine(
- Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
- Application.ProductName,
- ConnectionsFileInfo.DefaultConnectionsFile);
+ Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
+ Application.ProductName,
+ ConnectionsFileInfo.DefaultConnectionsFile);
return File.Exists(appDataPath) ? appDataPath : GetDefaultStartupConnectionFileNamePortableEdition();
}
@@ -319,25 +329,35 @@ namespace mRemoteNG.Connection
}
#region Events
+
public event EventHandler ConnectionsLoaded;
public event EventHandler ConnectionsSaved;
- private void RaiseConnectionsLoadedEvent(Optional previousTreeModel, ConnectionTreeModel newTreeModel,
- bool previousSourceWasDatabase, bool newSourceIsDatabase,
- string newSourcePath)
+ private void RaiseConnectionsLoadedEvent(Optional previousTreeModel,
+ ConnectionTreeModel newTreeModel,
+ bool previousSourceWasDatabase,
+ bool newSourceIsDatabase,
+ string newSourcePath)
{
ConnectionsLoaded?.Invoke(this, new ConnectionsLoadedEventArgs(
- previousTreeModel,
- newTreeModel,
- previousSourceWasDatabase,
- newSourceIsDatabase,
- newSourcePath));
+ previousTreeModel,
+ newTreeModel,
+ previousSourceWasDatabase,
+ newSourceIsDatabase,
+ newSourcePath));
}
- private void RaiseConnectionsSavedEvent(ConnectionTreeModel modelThatWasSaved, bool previouslyUsingDatabase, bool usingDatabase, string connectionFileName)
+ private void RaiseConnectionsSavedEvent(ConnectionTreeModel modelThatWasSaved,
+ bool previouslyUsingDatabase,
+ bool usingDatabase,
+ string connectionFileName)
{
- ConnectionsSaved?.Invoke(this, new ConnectionsSavedEventArgs(modelThatWasSaved, previouslyUsingDatabase, usingDatabase, connectionFileName));
+ ConnectionsSaved?.Invoke(this,
+ new ConnectionsSavedEventArgs(modelThatWasSaved, previouslyUsingDatabase,
+ usingDatabase,
+ connectionFileName));
}
+
#endregion
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/DefaultConnectionInfo.cs b/mRemoteV1/Connection/DefaultConnectionInfo.cs
index 9a4df225..72a089b5 100644
--- a/mRemoteV1/Connection/DefaultConnectionInfo.cs
+++ b/mRemoteV1/Connection/DefaultConnectionInfo.cs
@@ -5,36 +5,38 @@ using mRemoteNG.App;
namespace mRemoteNG.Connection
{
- public class DefaultConnectionInfo : ConnectionInfo
+ public class DefaultConnectionInfo : ConnectionInfo
{
public static DefaultConnectionInfo Instance { get; } = new DefaultConnectionInfo();
private DefaultConnectionInfo()
{
IsDefault = true;
- Inheritance = DefaultConnectionInheritance.Instance;
+ Inheritance = DefaultConnectionInheritance.Instance;
}
public void LoadFrom(TSource sourceInstance, Func propertyNameMutator = null)
{
if (propertyNameMutator == null)
- propertyNameMutator = a => a;
+ propertyNameMutator = a => a;
var connectionProperties = GetSerializableProperties();
foreach (var property in connectionProperties)
{
try
{
- var expectedPropertyName = propertyNameMutator(property.Name);
- var propertyFromSource = typeof(TSource).GetProperty(expectedPropertyName);
+ var expectedPropertyName = propertyNameMutator(property.Name);
+ var propertyFromSource = typeof(TSource).GetProperty(expectedPropertyName);
if (propertyFromSource == null)
- throw new SettingsPropertyNotFoundException($"No property with name '{expectedPropertyName}' found.");
+ throw new SettingsPropertyNotFoundException(
+ $"No property with name '{expectedPropertyName}' found.");
+
+ var valueFromSource = propertyFromSource.GetValue(sourceInstance, null);
- var valueFromSource = propertyFromSource.GetValue(sourceInstance, null);
-
if (property.PropertyType.IsEnum)
{
- property.SetValue(Instance, Enum.Parse(property.PropertyType, valueFromSource.ToString()), null);
+ property.SetValue(Instance, Enum.Parse(property.PropertyType, valueFromSource.ToString()),
+ null);
continue;
}
@@ -42,15 +44,18 @@ namespace mRemoteNG.Connection
}
catch (Exception ex)
{
- Runtime.MessageCollector?.AddExceptionStackTrace($"Error loading default connectioninfo property {property.Name}", ex);
+ Runtime.MessageCollector?.AddExceptionStackTrace(
+ $"Error loading default connectioninfo property {property.Name}",
+ ex);
}
}
}
- public void SaveTo(TDestination destinationInstance, Func propertyNameMutator = null)
+ public void SaveTo(TDestination destinationInstance,
+ Func propertyNameMutator = null)
{
if (propertyNameMutator == null)
- propertyNameMutator = (a) => a;
+ propertyNameMutator = (a) => a;
var connectionProperties = GetSerializableProperties();
@@ -58,20 +63,24 @@ namespace mRemoteNG.Connection
{
try
{
- var expectedPropertyName = propertyNameMutator(property.Name);
- var propertyFromDestination = typeof(TDestination).GetProperty(expectedPropertyName);
+ var expectedPropertyName = propertyNameMutator(property.Name);
+ var propertyFromDestination = typeof(TDestination).GetProperty(expectedPropertyName);
- if (propertyFromDestination == null)
- throw new SettingsPropertyNotFoundException($"No property with name '{expectedPropertyName}' found.");
+ if (propertyFromDestination == null)
+ throw new SettingsPropertyNotFoundException(
+ $"No property with name '{expectedPropertyName}' found.");
- // ensure value is of correct type
- var value = Convert.ChangeType(property.GetValue(Instance, null), propertyFromDestination.PropertyType);
+ // ensure value is of correct type
+ var value = Convert.ChangeType(property.GetValue(Instance, null),
+ propertyFromDestination.PropertyType);
propertyFromDestination.SetValue(destinationInstance, value, null);
}
catch (Exception ex)
{
- Runtime.MessageCollector?.AddExceptionStackTrace($"Error saving default connectioninfo property {property.Name}", ex);
+ Runtime.MessageCollector?.AddExceptionStackTrace(
+ $"Error saving default connectioninfo property {property.Name}",
+ ex);
}
}
}
diff --git a/mRemoteV1/Connection/DefaultConnectionInheritance.cs b/mRemoteV1/Connection/DefaultConnectionInheritance.cs
index b55ca863..8e2d8e82 100644
--- a/mRemoteV1/Connection/DefaultConnectionInheritance.cs
+++ b/mRemoteV1/Connection/DefaultConnectionInheritance.cs
@@ -13,10 +13,11 @@ namespace mRemoteNG.Connection
}
static DefaultConnectionInheritance()
- { }
+ {
+ }
- public void LoadFrom(TSource sourceInstance, Func propertyNameMutator = null)
+ public void LoadFrom(TSource sourceInstance, Func propertyNameMutator = null)
{
if (propertyNameMutator == null) propertyNameMutator = a => a;
var inheritanceProperties = GetProperties();
@@ -26,15 +27,18 @@ namespace mRemoteNG.Connection
if (propertyFromSettings == null)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
- $"DefaultConInherit-LoadFrom: Could not load {property.Name}", true);
+ $"DefaultConInherit-LoadFrom: Could not load {property.Name}",
+ true);
continue;
}
+
var valueFromSettings = propertyFromSettings.GetValue(sourceInstance, null);
property.SetValue(Instance, valueFromSettings, null);
}
}
- public void SaveTo(TDestination destinationInstance, Func propertyNameMutator = null)
+ public void SaveTo(TDestination destinationInstance,
+ Func propertyNameMutator = null)
{
if (propertyNameMutator == null) propertyNameMutator = a => a;
var inheritanceProperties = GetProperties();
@@ -45,9 +49,11 @@ namespace mRemoteNG.Connection
if (propertyFromSettings == null)
{
Runtime.MessageCollector?.AddMessage(Messages.MessageClass.ErrorMsg,
- $"DefaultConInherit-SaveTo: Could not load {property.Name}", true);
+ $"DefaultConInherit-SaveTo: Could not load {property.Name}",
+ true);
continue;
}
+
propertyFromSettings.SetValue(destinationInstance, localValue, null);
}
}
diff --git a/mRemoteV1/Connection/InterfaceControl.cs b/mRemoteV1/Connection/InterfaceControl.cs
index 733f03a9..b21c31b8 100644
--- a/mRemoteV1/Connection/InterfaceControl.cs
+++ b/mRemoteV1/Connection/InterfaceControl.cs
@@ -9,29 +9,31 @@ using WeifenLuo.WinFormsUI.Docking;
namespace mRemoteNG.Connection
{
- public sealed partial class InterfaceControl
+ public sealed partial class InterfaceControl
{
public ProtocolBase Protocol { get; set; }
- public ConnectionInfo Info { get; set; }
+ public ConnectionInfo Info { get; set; }
- public InterfaceControl(Control parent, ProtocolBase protocol, ConnectionInfo info)
- {
- try
- {
- Protocol = protocol;
- Info = info;
+ public InterfaceControl(Control parent, ProtocolBase protocol, ConnectionInfo info)
+ {
+ try
+ {
+ Protocol = protocol;
+ Info = info;
Parent = parent;
Location = new Point(0, 0);
Size = Parent.Size;
Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
- InitializeComponent();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t create new InterfaceControl" + Environment.NewLine + ex.Message);
- }
- }
+ InitializeComponent();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ "Couldn\'t create new InterfaceControl" + Environment.NewLine +
+ ex.Message);
+ }
+ }
public static InterfaceControl FindInterfaceControl(DockPanel DockPnl)
{
diff --git a/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTP.cs b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTP.cs
index cbdaca2f..3ebf3007 100644
--- a/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTP.cs
+++ b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTP.cs
@@ -1,17 +1,16 @@
namespace mRemoteNG.Connection.Protocol.Http
{
- public class ProtocolHTTP : HTTPBase
- {
-
- public ProtocolHTTP(RenderingEngine RenderingEngine) : base(RenderingEngine)
- {
+ public class ProtocolHTTP : HTTPBase
+ {
+ public ProtocolHTTP(RenderingEngine RenderingEngine) : base(RenderingEngine)
+ {
httpOrS = "http";
defaultPort = (int)Defaults.Port;
}
-
- public enum Defaults
- {
- Port = 80
- }
- }
-}
+
+ public enum Defaults
+ {
+ Port = 80
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPBase.cs b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPBase.cs
index 6b7f9ba3..fb43826d 100644
--- a/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPBase.cs
+++ b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPBase.cs
@@ -7,60 +7,62 @@ using mRemoteNG.App;
namespace mRemoteNG.Connection.Protocol.Http
{
- public class HTTPBase : ProtocolBase
- {
+ public class HTTPBase : ProtocolBase
+ {
#region Private Properties
- private Control wBrowser;
- protected string httpOrS;
- protected int defaultPort;
- private string tabTitle;
+
+ private Control wBrowser;
+ protected string httpOrS;
+ protected int defaultPort;
+ private string tabTitle;
+
#endregion
-
+
#region Public Methods
- protected HTTPBase(RenderingEngine RenderingEngine)
- {
- try
- {
- if (RenderingEngine == RenderingEngine.Gecko)
- {
- if(!Xpcom.IsInitialized)
+ protected HTTPBase(RenderingEngine RenderingEngine)
+ {
+ try
+ {
+ if (RenderingEngine == RenderingEngine.Gecko)
+ {
+ if (!Xpcom.IsInitialized)
Xpcom.Initialize("Firefox");
Control = new GeckoWebBrowser();
- }
- else
- {
+ }
+ else
+ {
Control = new WebBrowser();
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpConnectionFailed, ex);
- }
- }
-
- public override bool Initialize()
- {
- base.Initialize();
-
- try
- {
- var objTabPage = InterfaceControl.Parent as TabPage;
- // if (objTabPage != null) tabTitle = objTabPage.Title;
- }
- catch (Exception)
- {
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpConnectionFailed, ex);
+ }
+ }
+
+ public override bool Initialize()
+ {
+ base.Initialize();
+
+ try
+ {
+ var objTabPage = InterfaceControl.Parent as TabPage;
+ // if (objTabPage != null) tabTitle = objTabPage.Title;
+ }
+ catch (Exception)
+ {
tabTitle = "";
- }
-
- try
- {
+ }
+
+ try
+ {
wBrowser = Control;
-
- if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
- {
- var GeckoBrowser = (GeckoWebBrowser) wBrowser;
+
+ if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
+ {
+ var GeckoBrowser = (GeckoWebBrowser)wBrowser;
if (GeckoBrowser != null)
{
GeckoBrowser.DocumentTitleChanged += geckoBrowser_DocumentTitleChanged;
@@ -72,31 +74,31 @@ namespace mRemoteNG.Connection.Protocol.Http
}
}
else
- {
+ {
var objWebBrowser = (WebBrowser)wBrowser;
- objWebBrowser.ScrollBarsEnabled = true;
+ objWebBrowser.ScrollBarsEnabled = true;
// http://stackoverflow.com/questions/4655662/how-to-ignore-script-errors-in-webbrowser
objWebBrowser.ScriptErrorsSuppressed = true;
objWebBrowser.Navigated += wBrowser_Navigated;
- objWebBrowser.DocumentTitleChanged += wBrowser_DocumentTitleChanged;
- }
-
- return true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpSetPropsFailed, ex);
- return false;
- }
- }
-
- public override bool Connect()
- {
- try
- {
- var strHost = InterfaceControl.Info.Hostname;
+ objWebBrowser.DocumentTitleChanged += wBrowser_DocumentTitleChanged;
+ }
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpSetPropsFailed, ex);
+ return false;
+ }
+ }
+
+ public override bool Connect()
+ {
+ try
+ {
+ var strHost = InterfaceControl.Info.Hostname;
/*
* Commenting out since this codes doesn't actually do anything at this time...
* Possibly related to MR-221 and/or MR-533 ????
@@ -107,117 +109,120 @@ namespace mRemoteNG.Connection.Protocol.Http
{
strAuth = "Authorization: Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(InterfaceControl.Info.Username + ":" + InterfaceControl.Info.Password)) + Environment.NewLine;
}
- */
- if (InterfaceControl.Info.Port != defaultPort)
- {
- if (strHost.EndsWith("/"))
- {
- strHost = strHost.Substring(0, strHost.Length - 1);
- }
-
- if (strHost.Contains(httpOrS + "://") == false)
- {
- strHost = httpOrS + "://" + strHost;
- }
-
- if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
- {
+ */
+ if (InterfaceControl.Info.Port != defaultPort)
+ {
+ if (strHost.EndsWith("/"))
+ {
+ strHost = strHost.Substring(0, strHost.Length - 1);
+ }
+
+ if (strHost.Contains(httpOrS + "://") == false)
+ {
+ strHost = httpOrS + "://" + strHost;
+ }
+
+ if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
+ {
((GeckoWebBrowser)wBrowser).Navigate(strHost + ":" + InterfaceControl.Info.Port);
- }
- else
- {
+ }
+ else
+ {
((WebBrowser)wBrowser).Navigate(strHost + ":" + InterfaceControl.Info.Port);
- }
- }
- else
- {
- if (strHost.Contains(httpOrS + "://") == false)
- {
- strHost = httpOrS + "://" + strHost;
- }
-
- if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
- {
- ((GeckoWebBrowser)wBrowser).Navigate(strHost);
- }
- else
- {
+ }
+ }
+ else
+ {
+ if (strHost.Contains(httpOrS + "://") == false)
+ {
+ strHost = httpOrS + "://" + strHost;
+ }
+
+ if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
+ {
+ ((GeckoWebBrowser)wBrowser).Navigate(strHost);
+ }
+ else
+ {
((WebBrowser)wBrowser).Navigate(strHost);
- }
- }
-
- base.Connect();
- return true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpConnectFailed, ex);
- return false;
- }
- }
+ }
+ }
+
+ base.Connect();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpConnectFailed, ex);
+ return false;
+ }
+ }
+
#endregion
-
+
#region Private Methods
+
#endregion
-
+
#region Events
- private void wBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
- {
- var objWebBrowser = wBrowser as WebBrowser;
- if (objWebBrowser == null) return;
-
- // This can only be set once the WebBrowser control is shown, it will throw a COM exception otherwise.
- objWebBrowser.AllowWebBrowserDrop = false;
-
- objWebBrowser.Navigated -= wBrowser_Navigated;
- }
+
+ private void wBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
+ {
+ var objWebBrowser = wBrowser as WebBrowser;
+ if (objWebBrowser == null) return;
+
+ // This can only be set once the WebBrowser control is shown, it will throw a COM exception otherwise.
+ objWebBrowser.AllowWebBrowserDrop = false;
+
+ objWebBrowser.Navigated -= wBrowser_Navigated;
+ }
private void wBrowser_DocumentTitleChanged(object sender, EventArgs e)
- {
- try
- {
- var tabP = InterfaceControl.Parent as TabPage;
+ {
+ try
+ {
+ var tabP = InterfaceControl.Parent as TabPage;
- if (tabP == null) return;
- string shortTitle;
-
- if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
- {
- if (((GeckoWebBrowser) wBrowser).DocumentTitle.Length >= 15)
- {
- shortTitle = ((GeckoWebBrowser) wBrowser).DocumentTitle.Substring(0, 10) + "...";
- }
- else
- {
- shortTitle = ((GeckoWebBrowser) wBrowser).DocumentTitle;
- }
- }
- else
- {
- if (((WebBrowser) wBrowser).DocumentTitle.Length >= 15)
- {
- shortTitle = ((WebBrowser) wBrowser).DocumentTitle.Substring(0, 10) + "...";
- }
- else
- {
- shortTitle = ((WebBrowser) wBrowser).DocumentTitle;
- }
- }
-
- /* if (!string.IsNullOrEmpty(tabTitle))
- {
- tabP.Title = tabTitle + @" - " + shortTitle;
- }
- else
- {
- tabP.Title = shortTitle;
- }*/
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpDocumentTileChangeFailed, ex);
- }
- }
+ if (tabP == null) return;
+ string shortTitle;
+
+ if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
+ {
+ if (((GeckoWebBrowser)wBrowser).DocumentTitle.Length >= 15)
+ {
+ shortTitle = ((GeckoWebBrowser)wBrowser).DocumentTitle.Substring(0, 10) + "...";
+ }
+ else
+ {
+ shortTitle = ((GeckoWebBrowser)wBrowser).DocumentTitle;
+ }
+ }
+ else
+ {
+ if (((WebBrowser)wBrowser).DocumentTitle.Length >= 15)
+ {
+ shortTitle = ((WebBrowser)wBrowser).DocumentTitle.Substring(0, 10) + "...";
+ }
+ else
+ {
+ shortTitle = ((WebBrowser)wBrowser).DocumentTitle;
+ }
+ }
+
+ /* if (!string.IsNullOrEmpty(tabTitle))
+ {
+ tabP.Title = tabTitle + @" - " + shortTitle;
+ }
+ else
+ {
+ tabP.Title = shortTitle;
+ }*/
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpDocumentTileChangeFailed, ex);
+ }
+ }
private void geckoBrowser_DocumentTitleChanged(object sender, EventArgs e)
@@ -233,50 +238,53 @@ namespace mRemoteNG.Connection.Protocol.Http
{
if (((GeckoWebBrowser)wBrowser).DocumentTitle.Length >= 15)
{
- shortTitle = ((GeckoWebBrowser) wBrowser).DocumentTitle.Substring(0, 10) + "...";
+ shortTitle = ((GeckoWebBrowser)wBrowser).DocumentTitle.Substring(0, 10) + "...";
}
else
{
- shortTitle = ((GeckoWebBrowser) wBrowser).DocumentTitle;
+ shortTitle = ((GeckoWebBrowser)wBrowser).DocumentTitle;
}
}
else
{
- if (((WebBrowser) wBrowser).DocumentTitle.Length >= 15)
+ if (((WebBrowser)wBrowser).DocumentTitle.Length >= 15)
{
- shortTitle = ((WebBrowser) wBrowser).DocumentTitle.Substring(0, 10) + "...";
+ shortTitle = ((WebBrowser)wBrowser).DocumentTitle.Substring(0, 10) + "...";
}
else
{
- shortTitle = ((WebBrowser) wBrowser).DocumentTitle;
+ shortTitle = ((WebBrowser)wBrowser).DocumentTitle;
}
}
- /* if (!string.IsNullOrEmpty(tabTitle))
- {
- tabP.Title = tabTitle + @" - " + shortTitle;
- }
- else
- {
- tabP.Title = shortTitle;
- }*/
+ /* if (!string.IsNullOrEmpty(tabTitle))
+ {
+ tabP.Title = tabTitle + @" - " + shortTitle;
+ }
+ else
+ {
+ tabP.Title = shortTitle;
+ }*/
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpDocumentTileChangeFailed, ex);
}
}
-#endregion
-
-#region Enums
- public enum RenderingEngine
- {
+
+ #endregion
+
+ #region Enums
+
+ public enum RenderingEngine
+ {
[LocalizedAttributes.LocalizedDescription("strHttpInternetExplorer")]
IE = 1,
+
[LocalizedAttributes.LocalizedDescription("strHttpGecko")]
Gecko = 2
- }
+ }
-#endregion
- }
-}
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.CertEvent.cs b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.CertEvent.cs
index 086d8b49..5e9f1322 100644
--- a/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.CertEvent.cs
+++ b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.CertEvent.cs
@@ -4,6 +4,7 @@ using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Messages;
using mRemoteNG.UI.TaskDialog;
+
// ReSharper disable RedundantAssignment
namespace mRemoteNG.Connection.Protocol.Http
@@ -26,15 +27,17 @@ namespace mRemoteNG.Connection.Protocol.Http
string[] commandButtons =
{
- Language.strHttpsInsecureAllowOnce, // 0
- Language.strHttpsInsecureAllowAlways, // 1
- Language.strHttpsInsecureDontAllow // 2
+ Language.strHttpsInsecureAllowOnce, // 0
+ Language.strHttpsInsecureAllowAlways, // 1
+ Language.strHttpsInsecureDontAllow // 2
};
CTaskDialog.ShowTaskDialogBox(null, GeneralAppInfo.ProductName, Language.strHttpsInsecurePromptTitle,
- string.Format(Language.strHttpsInsecurePrompt, e.Uri.AbsoluteUri), "", "", "", "",
- string.Join(" | ", commandButtons), ETaskDialogButtons.None, ESysIcons.Question, ESysIcons.Question);
-
+ string.Format(Language.strHttpsInsecurePrompt, e.Uri.AbsoluteUri), "", "", "",
+ "",
+ string.Join(" | ", commandButtons), ETaskDialogButtons.None,
+ ESysIcons.Question, ESysIcons.Question);
+
var allow = false;
var temporary = true;
// ReSharper disable once SwitchStatementMissingSomeCases
@@ -53,10 +56,11 @@ namespace mRemoteNG.Connection.Protocol.Http
temporary = true; // just to be safe
break;
}
-
+
if (!allow)
{
- Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, $"User did not allow navigation to {e.Uri.AbsoluteUri} with an insecure certificate: {e.Message}");
+ Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
+ $"User did not allow navigation to {e.Uri.AbsoluteUri} with an insecure certificate: {e.Message}");
return;
}
@@ -65,10 +69,11 @@ namespace mRemoteNG.Connection.Protocol.Http
* However, my testing was successful in Gecko 45.0.22
*/
CertOverrideService.GetService().RememberValidityOverride(e.Uri, e.Certificate,
- CertOverride.Mismatch | CertOverride.Time | CertOverride.Untrusted, temporary);
+ CertOverride.Mismatch | CertOverride.Time |
+ CertOverride.Untrusted, temporary);
e.Handled = true;
((GeckoWebBrowser)sender).Navigate(e.Uri.AbsoluteUri);
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.cs b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.cs
index 08f28a92..90f35f5a 100644
--- a/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.cs
+++ b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.cs
@@ -1,17 +1,16 @@
namespace mRemoteNG.Connection.Protocol.Http
{
- public class ProtocolHTTPS : HTTPBase
- {
-
- public ProtocolHTTPS(RenderingEngine RenderingEngine) : base(RenderingEngine)
- {
+ public class ProtocolHTTPS : HTTPBase
+ {
+ public ProtocolHTTPS(RenderingEngine RenderingEngine) : base(RenderingEngine)
+ {
httpOrS = "https";
defaultPort = (int)Defaults.Port;
}
-
- public enum Defaults
- {
- Port = 443
- }
- }
-}
+
+ public enum Defaults
+ {
+ Port = 443
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/ICA/IcaProtocol.cs b/mRemoteV1/Connection/Protocol/ICA/IcaProtocol.cs
index 795e6494..fca5a617 100644
--- a/mRemoteV1/Connection/Protocol/ICA/IcaProtocol.cs
+++ b/mRemoteV1/Connection/Protocol/ICA/IcaProtocol.cs
@@ -14,335 +14,369 @@ using System.Windows.Forms;
namespace mRemoteNG.Connection.Protocol.ICA
{
public class IcaProtocol : ProtocolBase
- {
- private AxICAClient _icaClient;
- private ConnectionInfo _info;
+ {
+ private AxICAClient _icaClient;
+ private ConnectionInfo _info;
private readonly FrmMain _frmMain = FrmMain.Default;
-
+
#region Public Methods
- public IcaProtocol()
- {
- try
- {
- Control = new AxICAClient();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strIcaControlFailed + Environment.NewLine + ex.Message, true);
- }
- }
-
- public override bool Initialize()
- {
- base.Initialize();
-
- try
- {
- _icaClient = (AxICAClient)Control;
- _info = InterfaceControl.Info;
- _icaClient.CreateControl();
-
- while (!_icaClient.Created)
- {
- Thread.Sleep(10);
- Application.DoEvents();
- }
- _icaClient.Address = _info.Hostname;
- SetCredentials();
- SetResolution();
- SetColors();
- SetSecurity();
-
- //Disable hotkeys for international users
- _icaClient.Hotkey1Shift = null;
- _icaClient.Hotkey1Char = null;
- _icaClient.Hotkey2Shift = null;
- _icaClient.Hotkey2Char = null;
- _icaClient.Hotkey3Shift = null;
- _icaClient.Hotkey3Char = null;
- _icaClient.Hotkey4Shift = null;
- _icaClient.Hotkey4Char = null;
- _icaClient.Hotkey5Shift = null;
- _icaClient.Hotkey5Char = null;
- _icaClient.Hotkey6Shift = null;
- _icaClient.Hotkey6Char = null;
- _icaClient.Hotkey7Shift = null;
- _icaClient.Hotkey7Char = null;
- _icaClient.Hotkey8Shift = null;
- _icaClient.Hotkey8Char = null;
- _icaClient.Hotkey9Shift = null;
- _icaClient.Hotkey9Char = null;
- _icaClient.Hotkey10Shift = null;
- _icaClient.Hotkey10Char = null;
- _icaClient.Hotkey11Shift = null;
- _icaClient.Hotkey11Char = null;
-
- _icaClient.PersistentCacheEnabled = _info.CacheBitmaps;
- _icaClient.Title = _info.Name;
- return true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strIcaSetPropsFailed + Environment.NewLine + ex.Message, true);
- return false;
- }
- }
-
- public override bool Connect()
- {
- SetEventHandlers();
-
- try
- {
- _icaClient.Connect();
- base.Connect();
- return true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strIcaConnectionFailed + Environment.NewLine + ex.Message);
- return false;
- }
- }
+ public IcaProtocol()
+ {
+ try
+ {
+ Control = new AxICAClient();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strIcaControlFailed + Environment.NewLine + ex.Message,
+ true);
+ }
+ }
+
+ public override bool Initialize()
+ {
+ base.Initialize();
+
+ try
+ {
+ _icaClient = (AxICAClient)Control;
+ _info = InterfaceControl.Info;
+ _icaClient.CreateControl();
+
+ while (!_icaClient.Created)
+ {
+ Thread.Sleep(10);
+ Application.DoEvents();
+ }
+
+ _icaClient.Address = _info.Hostname;
+ SetCredentials();
+ SetResolution();
+ SetColors();
+ SetSecurity();
+
+ //Disable hotkeys for international users
+ _icaClient.Hotkey1Shift = null;
+ _icaClient.Hotkey1Char = null;
+ _icaClient.Hotkey2Shift = null;
+ _icaClient.Hotkey2Char = null;
+ _icaClient.Hotkey3Shift = null;
+ _icaClient.Hotkey3Char = null;
+ _icaClient.Hotkey4Shift = null;
+ _icaClient.Hotkey4Char = null;
+ _icaClient.Hotkey5Shift = null;
+ _icaClient.Hotkey5Char = null;
+ _icaClient.Hotkey6Shift = null;
+ _icaClient.Hotkey6Char = null;
+ _icaClient.Hotkey7Shift = null;
+ _icaClient.Hotkey7Char = null;
+ _icaClient.Hotkey8Shift = null;
+ _icaClient.Hotkey8Char = null;
+ _icaClient.Hotkey9Shift = null;
+ _icaClient.Hotkey9Char = null;
+ _icaClient.Hotkey10Shift = null;
+ _icaClient.Hotkey10Char = null;
+ _icaClient.Hotkey11Shift = null;
+ _icaClient.Hotkey11Char = null;
+
+ _icaClient.PersistentCacheEnabled = _info.CacheBitmaps;
+ _icaClient.Title = _info.Name;
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strIcaSetPropsFailed + Environment.NewLine + ex.Message,
+ true);
+ return false;
+ }
+ }
+
+ public override bool Connect()
+ {
+ SetEventHandlers();
+
+ try
+ {
+ _icaClient.Connect();
+ base.Connect();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strIcaConnectionFailed + Environment.NewLine + ex.Message);
+ return false;
+ }
+ }
+
#endregion
-
+
#region Private Methods
- private void SetCredentials()
- {
- try
- {
+
+ private void SetCredentials()
+ {
+ try
+ {
if (Force.HasFlag(ConnectionInfo.Force.NoCredentials))
- {
- return;
- }
+ {
+ return;
+ }
- var user = _info?.Username ?? "";
- var pass = _info?.Password ?? "";
- var dom = _info?.Domain ?? "";
+ var user = _info?.Username ?? "";
+ var pass = _info?.Password ?? "";
+ var dom = _info?.Domain ?? "";
- if (string.IsNullOrEmpty(user))
- {
- if (Settings.Default.EmptyCredentials == "windows")
- {
- _icaClient.Username = Environment.UserName;
- }
- else if (Settings.Default.EmptyCredentials == "custom")
- {
- _icaClient.Username = Settings.Default.DefaultUsername;
- }
- }
- else
- {
- _icaClient.Username = user;
- }
-
- if (string.IsNullOrEmpty(pass))
- {
- if (Settings.Default.EmptyCredentials == "custom")
- {
- if (Settings.Default.DefaultPassword != "")
- {
+ if (string.IsNullOrEmpty(user))
+ {
+ if (Settings.Default.EmptyCredentials == "windows")
+ {
+ _icaClient.Username = Environment.UserName;
+ }
+ else if (Settings.Default.EmptyCredentials == "custom")
+ {
+ _icaClient.Username = Settings.Default.DefaultUsername;
+ }
+ }
+ else
+ {
+ _icaClient.Username = user;
+ }
+
+ if (string.IsNullOrEmpty(pass))
+ {
+ if (Settings.Default.EmptyCredentials == "custom")
+ {
+ if (Settings.Default.DefaultPassword != "")
+ {
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
- _icaClient.SetProp("ClearPassword", cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey));
- }
- }
- }
- else
- {
- _icaClient.SetProp("ClearPassword", pass);
- }
-
- if (string.IsNullOrEmpty(dom))
- {
- if (Settings.Default.EmptyCredentials == "windows")
- {
- _icaClient.Domain = Environment.UserDomainName;
- }
- else if (Settings.Default.EmptyCredentials == "custom")
- {
- _icaClient.Domain = Settings.Default.DefaultDomain;
- }
- }
- else
- {
- _icaClient.Domain = dom;
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strIcaSetCredentialsFailed + Environment.NewLine + ex.Message, true);
- }
- }
-
- private void SetResolution()
- {
- try
- {
- if (Force.HasFlag(ConnectionInfo.Force.Fullscreen))
- {
- _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(_frmMain).Bounds.Width, Screen.FromControl(_frmMain).Bounds.Height, 0);
- _icaClient.FullScreenWindow();
-
- return;
- }
-
- if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.FitToWindow)
- {
- _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0);
- }
- else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.SmartSize)
- {
- _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0);
- }
- else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.Fullscreen)
- {
- _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(_frmMain).Bounds.Width, Screen.FromControl(_frmMain).Bounds.Height, 0);
- _icaClient.FullScreenWindow();
- }
- else
- {
- var resolution = RdpProtocol.GetResolutionRectangle(_info.Resolution);
- _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0);
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strIcaSetResolutionFailed + Environment.NewLine + ex.Message, true);
- }
- }
-
- private void SetColors()
- {
- // ReSharper disable once SwitchStatementMissingSomeCases
- switch (_info.Colors)
- {
- case RdpProtocol.RDPColors.Colors256:
- _icaClient.SetProp("DesiredColor", "2");
- break;
- case RdpProtocol.RDPColors.Colors15Bit:
- _icaClient.SetProp("DesiredColor", "4");
- break;
- case RdpProtocol.RDPColors.Colors16Bit:
- _icaClient.SetProp("DesiredColor", "4");
- break;
- default:
- _icaClient.SetProp("DesiredColor", "8");
- break;
- }
- }
-
- private void SetSecurity()
- {
- // ReSharper disable once SwitchStatementMissingSomeCases
- switch (_info.ICAEncryptionStrength)
- {
- case EncryptionStrength.Encr128BitLogonOnly:
- _icaClient.Encrypt = true;
- _icaClient.EncryptionLevelSession = "EncRC5-0";
- break;
- case EncryptionStrength.Encr40Bit:
- _icaClient.Encrypt = true;
- _icaClient.EncryptionLevelSession = "EncRC5-40";
- break;
- case EncryptionStrength.Encr56Bit:
- _icaClient.Encrypt = true;
- _icaClient.EncryptionLevelSession = "EncRC5-56";
- break;
- case EncryptionStrength.Encr128Bit:
- _icaClient.Encrypt = true;
- _icaClient.EncryptionLevelSession = "EncRC5-128";
- break;
- }
- }
-
- private void SetEventHandlers()
- {
- try
- {
- _icaClient.OnConnecting += ICAEvent_OnConnecting;
- _icaClient.OnConnect += ICAEvent_OnConnected;
- _icaClient.OnConnectFailed += ICAEvent_OnConnectFailed;
- _icaClient.OnDisconnect += ICAEvent_OnDisconnect;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strIcaSetEventHandlersFailed + Environment.NewLine + ex.Message, true);
- }
- }
- #endregion
-
- #region Private Events & Handlers
- private void ICAEvent_OnConnecting(object sender, EventArgs e)
- {
- Event_Connecting(this);
- }
-
- private void ICAEvent_OnConnected(object sender, EventArgs e)
- {
- Event_Connected(this);
- }
-
- private void ICAEvent_OnConnectFailed(object sender, EventArgs e)
- {
- Event_ErrorOccured(this, e.ToString(), null);
- }
-
- private void ICAEvent_OnDisconnect(object sender, EventArgs e)
- {
- Event_Disconnected(this, e.ToString(), null);
-
- if (Settings.Default.ReconnectOnDisconnect)
- {
- ReconnectGroup = new ReconnectGroup();
- //this.Load += ReconnectGroup_Load;
- ReconnectGroup.Left = (int) (((double) Control.Width / 2) - ((double) ReconnectGroup.Width / 2));
- ReconnectGroup.Top = (int) (((double) Control.Height / 2) - ((double) ReconnectGroup.Height / 2));
- ReconnectGroup.Parent = Control;
- ReconnectGroup.Show();
- tmrReconnect.Enabled = true;
- }
- else
- {
- Close();
- }
- }
- #endregion
-
- #region Reconnect Stuff
- public void tmrReconnect_Elapsed(object sender, ElapsedEventArgs e)
- {
- var srvReady = PortScanner.IsPortOpen(_info.Hostname, Convert.ToString(_info.Port));
-
- ReconnectGroup.ServerReady = srvReady;
+ _icaClient.SetProp("ClearPassword",
+ cryptographyProvider.Decrypt(Settings.Default.DefaultPassword,
+ Runtime.EncryptionKey));
+ }
+ }
+ }
+ else
+ {
+ _icaClient.SetProp("ClearPassword", pass);
+ }
+
+ if (string.IsNullOrEmpty(dom))
+ {
+ if (Settings.Default.EmptyCredentials == "windows")
+ {
+ _icaClient.Domain = Environment.UserDomainName;
+ }
+ else if (Settings.Default.EmptyCredentials == "custom")
+ {
+ _icaClient.Domain = Settings.Default.DefaultDomain;
+ }
+ }
+ else
+ {
+ _icaClient.Domain = dom;
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strIcaSetCredentialsFailed + Environment.NewLine +
+ ex.Message, true);
+ }
+ }
+
+ private void SetResolution()
+ {
+ try
+ {
+ if (Force.HasFlag(ConnectionInfo.Force.Fullscreen))
+ {
+ _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient,
+ Screen.FromControl(_frmMain).Bounds.Width,
+ Screen.FromControl(_frmMain).Bounds.Height, 0);
+ _icaClient.FullScreenWindow();
+
+ return;
+ }
+
+ if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.FitToWindow)
+ {
+ _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width,
+ InterfaceControl.Size.Height, 0);
+ }
+ else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.SmartSize)
+ {
+ _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width,
+ InterfaceControl.Size.Height, 0);
+ }
+ else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.Fullscreen)
+ {
+ _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient,
+ Screen.FromControl(_frmMain).Bounds.Width,
+ Screen.FromControl(_frmMain).Bounds.Height, 0);
+ _icaClient.FullScreenWindow();
+ }
+ else
+ {
+ var resolution = RdpProtocol.GetResolutionRectangle(_info.Resolution);
+ _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width,
+ resolution.Height, 0);
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strIcaSetResolutionFailed + Environment.NewLine +
+ ex.Message, true);
+ }
+ }
+
+ private void SetColors()
+ {
+ // ReSharper disable once SwitchStatementMissingSomeCases
+ switch (_info.Colors)
+ {
+ case RdpProtocol.RDPColors.Colors256:
+ _icaClient.SetProp("DesiredColor", "2");
+ break;
+ case RdpProtocol.RDPColors.Colors15Bit:
+ _icaClient.SetProp("DesiredColor", "4");
+ break;
+ case RdpProtocol.RDPColors.Colors16Bit:
+ _icaClient.SetProp("DesiredColor", "4");
+ break;
+ default:
+ _icaClient.SetProp("DesiredColor", "8");
+ break;
+ }
+ }
+
+ private void SetSecurity()
+ {
+ // ReSharper disable once SwitchStatementMissingSomeCases
+ switch (_info.ICAEncryptionStrength)
+ {
+ case EncryptionStrength.Encr128BitLogonOnly:
+ _icaClient.Encrypt = true;
+ _icaClient.EncryptionLevelSession = "EncRC5-0";
+ break;
+ case EncryptionStrength.Encr40Bit:
+ _icaClient.Encrypt = true;
+ _icaClient.EncryptionLevelSession = "EncRC5-40";
+ break;
+ case EncryptionStrength.Encr56Bit:
+ _icaClient.Encrypt = true;
+ _icaClient.EncryptionLevelSession = "EncRC5-56";
+ break;
+ case EncryptionStrength.Encr128Bit:
+ _icaClient.Encrypt = true;
+ _icaClient.EncryptionLevelSession = "EncRC5-128";
+ break;
+ }
+ }
+
+ private void SetEventHandlers()
+ {
+ try
+ {
+ _icaClient.OnConnecting += ICAEvent_OnConnecting;
+ _icaClient.OnConnect += ICAEvent_OnConnected;
+ _icaClient.OnConnectFailed += ICAEvent_OnConnectFailed;
+ _icaClient.OnDisconnect += ICAEvent_OnDisconnect;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strIcaSetEventHandlersFailed + Environment.NewLine +
+ ex.Message, true);
+ }
+ }
- if (!ReconnectGroup.ReconnectWhenReady || !srvReady) return;
- tmrReconnect.Enabled = false;
- ReconnectGroup.DisposeReconnectGroup();
- _icaClient.Connect();
- }
#endregion
-
+
+ #region Private Events & Handlers
+
+ private void ICAEvent_OnConnecting(object sender, EventArgs e)
+ {
+ Event_Connecting(this);
+ }
+
+ private void ICAEvent_OnConnected(object sender, EventArgs e)
+ {
+ Event_Connected(this);
+ }
+
+ private void ICAEvent_OnConnectFailed(object sender, EventArgs e)
+ {
+ Event_ErrorOccured(this, e.ToString(), null);
+ }
+
+ private void ICAEvent_OnDisconnect(object sender, EventArgs e)
+ {
+ Event_Disconnected(this, e.ToString(), null);
+
+ if (Settings.Default.ReconnectOnDisconnect)
+ {
+ ReconnectGroup = new ReconnectGroup();
+ //this.Load += ReconnectGroup_Load;
+ ReconnectGroup.Left = (int)(((double)Control.Width / 2) - ((double)ReconnectGroup.Width / 2));
+ ReconnectGroup.Top = (int)(((double)Control.Height / 2) - ((double)ReconnectGroup.Height / 2));
+ ReconnectGroup.Parent = Control;
+ ReconnectGroup.Show();
+ tmrReconnect.Enabled = true;
+ }
+ else
+ {
+ Close();
+ }
+ }
+
+ #endregion
+
+ #region Reconnect Stuff
+
+ public void tmrReconnect_Elapsed(object sender, ElapsedEventArgs e)
+ {
+ var srvReady = PortScanner.IsPortOpen(_info.Hostname, Convert.ToString(_info.Port));
+
+ ReconnectGroup.ServerReady = srvReady;
+
+ if (!ReconnectGroup.ReconnectWhenReady || !srvReady) return;
+ tmrReconnect.Enabled = false;
+ ReconnectGroup.DisposeReconnectGroup();
+ _icaClient.Connect();
+ }
+
+ #endregion
+
#region Enums
- public enum Defaults
- {
- Port = 1494,
- EncryptionStrength = 0
- }
-
- public enum EncryptionStrength
- {
+
+ public enum Defaults
+ {
+ Port = 1494,
+ EncryptionStrength = 0
+ }
+
+ public enum EncryptionStrength
+ {
[LocalizedAttributes.LocalizedDescription("strEncBasic")]
EncrBasic = 1,
+
[LocalizedAttributes.LocalizedDescription("strEnc128BitLogonOnly")]
Encr128BitLogonOnly = 127,
+
[LocalizedAttributes.LocalizedDescription("strEnc40Bit")]
Encr40Bit = 40,
+
[LocalizedAttributes.LocalizedDescription("strEnc56Bit")]
Encr56Bit = 56,
+
[LocalizedAttributes.LocalizedDescription("strEnc128Bit")]
Encr128Bit = 128
- }
+ }
+
#endregion
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/IntegratedProgram.cs b/mRemoteV1/Connection/Protocol/IntegratedProgram.cs
index c4fa5630..2b296074 100644
--- a/mRemoteV1/Connection/Protocol/IntegratedProgram.cs
+++ b/mRemoteV1/Connection/Protocol/IntegratedProgram.cs
@@ -9,174 +9,198 @@ using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol
{
- public class IntegratedProgram : ProtocolBase
- {
+ public class IntegratedProgram : ProtocolBase
+ {
#region Private Fields
+
private ExternalTool _externalTool;
private IntPtr _handle;
private Process _process;
+
#endregion
#region Public Methods
- public override bool Initialize()
- {
- if (InterfaceControl.Info == null)
- return base.Initialize();
- _externalTool = Runtime.ExternalToolsService.GetExtAppByName(InterfaceControl.Info.ExtApp);
+ public override bool Initialize()
+ {
+ if (InterfaceControl.Info == null)
+ return base.Initialize();
- if (_externalTool == null)
- {
- Runtime.MessageCollector?.AddMessage(MessageClass.ErrorMsg, string.Format(Language.CouldNotFindExternalTool, InterfaceControl.Info.ExtApp));
- return false;
- }
+ _externalTool = Runtime.ExternalToolsService.GetExtAppByName(InterfaceControl.Info.ExtApp);
- _externalTool.ConnectionInfo = InterfaceControl.Info;
+ if (_externalTool == null)
+ {
+ Runtime.MessageCollector?.AddMessage(MessageClass.ErrorMsg,
+ string.Format(Language.CouldNotFindExternalTool,
+ InterfaceControl.Info.ExtApp));
+ return false;
+ }
- return base.Initialize();
- }
-
- public override bool Connect()
- {
- try
- {
- Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, $"Attempting to start: {_externalTool.DisplayName}", true);
+ _externalTool.ConnectionInfo = InterfaceControl.Info;
+
+ return base.Initialize();
+ }
+
+ public override bool Connect()
+ {
+ try
+ {
+ Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg,
+ $"Attempting to start: {_externalTool.DisplayName}", true);
if (_externalTool.TryIntegrate == false)
- {
- _externalTool.Start(InterfaceControl.Info);
+ {
+ _externalTool.Start(InterfaceControl.Info);
/* Don't call close here... There's nothing for the override to do in this case since
* _process is not created in this scenario. When returning false, ProtocolBase.Close()
* will be called - which is just going to call IntegratedProgram.Close() again anyway...
* Close();
*/
- Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, $"Assuming no other errors/exceptions occurred immediately before this message regarding {_externalTool.DisplayName}, the next \"closed by user\" message can be ignored", true);
+ Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg,
+ $"Assuming no other errors/exceptions occurred immediately before this message regarding {_externalTool.DisplayName}, the next \"closed by user\" message can be ignored",
+ true);
return false;
- }
+ }
var argParser = new ExternalToolArgumentParser(_externalTool.ConnectionInfo);
- _process = new Process
- {
- StartInfo =
- {
- UseShellExecute = true,
- FileName = argParser.ParseArguments(_externalTool.FileName),
- Arguments = argParser.ParseArguments(_externalTool.Arguments)
- },
- EnableRaisingEvents = true
- };
+ _process = new Process
+ {
+ StartInfo =
+ {
+ UseShellExecute = true,
+ FileName = argParser.ParseArguments(_externalTool.FileName),
+ Arguments = argParser.ParseArguments(_externalTool.Arguments)
+ },
+ EnableRaisingEvents = true
+ };
- _process.Exited += ProcessExited;
-
- _process.Start();
+ _process.Exited += ProcessExited;
+
+ _process.Start();
_process.WaitForInputIdle(Settings.Default.MaxPuttyWaitTime * 1000);
var startTicks = Environment.TickCount;
- while (_handle.ToInt32() == 0 & Environment.TickCount < startTicks + Settings.Default.MaxPuttyWaitTime * 1000)
- {
- _process.Refresh();
- if (_process.MainWindowTitle != "Default IME")
- {
- _handle = _process.MainWindowHandle;
- }
- if (_handle.ToInt32() == 0)
- {
- Thread.Sleep(0);
- }
- }
-
- NativeMethods.SetParent(_handle, InterfaceControl.Handle);
- Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, Language.strIntAppStuff, true);
- Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppHandle, _handle), true);
- Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppTitle, _process.MainWindowTitle), true);
- Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppParentHandle, InterfaceControl.Parent.Handle), true);
-
- Resize(this, new EventArgs());
- base.Connect();
- return true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector?.AddExceptionMessage(Language.strIntAppConnectionFailed, ex);
- return false;
- }
- }
-
- public override void Focus()
- {
- try
- {
- NativeMethods.SetForegroundWindow(_handle);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppFocusFailed, ex);
- }
- }
-
- public override void Resize(object sender, EventArgs e)
- {
- try
- {
- if (InterfaceControl.Size == Size.Empty) return;
- NativeMethods.MoveWindow(_handle, -SystemInformation.FrameBorderSize.Width, -(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height), InterfaceControl.Width + SystemInformation.FrameBorderSize.Width * 2, InterfaceControl.Height + SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height * 2, true);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppResizeFailed, ex);
- }
- }
-
- public override void Close()
- {
+ while (_handle.ToInt32() == 0 &
+ Environment.TickCount < startTicks + Settings.Default.MaxPuttyWaitTime * 1000)
+ {
+ _process.Refresh();
+ if (_process.MainWindowTitle != "Default IME")
+ {
+ _handle = _process.MainWindowHandle;
+ }
+
+ if (_handle.ToInt32() == 0)
+ {
+ Thread.Sleep(0);
+ }
+ }
+
+ NativeMethods.SetParent(_handle, InterfaceControl.Handle);
+ Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, Language.strIntAppStuff, true);
+ Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strIntAppHandle, _handle), true);
+ Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strIntAppTitle, _process.MainWindowTitle),
+ true);
+ Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strIntAppParentHandle,
+ InterfaceControl.Parent.Handle), true);
+
+ Resize(this, new EventArgs());
+ base.Connect();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector?.AddExceptionMessage(Language.strIntAppConnectionFailed, ex);
+ return false;
+ }
+ }
+
+ public override void Focus()
+ {
+ try
+ {
+ NativeMethods.SetForegroundWindow(_handle);
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppFocusFailed, ex);
+ }
+ }
+
+ public override void Resize(object sender, EventArgs e)
+ {
+ try
+ {
+ if (InterfaceControl.Size == Size.Empty) return;
+ NativeMethods.MoveWindow(_handle, -SystemInformation.FrameBorderSize.Width,
+ -(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height),
+ InterfaceControl.Width + SystemInformation.FrameBorderSize.Width * 2,
+ InterfaceControl.Height + SystemInformation.CaptionHeight +
+ SystemInformation.FrameBorderSize.Height * 2, true);
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppResizeFailed, ex);
+ }
+ }
+
+ public override void Close()
+ {
/* only attempt this if we have a valid process object
* Non-integrated tools will still call base.Close() and don't have a valid process object.
* See Connect() above... This just muddies up the log.
*/
if (_process != null)
- {
- try
- {
- if (!_process.HasExited)
- {
- _process.Kill();
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppKillFailed, ex);
- }
+ {
+ try
+ {
+ if (!_process.HasExited)
+ {
+ _process.Kill();
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppKillFailed, ex);
+ }
- try
- {
- if (!_process.HasExited)
- {
- _process.Dispose();
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppDisposeFailed, ex);
- }
- }
+ try
+ {
+ if (!_process.HasExited)
+ {
+ _process.Dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppDisposeFailed, ex);
+ }
+ }
+
+ base.Close();
+ }
- base.Close();
- }
#endregion
-
+
#region Private Methods
- private void ProcessExited(object sender, EventArgs e)
- {
- Event_Closed(this);
- }
+
+ private void ProcessExited(object sender, EventArgs e)
+ {
+ Event_Closed(this);
+ }
+
#endregion
-
+
#region Enumerations
- public enum Defaults
- {
- Port = 0
- }
+
+ public enum Defaults
+ {
+ Port = 0
+ }
+
#endregion
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/ProtocolBase.cs b/mRemoteV1/Connection/Protocol/ProtocolBase.cs
index 2a6082e0..a9c9023d 100644
--- a/mRemoteV1/Connection/Protocol/ProtocolBase.cs
+++ b/mRemoteV1/Connection/Protocol/ProtocolBase.cs
@@ -4,6 +4,7 @@ using System;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.UI.Tabs;
+
// ReSharper disable UnusedMember.Local
namespace mRemoteNG.Connection.Protocol
@@ -12,51 +13,54 @@ namespace mRemoteNG.Connection.Protocol
{
#region Private Variables
- private ConnectionTab _connectionTab;
+ private ConnectionTab _connectionTab;
private InterfaceControl _interfaceControl;
- private ConnectingEventHandler ConnectingEvent;
+ private ConnectingEventHandler ConnectingEvent;
private ConnectedEventHandler ConnectedEvent;
private DisconnectedEventHandler DisconnectedEvent;
private ErrorOccuredEventHandler ErrorOccuredEvent;
private ClosingEventHandler ClosingEvent;
private ClosedEventHandler ClosedEvent;
+
#endregion
#region Public Properties
+
#region Control
+
private string Name { get; }
private ConnectionTab ConnectionTab
- {
- get => _connectionTab;
+ {
+ get => _connectionTab;
set
- {
- _connectionTab = value;
- _connectionTab.ResizeBegin += ResizeBegin;
- _connectionTab.Resize += Resize;
- _connectionTab.ResizeEnd += ResizeEnd;
- }
- }
+ {
+ _connectionTab = value;
+ _connectionTab.ResizeBegin += ResizeBegin;
+ _connectionTab.Resize += Resize;
+ _connectionTab.ResizeEnd += ResizeEnd;
+ }
+ }
public InterfaceControl InterfaceControl
- {
- get => _interfaceControl;
+ {
+ get => _interfaceControl;
set
- {
- _interfaceControl = value;
+ {
+ _interfaceControl = value;
- if(_interfaceControl.Parent is ConnectionTab ct)
- ConnectionTab = ct;
- }
- }
+ if (_interfaceControl.Parent is ConnectionTab ct)
+ ConnectionTab = ct;
+ }
+ }
protected Control Control { get; set; }
- #endregion
+ #endregion
public ConnectionInfo.Force Force { get; set; }
- public readonly System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
+ public readonly System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
protected ReconnectGroup ReconnectGroup;
protected ProtocolBase(string name)
@@ -71,240 +75,260 @@ namespace mRemoteNG.Connection.Protocol
#endregion
#region Methods
+
//public abstract int GetDefaultPort();
public virtual void Focus()
- {
- try
- {
- Control.Focus();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("Couldn't focus Control (Connection.Protocol.Base)", ex);
- }
- }
+ {
+ try
+ {
+ Control.Focus();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("Couldn't focus Control (Connection.Protocol.Base)",
+ ex);
+ }
+ }
public virtual void ResizeBegin(object sender, EventArgs e)
- {
- }
+ {
+ }
public virtual void Resize(object sender, EventArgs e)
- {
- }
+ {
+ }
public virtual void ResizeEnd(object sender, EventArgs e)
- {
- }
+ {
+ }
- public virtual bool Initialize()
- {
- try
- {
- _interfaceControl.Parent.Tag = _interfaceControl;
- _interfaceControl.Show();
+ public virtual bool Initialize()
+ {
+ try
+ {
+ _interfaceControl.Parent.Tag = _interfaceControl;
+ _interfaceControl.Show();
- if (Control == null) return true;
- Control.Name = Name;
- Control.Parent = _interfaceControl;
- Control.Location = _interfaceControl.Location;
- Control.Size = InterfaceControl.Size;
- Control.Anchor = _interfaceControl.Anchor;
+ if (Control == null) return true;
+ Control.Name = Name;
+ Control.Parent = _interfaceControl;
+ Control.Location = _interfaceControl.Location;
+ Control.Size = InterfaceControl.Size;
+ Control.Anchor = _interfaceControl.Anchor;
- return true;
- }
- catch (Exception ex)
- {
+ return true;
+ }
+ catch (Exception ex)
+ {
Runtime.MessageCollector.AddExceptionStackTrace("Couldn't SetProps (Connection.Protocol.Base)", ex);
- return false;
- }
- }
+ return false;
+ }
+ }
- public virtual bool Connect()
- {
- if (InterfaceControl.Info.Protocol == ProtocolType.RDP) return false;
- if (ConnectedEvent == null) return false;
- ConnectedEvent(this);
- return true;
- }
+ public virtual bool Connect()
+ {
+ if (InterfaceControl.Info.Protocol == ProtocolType.RDP) return false;
+ if (ConnectedEvent == null) return false;
+ ConnectedEvent(this);
+ return true;
+ }
- public virtual void Disconnect()
- {
- Close();
- }
+ public virtual void Disconnect()
+ {
+ Close();
+ }
- public virtual void Close()
- {
- var t = new Thread(CloseBG);
- t.SetApartmentState(ApartmentState.STA);
- t.IsBackground = true;
- t.Start();
- }
+ public virtual void Close()
+ {
+ var t = new Thread(CloseBG);
+ t.SetApartmentState(ApartmentState.STA);
+ t.IsBackground = true;
+ t.Start();
+ }
- private void CloseBG()
- {
- ClosedEvent?.Invoke(this);
- try
- {
- tmrReconnect.Enabled = false;
+ private void CloseBG()
+ {
+ ClosedEvent?.Invoke(this);
+ try
+ {
+ tmrReconnect.Enabled = false;
- if (Control != null)
- {
- try
- {
- DisposeControl();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't dispose control, probably form is already closed (Connection.Protocol.Base)", ex);
- }
- }
+ if (Control != null)
+ {
+ try
+ {
+ DisposeControl();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector?.AddExceptionStackTrace(
+ "Couldn't dispose control, probably form is already closed (Connection.Protocol.Base)",
+ ex);
+ }
+ }
- if (_interfaceControl == null) return;
+ if (_interfaceControl == null) return;
- try
- {
- if (_interfaceControl.Parent == null) return;
+ try
+ {
+ if (_interfaceControl.Parent == null) return;
- if (_interfaceControl.Parent.Tag != null)
- {
- SetTagToNothing();
- }
+ if (_interfaceControl.Parent.Tag != null)
+ {
+ SetTagToNothing();
+ }
- DisposeInterface();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't set InterfaceControl.Parent.Tag or Dispose Interface, probably form is already closed (Connection.Protocol.Base)", ex);
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't Close InterfaceControl BG (Connection.Protocol.Base)", ex);
- }
- }
+ DisposeInterface();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector?.AddExceptionStackTrace(
+ "Couldn't set InterfaceControl.Parent.Tag or Dispose Interface, probably form is already closed (Connection.Protocol.Base)",
+ ex);
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector?.AddExceptionStackTrace(
+ "Couldn't Close InterfaceControl BG (Connection.Protocol.Base)",
+ ex);
+ }
+ }
- private delegate void DisposeInterfaceCB();
- private void DisposeInterface()
- {
- if (_interfaceControl.InvokeRequired)
- {
- var s = new DisposeInterfaceCB(DisposeInterface);
- _interfaceControl.Invoke(s);
- }
- else
- {
- _interfaceControl.Dispose();
- }
- }
+ private delegate void DisposeInterfaceCB();
- private delegate void SetTagToNothingCB();
- private void SetTagToNothing()
- {
- if (_interfaceControl.Parent.InvokeRequired)
- {
- var s = new SetTagToNothingCB(SetTagToNothing);
- _interfaceControl.Parent.Invoke(s);
- }
- else
- {
- _interfaceControl.Parent.Tag = null;
- }
- }
+ private void DisposeInterface()
+ {
+ if (_interfaceControl.InvokeRequired)
+ {
+ var s = new DisposeInterfaceCB(DisposeInterface);
+ _interfaceControl.Invoke(s);
+ }
+ else
+ {
+ _interfaceControl.Dispose();
+ }
+ }
+
+ private delegate void SetTagToNothingCB();
+
+ private void SetTagToNothing()
+ {
+ if (_interfaceControl.Parent.InvokeRequired)
+ {
+ var s = new SetTagToNothingCB(SetTagToNothing);
+ _interfaceControl.Parent.Invoke(s);
+ }
+ else
+ {
+ _interfaceControl.Parent.Tag = null;
+ }
+ }
+
+ private delegate void DisposeControlCB();
+
+ private void DisposeControl()
+ {
+ if (Control.InvokeRequired)
+ {
+ var s = new DisposeControlCB(DisposeControl);
+ Control.Invoke(s);
+ }
+ else
+ {
+ Control.Dispose();
+ }
+ }
- private delegate void DisposeControlCB();
- private void DisposeControl()
- {
- if (Control.InvokeRequired)
- {
- var s = new DisposeControlCB(DisposeControl);
- Control.Invoke(s);
- }
- else
- {
- Control.Dispose();
- }
- }
#endregion
#region Events
- public delegate void ConnectingEventHandler(object sender);
- public event ConnectingEventHandler Connecting
- {
- add => ConnectingEvent = (ConnectingEventHandler) Delegate.Combine(ConnectingEvent, value);
- remove => ConnectingEvent = (ConnectingEventHandler) Delegate.Remove(ConnectingEvent, value);
+
+ public delegate void ConnectingEventHandler(object sender);
+
+ public event ConnectingEventHandler Connecting
+ {
+ add => ConnectingEvent = (ConnectingEventHandler)Delegate.Combine(ConnectingEvent, value);
+ remove => ConnectingEvent = (ConnectingEventHandler)Delegate.Remove(ConnectingEvent, value);
}
- public delegate void ConnectedEventHandler(object sender);
- public event ConnectedEventHandler Connected
- {
- add => ConnectedEvent = (ConnectedEventHandler) Delegate.Combine(ConnectedEvent, value);
- remove => ConnectedEvent = (ConnectedEventHandler) Delegate.Remove(ConnectedEvent, value);
+ public delegate void ConnectedEventHandler(object sender);
+
+ public event ConnectedEventHandler Connected
+ {
+ add => ConnectedEvent = (ConnectedEventHandler)Delegate.Combine(ConnectedEvent, value);
+ remove => ConnectedEvent = (ConnectedEventHandler)Delegate.Remove(ConnectedEvent, value);
}
- public delegate void DisconnectedEventHandler(object sender, string disconnectedMessage, int? reasonCode);
- public event DisconnectedEventHandler Disconnected
- {
- add => DisconnectedEvent = (DisconnectedEventHandler) Delegate.Combine(DisconnectedEvent, value);
- remove => DisconnectedEvent = (DisconnectedEventHandler) Delegate.Remove(DisconnectedEvent, value);
+ public delegate void DisconnectedEventHandler(object sender, string disconnectedMessage, int? reasonCode);
+
+ public event DisconnectedEventHandler Disconnected
+ {
+ add => DisconnectedEvent = (DisconnectedEventHandler)Delegate.Combine(DisconnectedEvent, value);
+ remove => DisconnectedEvent = (DisconnectedEventHandler)Delegate.Remove(DisconnectedEvent, value);
}
- public delegate void ErrorOccuredEventHandler(object sender, string errorMessage, int? errorCode);
- public event ErrorOccuredEventHandler ErrorOccured
- {
- add => ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Combine(ErrorOccuredEvent, value);
- remove => ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Remove(ErrorOccuredEvent, value);
+ public delegate void ErrorOccuredEventHandler(object sender, string errorMessage, int? errorCode);
+
+ public event ErrorOccuredEventHandler ErrorOccured
+ {
+ add => ErrorOccuredEvent = (ErrorOccuredEventHandler)Delegate.Combine(ErrorOccuredEvent, value);
+ remove => ErrorOccuredEvent = (ErrorOccuredEventHandler)Delegate.Remove(ErrorOccuredEvent, value);
}
- public delegate void ClosingEventHandler(object sender);
- public event ClosingEventHandler Closing
- {
- add => ClosingEvent = (ClosingEventHandler) Delegate.Combine(ClosingEvent, value);
- remove => ClosingEvent = (ClosingEventHandler) Delegate.Remove(ClosingEvent, value);
+ public delegate void ClosingEventHandler(object sender);
+
+ public event ClosingEventHandler Closing
+ {
+ add => ClosingEvent = (ClosingEventHandler)Delegate.Combine(ClosingEvent, value);
+ remove => ClosingEvent = (ClosingEventHandler)Delegate.Remove(ClosingEvent, value);
}
- public delegate void ClosedEventHandler(object sender);
- public event ClosedEventHandler Closed
- {
- add => ClosedEvent = (ClosedEventHandler) Delegate.Combine(ClosedEvent, value);
- remove => ClosedEvent = (ClosedEventHandler) Delegate.Remove(ClosedEvent, value);
+ public delegate void ClosedEventHandler(object sender);
+
+ public event ClosedEventHandler Closed
+ {
+ add => ClosedEvent = (ClosedEventHandler)Delegate.Combine(ClosedEvent, value);
+ remove => ClosedEvent = (ClosedEventHandler)Delegate.Remove(ClosedEvent, value);
}
- public void Event_Closing(object sender)
- {
- ClosingEvent?.Invoke(sender);
- }
+ public void Event_Closing(object sender)
+ {
+ ClosingEvent?.Invoke(sender);
+ }
- protected void Event_Closed(object sender)
- {
- ClosedEvent?.Invoke(sender);
- }
+ protected void Event_Closed(object sender)
+ {
+ ClosedEvent?.Invoke(sender);
+ }
- protected void Event_Connecting(object sender)
- {
- ConnectingEvent?.Invoke(sender);
- }
+ protected void Event_Connecting(object sender)
+ {
+ ConnectingEvent?.Invoke(sender);
+ }
- protected void Event_Connected(object sender)
- {
- ConnectedEvent?.Invoke(sender);
- }
+ protected void Event_Connected(object sender)
+ {
+ ConnectedEvent?.Invoke(sender);
+ }
- protected void Event_Disconnected(object sender, string disconnectedMessage, int? reasonCode)
- {
- DisconnectedEvent?.Invoke(sender, disconnectedMessage, reasonCode);
- }
+ protected void Event_Disconnected(object sender, string disconnectedMessage, int? reasonCode)
+ {
+ DisconnectedEvent?.Invoke(sender, disconnectedMessage, reasonCode);
+ }
- protected void Event_ErrorOccured(object sender, string errorMsg, int? errorCode)
- {
- ErrorOccuredEvent?.Invoke(sender, errorMsg, errorCode);
- }
+ protected void Event_ErrorOccured(object sender, string errorMsg, int? errorCode)
+ {
+ ErrorOccuredEvent?.Invoke(sender, errorMsg, errorCode);
+ }
+
+ protected void Event_ReconnectGroupCloseClicked()
+ {
+ Close();
+ }
- protected void Event_ReconnectGroupCloseClicked()
- {
- Close();
- }
#endregion
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/ProtocolFactory.cs b/mRemoteV1/Connection/Protocol/ProtocolFactory.cs
index c4f6ca99..6c7611f1 100644
--- a/mRemoteV1/Connection/Protocol/ProtocolFactory.cs
+++ b/mRemoteV1/Connection/Protocol/ProtocolFactory.cs
@@ -16,51 +16,53 @@ namespace mRemoteNG.Connection.Protocol
{
var newProtocol = default(ProtocolBase);
// ReSharper disable once SwitchStatementMissingSomeCases
- switch (connectionInfo.Protocol)
- {
- case ProtocolType.RDP:
- newProtocol = new RdpProtocol
- {
- LoadBalanceInfoUseUtf8 = Settings.Default.RdpLoadBalanceInfoUseUtf8
+ switch (connectionInfo.Protocol)
+ {
+ case ProtocolType.RDP:
+ newProtocol = new RdpProtocol
+ {
+ LoadBalanceInfoUseUtf8 = Settings.Default.RdpLoadBalanceInfoUseUtf8
};
- ((RdpProtocol) newProtocol).tmrReconnect.Elapsed += ((RdpProtocol) newProtocol).tmrReconnect_Elapsed;
- break;
- case ProtocolType.VNC:
- newProtocol = new ProtocolVNC();
- break;
- case ProtocolType.SSH1:
- newProtocol = new ProtocolSSH1();
- break;
- case ProtocolType.SSH2:
- newProtocol = new ProtocolSSH2();
- break;
- case ProtocolType.Telnet:
- newProtocol = new ProtocolTelnet();
- break;
- case ProtocolType.Rlogin:
- newProtocol = new ProtocolRlogin();
- break;
- case ProtocolType.RAW:
- newProtocol = new RawProtocol();
- break;
- case ProtocolType.HTTP:
- newProtocol = new ProtocolHTTP(connectionInfo.RenderingEngine);
- break;
- case ProtocolType.HTTPS:
- newProtocol = new ProtocolHTTPS(connectionInfo.RenderingEngine);
- break;
- case ProtocolType.ICA:
- newProtocol = new IcaProtocol();
- ((IcaProtocol) newProtocol).tmrReconnect.Elapsed += ((IcaProtocol) newProtocol).tmrReconnect_Elapsed;
- break;
- case ProtocolType.IntApp:
- newProtocol = new IntegratedProgram();
- if (connectionInfo.ExtApp == "")
- {
- throw (new Exception(Language.strNoExtAppDefined));
- }
- break;
- }
+ ((RdpProtocol)newProtocol).tmrReconnect.Elapsed += ((RdpProtocol)newProtocol).tmrReconnect_Elapsed;
+ break;
+ case ProtocolType.VNC:
+ newProtocol = new ProtocolVNC();
+ break;
+ case ProtocolType.SSH1:
+ newProtocol = new ProtocolSSH1();
+ break;
+ case ProtocolType.SSH2:
+ newProtocol = new ProtocolSSH2();
+ break;
+ case ProtocolType.Telnet:
+ newProtocol = new ProtocolTelnet();
+ break;
+ case ProtocolType.Rlogin:
+ newProtocol = new ProtocolRlogin();
+ break;
+ case ProtocolType.RAW:
+ newProtocol = new RawProtocol();
+ break;
+ case ProtocolType.HTTP:
+ newProtocol = new ProtocolHTTP(connectionInfo.RenderingEngine);
+ break;
+ case ProtocolType.HTTPS:
+ newProtocol = new ProtocolHTTPS(connectionInfo.RenderingEngine);
+ break;
+ case ProtocolType.ICA:
+ newProtocol = new IcaProtocol();
+ ((IcaProtocol)newProtocol).tmrReconnect.Elapsed += ((IcaProtocol)newProtocol).tmrReconnect_Elapsed;
+ break;
+ case ProtocolType.IntApp:
+ newProtocol = new IntegratedProgram();
+ if (connectionInfo.ExtApp == "")
+ {
+ throw (new Exception(Language.strNoExtAppDefined));
+ }
+
+ break;
+ }
+
return newProtocol;
}
}
diff --git a/mRemoteV1/Connection/Protocol/ProtocolList.cs b/mRemoteV1/Connection/Protocol/ProtocolList.cs
index e3582b48..0edbe325 100644
--- a/mRemoteV1/Connection/Protocol/ProtocolList.cs
+++ b/mRemoteV1/Connection/Protocol/ProtocolList.cs
@@ -1,74 +1,82 @@
using System;
using System.Collections;
using System.Collections.Specialized;
+
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Connection.Protocol
{
- public class ProtocolList : CollectionBase, INotifyCollectionChanged
- {
+ public class ProtocolList : CollectionBase, INotifyCollectionChanged
+ {
public ProtocolBase this[object index]
- {
- get
- {
- var @base = index as ProtocolBase;
- if (@base != null)
+ {
+ get
+ {
+ var @base = index as ProtocolBase;
+ if (@base != null)
return @base;
- if (index is int)
- return (ProtocolBase) List[Convert.ToInt32(index)];
- return null;
- }
- }
-
+ if (index is int)
+ return (ProtocolBase)List[Convert.ToInt32(index)];
+ return null;
+ }
+ }
+
public new int Count
{
get { return List.Count; }
}
- public void Add(ProtocolBase cProt)
- {
- List.Add(cProt);
- RaiseCollectionChangedEvent(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, cProt));
+ public void Add(ProtocolBase cProt)
+ {
+ List.Add(cProt);
+ RaiseCollectionChangedEvent(this,
+ new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, cProt));
}
-
- public void AddRange(ProtocolBase[] cProt)
- {
- foreach (var cP in cProt)
- {
- List.Add(cP);
- }
- RaiseCollectionChangedEvent(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, cProt));
- }
-
- public void Remove(ProtocolBase cProt)
- {
- try
- {
+
+ public void AddRange(ProtocolBase[] cProt)
+ {
+ foreach (var cP in cProt)
+ {
+ List.Add(cP);
+ }
+
+ RaiseCollectionChangedEvent(this,
+ new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, cProt));
+ }
+
+ public void Remove(ProtocolBase cProt)
+ {
+ try
+ {
if (!List.Contains(cProt))
return;
- List.Remove(cProt);
- RaiseCollectionChangedEvent(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, cProt));
+ List.Remove(cProt);
+ RaiseCollectionChangedEvent(this,
+ new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove,
+ cProt));
}
- catch (Exception)
- {
- }
- }
-
- public new void Clear()
- {
+ catch (Exception)
+ {
+ }
+ }
+
+ public new void Clear()
+ {
if (Count == 0)
return;
- List.Clear();
- RaiseCollectionChangedEvent(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
- }
+ List.Clear();
+ RaiseCollectionChangedEvent(this,
+ new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
+ }
- public event NotifyCollectionChangedEventHandler CollectionChanged;
- private void RaiseCollectionChangedEvent(object sender, NotifyCollectionChangedEventArgs args)
- {
- CollectionChanged?.Invoke(sender, args);
- }
+ public event NotifyCollectionChangedEventHandler CollectionChanged;
+
+ private void RaiseCollectionChangedEvent(object sender, NotifyCollectionChangedEventArgs args)
+ {
+ CollectionChanged?.Invoke(sender, args);
+ }
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/ProtocolType.cs b/mRemoteV1/Connection/Protocol/ProtocolType.cs
index 69d4fa6f..44aca2f9 100644
--- a/mRemoteV1/Connection/Protocol/ProtocolType.cs
+++ b/mRemoteV1/Connection/Protocol/ProtocolType.cs
@@ -2,29 +2,39 @@ using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol
{
- public enum ProtocolType
- {
+ public enum ProtocolType
+ {
[LocalizedAttributes.LocalizedDescription("strRDP")]
RDP = 0,
+
[LocalizedAttributes.LocalizedDescription("strVnc")]
VNC = 1,
+
[LocalizedAttributes.LocalizedDescription("strSsh1")]
SSH1 = 2,
+
[LocalizedAttributes.LocalizedDescription("strSsh2")]
SSH2 = 3,
+
[LocalizedAttributes.LocalizedDescription("strTelnet")]
Telnet = 4,
+
[LocalizedAttributes.LocalizedDescription("strRlogin")]
Rlogin = 5,
+
[LocalizedAttributes.LocalizedDescription("strRAW")]
RAW = 6,
+
[LocalizedAttributes.LocalizedDescription("strHttp")]
HTTP = 7,
+
[LocalizedAttributes.LocalizedDescription("strHttps")]
HTTPS = 8,
+
[LocalizedAttributes.LocalizedDescription("strICA")]
ICA = 9,
+
[LocalizedAttributes.LocalizedDescription("strExtApp")]
IntApp = 20
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/PuttyBase.cs b/mRemoteV1/Connection/Protocol/PuttyBase.cs
index 39de44bc..3897542d 100644
--- a/mRemoteV1/Connection/Protocol/PuttyBase.cs
+++ b/mRemoteV1/Connection/Protocol/PuttyBase.cs
@@ -15,9 +15,9 @@ using System.Windows.Forms;
namespace mRemoteNG.Connection.Protocol
{
public class PuttyBase : ProtocolBase
- {
- private const int IDM_RECONF = 0x50; // PuTTY Settings Menu ID
- private bool _isPuttyNg;
+ {
+ private const int IDM_RECONF = 0x50; // PuTTY Settings Menu ID
+ private bool _isPuttyNg;
private readonly DisplayProperties _display = new DisplayProperties();
#region Public Properties
@@ -26,176 +26,192 @@ namespace mRemoteNG.Connection.Protocol
protected Putty_SSHVersion PuttySSHVersion { private get; set; }
- public IntPtr PuttyHandle { get; set; }
+ public IntPtr PuttyHandle { get; set; }
- private Process PuttyProcess { get; set; }
+ private Process PuttyProcess { get; set; }
- public static string PuttyPath { get; set; }
+ public static string PuttyPath { get; set; }
- public bool Focused
- {
- get { return NativeMethods.GetForegroundWindow() == PuttyHandle; }
- }
+ public bool Focused
+ {
+ get { return NativeMethods.GetForegroundWindow() == PuttyHandle; }
+ }
- #endregion
+ #endregion
- #region Private Events & Handlers
- private void ProcessExited(object sender, EventArgs e)
- {
+ #region Private Events & Handlers
+
+ private void ProcessExited(object sender, EventArgs e)
+ {
Event_Closed(this);
- }
+ }
+
#endregion
#region Public Methods
- public override bool Connect()
- {
- try
- {
- _isPuttyNg = PuttyTypeDetector.GetPuttyType() == PuttyTypeDetector.PuttyType.PuttyNg;
- PuttyProcess = new Process
- {
- StartInfo =
- {
- UseShellExecute = false,
- FileName = PuttyPath
- }
- };
+ public override bool Connect()
+ {
+ try
+ {
+ _isPuttyNg = PuttyTypeDetector.GetPuttyType() == PuttyTypeDetector.PuttyType.PuttyNg;
- var arguments = new CommandLineArguments {EscapeForShell = false};
+ PuttyProcess = new Process
+ {
+ StartInfo =
+ {
+ UseShellExecute = false,
+ FileName = PuttyPath
+ }
+ };
- arguments.Add("-load", InterfaceControl.Info.PuttySession);
+ var arguments = new CommandLineArguments {EscapeForShell = false};
- if (!(InterfaceControl.Info is PuttySessionInfo))
- {
- arguments.Add("-" + PuttyProtocol);
+ arguments.Add("-load", InterfaceControl.Info.PuttySession);
- if (PuttyProtocol == Putty_Protocol.ssh)
- {
- var username = "";
- var password = "";
+ if (!(InterfaceControl.Info is PuttySessionInfo))
+ {
+ arguments.Add("-" + PuttyProtocol);
- if (!string.IsNullOrEmpty(InterfaceControl.Info?.Username))
- {
- username = InterfaceControl.Info.Username;
- }
- else
- {
- // ReSharper disable once SwitchStatementMissingSomeCases
- switch (Settings.Default.EmptyCredentials)
- {
- case "windows":
- username = Environment.UserName;
- break;
- case "custom":
- username = Settings.Default.DefaultUsername;
- break;
- }
- }
+ if (PuttyProtocol == Putty_Protocol.ssh)
+ {
+ var username = "";
+ var password = "";
- if (!string.IsNullOrEmpty(InterfaceControl.Info?.Password))
- {
- password = InterfaceControl.Info.Password;
- }
- else
- {
- if (Settings.Default.EmptyCredentials == "custom")
- {
+ if (!string.IsNullOrEmpty(InterfaceControl.Info?.Username))
+ {
+ username = InterfaceControl.Info.Username;
+ }
+ else
+ {
+ // ReSharper disable once SwitchStatementMissingSomeCases
+ switch (Settings.Default.EmptyCredentials)
+ {
+ case "windows":
+ username = Environment.UserName;
+ break;
+ case "custom":
+ username = Settings.Default.DefaultUsername;
+ break;
+ }
+ }
+
+ if (!string.IsNullOrEmpty(InterfaceControl.Info?.Password))
+ {
+ password = InterfaceControl.Info.Password;
+ }
+ else
+ {
+ if (Settings.Default.EmptyCredentials == "custom")
+ {
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
- password = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey);
- }
- }
+ password = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword,
+ Runtime.EncryptionKey);
+ }
+ }
- arguments.Add("-" + (int)PuttySSHVersion);
+ arguments.Add("-" + (int)PuttySSHVersion);
- if (!Force.HasFlag(ConnectionInfo.Force.NoCredentials))
- {
- if (!string.IsNullOrEmpty(username))
- {
- arguments.Add("-l", username);
- }
- if (!string.IsNullOrEmpty(password))
- {
- arguments.Add("-pw", password);
- }
- }
- }
+ if (!Force.HasFlag(ConnectionInfo.Force.NoCredentials))
+ {
+ if (!string.IsNullOrEmpty(username))
+ {
+ arguments.Add("-l", username);
+ }
- arguments.Add("-P", InterfaceControl.Info.Port.ToString());
- arguments.Add(InterfaceControl.Info.Hostname);
- }
+ if (!string.IsNullOrEmpty(password))
+ {
+ arguments.Add("-pw", password);
+ }
+ }
+ }
- if (_isPuttyNg)
- {
- arguments.Add("-hwndparent", InterfaceControl.Handle.ToString());
- }
+ arguments.Add("-P", InterfaceControl.Info.Port.ToString());
+ arguments.Add(InterfaceControl.Info.Hostname);
+ }
- PuttyProcess.StartInfo.Arguments = arguments.ToString();
+ if (_isPuttyNg)
+ {
+ arguments.Add("-hwndparent", InterfaceControl.Handle.ToString());
+ }
- PuttyProcess.EnableRaisingEvents = true;
- PuttyProcess.Exited += ProcessExited;
+ PuttyProcess.StartInfo.Arguments = arguments.ToString();
- PuttyProcess.Start();
- PuttyProcess.WaitForInputIdle(Settings.Default.MaxPuttyWaitTime * 1000);
+ PuttyProcess.EnableRaisingEvents = true;
+ PuttyProcess.Exited += ProcessExited;
- var startTicks = Environment.TickCount;
- while (PuttyHandle.ToInt32() == 0 & Environment.TickCount < startTicks + Settings.Default.MaxPuttyWaitTime * 1000)
- {
- if (_isPuttyNg)
- {
- PuttyHandle = NativeMethods.FindWindowEx(
- InterfaceControl.Handle, new IntPtr(0), null, null);
- }
- else
- {
- PuttyProcess.Refresh();
- PuttyHandle = PuttyProcess.MainWindowHandle;
- }
- if (PuttyHandle.ToInt32() == 0)
- {
- Thread.Sleep(0);
- }
- }
+ PuttyProcess.Start();
+ PuttyProcess.WaitForInputIdle(Settings.Default.MaxPuttyWaitTime * 1000);
- if (!_isPuttyNg)
- {
- NativeMethods.SetParent(PuttyHandle, InterfaceControl.Handle);
- }
+ var startTicks = Environment.TickCount;
+ while (PuttyHandle.ToInt32() == 0 &
+ Environment.TickCount < startTicks + Settings.Default.MaxPuttyWaitTime * 1000)
+ {
+ if (_isPuttyNg)
+ {
+ PuttyHandle = NativeMethods.FindWindowEx(
+ InterfaceControl.Handle, new IntPtr(0), null, null);
+ }
+ else
+ {
+ PuttyProcess.Refresh();
+ PuttyHandle = PuttyProcess.MainWindowHandle;
+ }
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strPuttyStuff, true);
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strPuttyHandle, PuttyHandle), true);
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strPuttyTitle, PuttyProcess.MainWindowTitle), true);
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strPuttyParentHandle, InterfaceControl.Parent.Handle), true);
+ if (PuttyHandle.ToInt32() == 0)
+ {
+ Thread.Sleep(0);
+ }
+ }
- Resize(this, new EventArgs());
- base.Connect();
- return true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyConnectionFailed + Environment.NewLine + ex.Message);
- return false;
- }
- }
+ if (!_isPuttyNg)
+ {
+ NativeMethods.SetParent(PuttyHandle, InterfaceControl.Handle);
+ }
- public override void Focus()
- {
- try
- {
- NativeMethods.SetForegroundWindow(PuttyHandle);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyFocusFailed + Environment.NewLine + ex.Message, true);
- }
- }
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strPuttyStuff, true);
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strPuttyHandle, PuttyHandle), true);
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strPuttyTitle, PuttyProcess.MainWindowTitle),
+ true);
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strPuttyParentHandle,
+ InterfaceControl.Parent.Handle), true);
- public override void Resize(object sender, EventArgs e)
- {
- try
- {
- if (InterfaceControl.Size == Size.Empty)
- return;
+ Resize(this, new EventArgs());
+ base.Connect();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strPuttyConnectionFailed + Environment.NewLine +
+ ex.Message);
+ return false;
+ }
+ }
+
+ public override void Focus()
+ {
+ try
+ {
+ NativeMethods.SetForegroundWindow(PuttyHandle);
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strPuttyFocusFailed + Environment.NewLine + ex.Message,
+ true);
+ }
+ }
+
+ public override void Resize(object sender, EventArgs e)
+ {
+ try
+ {
+ if (InterfaceControl.Size == Size.Empty)
+ return;
if (_isPuttyNg)
{
@@ -208,74 +224,85 @@ namespace mRemoteNG.Connection.Protocol
var scaledFrameBorderWidth = _display.ScaleWidth(SystemInformation.FrameBorderSize.Width);
NativeMethods.MoveWindow(PuttyHandle, -scaledFrameBorderWidth,
- -(SystemInformation.CaptionHeight + scaledFrameBorderHeight),
- InterfaceControl.Width + scaledFrameBorderWidth * 2,
- InterfaceControl.Height + SystemInformation.CaptionHeight + scaledFrameBorderHeight * 2,
- true);
+ -(SystemInformation.CaptionHeight + scaledFrameBorderHeight),
+ InterfaceControl.Width + scaledFrameBorderWidth * 2,
+ InterfaceControl.Height + SystemInformation.CaptionHeight +
+ scaledFrameBorderHeight * 2,
+ true);
}
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyResizeFailed + Environment.NewLine + ex.Message, true);
- }
- }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strPuttyResizeFailed + Environment.NewLine + ex.Message,
+ true);
+ }
+ }
- public override void Close()
- {
- try
- {
- if (PuttyProcess.HasExited == false)
- {
- PuttyProcess.Kill();
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyKillFailed + Environment.NewLine + ex.Message, true);
- }
+ public override void Close()
+ {
+ try
+ {
+ if (PuttyProcess.HasExited == false)
+ {
+ PuttyProcess.Kill();
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strPuttyKillFailed + Environment.NewLine + ex.Message,
+ true);
+ }
- try
- {
+ try
+ {
PuttyProcess.Dispose();
}
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyDisposeFailed + Environment.NewLine + ex.Message, true);
- }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strPuttyDisposeFailed + Environment.NewLine + ex.Message,
+ true);
+ }
- base.Close();
- }
+ base.Close();
+ }
- public void ShowSettingsDialog()
- {
- try
- {
+ public void ShowSettingsDialog()
+ {
+ try
+ {
NativeMethods.PostMessage(PuttyHandle, NativeMethods.WM_SYSCOMMAND, (IntPtr)IDM_RECONF, (IntPtr)0);
NativeMethods.SetForegroundWindow(PuttyHandle);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strPuttyShowSettingsDialogFailed + Environment.NewLine + ex.Message, true);
- }
- }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strPuttyShowSettingsDialogFailed + Environment.NewLine +
+ ex.Message, true);
+ }
+ }
+
#endregion
#region Enums
- protected enum Putty_Protocol
- {
- ssh = 0,
- telnet = 1,
- rlogin = 2,
- raw = 3,
- serial = 4
- }
+ protected enum Putty_Protocol
+ {
+ ssh = 0,
+ telnet = 1,
+ rlogin = 2,
+ raw = 3,
+ serial = 4
+ }
+
+ protected enum Putty_SSHVersion
+ {
+ ssh1 = 1,
+ ssh2 = 2
+ }
- protected enum Putty_SSHVersion
- {
- ssh1 = 1,
- ssh2 = 2
- }
#endregion
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/RAW/RawProtocol.cs b/mRemoteV1/Connection/Protocol/RAW/RawProtocol.cs
index 4e9643e3..cb7f0a51 100644
--- a/mRemoteV1/Connection/Protocol/RAW/RawProtocol.cs
+++ b/mRemoteV1/Connection/Protocol/RAW/RawProtocol.cs
@@ -1,15 +1,15 @@
namespace mRemoteNG.Connection.Protocol.RAW
{
- public class RawProtocol : PuttyBase
- {
- public RawProtocol()
- {
- PuttyProtocol = Putty_Protocol.raw;
- }
-
- public enum Defaults
- {
- Port = 23
- }
- }
+ public class RawProtocol : PuttyBase
+ {
+ public RawProtocol()
+ {
+ PuttyProtocol = Putty_Protocol.raw;
+ }
+
+ public enum Defaults
+ {
+ Port = 23
+ }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/RDP/AzureLoadBalanceInfoEncoder.cs b/mRemoteV1/Connection/Protocol/RDP/AzureLoadBalanceInfoEncoder.cs
index e0836053..1f7a2e38 100644
--- a/mRemoteV1/Connection/Protocol/RDP/AzureLoadBalanceInfoEncoder.cs
+++ b/mRemoteV1/Connection/Protocol/RDP/AzureLoadBalanceInfoEncoder.cs
@@ -37,4 +37,4 @@ namespace mRemoteNG.Connection.Protocol.RDP
return Encoding.Unicode.GetString(bytes);
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpClientWrap.cs b/mRemoteV1/Connection/Protocol/RDP/RdpClientWrap.cs
index 53414dc1..08ed2f85 100644
--- a/mRemoteV1/Connection/Protocol/RDP/RdpClientWrap.cs
+++ b/mRemoteV1/Connection/Protocol/RDP/RdpClientWrap.cs
@@ -11,14 +11,14 @@ namespace mRemoteNG.Connection.Protocol.RDP
class RdpClientWrap : AxMSTSCLib.AxMsRdpClient8NotSafeForScripting
{
public RdpClientWrap()
- : base()
+ : base()
{
GotFocus += RdpClientWrap_GotFocus;
}
private void RdpClientWrap_GotFocus(object sender, EventArgs e)
{
- ((ConnectionTab)Parent.Parent).Focus();
+ ((ConnectionTab)Parent.Parent).Focus();
}
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpErrorCodes.cs b/mRemoteV1/Connection/Protocol/RDP/RdpErrorCodes.cs
index aa963ffd..b20980c1 100644
--- a/mRemoteV1/Connection/Protocol/RDP/RdpErrorCodes.cs
+++ b/mRemoteV1/Connection/Protocol/RDP/RdpErrorCodes.cs
@@ -12,18 +12,18 @@ namespace mRemoteNG.Connection.Protocol.RDP
{
_description = new Hashtable
{
- { 0, "Language.strRdpErrorUnknown"},
- { 1, "Language.strRdpErrorCode1"},
- { 2, "Language.strRdpErrorOutOfMemory"},
- { 3, "Language.strRdpErrorWindowCreation"},
- { 4, "Language.strRdpErrorCode2"},
- { 5, "Language.strRdpErrorCode3"},
- { 6, "Language.strRdpErrorCode4"},
- { 7, "Language.strRdpErrorConnection"},
- { 100, "Language.strRdpErrorWinsock"}
+ {0, "Language.strRdpErrorUnknown"},
+ {1, "Language.strRdpErrorCode1"},
+ {2, "Language.strRdpErrorOutOfMemory"},
+ {3, "Language.strRdpErrorWindowCreation"},
+ {4, "Language.strRdpErrorCode2"},
+ {5, "Language.strRdpErrorCode3"},
+ {6, "Language.strRdpErrorCode4"},
+ {7, "Language.strRdpErrorConnection"},
+ {100, "Language.strRdpErrorWinsock"}
};
}
-
+
public static string GetError(int id)
{
try
diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs
index ce908a75..ade6e5a5 100644
--- a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs
+++ b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs
@@ -16,7 +16,7 @@ using System.Windows.Forms;
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpProtocol : ProtocolBase
- {
+ {
/* RDP v8 requires Windows 7 with:
* https://support.microsoft.com/en-us/kb/2592687
* OR
@@ -30,99 +30,104 @@ namespace mRemoteNG.Connection.Protocol.RDP
private bool _loginComplete;
private bool _redirectKeys;
private bool _alertOnIdleDisconnect;
- private readonly DisplayProperties _displayProperties;
+ private readonly DisplayProperties _displayProperties;
private readonly FrmMain _frmMain = FrmMain.Default;
#region Properties
- public bool SmartSize
- {
- get => _rdpClient.AdvancedSettings2.SmartSizing;
- private set
- {
- _rdpClient.AdvancedSettings2.SmartSizing = value;
- ReconnectForResize();
- }
- }
-
- public bool Fullscreen
- {
- get => _rdpClient.FullScreen;
- private set
- {
- _rdpClient.FullScreen = value;
- ReconnectForResize();
- }
- }
- private bool RedirectKeys
- {
+ public bool SmartSize
+ {
+ get => _rdpClient.AdvancedSettings2.SmartSizing;
+ private set
+ {
+ _rdpClient.AdvancedSettings2.SmartSizing = value;
+ ReconnectForResize();
+ }
+ }
+
+ public bool Fullscreen
+ {
+ get => _rdpClient.FullScreen;
+ private set
+ {
+ _rdpClient.FullScreen = value;
+ ReconnectForResize();
+ }
+ }
+
+ private bool RedirectKeys
+ {
/*
get
{
return _redirectKeys;
}
*/
- set
- {
- _redirectKeys = value;
- try
- {
- if (!_redirectKeys)
- {
- return;
- }
-
- Debug.Assert(Convert.ToBoolean(_rdpClient.SecuredSettingsEnabled));
+ set
+ {
+ _redirectKeys = value;
+ try
+ {
+ if (!_redirectKeys)
+ {
+ return;
+ }
+
+ Debug.Assert(Convert.ToBoolean(_rdpClient.SecuredSettingsEnabled));
var msRdpClientSecuredSettings = _rdpClient.SecuredSettings2;
- msRdpClientSecuredSettings.KeyboardHookMode = 1; // Apply key combinations at the remote server.
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetRedirectKeysFailed, ex);
- }
- }
- }
+ msRdpClientSecuredSettings.KeyboardHookMode = 1; // Apply key combinations at the remote server.
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetRedirectKeysFailed, ex);
+ }
+ }
+ }
public bool LoadBalanceInfoUseUtf8 { get; set; }
+
#endregion
#region Constructors
+
public RdpProtocol()
{
Control = new RdpClientWrap();
_displayProperties = new DisplayProperties();
}
+
#endregion
#region Public Methods
- public override bool Initialize()
- {
- base.Initialize();
- try
- {
- Control.CreateControl();
- _connectionInfo = InterfaceControl.Info;
-
- try
- {
- while (!Control.Created)
- {
- Thread.Sleep(0);
- Application.DoEvents();
- }
- _rdpClient = (MsRdpClient8NotSafeForScripting)((AxMsRdpClient8NotSafeForScripting)Control).GetOcx();
- }
- catch (System.Runtime.InteropServices.COMException ex)
- {
- Runtime.MessageCollector.AddExceptionMessage(Language.strRdpControlCreationFailed, ex);
- Control.Dispose();
- return false;
- }
-
- _rdpVersion = new Version(_rdpClient.Version);
-
- _rdpClient.Server = _connectionInfo.Hostname;
+ public override bool Initialize()
+ {
+ base.Initialize();
+ try
+ {
+ Control.CreateControl();
+ _connectionInfo = InterfaceControl.Info;
+
+ try
+ {
+ while (!Control.Created)
+ {
+ Thread.Sleep(0);
+ Application.DoEvents();
+ }
+
+ _rdpClient = (MsRdpClient8NotSafeForScripting)((AxMsRdpClient8NotSafeForScripting)Control).GetOcx();
+ }
+ catch (System.Runtime.InteropServices.COMException ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage(Language.strRdpControlCreationFailed, ex);
+ Control.Dispose();
+ return false;
+ }
+
+ _rdpVersion = new Version(_rdpClient.Version);
+
+ _rdpClient.Server = _connectionInfo.Hostname;
SetCredentials();
SetResolution();
@@ -133,549 +138,577 @@ namespace mRemoteNG.Connection.Protocol.RDP
//not user changeable
_rdpClient.AdvancedSettings2.GrabFocusOnConnect = true;
- _rdpClient.AdvancedSettings3.EnableAutoReconnect = true;
- _rdpClient.AdvancedSettings3.MaxReconnectAttempts = Settings.Default.RdpReconnectionCount;
- _rdpClient.AdvancedSettings2.keepAliveInterval = 60000; //in milliseconds (10,000 = 10 seconds)
- _rdpClient.AdvancedSettings5.AuthenticationLevel = 0;
- _rdpClient.AdvancedSettings2.EncryptionEnabled = 1;
-
- _rdpClient.AdvancedSettings2.overallConnectionTimeout = Settings.Default.ConRDPOverallConnectionTimeout;
-
- _rdpClient.AdvancedSettings2.BitmapPeristence = Convert.ToInt32(_connectionInfo.CacheBitmaps);
- if (_rdpVersion >= Versions.RDC61)
- {
- _rdpClient.AdvancedSettings7.EnableCredSspSupport = _connectionInfo.UseCredSsp;
- _rdpClient.AdvancedSettings8.AudioQualityMode = (uint)_connectionInfo.SoundQuality;
- }
+ _rdpClient.AdvancedSettings3.EnableAutoReconnect = true;
+ _rdpClient.AdvancedSettings3.MaxReconnectAttempts = Settings.Default.RdpReconnectionCount;
+ _rdpClient.AdvancedSettings2.keepAliveInterval = 60000; //in milliseconds (10,000 = 10 seconds)
+ _rdpClient.AdvancedSettings5.AuthenticationLevel = 0;
+ _rdpClient.AdvancedSettings2.EncryptionEnabled = 1;
+
+ _rdpClient.AdvancedSettings2.overallConnectionTimeout = Settings.Default.ConRDPOverallConnectionTimeout;
+
+ _rdpClient.AdvancedSettings2.BitmapPeristence = Convert.ToInt32(_connectionInfo.CacheBitmaps);
+ if (_rdpVersion >= Versions.RDC61)
+ {
+ _rdpClient.AdvancedSettings7.EnableCredSspSupport = _connectionInfo.UseCredSsp;
+ _rdpClient.AdvancedSettings8.AudioQualityMode = (uint)_connectionInfo.SoundQuality;
+ }
SetUseConsoleSession();
SetPort();
- RedirectKeys = _connectionInfo.RedirectKeys;
+ RedirectKeys = _connectionInfo.RedirectKeys;
SetRedirection();
SetAuthenticationLevel();
- SetLoadBalanceInfo();
+ SetLoadBalanceInfo();
SetRdGateway();
_rdpClient.ColorDepth = (int)_connectionInfo.Colors;
SetPerformanceFlags();
-
- _rdpClient.ConnectingText = Language.strConnecting;
-
- Control.Anchor = AnchorStyles.None;
-
- return true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPropsFailed, ex);
- return false;
- }
- }
- public override bool Connect()
- {
- _loginComplete = false;
- SetEventHandlers();
+ _rdpClient.ConnectingText = Language.strConnecting;
+
+ Control.Anchor = AnchorStyles.None;
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPropsFailed, ex);
+ return false;
+ }
+ }
+
+ public override bool Connect()
+ {
+ _loginComplete = false;
+ SetEventHandlers();
try
- {
- _rdpClient.Connect();
- base.Connect();
- return true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strConnectionOpenFailed, ex);
- }
-
- return false;
- }
-
- public override void Disconnect()
- {
- try
- {
- _rdpClient.Disconnect();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpDisconnectFailed, ex);
- Close();
- }
- }
-
- public void ToggleFullscreen()
- {
- try
- {
- Fullscreen = !Fullscreen;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpToggleFullscreenFailed, ex);
- }
- }
-
- public void ToggleSmartSize()
- {
- try
- {
- SmartSize = !SmartSize;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpToggleSmartSizeFailed, ex);
- }
- }
-
- public override void Focus()
- {
- try
- {
- if (Control.ContainsFocus == false)
- {
- Control.Focus();
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpFocusFailed, ex);
- }
- }
-
- private Size _controlBeginningSize;
- public override void ResizeBegin(object sender, EventArgs e)
- {
- _controlBeginningSize = Control.Size;
- }
-
- public override void Resize(object sender, EventArgs e)
- {
- if (DoResize() && _controlBeginningSize.IsEmpty)
- {
- ReconnectForResize();
- }
- base.Resize(sender, e);
- }
-
- public override void ResizeEnd(object sender, EventArgs e)
- {
- DoResize();
- if (!(Control.Size == _controlBeginningSize))
- {
- ReconnectForResize();
- }
- _controlBeginningSize = Size.Empty;
- }
- #endregion
-
- #region Private Methods
- private bool DoResize()
- {
- Control.Location = InterfaceControl.Location;
- if (!(Control.Size == InterfaceControl.Size) && !(InterfaceControl.Size == Size.Empty)) // kmscode - this doesn't look right to me. But I'm not aware of any functionality issues with this currently...
- {
- Control.Size = InterfaceControl.Size;
- return true;
- }
- else
- {
- return false;
- }
- }
-
- private void ReconnectForResize()
- {
- if (_rdpVersion < Versions.RDC80)
- {
- return;
- }
-
- if (!_loginComplete)
- {
- return;
- }
-
- if (!InterfaceControl.Info.AutomaticResize)
- {
- return;
- }
-
- if (!(InterfaceControl.Info.Resolution == RDPResolutions.FitToWindow | InterfaceControl.Info.Resolution == RDPResolutions.Fullscreen))
- {
- return;
- }
-
- if (SmartSize)
- {
- return;
- }
+ {
+ _rdpClient.Connect();
+ base.Connect();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strConnectionOpenFailed, ex);
+ }
- try
- {
- Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, $"Resizing RDP connection to host '{_connectionInfo.Hostname}'");
- var size = !Fullscreen ? Control.Size : Screen.FromControl(Control).Bounds.Size;
+ return false;
+ }
+
+ public override void Disconnect()
+ {
+ try
+ {
+ _rdpClient.Disconnect();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpDisconnectFailed, ex);
+ Close();
+ }
+ }
+
+ public void ToggleFullscreen()
+ {
+ try
+ {
+ Fullscreen = !Fullscreen;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpToggleFullscreenFailed, ex);
+ }
+ }
+
+ public void ToggleSmartSize()
+ {
+ try
+ {
+ SmartSize = !SmartSize;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpToggleSmartSizeFailed, ex);
+ }
+ }
+
+ public override void Focus()
+ {
+ try
+ {
+ if (Control.ContainsFocus == false)
+ {
+ Control.Focus();
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpFocusFailed, ex);
+ }
+ }
+
+ private Size _controlBeginningSize;
+
+ public override void ResizeBegin(object sender, EventArgs e)
+ {
+ _controlBeginningSize = Control.Size;
+ }
+
+ public override void Resize(object sender, EventArgs e)
+ {
+ if (DoResize() && _controlBeginningSize.IsEmpty)
+ {
+ ReconnectForResize();
+ }
+
+ base.Resize(sender, e);
+ }
+
+ public override void ResizeEnd(object sender, EventArgs e)
+ {
+ DoResize();
+ if (!(Control.Size == _controlBeginningSize))
+ {
+ ReconnectForResize();
+ }
+
+ _controlBeginningSize = Size.Empty;
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private bool DoResize()
+ {
+ Control.Location = InterfaceControl.Location;
+ if (!(Control.Size == InterfaceControl.Size) && !(InterfaceControl.Size == Size.Empty)
+ ) // kmscode - this doesn't look right to me. But I'm not aware of any functionality issues with this currently...
+ {
+ Control.Size = InterfaceControl.Size;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private void ReconnectForResize()
+ {
+ if (_rdpVersion < Versions.RDC80)
+ {
+ return;
+ }
+
+ if (!_loginComplete)
+ {
+ return;
+ }
+
+ if (!InterfaceControl.Info.AutomaticResize)
+ {
+ return;
+ }
+
+ if (!(InterfaceControl.Info.Resolution == RDPResolutions.FitToWindow |
+ InterfaceControl.Info.Resolution == RDPResolutions.Fullscreen))
+ {
+ return;
+ }
+
+ if (SmartSize)
+ {
+ return;
+ }
+
+ try
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg,
+ $"Resizing RDP connection to host '{_connectionInfo.Hostname}'");
+ var size = !Fullscreen ? Control.Size : Screen.FromControl(Control).Bounds.Size;
IMsRdpClient8 msRdpClient8 = _rdpClient;
- msRdpClient8.Reconnect((uint)size.Width, (uint)size.Height);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage(string.Format(Language.ChangeConnectionResolutionError, _connectionInfo.Hostname),
- ex, MessageClass.WarningMsg, false);
- }
- }
-
- private void SetRdGateway()
- {
- try
- {
- if (_rdpClient.TransportSettings.GatewayIsSupported == 0)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strRdpGatewayNotSupported, true);
- return;
- }
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strRdpGatewayIsSupported, true);
+ msRdpClient8.Reconnect((uint)size.Width, (uint)size.Height);
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage(
+ string.Format(Language.ChangeConnectionResolutionError,
+ _connectionInfo.Hostname),
+ ex, MessageClass.WarningMsg, false);
+ }
+ }
- if (_connectionInfo.RDGatewayUsageMethod != RDGatewayUsageMethod.Never)
- {
- _rdpClient.TransportSettings.GatewayUsageMethod = (uint)_connectionInfo.RDGatewayUsageMethod;
- _rdpClient.TransportSettings.GatewayHostname = _connectionInfo.RDGatewayHostname;
- _rdpClient.TransportSettings.GatewayProfileUsageMethod = 1; // TSC_PROXY_PROFILE_MODE_EXPLICIT
- if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard)
- {
- _rdpClient.TransportSettings.GatewayCredsSource = 1; // TSC_PROXY_CREDS_MODE_SMARTCARD
- }
- if (_rdpVersion >= Versions.RDC61 && !Force.HasFlag(ConnectionInfo.Force.NoCredentials))
- {
- if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes)
- {
- _rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.Username;
- _rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.Password;
- _rdpClient.TransportSettings2.GatewayDomain = _connectionInfo?.Domain;
- }
- else if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard)
- {
- _rdpClient.TransportSettings2.GatewayCredSharing = 0;
- }
- else
- {
+ private void SetRdGateway()
+ {
+ try
+ {
+ if (_rdpClient.TransportSettings.GatewayIsSupported == 0)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strRdpGatewayNotSupported,
+ true);
+ return;
+ }
+
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strRdpGatewayIsSupported,
+ true);
+
+ if (_connectionInfo.RDGatewayUsageMethod != RDGatewayUsageMethod.Never)
+ {
+ _rdpClient.TransportSettings.GatewayUsageMethod = (uint)_connectionInfo.RDGatewayUsageMethod;
+ _rdpClient.TransportSettings.GatewayHostname = _connectionInfo.RDGatewayHostname;
+ _rdpClient.TransportSettings.GatewayProfileUsageMethod = 1; // TSC_PROXY_PROFILE_MODE_EXPLICIT
+ if (_connectionInfo.RDGatewayUseConnectionCredentials ==
+ RDGatewayUseConnectionCredentials.SmartCard)
+ {
+ _rdpClient.TransportSettings.GatewayCredsSource = 1; // TSC_PROXY_CREDS_MODE_SMARTCARD
+ }
+
+ if (_rdpVersion >= Versions.RDC61 && !Force.HasFlag(ConnectionInfo.Force.NoCredentials))
+ {
+ if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes)
+ {
+ _rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.Username;
+ _rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.Password;
+ _rdpClient.TransportSettings2.GatewayDomain = _connectionInfo?.Domain;
+ }
+ else if (_connectionInfo.RDGatewayUseConnectionCredentials ==
+ RDGatewayUseConnectionCredentials.SmartCard)
+ {
+ _rdpClient.TransportSettings2.GatewayCredSharing = 0;
+ }
+ else
+ {
_rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.RDGatewayUsername;
_rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.RDGatewayPassword;
_rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.RDGatewayDomain;
_rdpClient.TransportSettings2.GatewayCredSharing = 0;
}
- }
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetGatewayFailed, ex);
- }
- }
-
- private void SetUseConsoleSession()
- {
- try
- {
- bool value;
-
- if (Force.HasFlag(ConnectionInfo.Force.UseConsoleSession))
- {
- value = true;
- }
- else if (Force.HasFlag(ConnectionInfo.Force.DontUseConsoleSession))
- {
- value = false;
- }
- else
- {
- value = _connectionInfo.UseConsoleSession;
- }
-
- if (_rdpVersion >= Versions.RDC61)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strRdpSetConsoleSwitch, _rdpVersion), true);
- _rdpClient.AdvancedSettings7.ConnectToAdministerServer = value;
- }
- else
- {
- Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strRdpSetConsoleSwitch, _rdpVersion) + Environment.NewLine + "No longer supported in this RDP version. Reference: https://msdn.microsoft.com/en-us/library/aa380863(v=vs.85).aspx", true);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetGatewayFailed, ex);
+ }
+ }
+
+ private void SetUseConsoleSession()
+ {
+ try
+ {
+ bool value;
+
+ if (Force.HasFlag(ConnectionInfo.Force.UseConsoleSession))
+ {
+ value = true;
+ }
+ else if (Force.HasFlag(ConnectionInfo.Force.DontUseConsoleSession))
+ {
+ value = false;
+ }
+ else
+ {
+ value = _connectionInfo.UseConsoleSession;
+ }
+
+ if (_rdpVersion >= Versions.RDC61)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strRdpSetConsoleSwitch, _rdpVersion),
+ true);
+ _rdpClient.AdvancedSettings7.ConnectToAdministerServer = value;
+ }
+ else
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
+ string.Format(Language.strRdpSetConsoleSwitch, _rdpVersion) +
+ Environment.NewLine +
+ "No longer supported in this RDP version. Reference: https://msdn.microsoft.com/en-us/library/aa380863(v=vs.85).aspx",
+ true);
// ConnectToServerConsole is deprecated
//https://msdn.microsoft.com/en-us/library/aa380863(v=vs.85).aspx
//_rdpClient.AdvancedSettings2.ConnectToServerConsole = value;
}
}
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetConsoleSessionFailed, ex);
- }
- }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetConsoleSessionFailed, ex);
+ }
+ }
- private object GetExtendedProperty(string property)
- {
- try
- {
- // ReSharper disable once UseIndexedProperty
- return ((IMsRdpExtendedSettings)_rdpClient).get_Property(property);
- }
- catch (Exception e)
- {
- Runtime.MessageCollector.AddExceptionMessage($"Error getting extended RDP property '{property}'",
- e, MessageClass.WarningMsg, false);
- return null;
- }
- }
+ private object GetExtendedProperty(string property)
+ {
+ try
+ {
+ // ReSharper disable once UseIndexedProperty
+ return ((IMsRdpExtendedSettings)_rdpClient).get_Property(property);
+ }
+ catch (Exception e)
+ {
+ Runtime.MessageCollector.AddExceptionMessage($"Error getting extended RDP property '{property}'",
+ e, MessageClass.WarningMsg, false);
+ return null;
+ }
+ }
private void SetExtendedProperty(string property, object value)
- {
- try
- {
- // ReSharper disable once UseIndexedProperty
- ((IMsRdpExtendedSettings)_rdpClient).set_Property(property, ref value);
- }
- catch (Exception e)
- {
- Runtime.MessageCollector.AddExceptionMessage($"Error setting extended RDP property '{property}'",
- e, MessageClass.WarningMsg, false);
- }
- }
+ {
+ try
+ {
+ // ReSharper disable once UseIndexedProperty
+ ((IMsRdpExtendedSettings)_rdpClient).set_Property(property, ref value);
+ }
+ catch (Exception e)
+ {
+ Runtime.MessageCollector.AddExceptionMessage($"Error setting extended RDP property '{property}'",
+ e, MessageClass.WarningMsg, false);
+ }
+ }
- private void SetCredentials()
- {
- try
- {
- if (Force.HasFlag(ConnectionInfo.Force.NoCredentials))
- {
- return;
- }
+ private void SetCredentials()
+ {
+ try
+ {
+ if (Force.HasFlag(ConnectionInfo.Force.NoCredentials))
+ {
+ return;
+ }
- var userName = _connectionInfo?.Username ?? "";
- var password = _connectionInfo?.Password ?? "";
- var domain = _connectionInfo?.Domain ?? "";
-
- if (string.IsNullOrEmpty(userName))
- {
- if (Settings.Default.EmptyCredentials == "windows")
- {
- _rdpClient.UserName = Environment.UserName;
- }
- else if (Settings.Default.EmptyCredentials == "custom")
- {
- _rdpClient.UserName = Settings.Default.DefaultUsername;
- }
- }
- else
- {
- _rdpClient.UserName = userName;
- }
-
- if (string.IsNullOrEmpty(password))
- {
- if (Settings.Default.EmptyCredentials == "custom")
- {
- if (Settings.Default.DefaultPassword != "")
- {
+ var userName = _connectionInfo?.Username ?? "";
+ var password = _connectionInfo?.Password ?? "";
+ var domain = _connectionInfo?.Domain ?? "";
+
+ if (string.IsNullOrEmpty(userName))
+ {
+ if (Settings.Default.EmptyCredentials == "windows")
+ {
+ _rdpClient.UserName = Environment.UserName;
+ }
+ else if (Settings.Default.EmptyCredentials == "custom")
+ {
+ _rdpClient.UserName = Settings.Default.DefaultUsername;
+ }
+ }
+ else
+ {
+ _rdpClient.UserName = userName;
+ }
+
+ if (string.IsNullOrEmpty(password))
+ {
+ if (Settings.Default.EmptyCredentials == "custom")
+ {
+ if (Settings.Default.DefaultPassword != "")
+ {
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
- _rdpClient.AdvancedSettings2.ClearTextPassword = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey);
- }
- }
- }
- else
- {
- _rdpClient.AdvancedSettings2.ClearTextPassword = password;
- }
-
- if (string.IsNullOrEmpty(domain))
- {
- if (Settings.Default.EmptyCredentials == "windows")
- {
- _rdpClient.Domain = Environment.UserDomainName;
- }
- else if (Settings.Default.EmptyCredentials == "custom")
- {
- _rdpClient.Domain = Settings.Default.DefaultDomain;
- }
- }
- else
- {
- _rdpClient.Domain = domain;
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetCredentialsFailed, ex);
- }
- }
-
- private void SetResolution()
- {
- try
- {
- var scaleFactor = (uint)_displayProperties.ResolutionScalingFactor.Width * 100;
- SetExtendedProperty("DesktopScaleFactor", scaleFactor);
- SetExtendedProperty("DeviceScaleFactor", (uint)100);
+ _rdpClient.AdvancedSettings2.ClearTextPassword =
+ cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey);
+ }
+ }
+ }
+ else
+ {
+ _rdpClient.AdvancedSettings2.ClearTextPassword = password;
+ }
+
+ if (string.IsNullOrEmpty(domain))
+ {
+ if (Settings.Default.EmptyCredentials == "windows")
+ {
+ _rdpClient.Domain = Environment.UserDomainName;
+ }
+ else if (Settings.Default.EmptyCredentials == "custom")
+ {
+ _rdpClient.Domain = Settings.Default.DefaultDomain;
+ }
+ }
+ else
+ {
+ _rdpClient.Domain = domain;
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetCredentialsFailed, ex);
+ }
+ }
+
+ private void SetResolution()
+ {
+ try
+ {
+ var scaleFactor = (uint)_displayProperties.ResolutionScalingFactor.Width * 100;
+ SetExtendedProperty("DesktopScaleFactor", scaleFactor);
+ SetExtendedProperty("DeviceScaleFactor", (uint)100);
if (Force.HasFlag(ConnectionInfo.Force.Fullscreen))
- {
- _rdpClient.FullScreen = true;
+ {
+ _rdpClient.FullScreen = true;
_rdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width;
_rdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height;
-
- return;
- }
-
- if ((InterfaceControl.Info.Resolution == RDPResolutions.FitToWindow) || (InterfaceControl.Info.Resolution == RDPResolutions.SmartSize))
- {
- _rdpClient.DesktopWidth = InterfaceControl.Size.Width;
- _rdpClient.DesktopHeight = InterfaceControl.Size.Height;
- if (InterfaceControl.Info.Resolution == RDPResolutions.SmartSize)
- {
+ return;
+ }
+
+ if ((InterfaceControl.Info.Resolution == RDPResolutions.FitToWindow) ||
+ (InterfaceControl.Info.Resolution == RDPResolutions.SmartSize))
+ {
+ _rdpClient.DesktopWidth = InterfaceControl.Size.Width;
+ _rdpClient.DesktopHeight = InterfaceControl.Size.Height;
+
+ if (InterfaceControl.Info.Resolution == RDPResolutions.SmartSize)
+ {
_rdpClient.AdvancedSettings2.SmartSizing = true;
}
- }
- else if (InterfaceControl.Info.Resolution == RDPResolutions.Fullscreen)
- {
- _rdpClient.FullScreen = true;
+ }
+ else if (InterfaceControl.Info.Resolution == RDPResolutions.Fullscreen)
+ {
+ _rdpClient.FullScreen = true;
_rdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width;
_rdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height;
- }
- else
- {
- var resolution = GetResolutionRectangle(_connectionInfo.Resolution);
- _rdpClient.DesktopWidth = resolution.Width;
- _rdpClient.DesktopHeight = resolution.Height;
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetResolutionFailed, ex);
- }
- }
-
- private void SetPort()
- {
- try
- {
- if (_connectionInfo.Port != (int)Defaults.Port)
- {
- _rdpClient.AdvancedSettings2.RDPPort = _connectionInfo.Port;
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPortFailed, ex);
- }
- }
-
- private void SetRedirection()
- {
- try
- {
- _rdpClient.AdvancedSettings2.RedirectDrives = _connectionInfo.RedirectDiskDrives;
- _rdpClient.AdvancedSettings2.RedirectPorts = _connectionInfo.RedirectPorts;
- _rdpClient.AdvancedSettings2.RedirectPrinters = _connectionInfo.RedirectPrinters;
- _rdpClient.AdvancedSettings2.RedirectSmartCards = _connectionInfo.RedirectSmartCards;
- _rdpClient.SecuredSettings2.AudioRedirectionMode = (int)_connectionInfo.RedirectSound;
+ }
+ else
+ {
+ var resolution = GetResolutionRectangle(_connectionInfo.Resolution);
+ _rdpClient.DesktopWidth = resolution.Width;
+ _rdpClient.DesktopHeight = resolution.Height;
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetResolutionFailed, ex);
+ }
+ }
+
+ private void SetPort()
+ {
+ try
+ {
+ if (_connectionInfo.Port != (int)Defaults.Port)
+ {
+ _rdpClient.AdvancedSettings2.RDPPort = _connectionInfo.Port;
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPortFailed, ex);
+ }
+ }
+
+ private void SetRedirection()
+ {
+ try
+ {
+ _rdpClient.AdvancedSettings2.RedirectDrives = _connectionInfo.RedirectDiskDrives;
+ _rdpClient.AdvancedSettings2.RedirectPorts = _connectionInfo.RedirectPorts;
+ _rdpClient.AdvancedSettings2.RedirectPrinters = _connectionInfo.RedirectPrinters;
+ _rdpClient.AdvancedSettings2.RedirectSmartCards = _connectionInfo.RedirectSmartCards;
+ _rdpClient.SecuredSettings2.AudioRedirectionMode = (int)_connectionInfo.RedirectSound;
_rdpClient.AdvancedSettings.DisableRdpdr = _connectionInfo.RedirectClipboard ? 0 : 1;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetRedirectionFailed, ex);
- }
- }
-
- private void SetPerformanceFlags()
- {
- try
- {
- var pFlags = 0;
- if (_connectionInfo.DisplayThemes == false)
- {
- pFlags += Convert.ToInt32(RDPPerformanceFlags.DisableThemes);
- }
-
- if (_connectionInfo.DisplayWallpaper == false)
- {
- pFlags += Convert.ToInt32(RDPPerformanceFlags.DisableWallpaper);
- }
-
- if (_connectionInfo.EnableFontSmoothing)
- {
- pFlags += Convert.ToInt32(RDPPerformanceFlags.EnableFontSmoothing);
- }
-
- if (_connectionInfo.EnableDesktopComposition)
- {
- pFlags += Convert.ToInt32(RDPPerformanceFlags.EnableDesktopComposition);
- }
-
- _rdpClient.AdvancedSettings2.PerformanceFlags = pFlags;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPerformanceFlagsFailed, ex);
- }
- }
-
- private void SetAuthenticationLevel()
- {
- try
- {
- _rdpClient.AdvancedSettings5.AuthenticationLevel = (uint)_connectionInfo.RDPAuthenticationLevel;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetAuthenticationLevelFailed, ex);
- }
- }
-
- private void SetLoadBalanceInfo()
- {
- if (string.IsNullOrEmpty(_connectionInfo.LoadBalanceInfo))
- {
- return;
- }
- try
- {
- _rdpClient.AdvancedSettings2.LoadBalanceInfo = LoadBalanceInfoUseUtf8
- ? new AzureLoadBalanceInfoEncoder().Encode(_connectionInfo.LoadBalanceInfo)
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetRedirectionFailed, ex);
+ }
+ }
+
+ private void SetPerformanceFlags()
+ {
+ try
+ {
+ var pFlags = 0;
+ if (_connectionInfo.DisplayThemes == false)
+ {
+ pFlags += Convert.ToInt32(RDPPerformanceFlags.DisableThemes);
+ }
+
+ if (_connectionInfo.DisplayWallpaper == false)
+ {
+ pFlags += Convert.ToInt32(RDPPerformanceFlags.DisableWallpaper);
+ }
+
+ if (_connectionInfo.EnableFontSmoothing)
+ {
+ pFlags += Convert.ToInt32(RDPPerformanceFlags.EnableFontSmoothing);
+ }
+
+ if (_connectionInfo.EnableDesktopComposition)
+ {
+ pFlags += Convert.ToInt32(RDPPerformanceFlags.EnableDesktopComposition);
+ }
+
+ _rdpClient.AdvancedSettings2.PerformanceFlags = pFlags;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetPerformanceFlagsFailed, ex);
+ }
+ }
+
+ private void SetAuthenticationLevel()
+ {
+ try
+ {
+ _rdpClient.AdvancedSettings5.AuthenticationLevel = (uint)_connectionInfo.RDPAuthenticationLevel;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetAuthenticationLevelFailed, ex);
+ }
+ }
+
+ private void SetLoadBalanceInfo()
+ {
+ if (string.IsNullOrEmpty(_connectionInfo.LoadBalanceInfo))
+ {
+ return;
+ }
+
+ try
+ {
+ _rdpClient.AdvancedSettings2.LoadBalanceInfo = LoadBalanceInfoUseUtf8
+ ? new AzureLoadBalanceInfoEncoder().Encode(_connectionInfo.LoadBalanceInfo)
: _connectionInfo.LoadBalanceInfo;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("Unable to set load balance info.", ex);
- }
- }
-
- private void SetEventHandlers()
- {
- try
- {
- _rdpClient.OnConnecting += RDPEvent_OnConnecting;
- _rdpClient.OnConnected += RDPEvent_OnConnected;
- _rdpClient.OnLoginComplete += RDPEvent_OnLoginComplete;
- _rdpClient.OnFatalError += RDPEvent_OnFatalError;
- _rdpClient.OnDisconnected += RDPEvent_OnDisconnected;
- _rdpClient.OnLeaveFullScreenMode += RDPEvent_OnLeaveFullscreenMode;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("Unable to set load balance info.", ex);
+ }
+ }
+
+ private void SetEventHandlers()
+ {
+ try
+ {
+ _rdpClient.OnConnecting += RDPEvent_OnConnecting;
+ _rdpClient.OnConnected += RDPEvent_OnConnected;
+ _rdpClient.OnLoginComplete += RDPEvent_OnLoginComplete;
+ _rdpClient.OnFatalError += RDPEvent_OnFatalError;
+ _rdpClient.OnDisconnected += RDPEvent_OnDisconnected;
+ _rdpClient.OnLeaveFullScreenMode += RDPEvent_OnLeaveFullscreenMode;
_rdpClient.OnIdleTimeoutNotification += RDPEvent_OnIdleTimeoutNotification;
}
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetEventHandlersFailed, ex);
- }
- }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetEventHandlersFailed, ex);
+ }
+ }
+
#endregion
-
+
#region Private Events & Handlers
+
private void RDPEvent_OnIdleTimeoutNotification()
{
Close(); //Simply close the RDP Session if the idle timeout has been triggered.
if (!_alertOnIdleDisconnect) return;
- MessageBox.Show($"The {_connectionInfo.Name} session was disconnected due to inactivity", "Session Disconnected", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ MessageBox.Show($"The {_connectionInfo.Name} session was disconnected due to inactivity",
+ "Session Disconnected", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
@@ -683,233 +716,251 @@ namespace mRemoteNG.Connection.Protocol.RDP
{
var errorMsg = RdpErrorCodes.GetError(errorCode);
Event_ErrorOccured(this, errorMsg, errorCode);
- }
-
- private void RDPEvent_OnDisconnected(int discReason)
- {
- const int UI_ERR_NORMAL_DISCONNECT = 0xB08;
- if (discReason != UI_ERR_NORMAL_DISCONNECT)
- {
- var reason = _rdpClient.GetErrorDescription((uint)discReason, (uint) _rdpClient.ExtendedDisconnectReason);
- Event_Disconnected(this, reason, discReason);
- }
-
- if (Settings.Default.ReconnectOnDisconnect)
- {
- ReconnectGroup = new ReconnectGroup();
- ReconnectGroup.CloseClicked += Event_ReconnectGroupCloseClicked;
- ReconnectGroup.Left = (int) ((double) Control.Width / 2 - (double) ReconnectGroup.Width / 2);
- ReconnectGroup.Top = (int) ((double) Control.Height / 2 - (double) ReconnectGroup.Height / 2);
- ReconnectGroup.Parent = Control;
- ReconnectGroup.Show();
- tmrReconnect.Enabled = true;
- }
- else
- {
- Close();
- }
- }
-
- private void RDPEvent_OnConnecting()
- {
- Event_Connecting(this);
- }
-
- private void RDPEvent_OnConnected()
- {
- Event_Connected(this);
- }
-
- private void RDPEvent_OnLoginComplete()
- {
- _loginComplete = true;
- }
-
- private void RDPEvent_OnLeaveFullscreenMode()
- {
- Fullscreen = false;
+ }
+
+ private void RDPEvent_OnDisconnected(int discReason)
+ {
+ const int UI_ERR_NORMAL_DISCONNECT = 0xB08;
+ if (discReason != UI_ERR_NORMAL_DISCONNECT)
+ {
+ var reason =
+ _rdpClient.GetErrorDescription((uint)discReason, (uint)_rdpClient.ExtendedDisconnectReason);
+ Event_Disconnected(this, reason, discReason);
+ }
+
+ if (Settings.Default.ReconnectOnDisconnect)
+ {
+ ReconnectGroup = new ReconnectGroup();
+ ReconnectGroup.CloseClicked += Event_ReconnectGroupCloseClicked;
+ ReconnectGroup.Left = (int)((double)Control.Width / 2 - (double)ReconnectGroup.Width / 2);
+ ReconnectGroup.Top = (int)((double)Control.Height / 2 - (double)ReconnectGroup.Height / 2);
+ ReconnectGroup.Parent = Control;
+ ReconnectGroup.Show();
+ tmrReconnect.Enabled = true;
+ }
+ else
+ {
+ Close();
+ }
+ }
+
+ private void RDPEvent_OnConnecting()
+ {
+ Event_Connecting(this);
+ }
+
+ private void RDPEvent_OnConnected()
+ {
+ Event_Connected(this);
+ }
+
+ private void RDPEvent_OnLoginComplete()
+ {
+ _loginComplete = true;
+ }
+
+ private void RDPEvent_OnLeaveFullscreenMode()
+ {
+ Fullscreen = false;
_leaveFullscreenEvent?.Invoke(this, new EventArgs());
}
+
#endregion
-
+
#region Public Events & Handlers
- public delegate void LeaveFullscreenEventHandler(object sender, EventArgs e);
- private LeaveFullscreenEventHandler _leaveFullscreenEvent;
-
- public event LeaveFullscreenEventHandler LeaveFullscreen
- {
- add => _leaveFullscreenEvent = (LeaveFullscreenEventHandler)Delegate.Combine(_leaveFullscreenEvent, value);
- remove => _leaveFullscreenEvent = (LeaveFullscreenEventHandler)Delegate.Remove(_leaveFullscreenEvent, value);
+
+ public delegate void LeaveFullscreenEventHandler(object sender, EventArgs e);
+
+ private LeaveFullscreenEventHandler _leaveFullscreenEvent;
+
+ public event LeaveFullscreenEventHandler LeaveFullscreen
+ {
+ add => _leaveFullscreenEvent = (LeaveFullscreenEventHandler)Delegate.Combine(_leaveFullscreenEvent, value);
+ remove =>
+ _leaveFullscreenEvent = (LeaveFullscreenEventHandler)Delegate.Remove(_leaveFullscreenEvent, value);
}
+
#endregion
-
+
#region Enums
- public enum Defaults
- {
- Colors = RDPColors.Colors16Bit,
- Sounds = RDPSounds.DoNotPlay,
- Resolution = RDPResolutions.FitToWindow,
- Port = 3389
- }
-
- public enum RDPColors
- {
+
+ public enum Defaults
+ {
+ Colors = RDPColors.Colors16Bit,
+ Sounds = RDPSounds.DoNotPlay,
+ Resolution = RDPResolutions.FitToWindow,
+ Port = 3389
+ }
+
+ public enum RDPColors
+ {
[LocalizedAttributes.LocalizedDescription("strRDP256Colors")]
Colors256 = 8,
+
[LocalizedAttributes.LocalizedDescription("strRDP32768Colors")]
Colors15Bit = 15,
+
[LocalizedAttributes.LocalizedDescription("strRDP65536Colors")]
Colors16Bit = 16,
+
[LocalizedAttributes.LocalizedDescription("strRDP16777216Colors")]
Colors24Bit = 24,
+
[LocalizedAttributes.LocalizedDescription("strRDP4294967296Colors")]
Colors32Bit = 32
- }
-
- public enum RDPSounds
- {
+ }
+
+ public enum RDPSounds
+ {
[LocalizedAttributes.LocalizedDescription("strRDPSoundBringToThisComputer")]
BringToThisComputer = 0,
+
[LocalizedAttributes.LocalizedDescription("strRDPSoundLeaveAtRemoteComputer")]
LeaveAtRemoteComputer = 1,
+
[LocalizedAttributes.LocalizedDescription("strRDPSoundDoNotPlay")]
DoNotPlay = 2
- }
+ }
- public enum RDPSoundQuality
- {
+ public enum RDPSoundQuality
+ {
[LocalizedAttributes.LocalizedDescription("strRDPSoundQualityDynamic")]
Dynamic = 0,
+
[LocalizedAttributes.LocalizedDescription("strRDPSoundQualityMedium")]
Medium = 1,
+
[LocalizedAttributes.LocalizedDescription("strRDPSoundQualityHigh")]
High = 2
}
private enum RDPPerformanceFlags
- {
- [Description("strRDPDisableWallpaper")]DisableWallpaper = 0x1,
+ {
+ [Description("strRDPDisableWallpaper")]
+ DisableWallpaper = 0x1,
+
// [Description("strRDPDisableFullWindowdrag")]DisableFullWindowDrag = 0x2,
// [Description("strRDPDisableMenuAnimations")]DisableMenuAnimations = 0x4,
- [Description("strRDPDisableThemes")]DisableThemes = 0x8,
+ [Description("strRDPDisableThemes")] DisableThemes = 0x8,
+
// [Description("strRDPDisableCursorShadow")]DisableCursorShadow = 0x20,
// [Description("strRDPDisableCursorblinking")]DisableCursorBlinking = 0x40,
- [Description("strRDPEnableFontSmoothing")]EnableFontSmoothing = 0x80,
- [Description("strRDPEnableDesktopComposition")]EnableDesktopComposition = 0x100
- }
+ [Description("strRDPEnableFontSmoothing")]
+ EnableFontSmoothing = 0x80,
+
+ [Description("strRDPEnableDesktopComposition")]
+ EnableDesktopComposition = 0x100
+ }
public enum RDPResolutions
{
[LocalizedAttributes.LocalizedDescription("strRDPFitToPanel")]
FitToWindow,
+
[LocalizedAttributes.LocalizedDescription("strFullscreen")]
Fullscreen,
+
[LocalizedAttributes.LocalizedDescription("strRDPSmartSize")]
SmartSize,
- [Description("800x600")]
- Res800x600,
- [Description("1024x768")]
- Res1024x768,
- [Description("1152x864")]
- Res1152x864,
- [Description("1280x800")]
- Res1280x800,
- [Description("1280x1024")]
- Res1280x1024,
- [Description("1366x768")]
- Res1366x768,
- [Description("1440x900")]
- Res1440x900,
- [Description("1600x900")]
- Res1600x900,
- [Description("1600x1200")]
- Res1600x1200,
- [Description("1680x1050")]
- Res1680x1050,
- [Description("1920x1080")]
- Res1920x1080,
- [Description("1920x1200")]
- Res1920x1200,
- [Description("2048x1536")]
- Res2048x1536,
- [Description("2560x1440")]
- Res2560x1440,
- [Description("2560x1600")]
- Res2560x1600,
- [Description("2560x2048")]
- Res2560x2048,
- [Description("3840x2160")]
- Res3840x2160
+ [Description("800x600")] Res800x600,
+ [Description("1024x768")] Res1024x768,
+ [Description("1152x864")] Res1152x864,
+ [Description("1280x800")] Res1280x800,
+ [Description("1280x1024")] Res1280x1024,
+ [Description("1366x768")] Res1366x768,
+ [Description("1440x900")] Res1440x900,
+ [Description("1600x900")] Res1600x900,
+ [Description("1600x1200")] Res1600x1200,
+ [Description("1680x1050")] Res1680x1050,
+ [Description("1920x1080")] Res1920x1080,
+ [Description("1920x1200")] Res1920x1200,
+ [Description("2048x1536")] Res2048x1536,
+ [Description("2560x1440")] Res2560x1440,
+ [Description("2560x1600")] Res2560x1600,
+ [Description("2560x2048")] Res2560x2048,
+ [Description("3840x2160")] Res3840x2160
}
public enum AuthenticationLevel
- {
+ {
[LocalizedAttributes.LocalizedDescription("strAlwaysConnectEvenIfAuthFails")]
NoAuth = 0,
+
[LocalizedAttributes.LocalizedDescription("strDontConnectWhenAuthFails")]
AuthRequired = 1,
+
[LocalizedAttributes.LocalizedDescription("strWarnIfAuthFails")]
WarnOnFailedAuth = 2
- }
-
- public enum RDGatewayUsageMethod
- {
+ }
+
+ public enum RDGatewayUsageMethod
+ {
[LocalizedAttributes.LocalizedDescription("strNever")]
Never = 0, // TSC_PROXY_MODE_NONE_DIRECT
+
[LocalizedAttributes.LocalizedDescription("strAlways")]
Always = 1, // TSC_PROXY_MODE_DIRECT
+
[LocalizedAttributes.LocalizedDescription("strDetect")]
Detect = 2 // TSC_PROXY_MODE_DETECT
- }
-
- public enum RDGatewayUseConnectionCredentials
- {
+ }
+
+ public enum RDGatewayUseConnectionCredentials
+ {
[LocalizedAttributes.LocalizedDescription("strUseDifferentUsernameAndPassword")]
No = 0,
+
[LocalizedAttributes.LocalizedDescription("strUseSameUsernameAndPassword")]
Yes = 1,
+
[LocalizedAttributes.LocalizedDescription("strUseSmartCard")]
SmartCard = 2
- }
+ }
+
#endregion
-
+
#region Resolution
- public static Rectangle GetResolutionRectangle(RDPResolutions resolution)
- {
- string[] resolutionParts = null;
- if (resolution != RDPResolutions.FitToWindow & resolution != RDPResolutions.Fullscreen & resolution != RDPResolutions.SmartSize)
- {
- resolutionParts = resolution.ToString().Replace("Res", "").Split('x');
- }
- if (resolutionParts == null || resolutionParts.Length != 2)
- {
- return new Rectangle(0, 0, 0, 0);
- }
- else
- {
+
+ public static Rectangle GetResolutionRectangle(RDPResolutions resolution)
+ {
+ string[] resolutionParts = null;
+ if (resolution != RDPResolutions.FitToWindow & resolution != RDPResolutions.Fullscreen &
+ resolution != RDPResolutions.SmartSize)
+ {
+ resolutionParts = resolution.ToString().Replace("Res", "").Split('x');
+ }
+
+ if (resolutionParts == null || resolutionParts.Length != 2)
+ {
+ return new Rectangle(0, 0, 0, 0);
+ }
+ else
+ {
return new Rectangle(0, 0, Convert.ToInt32(resolutionParts[0]), Convert.ToInt32(resolutionParts[1]));
- }
- }
+ }
+ }
+
#endregion
public static class Versions
- {
- public static readonly Version RDC60 = new Version(6, 0, 6000);
- public static readonly Version RDC61 = new Version(6, 0, 6001);
- public static readonly Version RDC70 = new Version(6, 1, 7600);
- public static readonly Version RDC80 = new Version(6, 2, 9200);
+ {
+ public static readonly Version RDC60 = new Version(6, 0, 6000);
+ public static readonly Version RDC61 = new Version(6, 0, 6001);
+ public static readonly Version RDC70 = new Version(6, 1, 7600);
+ public static readonly Version RDC80 = new Version(6, 2, 9200);
public static readonly Version RDC81 = new Version(6, 3, 9600);
- }
-
+ }
+
#region Reconnect Stuff
- public void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
- {
- try
- {
- var srvReady = PortScanner.IsPortOpen(_connectionInfo.Hostname, Convert.ToString(_connectionInfo.Port));
-
- ReconnectGroup.ServerReady = srvReady;
+
+ public void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
+ {
+ try
+ {
+ var srvReady = PortScanner.IsPortOpen(_connectionInfo.Hostname, Convert.ToString(_connectionInfo.Port));
+
+ ReconnectGroup.ServerReady = srvReady;
if (!ReconnectGroup.ReconnectWhenReady || !srvReady) return;
tmrReconnect.Enabled = false;
@@ -917,12 +968,15 @@ namespace mRemoteNG.Connection.Protocol.RDP
//SetProps()
_rdpClient.Connect();
}
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionMessage(string.Format(Language.AutomaticReconnectError, _connectionInfo.Hostname),
- ex, MessageClass.WarningMsg, false);
- }
- }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionMessage(
+ string.Format(Language.AutomaticReconnectError,
+ _connectionInfo.Hostname),
+ ex, MessageClass.WarningMsg, false);
+ }
+ }
+
#endregion
- }
-}
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/Rlogin/Connection.Protocol.Rlogin.cs b/mRemoteV1/Connection/Protocol/Rlogin/Connection.Protocol.Rlogin.cs
index 6a8b187b..e3fcba19 100644
--- a/mRemoteV1/Connection/Protocol/Rlogin/Connection.Protocol.Rlogin.cs
+++ b/mRemoteV1/Connection/Protocol/Rlogin/Connection.Protocol.Rlogin.cs
@@ -1,16 +1,15 @@
namespace mRemoteNG.Connection.Protocol.Rlogin
{
- public class ProtocolRlogin : PuttyBase
- {
-
- public ProtocolRlogin()
- {
- this.PuttyProtocol = Putty_Protocol.rlogin;
- }
-
- public enum Defaults
- {
- Port = 513
- }
- }
+ public class ProtocolRlogin : PuttyBase
+ {
+ public ProtocolRlogin()
+ {
+ this.PuttyProtocol = Putty_Protocol.rlogin;
+ }
+
+ public enum Defaults
+ {
+ Port = 513
+ }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH1.cs b/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH1.cs
index d5e99500..8472308d 100644
--- a/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH1.cs
+++ b/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH1.cs
@@ -1,19 +1,16 @@
-
-
namespace mRemoteNG.Connection.Protocol.SSH
{
- public class ProtocolSSH1 : PuttyBase
- {
-
- public ProtocolSSH1()
- {
- PuttyProtocol = Putty_Protocol.ssh;
- PuttySSHVersion = Putty_SSHVersion.ssh1;
- }
-
- public enum Defaults
- {
- Port = 22
- }
- }
-}
+ public class ProtocolSSH1 : PuttyBase
+ {
+ public ProtocolSSH1()
+ {
+ PuttyProtocol = Putty_Protocol.ssh;
+ PuttySSHVersion = Putty_SSHVersion.ssh1;
+ }
+
+ public enum Defaults
+ {
+ Port = 22
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH2.cs b/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH2.cs
index 9bd6adf8..d05c40fe 100644
--- a/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH2.cs
+++ b/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH2.cs
@@ -1,17 +1,16 @@
namespace mRemoteNG.Connection.Protocol.SSH
{
- public class ProtocolSSH2 : PuttyBase
- {
-
- public ProtocolSSH2()
- {
- PuttyProtocol = Putty_Protocol.ssh;
- PuttySSHVersion = Putty_SSHVersion.ssh2;
- }
-
- public enum Defaults
- {
- Port = 22
- }
- }
-}
+ public class ProtocolSSH2 : PuttyBase
+ {
+ public ProtocolSSH2()
+ {
+ PuttyProtocol = Putty_Protocol.ssh;
+ PuttySSHVersion = Putty_SSHVersion.ssh2;
+ }
+
+ public enum Defaults
+ {
+ Port = 22
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/Serial/Connection.Protocol.Serial.cs b/mRemoteV1/Connection/Protocol/Serial/Connection.Protocol.Serial.cs
index 9e8d2ffd..0f4ca94d 100644
--- a/mRemoteV1/Connection/Protocol/Serial/Connection.Protocol.Serial.cs
+++ b/mRemoteV1/Connection/Protocol/Serial/Connection.Protocol.Serial.cs
@@ -1,16 +1,15 @@
namespace mRemoteNG.Connection.Protocol.Serial
{
- public class ProtocolSerial : PuttyBase
- {
-
- public ProtocolSerial()
- {
- this.PuttyProtocol = Putty_Protocol.serial;
- }
-
- public enum Defaults
- {
- Port = 9600
- }
- }
+ public class ProtocolSerial : PuttyBase
+ {
+ public ProtocolSerial()
+ {
+ this.PuttyProtocol = Putty_Protocol.serial;
+ }
+
+ public enum Defaults
+ {
+ Port = 9600
+ }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/Telnet/Connection.Protocol.Telnet.cs b/mRemoteV1/Connection/Protocol/Telnet/Connection.Protocol.Telnet.cs
index 7fc93cbf..6f891c07 100644
--- a/mRemoteV1/Connection/Protocol/Telnet/Connection.Protocol.Telnet.cs
+++ b/mRemoteV1/Connection/Protocol/Telnet/Connection.Protocol.Telnet.cs
@@ -1,16 +1,15 @@
namespace mRemoteNG.Connection.Protocol.Telnet
{
- public class ProtocolTelnet : PuttyBase
- {
-
- public ProtocolTelnet()
- {
- this.PuttyProtocol = Putty_Protocol.telnet;
- }
-
- public enum Defaults
- {
- Port = 23
- }
- }
+ public class ProtocolTelnet : PuttyBase
+ {
+ public ProtocolTelnet()
+ {
+ this.PuttyProtocol = Putty_Protocol.telnet;
+ }
+
+ public enum Defaults
+ {
+ Port = 23
+ }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs b/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs
index 63db3a92..c948ca5d 100644
--- a/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs
+++ b/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs
@@ -3,280 +3,314 @@ using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using System;
using System.ComponentModel;
+
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Connection.Protocol.VNC
{
public class ProtocolVNC : ProtocolBase
- {
+ {
#region Properties
+
public bool SmartSize
{
get { return _VNC.Scaled; }
set { _VNC.Scaled = value; }
}
- public bool ViewOnly
- {
- get { return _VNC.ViewOnly; }
- set { _VNC.ViewOnly = value; }
- }
+ public bool ViewOnly
+ {
+ get { return _VNC.ViewOnly; }
+ set { _VNC.ViewOnly = value; }
+ }
- #endregion
-
- #region Private Declarations
- private VncSharp.RemoteDesktop _VNC;
- private ConnectionInfo Info;
#endregion
-
+
+ #region Private Declarations
+
+ private VncSharp.RemoteDesktop _VNC;
+ private ConnectionInfo Info;
+
+ #endregion
+
#region Public Methods
- public ProtocolVNC()
- {
- Control = new VncSharp.RemoteDesktop();
- }
-
- public override bool Initialize()
- {
- base.Initialize();
-
- try
- {
+
+ public ProtocolVNC()
+ {
+ Control = new VncSharp.RemoteDesktop();
+ }
+
+ public override bool Initialize()
+ {
+ base.Initialize();
+
+ try
+ {
_VNC = (VncSharp.RemoteDesktop)Control;
-
- Info = InterfaceControl.Info;
-
- _VNC.VncPort = Info.Port;
+
+ Info = InterfaceControl.Info;
+
+ _VNC.VncPort = Info.Port;
return true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncSetPropsFailed + Environment.NewLine + ex.Message, true);
- return false;
- }
- }
-
- public override bool Connect()
- {
- SetEventHandlers();
-
- try
- {
- _VNC.Connect(Info.Hostname, Info.VNCViewOnly, Info.VNCSmartSizeMode != SmartSizeMode.SmartSNo);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strConnectionOpenFailed + Environment.NewLine + ex.Message);
- return false;
- }
-
- return true;
- }
-
- public override void Disconnect()
- {
- try
- {
- _VNC.Disconnect();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncConnectionDisconnectFailed + Environment.NewLine + ex.Message, true);
- }
- }
-
- public void SendSpecialKeys(SpecialKeys Keys)
- {
- try
- {
- // ReSharper disable once SwitchStatementMissingSomeCases
- switch (Keys)
- {
- case SpecialKeys.CtrlAltDel:
- _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlAltDel);
- break;
- case SpecialKeys.CtrlEsc:
- _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlEsc);
- break;
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncSendSpecialKeysFailed + Environment.NewLine + ex.Message, true);
- }
- }
-
- public void ToggleSmartSize()
- {
- try
- {
- SmartSize = !SmartSize;
- RefreshScreen();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncToggleSmartSizeFailed + Environment.NewLine + ex.Message, true);
- }
- }
-
- public void ToggleViewOnly()
- {
- try
- {
- ViewOnly = !ViewOnly;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncToggleViewOnlyFailed + Environment.NewLine + ex.Message, true);
- }
- }
-
-
- public void StartChat()
- {
- throw new NotImplementedException();
- }
-
- public void StartFileTransfer()
- {
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ Language.strVncSetPropsFailed + Environment.NewLine + ex.Message,
+ true);
+ return false;
+ }
+ }
+
+ public override bool Connect()
+ {
+ SetEventHandlers();
+
+ try
+ {
+ _VNC.Connect(Info.Hostname, Info.VNCViewOnly, Info.VNCSmartSizeMode != SmartSizeMode.SmartSNo);
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ Language.strConnectionOpenFailed + Environment.NewLine +
+ ex.Message);
+ return false;
+ }
+
+ return true;
+ }
+
+ public override void Disconnect()
+ {
+ try
+ {
+ _VNC.Disconnect();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ Language.strVncConnectionDisconnectFailed + Environment.NewLine +
+ ex.Message, true);
+ }
+ }
+
+ public void SendSpecialKeys(SpecialKeys Keys)
+ {
+ try
+ {
+ // ReSharper disable once SwitchStatementMissingSomeCases
+ switch (Keys)
+ {
+ case SpecialKeys.CtrlAltDel:
+ _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlAltDel);
+ break;
+ case SpecialKeys.CtrlEsc:
+ _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlEsc);
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ Language.strVncSendSpecialKeysFailed + Environment.NewLine +
+ ex.Message, true);
+ }
+ }
+
+ public void ToggleSmartSize()
+ {
+ try
+ {
+ SmartSize = !SmartSize;
+ RefreshScreen();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ Language.strVncToggleSmartSizeFailed + Environment.NewLine +
+ ex.Message, true);
+ }
+ }
+
+ public void ToggleViewOnly()
+ {
+ try
+ {
+ ViewOnly = !ViewOnly;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ Language.strVncToggleViewOnlyFailed + Environment.NewLine +
+ ex.Message, true);
+ }
+ }
+
+
+ public void StartChat()
+ {
throw new NotImplementedException();
}
-
- public void RefreshScreen()
- {
- try
- {
- _VNC.FullScreenUpdate();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncRefreshFailed + Environment.NewLine + ex.Message, true);
- }
- }
- #endregion
-
- #region Private Methods
- private void SetEventHandlers()
- {
- try
- {
- _VNC.ConnectComplete += VNCEvent_Connected;
- _VNC.ConnectionLost += VNCEvent_Disconnected;
- FrmMain.ClipboardChanged += VNCEvent_ClipboardChanged;
- if (!Force.HasFlag(ConnectionInfo.Force.NoCredentials) && Info?.Password?.Length > 0)
- {
- _VNC.GetPassword = VNCEvent_Authenticate;
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncSetEventHandlersFailed + Environment.NewLine + ex.Message, true);
- }
- }
- #endregion
-
- #region Private Events & Handlers
- private void VNCEvent_Connected(object sender, EventArgs e)
- {
- Event_Connected(this);
- _VNC.AutoScroll = Info.VNCSmartSizeMode == SmartSizeMode.SmartSNo;
- }
-
- private void VNCEvent_Disconnected(object sender, EventArgs e)
- {
- FrmMain.ClipboardChanged -= VNCEvent_ClipboardChanged;
- Event_Disconnected(sender, @"VncSharp Disconnected.", null);
- Close();
- }
-
- private void VNCEvent_ClipboardChanged()
- {
- _VNC.FillServerClipboard();
- }
-
- private string VNCEvent_Authenticate()
- {
- return Info.Password;
- }
- #endregion
-
+ public void StartFileTransfer()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void RefreshScreen()
+ {
+ try
+ {
+ _VNC.FullScreenUpdate();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ Language.strVncRefreshFailed + Environment.NewLine + ex.Message,
+ true);
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private void SetEventHandlers()
+ {
+ try
+ {
+ _VNC.ConnectComplete += VNCEvent_Connected;
+ _VNC.ConnectionLost += VNCEvent_Disconnected;
+ FrmMain.ClipboardChanged += VNCEvent_ClipboardChanged;
+ if (!Force.HasFlag(ConnectionInfo.Force.NoCredentials) && Info?.Password?.Length > 0)
+ {
+ _VNC.GetPassword = VNCEvent_Authenticate;
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ Language.strVncSetEventHandlersFailed + Environment.NewLine +
+ ex.Message, true);
+ }
+ }
+
+ #endregion
+
+ #region Private Events & Handlers
+
+ private void VNCEvent_Connected(object sender, EventArgs e)
+ {
+ Event_Connected(this);
+ _VNC.AutoScroll = Info.VNCSmartSizeMode == SmartSizeMode.SmartSNo;
+ }
+
+ private void VNCEvent_Disconnected(object sender, EventArgs e)
+ {
+ FrmMain.ClipboardChanged -= VNCEvent_ClipboardChanged;
+ Event_Disconnected(sender, @"VncSharp Disconnected.", null);
+ Close();
+ }
+
+ private void VNCEvent_ClipboardChanged()
+ {
+ _VNC.FillServerClipboard();
+ }
+
+ private string VNCEvent_Authenticate()
+ {
+ return Info.Password;
+ }
+
+ #endregion
+
#region Enums
- public enum Defaults
- {
- Port = 5900
- }
-
- public enum SpecialKeys
- {
- CtrlAltDel,
- CtrlEsc
- }
-
- public enum Compression
- {
- [LocalizedAttributes.LocalizedDescription("strNoCompression")]CompNone = 99,
- [Description("0")]Comp0 = 0,
- [Description("1")]Comp1 = 1,
- [Description("2")]Comp2 = 2,
- [Description("3")]Comp3 = 3,
- [Description("4")]Comp4 = 4,
- [Description("5")]Comp5 = 5,
- [Description("6")]Comp6 = 6,
- [Description("7")]Comp7 = 7,
- [Description("8")]Comp8 = 8,
- [Description("9")]Comp9 = 9
- }
-
- public enum Encoding
- {
- [Description("Raw")]EncRaw,
- [Description("RRE")]EncRRE,
- [Description("CoRRE")]EncCorre,
- [Description("Hextile")]EncHextile,
- [Description("Zlib")]EncZlib,
- [Description("Tight")]EncTight,
- [Description("ZlibHex")]EncZLibHex,
- [Description("ZRLE")]EncZRLE
- }
-
- public enum AuthMode
- {
+
+ public enum Defaults
+ {
+ Port = 5900
+ }
+
+ public enum SpecialKeys
+ {
+ CtrlAltDel,
+ CtrlEsc
+ }
+
+ public enum Compression
+ {
+ [LocalizedAttributes.LocalizedDescription("strNoCompression")]
+ CompNone = 99,
+ [Description("0")] Comp0 = 0,
+ [Description("1")] Comp1 = 1,
+ [Description("2")] Comp2 = 2,
+ [Description("3")] Comp3 = 3,
+ [Description("4")] Comp4 = 4,
+ [Description("5")] Comp5 = 5,
+ [Description("6")] Comp6 = 6,
+ [Description("7")] Comp7 = 7,
+ [Description("8")] Comp8 = 8,
+ [Description("9")] Comp9 = 9
+ }
+
+ public enum Encoding
+ {
+ [Description("Raw")] EncRaw,
+ [Description("RRE")] EncRRE,
+ [Description("CoRRE")] EncCorre,
+ [Description("Hextile")] EncHextile,
+ [Description("Zlib")] EncZlib,
+ [Description("Tight")] EncTight,
+ [Description("ZlibHex")] EncZLibHex,
+ [Description("ZRLE")] EncZRLE
+ }
+
+ public enum AuthMode
+ {
[LocalizedAttributes.LocalizedDescription("VNC")]
AuthVNC,
+
[LocalizedAttributes.LocalizedDescription("Windows")]
AuthWin
- }
-
- public enum ProxyType
- {
+ }
+
+ public enum ProxyType
+ {
[LocalizedAttributes.LocalizedDescription("strNone")]
ProxyNone,
+
[LocalizedAttributes.LocalizedDescription("strHttp")]
ProxyHTTP,
+
[LocalizedAttributes.LocalizedDescription("strSocks5")]
ProxySocks5,
+
[LocalizedAttributes.LocalizedDescription("strUltraVncRepeater")]
ProxyUltra
- }
-
- public enum Colors
- {
+ }
+
+ public enum Colors
+ {
[LocalizedAttributes.LocalizedDescription("strNormal")]
ColNormal,
- [Description("8-bit")]Col8Bit
- }
-
- public enum SmartSizeMode
- {
+ [Description("8-bit")] Col8Bit
+ }
+
+ public enum SmartSizeMode
+ {
[LocalizedAttributes.LocalizedDescription("strNoSmartSize")]
SmartSNo,
+
[LocalizedAttributes.LocalizedDescription("strFree")]
SmartSFree,
+
[LocalizedAttributes.LocalizedDescription("strAspect")]
SmartSAspect
- }
+ }
+
#endregion
- }
-}
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/Protocol/VNC/VNCEnum.cs b/mRemoteV1/Connection/Protocol/VNC/VNCEnum.cs
index c7267613..0ff96f11 100644
--- a/mRemoteV1/Connection/Protocol/VNC/VNCEnum.cs
+++ b/mRemoteV1/Connection/Protocol/VNC/VNCEnum.cs
@@ -4,77 +4,84 @@ using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol.VNC
{
public enum Defaults
- {
- Port = 5900
- }
-
- public enum SpecialKeys
- {
- CtrlAltDel,
- CtrlEsc
- }
-
- public enum Compression
- {
- [LocalizedAttributes.LocalizedDescription("strNoCompression")]CompNone = 99,
- [Description("0")]Comp0 = 0,
- [Description("1")]Comp1 = 1,
- [Description("2")]Comp2 = 2,
- [Description("3")]Comp3 = 3,
- [Description("4")]Comp4 = 4,
- [Description("5")]Comp5 = 5,
- [Description("6")]Comp6 = 6,
- [Description("7")]Comp7 = 7,
- [Description("8")]Comp8 = 8,
- [Description("9")]Comp9 = 9
- }
-
- public enum Encoding
- {
- [Description("Raw")]EncRaw,
- [Description("RRE")]EncRRE,
- [Description("CoRRE")]EncCorre,
- [Description("Hextile")]EncHextile,
- [Description("Zlib")]EncZlib,
- [Description("Tight")]EncTight,
- [Description("ZlibHex")]EncZLibHex,
- [Description("ZRLE")]EncZRLE
- }
-
- public enum AuthMode
- {
- [LocalizedAttributes.LocalizedDescription("VNC")]
- AuthVNC,
- [LocalizedAttributes.LocalizedDescription("Windows")]
- AuthWin
- }
-
- public enum ProxyType
- {
- [LocalizedAttributes.LocalizedDescription("strNone")]
- ProxyNone,
- [LocalizedAttributes.LocalizedDescription("strHttp")]
- ProxyHTTP,
- [LocalizedAttributes.LocalizedDescription("strSocks5")]
- ProxySocks5,
- [LocalizedAttributes.LocalizedDescription("strUltraVncRepeater")]
- ProxyUltra
- }
-
- public enum Colors
- {
- [LocalizedAttributes.LocalizedDescription("strNormal")]
- ColNormal,
- [Description("8-bit")]Col8Bit
- }
-
- public enum SmartSizeMode
- {
- [LocalizedAttributes.LocalizedDescription("strNoSmartSize")]
- SmartSNo,
- [LocalizedAttributes.LocalizedDescription("strFree")]
- SmartSFree,
- [LocalizedAttributes.LocalizedDescription("strAspect")]
- SmartSAspect
- }
-}
+ {
+ Port = 5900
+ }
+
+ public enum SpecialKeys
+ {
+ CtrlAltDel,
+ CtrlEsc
+ }
+
+ public enum Compression
+ {
+ [LocalizedAttributes.LocalizedDescription("strNoCompression")]
+ CompNone = 99,
+ [Description("0")] Comp0 = 0,
+ [Description("1")] Comp1 = 1,
+ [Description("2")] Comp2 = 2,
+ [Description("3")] Comp3 = 3,
+ [Description("4")] Comp4 = 4,
+ [Description("5")] Comp5 = 5,
+ [Description("6")] Comp6 = 6,
+ [Description("7")] Comp7 = 7,
+ [Description("8")] Comp8 = 8,
+ [Description("9")] Comp9 = 9
+ }
+
+ public enum Encoding
+ {
+ [Description("Raw")] EncRaw,
+ [Description("RRE")] EncRRE,
+ [Description("CoRRE")] EncCorre,
+ [Description("Hextile")] EncHextile,
+ [Description("Zlib")] EncZlib,
+ [Description("Tight")] EncTight,
+ [Description("ZlibHex")] EncZLibHex,
+ [Description("ZRLE")] EncZRLE
+ }
+
+ public enum AuthMode
+ {
+ [LocalizedAttributes.LocalizedDescription("VNC")]
+ AuthVNC,
+
+ [LocalizedAttributes.LocalizedDescription("Windows")]
+ AuthWin
+ }
+
+ public enum ProxyType
+ {
+ [LocalizedAttributes.LocalizedDescription("strNone")]
+ ProxyNone,
+
+ [LocalizedAttributes.LocalizedDescription("strHttp")]
+ ProxyHTTP,
+
+ [LocalizedAttributes.LocalizedDescription("strSocks5")]
+ ProxySocks5,
+
+ [LocalizedAttributes.LocalizedDescription("strUltraVncRepeater")]
+ ProxyUltra
+ }
+
+ public enum Colors
+ {
+ [LocalizedAttributes.LocalizedDescription("strNormal")]
+ ColNormal,
+ [Description("8-bit")] Col8Bit
+ }
+
+ public enum SmartSizeMode
+ {
+ [LocalizedAttributes.LocalizedDescription("strNoSmartSize")]
+ SmartSNo,
+
+ [LocalizedAttributes.LocalizedDescription("strFree")]
+ SmartSFree,
+
+ [LocalizedAttributes.LocalizedDescription("strAspect")]
+ SmartSAspect
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Connection/PuttySessionInfo.cs b/mRemoteV1/Connection/PuttySessionInfo.cs
index 4fd37e73..e15d82f4 100644
--- a/mRemoteV1/Connection/PuttySessionInfo.cs
+++ b/mRemoteV1/Connection/PuttySessionInfo.cs
@@ -10,20 +10,17 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Connection
{
- public sealed class PuttySessionInfo : ConnectionInfo, IComponent
- {
+ public sealed class PuttySessionInfo : ConnectionInfo, IComponent
+ {
#region Properties
- [Browsable(false)]
- public RootPuttySessionsNodeInfo RootRootPuttySessionsInfo { get; set; }
- [ReadOnly(true)]
- public override string PuttySession { get; set; }
+ [Browsable(false)] public RootPuttySessionsNodeInfo RootRootPuttySessionsInfo { get; set; }
- [ReadOnly(true)]
- public override string Name { get; set; }
+ [ReadOnly(true)] public override string PuttySession { get; set; }
- [ReadOnly(true), Browsable(false)]
- public override string Description { get; set; }
+ [ReadOnly(true)] public override string Name { get; set; }
+
+ [ReadOnly(true), Browsable(false)] public override string Description { get; set; }
[ReadOnly(true), Browsable(false)]
public override string Icon
@@ -39,56 +36,52 @@ namespace mRemoteNG.Connection
set { }
}
- [ReadOnly(true)]
- public override string Hostname { get; set; }
+ [ReadOnly(true)] public override string Hostname { get; set; }
- [ReadOnly(true)]
- public override string Username { get; set; }
+ [ReadOnly(true)] public override string Username { get; set; }
- [ReadOnly(true), Browsable(false)]
- public override string Password { get; set; }
+ [ReadOnly(true), Browsable(false)] public override string Password { get; set; }
- [ReadOnly(true)]
- public override ProtocolType Protocol { get; set; }
+ [ReadOnly(true)] public override ProtocolType Protocol { get; set; }
- [ReadOnly(true)]
- public override int Port { get; set; }
+ [ReadOnly(true)] public override int Port { get; set; }
- [ReadOnly(true), Browsable(false)]
- public override string PreExtApp { get; set; }
+ [ReadOnly(true), Browsable(false)] public override string PreExtApp { get; set; }
- [ReadOnly(true), Browsable(false)]
- public override string PostExtApp { get; set; }
+ [ReadOnly(true), Browsable(false)] public override string PostExtApp { get; set; }
- [ReadOnly(true), Browsable(false)]
- public override string MacAddress { get; set; }
+ [ReadOnly(true), Browsable(false)] public override string MacAddress { get; set; }
+
+ [ReadOnly(true), Browsable(false)] public override string UserField { get; set; }
- [ReadOnly(true), Browsable(false)]
- public override string UserField { get; set; }
#endregion
- [Command(),LocalizedAttributes.LocalizedDisplayName("strPuttySessionSettings")]
+ [Command(), LocalizedAttributes.LocalizedDisplayName("strPuttySessionSettings")]
public void SessionSettings()
- {
- try
- {
- var puttyProcess = new PuttyProcessController();
- if (!puttyProcess.Start())
- {
- return;
- }
- if (puttyProcess.SelectListBoxItem(PuttySession))
- {
- puttyProcess.ClickButton("&Load");
- }
- puttyProcess.SetControlText("Button", "&Cancel", "&Close");
- puttyProcess.SetControlVisible("Button", "&Open", false);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strErrorCouldNotLaunchPutty + Environment.NewLine + ex.Message);
- }
- }
+ {
+ try
+ {
+ var puttyProcess = new PuttyProcessController();
+ if (!puttyProcess.Start())
+ {
+ return;
+ }
+
+ if (puttyProcess.SelectListBoxItem(PuttySession))
+ {
+ puttyProcess.ClickButton("&Load");
+ }
+
+ puttyProcess.SetControlText("Button", "&Cancel", "&Close");
+ puttyProcess.SetControlVisible("Button", "&Open", false);
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
+ Language.strErrorCouldNotLaunchPutty + Environment.NewLine +
+ ex.Message);
+ }
+ }
public override TreeNodeType GetTreeNodeType()
{
@@ -96,19 +89,21 @@ namespace mRemoteNG.Connection
}
#region IComponent
+
[Browsable(false)]
public ISite Site
- {
- get => new PropertyGridCommandSite(this);
+ {
+ get => new PropertyGridCommandSite(this);
set => throw (new NotImplementedException());
}
public void Dispose()
- {
+ {
Disposed?.Invoke(this, EventArgs.Empty);
}
public event EventHandler Disposed;
+
#endregion
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Container/ContainerInfo.cs b/mRemoteV1/Container/ContainerInfo.cs
index 989fc911..69c9c1dd 100644
--- a/mRemoteV1/Container/ContainerInfo.cs
+++ b/mRemoteV1/Container/ContainerInfo.cs
@@ -9,34 +9,37 @@ using mRemoteNG.Tree;
namespace mRemoteNG.Container
{
- [DefaultProperty("Name")]
+ [DefaultProperty("Name")]
public class ContainerInfo : ConnectionInfo, INotifyCollectionChanged
- {
- private bool _isExpanded;
+ {
+ private bool _isExpanded;
- [Browsable(false)]
- public List Children { get; } = new List();
+ [Browsable(false)] public List Children { get; } = new List();
- [Category(""), Browsable(false), ReadOnly(false), Bindable(false), DefaultValue(""), DesignOnly(false)]
- public bool IsExpanded
- {
- get => _isExpanded;
- set => SetField(ref _isExpanded, value, "IsExpanded");
- }
+ [Category(""), Browsable(false), ReadOnly(false), Bindable(false), DefaultValue(""), DesignOnly(false)]
+ public bool IsExpanded
+ {
+ get => _isExpanded;
+ set => SetField(ref _isExpanded, value, "IsExpanded");
+ }
- [Browsable(false)]
- public override bool IsContainer { get { return true; } set {} }
+ [Browsable(false)]
+ public override bool IsContainer
+ {
+ get { return true; }
+ set { }
+ }
- public ContainerInfo(string uniqueId)
- : base(uniqueId)
+ public ContainerInfo(string uniqueId)
+ : base(uniqueId)
{
SetDefaults();
}
- public ContainerInfo()
- : this(Guid.NewGuid().ToString())
- {
- }
+ public ContainerInfo()
+ : this(Guid.NewGuid().ToString())
+ {
+ }
public override TreeNodeType GetTreeNodeType()
{
@@ -76,7 +79,9 @@ namespace mRemoteNG.Container
newChildItem.Parent = this;
Children.Insert(index, newChildItem);
SubscribeToChildEvents(newChildItem);
- RaiseCollectionChangedEvent(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, newChildItem));
+ RaiseCollectionChangedEvent(this,
+ new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add,
+ newChildItem));
}
public void AddChildRange(IEnumerable newChildren)
@@ -93,7 +98,9 @@ namespace mRemoteNG.Container
removalTarget.Parent = null;
Children.Remove(removalTarget);
UnsubscribeToChildEvents(removalTarget);
- RaiseCollectionChangedEvent(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removalTarget));
+ RaiseCollectionChangedEvent(this,
+ new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove,
+ removalTarget));
}
public void RemoveChildRange(IEnumerable removalTargets)
@@ -111,7 +118,10 @@ namespace mRemoteNG.Container
Children.Remove(child);
if (newIndex > Children.Count) newIndex = Children.Count;
Children.Insert(newIndex, child);
- RaiseCollectionChangedEvent(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, child, newIndex, originalIndex));
+ RaiseCollectionChangedEvent(this,
+ new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, child,
+ newIndex,
+ originalIndex));
}
public void SetChildAbove(ConnectionInfo childToPromote, ConnectionInfo reference)
@@ -161,7 +171,8 @@ namespace mRemoteNG.Container
SortOn(connectionInfo => connectionInfo.Name, sortDirection);
}
- public void SortOn(Func propertyToCompare, ListSortDirection sortDirection = ListSortDirection.Ascending)
+ public void SortOn(Func propertyToCompare,
+ ListSortDirection sortDirection = ListSortDirection.Ascending)
where TProperty : IComparable
{
var connectionComparer = new ConnectionInfoComparer(propertyToCompare)
@@ -169,7 +180,8 @@ namespace mRemoteNG.Container
SortDirection = sortDirection
};
Children.Sort(connectionComparer);
- RaiseCollectionChangedEvent(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
+ RaiseCollectionChangedEvent(this,
+ new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
public void SortRecursive(ListSortDirection sortDirection = ListSortDirection.Ascending)
@@ -177,7 +189,8 @@ namespace mRemoteNG.Container
SortOnRecursive(connectionInfo => connectionInfo.Name, sortDirection);
}
- public void SortOnRecursive(Func propertyToCompare, ListSortDirection sortDirection = ListSortDirection.Ascending)
+ public void SortOnRecursive(Func propertyToCompare,
+ ListSortDirection sortDirection = ListSortDirection.Ascending)
where TProperty : IComparable
{
foreach (var child in Children.OfType())
@@ -187,7 +200,7 @@ namespace mRemoteNG.Container
// Deep clone, recursive
public override ConnectionInfo Clone()
- {
+ {
var newContainer = new ContainerInfo();
newContainer.CopyFrom(this);
newContainer.OpenConnections = new ProtocolList();
@@ -198,14 +211,15 @@ namespace mRemoteNG.Container
newChild.RemoveParent();
newContainer.AddChild(newChild);
}
+
return newContainer;
- }
-
- private void SetDefaults()
- {
- Name = "New Folder";
+ }
+
+ private void SetDefaults()
+ {
+ Name = "New Folder";
IsExpanded = true;
- }
+ }
public IEnumerable GetRecursiveChildList()
{
@@ -217,6 +231,7 @@ namespace mRemoteNG.Container
if (childContainer != null)
childList.AddRange(GetRecursiveChildList(childContainer));
}
+
return childList;
}
@@ -230,6 +245,7 @@ namespace mRemoteNG.Container
if (childContainer != null)
childList.AddRange(GetRecursiveChildList(childContainer));
}
+
return childList;
}
@@ -250,9 +266,10 @@ namespace mRemoteNG.Container
}
public event NotifyCollectionChangedEventHandler CollectionChanged;
+
private void RaiseCollectionChangedEvent(object sender, NotifyCollectionChangedEventArgs args)
{
CollectionChanged?.Invoke(sender, args);
}
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Credential/CredentialDeletionMsgBoxConfirmer.cs b/mRemoteV1/Credential/CredentialDeletionMsgBoxConfirmer.cs
index 7fe3dcd2..f433371d 100644
--- a/mRemoteV1/Credential/CredentialDeletionMsgBoxConfirmer.cs
+++ b/mRemoteV1/Credential/CredentialDeletionMsgBoxConfirmer.cs
@@ -11,7 +11,8 @@ namespace mRemoteNG.Credential
{
private readonly Func _confirmationFunc;
- public CredentialDeletionMsgBoxConfirmer(Func confirmationFunc)
+ public CredentialDeletionMsgBoxConfirmer(
+ Func confirmationFunc)
{
if (confirmationFunc == null)
throw new ArgumentNullException(nameof(confirmationFunc));
@@ -25,18 +26,19 @@ namespace mRemoteNG.Credential
if (targetsArray.Length == 0) return false;
if (targetsArray.Length > 1)
return PromptUser(
- string.Format(
- "Are you sure you want to delete these {0} selected credentials?",
- targetsArray.Length));
+ string.Format(
+ "Are you sure you want to delete these {0} selected credentials?",
+ targetsArray.Length));
return PromptUser(
- string.Format(
- Language.strConfirmDeleteCredentialRecord,
- targetsArray.First().Title));
+ string.Format(
+ Language.strConfirmDeleteCredentialRecord,
+ targetsArray.First().Title));
}
private bool PromptUser(string promptMessage)
{
- var msgBoxResponse = _confirmationFunc.Invoke(promptMessage, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+ var msgBoxResponse = _confirmationFunc.Invoke(promptMessage, Application.ProductName,
+ MessageBoxButtons.YesNo, MessageBoxIcon.Question);
return msgBoxResponse == DialogResult.Yes;
}
}
diff --git a/mRemoteV1/Credential/CredentialRecordTypeConverter.cs b/mRemoteV1/Credential/CredentialRecordTypeConverter.cs
index 357c38ca..396c030f 100644
--- a/mRemoteV1/Credential/CredentialRecordTypeConverter.cs
+++ b/mRemoteV1/Credential/CredentialRecordTypeConverter.cs
@@ -11,21 +11,24 @@ namespace mRemoteNG.Credential
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
- return sourceType == typeof(Guid) ||
- base.CanConvertFrom(context, sourceType);
+ return sourceType == typeof(Guid) ||
+ base.CanConvertFrom(context, sourceType);
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(Guid) ||
- destinationType == typeof(ICredentialRecord) ||
- base.CanConvertTo(context, destinationType);
+ destinationType == typeof(ICredentialRecord) ||
+ base.CanConvertTo(context, destinationType);
}
- public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ public override object ConvertTo(ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
{
if (value is ICredentialRecord && destinationType == typeof(Guid))
- return ((ICredentialRecord) value).Id;
+ return ((ICredentialRecord)value).Id;
if (value is ICredentialRecord && destinationType == typeof(ICredentialRecord))
return value;
return base.ConvertTo(context, culture, value, destinationType);
@@ -34,7 +37,8 @@ namespace mRemoteNG.Credential
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (!(value is Guid)) return base.ConvertFrom(context, culture, value);
- var matchedCredentials = Runtime.CredentialProviderCatalog.GetCredentialRecords().Where(record => record.Id.Equals(value)).ToArray();
+ var matchedCredentials = Runtime.CredentialProviderCatalog.GetCredentialRecords()
+ .Where(record => record.Id.Equals(value)).ToArray();
return matchedCredentials.Any() ? matchedCredentials.First() : null;
}
}
diff --git a/mRemoteV1/Credential/CredentialServiceFacade.cs b/mRemoteV1/Credential/CredentialServiceFacade.cs
index a7e430ee..88a96d49 100644
--- a/mRemoteV1/Credential/CredentialServiceFacade.cs
+++ b/mRemoteV1/Credential/CredentialServiceFacade.cs
@@ -13,7 +13,9 @@ namespace mRemoteNG.Credential
public IEnumerable CredentialRepositories => _repositoryList;
- public CredentialServiceFacade(ICredentialRepositoryList repositoryList, ILoader> loader, ISaver> saver)
+ public CredentialServiceFacade(ICredentialRepositoryList repositoryList,
+ ILoader> loader,
+ ISaver> saver)
{
if (repositoryList == null)
throw new ArgumentNullException(nameof(repositoryList));
@@ -62,22 +64,28 @@ namespace mRemoteNG.Credential
}
#region Setup
+
private void SetupEventHandlers()
{
_repositoryList.RepositoriesUpdated += HandleRepositoriesUpdatedEvent;
_repositoryList.CredentialsUpdated += HandleCredentialsUpdatedEvent;
}
- private void HandleRepositoriesUpdatedEvent(object sender, CollectionUpdatedEventArgs collectionUpdatedEventArgs)
+ private void HandleRepositoriesUpdatedEvent(object sender,
+ CollectionUpdatedEventArgs
+ collectionUpdatedEventArgs)
{
SaveRepositoryList();
}
- private void HandleCredentialsUpdatedEvent(object sender, CollectionUpdatedEventArgs collectionUpdatedEventArgs)
+ private void HandleCredentialsUpdatedEvent(object sender,
+ CollectionUpdatedEventArgs
+ collectionUpdatedEventArgs)
{
var repo = sender as ICredentialRepository;
repo?.SaveCredentials(repo.Config.Key);
}
+
#endregion
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Credential/CredentialServiceFactory.cs b/mRemoteV1/Credential/CredentialServiceFactory.cs
index d45e0d60..d04b9719 100644
--- a/mRemoteV1/Credential/CredentialServiceFactory.cs
+++ b/mRemoteV1/Credential/CredentialServiceFactory.cs
@@ -16,15 +16,18 @@ namespace mRemoteNG.Credential
{
var cryptoFromSettings = new CryptoProviderFactoryFromSettings();
var credRepoSerializer = new XmlCredentialPasswordEncryptorDecorator(
- cryptoFromSettings.Build(),
- new XmlCredentialRecordSerializer());
- var credRepoDeserializer = new XmlCredentialPasswordDecryptorDecorator(new XmlCredentialRecordDeserializer());
+ cryptoFromSettings.Build(),
+ new XmlCredentialRecordSerializer());
+ var credRepoDeserializer =
+ new XmlCredentialPasswordDecryptorDecorator(new XmlCredentialRecordDeserializer());
var credentialRepoListPath = Path.Combine(SettingsFileInfo.SettingsPath, "credentialRepositories.xml");
var repoListDataProvider = new FileDataProvider(credentialRepoListPath);
var repoListLoader = new CredentialRepositoryListLoader(
- repoListDataProvider,
- new CredentialRepositoryListDeserializer(credRepoSerializer, credRepoDeserializer));
+ repoListDataProvider,
+ new
+ CredentialRepositoryListDeserializer(credRepoSerializer,
+ credRepoDeserializer));
var repoListSaver = new CredentialRepositoryListSaver(repoListDataProvider);
return new CredentialServiceFacade(Runtime.CredentialProviderCatalog, repoListLoader, repoListSaver);
diff --git a/mRemoteV1/Credential/PlaceholderCredentialRecord.cs b/mRemoteV1/Credential/PlaceholderCredentialRecord.cs
index 6cff5abd..ee4d5fdc 100644
--- a/mRemoteV1/Credential/PlaceholderCredentialRecord.cs
+++ b/mRemoteV1/Credential/PlaceholderCredentialRecord.cs
@@ -12,17 +12,13 @@ namespace mRemoteNG.Credential
public Guid Id { get; }
- [ReadOnly(true)]
- public string Title { get; set; } = Language.CredentialUnavailable;
+ [ReadOnly(true)] public string Title { get; set; } = Language.CredentialUnavailable;
- [ReadOnly(true)]
- public string Username { get; set; } = Language.CredentialUnavailable;
+ [ReadOnly(true)] public string Username { get; set; } = Language.CredentialUnavailable;
- [ReadOnly(true)]
- public SecureString Password { get; set; } = new SecureString();
+ [ReadOnly(true)] public SecureString Password { get; set; } = new SecureString();
- [ReadOnly(true)]
- public string Domain { get; set; } = Language.CredentialUnavailable;
+ [ReadOnly(true)] public string Domain { get; set; } = Language.CredentialUnavailable;
public PlaceholderCredentialRecord(IEnumerable id)
{
@@ -31,4 +27,4 @@ namespace mRemoteNG.Credential
public override string ToString() => Language.CredentialUnavailable;
}
-}
+}
\ No newline at end of file
diff --git a/mRemoteV1/Credential/Repositories/CredentialRepositoryConfig.cs b/mRemoteV1/Credential/Repositories/CredentialRepositoryConfig.cs
index 7a7575bd..1b3575e8 100644
--- a/mRemoteV1/Credential/Repositories/CredentialRepositoryConfig.cs
+++ b/mRemoteV1/Credential/Repositories/CredentialRepositoryConfig.cs
@@ -39,7 +39,7 @@ namespace mRemoteNG.Credential.Repositories
get { return _source; }
set
{
- _source = value;
+ _source = value;
RaisePropertyChangedEvent(nameof(Source));
}
}
@@ -49,7 +49,7 @@ namespace mRemoteNG.Credential.Repositories
get { return _key; }
set
{
- _key = value;
+ _key = value;
RaisePropertyChangedEvent(nameof(Key));
}
}
@@ -74,6 +74,7 @@ namespace mRemoteNG.Credential.Repositories
}
public event PropertyChangedEventHandler PropertyChanged;
+
protected virtual void RaisePropertyChangedEvent(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
diff --git a/mRemoteV1/Credential/Repositories/CredentialRepositoryList.cs b/mRemoteV1/Credential/Repositories/CredentialRepositoryList.cs
index f73360cd..a3305d2e 100644
--- a/mRemoteV1/Credential/Repositories/CredentialRepositoryList.cs
+++ b/mRemoteV1/Credential/Repositories/CredentialRepositoryList.cs
@@ -19,7 +19,7 @@ namespace mRemoteNG.Credential.Repositories
_credentialProviders.Add(credentialProvider);
credentialProvider.CredentialsUpdated += RaiseCredentialsUpdatedEvent;
credentialProvider.RepositoryConfigUpdated += OnRepoConfigChanged;
- RaiseRepositoriesUpdatedEvent(ActionType.Added, new[] { credentialProvider });
+ RaiseRepositoriesUpdatedEvent(ActionType.Added, new[] {credentialProvider});
}
public void RemoveProvider(ICredentialRepository credentialProvider)
@@ -28,7 +28,7 @@ namespace mRemoteNG.Credential.Repositories
credentialProvider.CredentialsUpdated -= RaiseCredentialsUpdatedEvent;
credentialProvider.RepositoryConfigUpdated -= OnRepoConfigChanged;
_credentialProviders.Remove(credentialProvider);
- RaiseRepositoriesUpdatedEvent(ActionType.Removed, new[] { credentialProvider });
+ RaiseRepositoriesUpdatedEvent(ActionType.Removed, new[] {credentialProvider});
}
public bool Contains(Guid repositoryId)
@@ -43,12 +43,14 @@ namespace mRemoteNG.Credential.Repositories
{
list.AddRange(repository.CredentialRecords);
}
+
return list;
}
public ICredentialRecord GetCredentialRecord(Guid id)
{
- return CredentialProviders.SelectMany(repo => repo.CredentialRecords).FirstOrDefault(record => record.Id.Equals(id));
+ return CredentialProviders.SelectMany(repo => repo.CredentialRecords)
+ .FirstOrDefault(record => record.Id.Equals(id));
}
public IEnumerator GetEnumerator()
@@ -66,7 +68,8 @@ namespace mRemoteNG.Credential.Repositories
private void RaiseRepositoriesUpdatedEvent(ActionType action, IEnumerable changedItems)
{
- RepositoriesUpdated?.Invoke(this, new CollectionUpdatedEventArgs(action, changedItems));
+ RepositoriesUpdated?.Invoke(this,
+ new CollectionUpdatedEventArgs(action, changedItems));
}
private void RaiseCredentialsUpdatedEvent(object sender, CollectionUpdatedEventArgs args)
@@ -78,7 +81,7 @@ namespace mRemoteNG.Credential.Repositories
{
var repo = sender as ICredentialRepository;
if (repo == null) return;
- RaiseRepositoriesUpdatedEvent(ActionType.Updated, new[] { repo });
+ RaiseRepositoriesUpdatedEvent(ActionType.Updated, new[] {repo});
}
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Credential/Repositories/XmlCredentialRepository.cs b/mRemoteV1/Credential/Repositories/XmlCredentialRepository.cs
index bb026880..ebb20073 100644
--- a/mRemoteV1/Credential/Repositories/XmlCredentialRepository.cs
+++ b/mRemoteV1/Credential/Repositories/XmlCredentialRepository.cs
@@ -17,7 +17,9 @@ namespace mRemoteNG.Credential.Repositories
public IList CredentialRecords { get; }
public bool IsLoaded { get; private set; }
- public XmlCredentialRepository(ICredentialRepositoryConfig config, CredentialRecordSaver credentialRecordSaver, CredentialRecordLoader credentialRecordLoader)
+ public XmlCredentialRepository(ICredentialRepositoryConfig config,
+ CredentialRecordSaver credentialRecordSaver,
+ CredentialRecordLoader credentialRecordLoader)
{
if (config == null)
throw new ArgumentNullException(nameof(config));
@@ -28,7 +30,8 @@ namespace mRemoteNG.Credential.Repositories
Config = config;
CredentialRecords = new FullyObservableCollection();
- ((FullyObservableCollection) CredentialRecords).CollectionUpdated += RaiseCredentialsUpdatedEvent;
+ ((FullyObservableCollection)CredentialRecords).CollectionUpdated +=
+ RaiseCredentialsUpdatedEvent;
Config.PropertyChanged += (sender, args) => RaiseRepositoryConfigUpdatedEvent(args);
_credentialRecordSaver = credentialRecordSaver;
_credentialRecordLoader = credentialRecordLoader;
@@ -42,6 +45,7 @@ namespace mRemoteNG.Credential.Repositories
if (ThisIsADuplicateCredentialRecord(newCredential)) continue;
CredentialRecords.Add(newCredential);
}
+
IsLoaded = true;
Config.Key = key;
}
@@ -71,7 +75,8 @@ namespace mRemoteNG.Credential.Repositories
RepositoryConfigUpdated?.Invoke(this, args);
}
- protected virtual void RaiseCredentialsUpdatedEvent(object sender, CollectionUpdatedEventArgs args)
+ protected virtual void RaiseCredentialsUpdatedEvent(object sender,
+ CollectionUpdatedEventArgs args)
{
CredentialsUpdated?.Invoke(this, args);
}
diff --git a/mRemoteV1/Credential/Repositories/XmlCredentialRepositoryFactory.cs b/mRemoteV1/Credential/Repositories/XmlCredentialRepositoryFactory.cs
index 0cebc69d..8ab806b8 100644
--- a/mRemoteV1/Credential/Repositories/XmlCredentialRepositoryFactory.cs
+++ b/mRemoteV1/Credential/Repositories/XmlCredentialRepositoryFactory.cs
@@ -12,7 +12,8 @@ namespace mRemoteNG.Credential.Repositories
private readonly ISecureSerializer, string> _serializer;
private readonly ISecureDeserializer> _deserializer;
- public XmlCredentialRepositoryFactory(ISecureSerializer, string> serializer, ISecureDeserializer> deserializer)
+ public XmlCredentialRepositoryFactory(ISecureSerializer, string> serializer,
+ ISecureDeserializer> deserializer)
{
if (serializer == null)
throw new ArgumentNullException(nameof(serializer));
diff --git a/mRemoteV1/Messages/Message.cs b/mRemoteV1/Messages/Message.cs
index 45dc0699..5888e579 100644
--- a/mRemoteV1/Messages/Message.cs
+++ b/mRemoteV1/Messages/Message.cs
@@ -2,12 +2,12 @@ using System;
namespace mRemoteNG.Messages
{
- public class Message : IMessage
- {
- public MessageClass Class { get; set; }
- public string Text { get; set; }
- public DateTime Date { get; set; }
- public bool OnlyLog { get; set; }
+ public class Message : IMessage
+ {
+ public MessageClass Class { get; set; }
+ public string Text { get; set; }
+ public DateTime Date { get; set; }
+ public bool OnlyLog { get; set; }
public Message(MessageClass messageClass, string messageText, bool onlyLog = false)
{
@@ -16,5 +16,5 @@ namespace mRemoteNG.Messages
Date = DateTime.Now;
OnlyLog = onlyLog;
}
- }
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/Messages/MessageCollector.cs b/mRemoteV1/Messages/MessageCollector.cs
index b156cc12..9a89be74 100644
--- a/mRemoteV1/Messages/MessageCollector.cs
+++ b/mRemoteV1/Messages/MessageCollector.cs
@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
+
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Messages
@@ -26,7 +27,7 @@ namespace mRemoteNG.Messages
public void AddMessage(IMessage message)
{
- AddMessages(new [] {message});
+ AddMessages(new[] {message});
}
public void AddMessages(IEnumerable messages)
@@ -38,18 +39,27 @@ namespace mRemoteNG.Messages
_messageList.Add(message);
newMessages.Add(message);
}
+
if (newMessages.Any())
RaiseCollectionChangedEvent(NotifyCollectionChangedAction.Add, newMessages);
}
- public void AddExceptionMessage(string message, Exception ex, MessageClass msgClass = MessageClass.ErrorMsg, bool logOnly = true)
+ public void AddExceptionMessage(string message,
+ Exception ex,
+ MessageClass msgClass = MessageClass.ErrorMsg,
+ bool logOnly = true)
{
- AddMessage(msgClass, message + Environment.NewLine + Tools.MiscTools.GetExceptionMessageRecursive(ex), logOnly);
+ AddMessage(msgClass, message + Environment.NewLine + Tools.MiscTools.GetExceptionMessageRecursive(ex),
+ logOnly);
}
- public void AddExceptionStackTrace(string message, Exception ex, MessageClass msgClass = MessageClass.ErrorMsg, bool logOnly = true)
+ public void AddExceptionStackTrace(string message,
+ Exception ex,
+ MessageClass msgClass = MessageClass.ErrorMsg,
+ bool logOnly = true)
{
- AddMessage(msgClass, message + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace, logOnly);
+ AddMessage(msgClass, message + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace,
+ logOnly);
}
public void ClearMessages()
diff --git a/mRemoteV1/Messages/MessageWriters/NotificationPanelMessageWriter.cs b/mRemoteV1/Messages/MessageWriters/NotificationPanelMessageWriter.cs
index 7ec99de3..29cb3d44 100644
--- a/mRemoteV1/Messages/MessageWriters/NotificationPanelMessageWriter.cs
+++ b/mRemoteV1/Messages/MessageWriters/NotificationPanelMessageWriter.cs
@@ -26,7 +26,7 @@ namespace mRemoteNG.Messages.MessageWriters
private void AddToList(ListViewItem lvItem)
{
if (_messageWindow.lvErrorCollector.InvokeRequired)
- _messageWindow.lvErrorCollector.Invoke((MethodInvoker) (() => AddToList(lvItem)));
+ _messageWindow.lvErrorCollector.Invoke((MethodInvoker)(() => AddToList(lvItem)));
else
_messageWindow.lvErrorCollector.Items.Insert(0, lvItem);
}
diff --git a/mRemoteV1/Messages/MessageWriters/PopupMessageWriter.cs b/mRemoteV1/Messages/MessageWriters/PopupMessageWriter.cs
index 93602d50..2e6a0495 100644
--- a/mRemoteV1/Messages/MessageWriters/PopupMessageWriter.cs
+++ b/mRemoteV1/Messages/MessageWriters/PopupMessageWriter.cs
@@ -10,16 +10,20 @@ namespace mRemoteNG.Messages.MessageWriters
switch (message.Class)
{
case MessageClass.DebugMsg:
- MessageBox.Show(message.Text, string.Format(Language.strTitleInformation, message.Date), MessageBoxButtons.OK, MessageBoxIcon.Information);
+ MessageBox.Show(message.Text, string.Format(Language.strTitleInformation, message.Date),
+ MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case MessageClass.InformationMsg:
- MessageBox.Show(message.Text, string.Format(Language.strTitleInformation, message.Date), MessageBoxButtons.OK, MessageBoxIcon.Information);
+ MessageBox.Show(message.Text, string.Format(Language.strTitleInformation, message.Date),
+ MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case MessageClass.WarningMsg:
- MessageBox.Show(message.Text, string.Format(Language.strTitleWarning, message.Date), MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBox.Show(message.Text, string.Format(Language.strTitleWarning, message.Date),
+ MessageBoxButtons.OK, MessageBoxIcon.Warning);
break;
case MessageClass.ErrorMsg:
- MessageBox.Show(message.Text, string.Format(Language.strTitleError, message.Date), MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(message.Text, string.Format(Language.strTitleError, message.Date),
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
default:
throw new ArgumentOutOfRangeException();
diff --git a/mRemoteV1/Messages/WriterDecorators/MessageFocusDecorator.cs b/mRemoteV1/Messages/WriterDecorators/MessageFocusDecorator.cs
index c9d7d9dc..a3e30c68 100644
--- a/mRemoteV1/Messages/WriterDecorators/MessageFocusDecorator.cs
+++ b/mRemoteV1/Messages/WriterDecorators/MessageFocusDecorator.cs
@@ -15,7 +15,9 @@ namespace mRemoteNG.Messages.WriterDecorators
private readonly ErrorAndInfoWindow _messageWindow;
private readonly FrmMain _frmMain = FrmMain.Default;
- public MessageFocusDecorator(ErrorAndInfoWindow messageWindow, IMessageTypeFilteringOptions filter, IMessageWriter decoratedWriter)
+ public MessageFocusDecorator(ErrorAndInfoWindow messageWindow,
+ IMessageTypeFilteringOptions filter,
+ IMessageWriter decoratedWriter)
{
_filter = filter ?? throw new ArgumentNullException(nameof(filter));
_messageWindow = messageWindow ?? throw new ArgumentNullException(nameof(messageWindow));
@@ -46,14 +48,15 @@ namespace mRemoteNG.Messages.WriterDecorators
if (_filter.AllowErrorMessages) return true;
break;
}
+
return false;
}
private async Task SwitchToMessageAsync()
{
await Task
- .Delay(TimeSpan.FromMilliseconds(300))
- .ContinueWith(task => SwitchToMessage());
+ .Delay(TimeSpan.FromMilliseconds(300))
+ .ContinueWith(task => SwitchToMessage());
}
private void SwitchToMessage()
diff --git a/mRemoteV1/Messages/WriterDecorators/MessageTypeFilterDecorator.cs b/mRemoteV1/Messages/WriterDecorators/MessageTypeFilterDecorator.cs
index cf92b577..ed8a4be2 100644
--- a/mRemoteV1/Messages/WriterDecorators/MessageTypeFilterDecorator.cs
+++ b/mRemoteV1/Messages/WriterDecorators/MessageTypeFilterDecorator.cs
@@ -43,6 +43,7 @@ namespace mRemoteNG.Messages.WriterDecorators
if (_filter.AllowDebugMessages) return true;
break;
}
+
return false;
}
}
diff --git a/mRemoteV1/Properties/AssemblyInfo.cs b/mRemoteV1/Properties/AssemblyInfo.cs
index 08b0f100..2f15b6a7 100644
--- a/mRemoteV1/Properties/AssemblyInfo.cs
+++ b/mRemoteV1/Properties/AssemblyInfo.cs
@@ -3,7 +3,6 @@ using System.Resources;
using System.Runtime.InteropServices;
-
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
diff --git a/mRemoteV1/Properties/Settings.settings b/mRemoteV1/Properties/Settings.settings
index 40257a08..63093198 100644
--- a/mRemoteV1/Properties/Settings.settings
+++ b/mRemoteV1/Properties/Settings.settings
@@ -1,699 +1,701 @@
-
-
-
-
- 0, 0
-
-
- 0, 0
-
-
- Normal
-
-
- False
-
-
- True
-
-
-
-
-
- True
-
-
- True
-
-
- True
-
-
- False
-
-
- False
-
-
-
-
-
- True
-
-
- True
-
-
- False
-
-
- False
-
-
- True
-
-
- False
-
-
- False
-
-
- noinfo
-
-
-
-
-
-
-
-
-
-
-
- False
-
-
- True
-
-
- False
-
-
- False
-
-
- False
-
-
-
-
-
- 80
-
-
- False
-
-
-
-
-
-
-
-
-
-
-
- RDP
-
-
- Default Settings
-
-
- False
-
-
- FitToWindow
-
-
- Colors16Bit
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- DoNotPlay
-
-
- 2
-
-
- False
-
-
- False
-
-
- False
-
-
- 0
-
-
- False
-
-
- True
-
-
- 0, 0
-
-
- Bottom
-
-
- True
-
-
- 3, 24
-
-
- Top
-
-
- False
-
-
- False
-
-
-
-
-
-
-
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- EncrBasic
-
-
- False
-
-
-
-
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- True
-
-
- False
-
-
- False
-
-
- AuthVNC
-
-
- ColNormal
-
-
- SmartSAspect
-
-
- False
-
-
- CompNone
-
-
- EncHextile
-
-
-
-
-
-
-
-
- 0
-
-
- ProxyNone
-
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- NoAuth
-
-
- False
-
-
- 5500
-
-
- False
-
-
-
-
-
- IE
-
-
- False
-
-
-
-
-
- False
-
-
- False
-
-
-
-
-
- False
-
-
-
-
-
- False
-
-
- False
-
-
- 14
-
-
- 1980-01-01
-
-
- False
-
-
- Never
-
-
- Yes
-
-
- mRemoteNG
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- 5
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- 4
-
-
-
-
-
-
-
-
- mRemoteNG
-
-
- 10
-
-
- {0}.{1:yyyyMMdd-HHmmssffff}.backup
-
-
- False
-
-
- True
-
-
- False
-
-
- False
-
-
- release
-
-
-
-
-
- True
-
-
-
-
-
-
-
-
- True
-
-
- https://mremoteng.org/
-
-
-
-
-
- True
-
-
- False
-
-
- False
-
-
- RDP
-
-
- 9/9, 33/8
-
-
- 9/8, 34/8
-
-
- False
-
-
- 20
-
-
- AES
-
-
- GCM
-
-
- 1000
-
-
- Dynamic
-
-
- False
-
-
- 0
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- 00000000-0000-0000-0000-000000000000
-
-
-
-
-
- False
-
-
- True
-
-
- True
-
-
- True
-
-
- False
-
-
- False
-
-
- True
-
-
- True
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- True
-
-
- True
-
-
- cs-CZ,de,el,en,en-US,es-AR,es,fr,hu,it,ja-JP,ko-KR,nb-NO,nl,pt,pt-BR,pl,ru,uk,tr-TR,zh-CN,zh-TW
-
-
- True
-
-
-
-
-
-
-
-
-
-
-
- General
-
-
- True
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- 0, 0
-
-
-
-
-
- False
-
-
- False
-
-
- General
-
-
- False
-
-
- False
-
-
- True
-
-
- False
-
-
+
+
+
+
+
+ 0, 0
+
+
+ 0, 0
+
+
+ Normal
+
+
+ False
+
+
+ True
+
+
+
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+
+
+
+ True
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ noinfo
+
+
+
+
+
+
+
+
+
+
+
+ False
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+
+
+
+ 80
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+ RDP
+
+
+ Default Settings
+
+
+ False
+
+
+ FitToWindow
+
+
+ Colors16Bit
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ DoNotPlay
+
+
+ 2
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ 0
+
+
+ False
+
+
+ True
+
+
+ 0, 0
+
+
+ Bottom
+
+
+ True
+
+
+ 3, 24
+
+
+ Top
+
+
+ False
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ EncrBasic
+
+
+ False
+
+
+
+
+
+
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ AuthVNC
+
+
+ ColNormal
+
+
+ SmartSAspect
+
+
+ False
+
+
+ CompNone
+
+
+ EncHextile
+
+
+
+
+
+
+
+
+ 0
+
+
+ ProxyNone
+
+
+
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ NoAuth
+
+
+ False
+
+
+ 5500
+
+
+ False
+
+
+
+
+
+ IE
+
+
+ False
+
+
+
+
+
+ False
+
+
+ False
+
+
+
+
+
+ False
+
+
+
+
+
+ False
+
+
+ False
+
+
+ 14
+
+
+ 1980-01-01
+
+
+ False
+
+
+ Never
+
+
+ Yes
+
+
+ mRemoteNG
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ 4
+
+
+
+
+
+
+
+
+ mRemoteNG
+
+
+ 10
+
+
+ {0}.{1:yyyyMMdd-HHmmssffff}.backup
+
+
+ False
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ release
+
+
+
+
+
+ True
+
+
+
+
+
+
+
+
+ True
+
+
+ https://mremoteng.org/
+
+
+
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ RDP
+
+
+ 9/9, 33/8
+
+
+ 9/8, 34/8
+
+
+ False
+
+
+ 20
+
+
+ AES
+
+
+ GCM
+
+
+ 1000
+
+
+ Dynamic
+
+
+ False
+
+
+ 0
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ 00000000-0000-0000-0000-000000000000
+
+
+
+
+
+ False
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ True
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ True
+
+
+ True
+
+
+ cs-CZ,de,el,en,en-US,es-AR,es,fr,hu,it,ja-JP,ko-KR,nb-NO,nl,pt,pt-BR,pl,ru,uk,tr-TR,zh-CN,zh-TW
+
+
+ True
+
+
+
+
+
+
+
+
+
+
+
+ General
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ 0, 0
+
+
+
+
+
+ False
+
+
+ False
+
+
+ General
+
+
+ False
+
+
+ False
+
+
+ True
+
+
+ False
+
+
\ No newline at end of file
diff --git a/mRemoteV1/Resources/Help/Index.htm b/mRemoteV1/Resources/Help/Index.htm
index cfa50ca0..cc9cad1d 100644
--- a/mRemoteV1/Resources/Help/Index.htm
+++ b/mRemoteV1/Resources/Help/Index.htm
@@ -1,48 +1,86 @@
-
- mRemoteNG Help
-
+
+ mRemoteNG Help
+
-
+
Done from nmat, please remove this div after review.
-
-
Welcome to mRemoteNG
-
-
+
+Welcome to mRemoteNG
+
+
This documentation is written and based on version 1.76 of mRemoteNG. If you find anything to improve or wrong with the documentation then please report it to github.
Also note that documentation can be found on github pages that are updated more frequently then information provided here.
-
- Getting Started
-
- User Interface
-
- Special Topics
- Connections
-
+
+Getting Started
+
+User Interface
+
+Special Topics
+Connections
+
-
+