diff --git a/SharedLibraryNG/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/SharedLibraryNG/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index bbaa4fbc5..7588ac976 100644 Binary files a/SharedLibraryNG/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/SharedLibraryNG/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/TestProject/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/TestProject/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index c26ebc5fe..7cbb75911 100644 Binary files a/TestProject/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/TestProject/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/TestProject/obj/Debug/mRemoteNG_Accessor.exe b/TestProject/obj/Debug/mRemoteNG_Accessor.exe index a70473851..7b38a119c 100644 Binary files a/TestProject/obj/Debug/mRemoteNG_Accessor.exe and b/TestProject/obj/Debug/mRemoteNG_Accessor.exe differ diff --git a/TestProject/obj/Debug/mRemoteNG_Accessor.pdb b/TestProject/obj/Debug/mRemoteNG_Accessor.pdb index 42b9c4826..c92460a3a 100644 Binary files a/TestProject/obj/Debug/mRemoteNG_Accessor.pdb and b/TestProject/obj/Debug/mRemoteNG_Accessor.pdb differ diff --git a/mRemoteV1.ConvertedToC#/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache b/mRemoteV1.ConvertedToC#/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache index a66e27a8c..a14dcf842 100644 Binary files a/mRemoteV1.ConvertedToC#/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache and b/mRemoteV1.ConvertedToC#/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/mRemoteV1.ConvertedToC#/obj/Debug Portable/Interop.WFICALib.dll b/mRemoteV1.ConvertedToC#/obj/Debug Portable/Interop.WFICALib.dll index 869205682..421ec0cb8 100644 Binary files a/mRemoteV1.ConvertedToC#/obj/Debug Portable/Interop.WFICALib.dll and b/mRemoteV1.ConvertedToC#/obj/Debug Portable/Interop.WFICALib.dll differ diff --git a/mRemoteV1.ConvertedToC#/obj/Debug Portable/mRemoteV1.Converted.csproj.ResolveComReference.cache b/mRemoteV1.ConvertedToC#/obj/Debug Portable/mRemoteV1.Converted.csproj.ResolveComReference.cache index dd2d9b9f0..386521824 100644 Binary files a/mRemoteV1.ConvertedToC#/obj/Debug Portable/mRemoteV1.Converted.csproj.ResolveComReference.cache and b/mRemoteV1.ConvertedToC#/obj/Debug Portable/mRemoteV1.Converted.csproj.ResolveComReference.cache differ diff --git a/mRemoteV1.v12.suo b/mRemoteV1.v12.suo index 228f145f0..5b25db4b2 100644 Binary files a/mRemoteV1.v12.suo and b/mRemoteV1.v12.suo differ diff --git a/mRemoteV1/CS/App/App.Native.cs b/mRemoteV1/CS/App/App.Native.cs index 1b58bcf07..663e8a8d6 100644 --- a/mRemoteV1/CS/App/App.Native.cs +++ b/mRemoteV1/CS/App/App.Native.cs @@ -1,4 +1,3 @@ -// VBConversions Note: VB project level imports using System.Collections.Generic; using System; using AxWFICALib; @@ -9,8 +8,6 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports - using System.Runtime.InteropServices; @@ -18,44 +15,62 @@ namespace mRemoteNG.App { public static class Native { -#region Functions - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern bool AppendMenu(IntPtr hMenu, int uFlags, IntPtr uIDNewItem, string lpNewItem); + #region Functions + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern bool AppendMenu(IntPtr hMenu, int uFlags, IntPtr uIDNewItem, string lpNewItem); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr CreatePopupMenu(); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern IntPtr CreatePopupMenu(); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr GetForegroundWindow(); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern IntPtr GetForegroundWindow(); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern bool InsertMenu(IntPtr hMenu, int uPosition, int uFlags, IntPtr uIDNewItem, string lpNewItem); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern bool InsertMenu(IntPtr hMenu, int uPosition, int uFlags, IntPtr uIDNewItem, string lpNewItem); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern int IsIconic(IntPtr hWnd); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern int IsIconic(IntPtr hWnd); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int cx, int cy, bool repaint); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int cx, int cy, bool repaint); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern int SendMessage(IntPtr hWnd, int msg, int wparam, int lparam); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern int SendMessage(IntPtr hWnd, int msg, int wparam, int lparam); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern bool SetForegroundWindow(IntPtr hWnd); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern bool SetForegroundWindow(IntPtr hWnd); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern bool SetMenuItemBitmaps(IntPtr hMenu, int uPosition, int uFlags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern bool SetMenuItemBitmaps(IntPtr hMenu, int uPosition, int uFlags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern long SetParent(IntPtr hWndChild, IntPtr hWndNewParent); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern long SetParent(IntPtr hWndChild, IntPtr hWndNewParent); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern int SetWindowLong(IntPtr hWnd, int nIndex, long dwNewLong); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern int SetWindowLong(IntPtr hWnd, int nIndex, long dwNewLong); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern int ShowWindow(IntPtr hWnd, int nCmdShow); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern int ShowWindow(IntPtr hWnd, int nCmdShow); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr WindowFromPoint(Point point); -#endregion + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern IntPtr WindowFromPoint(Point point); + #endregion -#region Structures - [StructLayout(LayoutKind.Sequential)]public struct WINDOWPOS + #region Structures + [StructLayout(LayoutKind.Sequential)] + public struct WINDOWPOS { public IntPtr hwnd; public IntPtr hwndInsertAfter; @@ -65,9 +80,9 @@ namespace mRemoteNG.App public int cy; public int flags; } -#endregion + #endregion -#region Helpers + #region Helpers public static int MAKELONG(int wLow, int wHigh) { return wLow | wHigh << 16; @@ -97,10 +112,9 @@ namespace mRemoteNG.App { return HIWORD(value.ToInt32()); } + #endregion -#endregion - -#region Constants + #region Constants // GetWindowLong public const int GWL_STYLE = (-16); @@ -178,6 +192,6 @@ namespace mRemoteNG.App // Virtual Key Codes public const int VK_CONTROL = 0x11; public const int VK_C = 0x67; -#endregion + #endregion } } diff --git a/mRemoteV1/CS/App/App.Runtime.cs b/mRemoteV1/CS/App/App.Runtime.cs index 389d0bdf6..ff511f9ea 100644 --- a/mRemoteV1/CS/App/App.Runtime.cs +++ b/mRemoteV1/CS/App/App.Runtime.cs @@ -342,7 +342,7 @@ namespace mRemoteNG.App { using (OptionsForm optionsForm = new OptionsForm()) { - optionsForm.ShowDialog(frmMain); + optionsForm.ShowDialog(frmMain.Default); } } else if (windowType.Equals(UI.Window.Type.SSHTransfer)) @@ -422,7 +422,7 @@ namespace mRemoteNG.App { using (OptionsForm optionsForm = new OptionsForm()) { - optionsForm.ShowDialog(frmMain, typeof(UpdatesPage)); + optionsForm.ShowDialog(frmMain.Default, typeof(UpdatesPage)); } } @@ -492,7 +492,7 @@ namespace mRemoteNG.App if (isFipsPolicyEnabled) { - MessageBox.Show(frmMain, string.Format(My.Language.strErrorFipsPolicyIncompatible, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName), (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(frmMain.Default, string.Format(My.Language.strErrorFipsPolicyIncompatible, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName), (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); System.Environment.Exit(1); } } @@ -1635,7 +1635,7 @@ namespace mRemoteNG.App saveFileDialog.Filter = string.Join("|", fileTypes.ToArray()); - if (!(saveFileDialog.ShowDialog(frmMain) == DialogResult.OK)) + if (!(saveFileDialog.ShowDialog(frmMain.Default) == DialogResult.OK)) { return ; } diff --git a/mRemoteV1/CS/App/Export.cs b/mRemoteV1/CS/App/Export.cs index 6f44552ed..4fbb53761 100644 --- a/mRemoteV1/CS/App/Export.cs +++ b/mRemoteV1/CS/App/Export.cs @@ -38,7 +38,7 @@ namespace mRemoteNG.App exportForm.SelectedConnection = selectedTreeNode; } - if (!(exportForm.ShowDialog(frmMain) == DialogResult.OK)) + if (!(exportForm.ShowDialog(frmMain.Default) == DialogResult.OK)) { return ; } diff --git a/mRemoteV1/CS/Config/Config.Connections.Load.cs b/mRemoteV1/CS/Config/Config.Connections.Load.cs index 3d6ec9655..89fcfd678 100644 --- a/mRemoteV1/CS/Config/Config.Connections.Load.cs +++ b/mRemoteV1/CS/Config/Config.Connections.Load.cs @@ -185,7 +185,20 @@ namespace mRemoteNG.Config.Connections const double maxSupportedSchemaVersion = 2.5; if (confVersion > maxSupportedSchemaVersion) { - cTaskDialog.ShowTaskDialogBox(frmMain, System.Windows.Forms.Application.ProductName, "Incompatible database schema", string.Format("The database schema on the server is not supported. Please upgrade to a newer version of {0}.", System.Windows.Forms.Application.ProductName), string.Format("Schema Version: {1}{0}Highest Supported Version: {2}", Constants.vbNewLine, confVersion.ToString(), maxSupportedSchemaVersion.ToString()), "", "", "", "", eTaskDialogButtons.OK, eSysIcons.Error, null); + cTaskDialog.ShowTaskDialogBox( + frmMain.Default, + System.Windows.Forms.Application.ProductName, + "Incompatible database schema", + string.Format("The database schema on the server is not supported. Please upgrade to a newer version of {0}.", System.Windows.Forms.Application.ProductName), + string.Format("Schema Version: {1}{0}Highest Supported Version: {2}", Constants.vbNewLine, confVersion.ToString(), maxSupportedSchemaVersion.ToString()), + "", + "", + "", + "", + eTaskDialogButtons.OK, + eSysIcons.Error, + eSysIcons.Error + ); throw (new Exception(string.Format("Incompatible database schema (schema version {0}).", confVersion))); } @@ -196,8 +209,8 @@ namespace mRemoteNG.Config.Connections rootInfo.TreeNode = RootTreeNode; RootTreeNode.Tag = rootInfo; - RootTreeNode.ImageIndex = Images.Enums.TreeImage.Root; - RootTreeNode.SelectedImageIndex = Images.Enums.TreeImage.Root; + RootTreeNode.ImageIndex = (int)Images.Enums.TreeImage.Root; + RootTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Root; if (Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["Protected"]), pW) != "ThisIsNotProtected") { @@ -296,7 +309,7 @@ namespace mRemoteNG.Config.Connections conI.TreeNode = tNode; //conI.Parent = _previousContainer 'NEW - this._ConnectionList.Add(conI); + this.ConnectionList.Add(conI); tNode.Tag = conI; @@ -314,19 +327,19 @@ namespace mRemoteNG.Config.Connections if (conI.OpenConnections.Count > 0) { - tNode.ImageIndex = Images.Enums.TreeImage.ConnectionOpen; - tNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionOpen; + tNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionOpen; + tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionOpen; } else { - tNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed; - tNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed; + tNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; } } else { - tNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed; - tNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed; + tNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; } if (conI.ConstantID == _PreviousSelected) @@ -336,8 +349,8 @@ namespace mRemoteNG.Config.Connections } else { - tNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed; - tNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed; + tNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; } } else if (Tree.Node.GetNodeTypeFromString(System.Convert.ToString(sqlRd["Type"])) == Tree.Node.Type.Container) @@ -376,7 +389,7 @@ namespace mRemoteNG.Config.Connections } else { - if (sqlRd["Expanded"] == true) + if (System.Convert.ToBoolean(sqlRd["Expanded"]) == true) { contI.IsExpanded = true; } @@ -387,11 +400,11 @@ namespace mRemoteNG.Config.Connections } this._ContainerList.Add(contI); - this._ConnectionList.Add(conI); + this.ConnectionList.Add(conI); tNode.Tag = contI; - tNode.ImageIndex = Images.Enums.TreeImage.Container; - tNode.SelectedImageIndex = Images.Enums.TreeImage.Container; + tNode.ImageIndex = (int)Images.Enums.TreeImage.Container; + tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; } string parentId = System.Convert.ToString(sqlRd["ParentID"].ToString().Trim()); @@ -409,7 +422,7 @@ namespace mRemoteNG.Config.Connections if (Tree.Node.GetNodeType(tNode) == Tree.Node.Type.Connection) { - (tNode.Tag as Connection.Info).Parent = pNode.Tag; + (tNode.Tag as Connection.Info).Parent = (mRemoteNG.Container.Info)pNode.Tag; } else if (Tree.Node.GetNodeType(tNode) == Tree.Node.Type.Container) { @@ -455,14 +468,14 @@ namespace mRemoteNG.Config.Connections conI.RedirectPorts = System.Convert.ToBoolean(sqlRd["RedirectPorts"]); conI.RedirectSmartCards = System.Convert.ToBoolean(sqlRd["RedirectSmartCards"]); conI.RedirectKeys = System.Convert.ToBoolean(sqlRd["RedirectKeys"]); - conI.RedirectSound = Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPSounds), System.Convert.ToString(sqlRd["RedirectSound"])); - - conI.Protocol = Tools.Misc.StringToEnum(typeof(Connection.Protocol.Protocols), System.Convert.ToString(sqlRd["Protocol"])); + conI.RedirectSound = (Connection.Protocol.RDP.RDPSounds)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPSounds), System.Convert.ToString(sqlRd["RedirectSound"])); + + conI.Protocol = (Connection.Protocol.Protocols)Tools.Misc.StringToEnum(typeof(Connection.Protocol.Protocols), System.Convert.ToString(sqlRd["Protocol"])); conI.Port = System.Convert.ToInt32(sqlRd["Port"]); conI.PuttySession = System.Convert.ToString(sqlRd["PuttySession"]); - - conI.Colors = Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPColors), System.Convert.ToString(sqlRd["Colors"])); - conI.Resolution = Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPResolutions), System.Convert.ToString(sqlRd["Resolution"])); + + conI.Colors = (Connection.Protocol.RDP.RDPColors)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPColors), System.Convert.ToString(sqlRd["Colors"])); + conI.Resolution = (Connection.Protocol.RDP.RDPResolutions)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPResolutions), System.Convert.ToString(sqlRd["Resolution"])); conI.Inherit = new Connection.Info.Inheritance(conI); conI.Inherit.CacheBitmaps = System.Convert.ToBoolean(sqlRd["InheritCacheBitmaps"]); @@ -492,7 +505,7 @@ namespace mRemoteNG.Config.Connections if (this.confVersion > 1.5) //1.6 { - conI.ICAEncryption = Tools.Misc.StringToEnum(typeof(Connection.Protocol.ICA.EncryptionStrength), System.Convert.ToString(sqlRd["ICAEncryptionStrength"])); + conI.ICAEncryption = (Connection.Protocol.ICA.EncryptionStrength)Tools.Misc.StringToEnum(typeof(Connection.Protocol.ICA.EncryptionStrength), System.Convert.ToString(sqlRd["ICAEncryptionStrength"])); conI.Inherit.ICAEncryption = System.Convert.ToBoolean(sqlRd["InheritICAEncryptionStrength"]); conI.PreExtApp = System.Convert.ToString(sqlRd["PreExtApp"]); @@ -503,16 +516,16 @@ namespace mRemoteNG.Config.Connections if (this.confVersion > 1.6) //1.7 { - conI.VNCCompression = Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.Compression), System.Convert.ToString(sqlRd["VNCCompression"])); - conI.VNCEncoding = Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.Encoding), System.Convert.ToString(sqlRd["VNCEncoding"])); - conI.VNCAuthMode = Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.AuthMode), System.Convert.ToString(sqlRd["VNCAuthMode"])); - conI.VNCProxyType = Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.ProxyType), System.Convert.ToString(sqlRd["VNCProxyType"])); + conI.VNCCompression = (Connection.Protocol.VNC.Compression)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.Compression), System.Convert.ToString(sqlRd["VNCCompression"])); + conI.VNCEncoding = (Connection.Protocol.VNC.Encoding)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.Encoding), System.Convert.ToString(sqlRd["VNCEncoding"])); + conI.VNCAuthMode = (Connection.Protocol.VNC.AuthMode)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.AuthMode), System.Convert.ToString(sqlRd["VNCAuthMode"])); + conI.VNCProxyType = (Connection.Protocol.VNC.ProxyType)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.ProxyType), System.Convert.ToString(sqlRd["VNCProxyType"])); conI.VNCProxyIP = System.Convert.ToString(sqlRd["VNCProxyIP"]); conI.VNCProxyPort = System.Convert.ToInt32(sqlRd["VNCProxyPort"]); conI.VNCProxyUsername = System.Convert.ToString(sqlRd["VNCProxyUsername"]); conI.VNCProxyPassword = Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["VNCProxyPassword"]), pW); - conI.VNCColors = Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.Colors), System.Convert.ToString(sqlRd["VNCColors"])); - conI.VNCSmartSizeMode = Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.SmartSizeMode), System.Convert.ToString(sqlRd["VNCSmartSizeMode"])); + conI.VNCColors = (Connection.Protocol.VNC.Colors)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.Colors), System.Convert.ToString(sqlRd["VNCColors"])); + conI.VNCSmartSizeMode = (Connection.Protocol.VNC.SmartSizeMode)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.SmartSizeMode), System.Convert.ToString(sqlRd["VNCSmartSizeMode"])); conI.VNCViewOnly = System.Convert.ToBoolean(sqlRd["VNCViewOnly"]); conI.Inherit.VNCCompression = System.Convert.ToBoolean(sqlRd["InheritVNCCompression"]); @@ -530,14 +543,14 @@ namespace mRemoteNG.Config.Connections if (this.confVersion > 1.7) //1.8 { - conI.RDPAuthenticationLevel = Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.AuthenticationLevel), System.Convert.ToString(sqlRd["RDPAuthenticationLevel"])); + conI.RDPAuthenticationLevel = (Connection.Protocol.RDP.AuthenticationLevel)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.AuthenticationLevel), System.Convert.ToString(sqlRd["RDPAuthenticationLevel"])); conI.Inherit.RDPAuthenticationLevel = System.Convert.ToBoolean(sqlRd["InheritRDPAuthenticationLevel"]); } if (this.confVersion > 1.8) //1.9 { - conI.RenderingEngine = Tools.Misc.StringToEnum(typeof(Connection.Protocol.HTTPBase.RenderingEngine), System.Convert.ToString(sqlRd["RenderingEngine"])); + conI.RenderingEngine = (Connection.Protocol.HTTPBase.RenderingEngine)Tools.Misc.StringToEnum(typeof(Connection.Protocol.HTTPBase.RenderingEngine), System.Convert.ToString(sqlRd["RenderingEngine"])); conI.MacAddress = System.Convert.ToString(sqlRd["MacAddress"]); conI.Inherit.RenderingEngine = System.Convert.ToBoolean(sqlRd["InheritRenderingEngine"]); @@ -560,9 +573,9 @@ namespace mRemoteNG.Config.Connections if (this.confVersion >= 2.2) { - conI.RDGatewayUsageMethod = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.RDGatewayUsageMethod), System.Convert.ToString(sqlRd["RDGatewayUsageMethod"])); + conI.RDGatewayUsageMethod = (mRemoteNG.Connection.Protocol.RDP.RDGatewayUsageMethod)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.RDGatewayUsageMethod), System.Convert.ToString(sqlRd["RDGatewayUsageMethod"])); conI.RDGatewayHostname = System.Convert.ToString(sqlRd["RDGatewayHostname"]); - conI.RDGatewayUseConnectionCredentials = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.RDGatewayUseConnectionCredentials), System.Convert.ToString(sqlRd["RDGatewayUseConnectionCredentials"])); + conI.RDGatewayUseConnectionCredentials = (mRemoteNG.Connection.Protocol.RDP.RDGatewayUseConnectionCredentials)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.RDGatewayUseConnectionCredentials), System.Convert.ToString(sqlRd["RDGatewayUseConnectionCredentials"])); conI.RDGatewayUsername = System.Convert.ToString(sqlRd["RDGatewayUsername"]); conI.RDGatewayPassword = Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["RDGatewayPassword"]), pW); conI.RDGatewayDomain = System.Convert.ToString(sqlRd["RDGatewayDomain"]); @@ -681,7 +694,7 @@ namespace mRemoteNG.Config.Connections { if (!import) { - IsConnectionsFileLoaded = false; + Runtime.IsConnectionsFileLoaded = false; } // SECTION 1. Create a DOM Document and load the XML data into it. @@ -707,7 +720,20 @@ namespace mRemoteNG.Config.Connections const double maxSupportedConfVersion = 2.5; if (confVersion > maxSupportedConfVersion) { - cTaskDialog.ShowTaskDialogBox(frmMain, System.Windows.Forms.Application.ProductName, "Incompatible connection file format", string.Format("The format of this connection file is not supported. Please upgrade to a newer version of {0}.", System.Windows.Forms.Application.ProductName), string.Format("{1}{0}File Format Version: {2}{0}Highest Supported Version: {3}", Constants.vbNewLine, ConnectionFileName, confVersion.ToString(), maxSupportedConfVersion.ToString()), "", "", "", "", eTaskDialogButtons.OK, eSysIcons.Error, null); + cTaskDialog.ShowTaskDialogBox( + frmMain.Default, + System.Windows.Forms.Application.ProductName, + "Incompatible connection file format", + string.Format("The format of this connection file is not supported. Please upgrade to a newer version of {0}.", System.Windows.Forms.Application.ProductName), + string.Format("{1}{0}File Format Version: {2}{0}Highest Supported Version: {3}", Constants.vbNewLine, ConnectionFileName, confVersion.ToString(), maxSupportedConfVersion.ToString()), + "", + "", + "", + "", + eTaskDialogButtons.OK, + eSysIcons.Error, + eSysIcons.Error + ); throw (new Exception(string.Format("Incompatible connection file format (file format version {0}).", confVersion))); } @@ -758,7 +784,7 @@ namespace mRemoteNG.Config.Connections bool isExportFile = false; if (confVersion >= 1.0) { - if (xDom.DocumentElement.Attributes["Export"].Value == true) + if (System.Convert.ToBoolean(xDom.DocumentElement.Attributes["Export"].Value) == true) { isExportFile = true; } @@ -772,11 +798,11 @@ namespace mRemoteNG.Config.Connections if (!isExportFile) { - RootTreeNode.ImageIndex = Images.Enums.TreeImage.Root; - RootTreeNode.SelectedImageIndex = Images.Enums.TreeImage.Root; + RootTreeNode.ImageIndex = (int)Images.Enums.TreeImage.Root; + RootTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Root; } - - Windows.treeForm.tvConnections.BeginUpdate(); + + Runtime.Windows.treeForm.tvConnections.BeginUpdate(); // SECTION 3. Populate the TreeView with the DOM nodes. AddNodeFromXml(xDom.DocumentElement, RootTreeNode); @@ -791,8 +817,8 @@ namespace mRemoteNG.Config.Connections contI.TreeNode.Expand(); } } - - Windows.treeForm.tvConnections.EndUpdate(); + + Runtime.Windows.treeForm.tvConnections.EndUpdate(); //open connections from last mremote session if (My.Settings.Default.OpenConsFromLastSession == true && My.Settings.Default.NoReconnect == false) @@ -801,7 +827,7 @@ namespace mRemoteNG.Config.Connections { if (conI.PleaseConnect == true) { - OpenConnection(conI); + Runtime.OpenConnection(conI); } } } @@ -810,9 +836,9 @@ namespace mRemoteNG.Config.Connections if (!import) { - IsConnectionsFileLoaded = true; + Runtime.IsConnectionsFileLoaded = true; } - Windows.treeForm.InitialRefresh(); + Runtime.Windows.treeForm.InitialRefresh(); SetSelectedNode(RootTreeNode); } catch (Exception ex) @@ -846,8 +872,8 @@ namespace mRemoteNG.Config.Connections ConnectionList.Add(connectionInfo); treeNode.Tag = connectionInfo; - treeNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed; - treeNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed; + treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; } else if (Tree.Node.GetNodeTypeFromString(xmlNode.Attributes["Type"].Value) == Tree.Node.Type.Container) //container info { @@ -893,8 +919,8 @@ namespace mRemoteNG.Config.Connections ContainerList.Add(containerInfo); treeNode.Tag = containerInfo; - treeNode.ImageIndex = Images.Enums.TreeImage.Container; - treeNode.SelectedImageIndex = Images.Enums.TreeImage.Container; + treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container; + treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; } AddNodeFromXml(xmlNode, treeNode); @@ -928,25 +954,24 @@ namespace mRemoteNG.Config.Connections private Connection.Info GetConnectionInfoFromXml(XmlNode xxNode) { Connection.Info conI = new Connection.Info(); - try { - XmlNode with_1 = xxNode; + XmlNode xmlnode = xxNode; if (this.confVersion > 0.1) //0.2 { - conI.Name = with_1.Attributes["Name"].Value; - conI.Description = with_1.Attributes["Descr"].Value; - conI.Hostname = with_1.Attributes["Hostname"].Value; - conI.Username = with_1.Attributes["Username"].Value; - conI.Password = Security.Crypt.Decrypt(with_1.Attributes["Password"].Value, pW); - conI.Domain = with_1.Attributes["Domain"].Value; - conI.DisplayWallpaper = bool.Parse(with_1.Attributes["DisplayWallpaper"].Value); - conI.DisplayThemes = bool.Parse(with_1.Attributes["DisplayThemes"].Value); - conI.CacheBitmaps = bool.Parse(with_1.Attributes["CacheBitmaps"].Value); + conI.Name = xmlnode.Attributes["Name"].Value; + conI.Description = xmlnode.Attributes["Descr"].Value; + conI.Hostname = xmlnode.Attributes["Hostname"].Value; + conI.Username = xmlnode.Attributes["Username"].Value; + conI.Password = Security.Crypt.Decrypt(xmlnode.Attributes["Password"].Value, pW); + conI.Domain = xmlnode.Attributes["Domain"].Value; + conI.DisplayWallpaper = bool.Parse(xmlnode.Attributes["DisplayWallpaper"].Value); + conI.DisplayThemes = bool.Parse(xmlnode.Attributes["DisplayThemes"].Value); + conI.CacheBitmaps = bool.Parse(xmlnode.Attributes["CacheBitmaps"].Value); if (this.confVersion < 1.1) //1.0 - 0.1 { - if (with_1.Attributes["Fullscreen"].Value == true) + if (System.Convert.ToBoolean(xmlnode.Attributes["Fullscreen"].Value) == true) { conI.Resolution = Connection.Protocol.RDP.RDPResolutions.Fullscreen; } @@ -961,10 +986,10 @@ namespace mRemoteNG.Config.Connections { if (this.confVersion < 0.7) { - if (System.Convert.ToBoolean(with_1.Attributes["UseVNC"].Value) == true) + if (System.Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) == true) { conI.Protocol = Connection.Protocol.Protocols.VNC; - conI.Port = (int) (with_1.Attributes["VNCPort"].Value); + conI.Port = System.Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value); } else { @@ -974,7 +999,7 @@ namespace mRemoteNG.Config.Connections } else { - conI.Port = Connection.Protocol.RDP.Defaults.Port; + conI.Port = (int)Connection.Protocol.RDP.Defaults.Port; conI.Protocol = Connection.Protocol.Protocols.RDP; } @@ -982,29 +1007,29 @@ namespace mRemoteNG.Config.Connections { if (this.confVersion < 0.7) { - if (System.Convert.ToBoolean(with_1.Attributes["UseVNC"].Value) == true) + if (System.Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) == true) { - conI.Port = (int) (with_1.Attributes["VNCPort"].Value); + conI.Port = System.Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value); } else { - conI.Port = (int) (with_1.Attributes["RDPPort"].Value); + conI.Port = System.Convert.ToInt32(xmlnode.Attributes["RDPPort"].Value); } } - conI.UseConsoleSession = bool.Parse(with_1.Attributes["ConnectToConsole"].Value); + conI.UseConsoleSession = bool.Parse(xmlnode.Attributes["ConnectToConsole"].Value); } else { if (this.confVersion < 0.7) { - if (System.Convert.ToBoolean(with_1.Attributes["UseVNC"].Value) == true) + if (System.Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) == true) { - conI.Port = Connection.Protocol.VNC.Defaults.Port; + conI.Port = (int)Connection.Protocol.VNC.Defaults.Port; } else { - conI.Port = Connection.Protocol.RDP.Defaults.Port; + conI.Port = (int)Connection.Protocol.RDP.Defaults.Port; } } conI.UseConsoleSession = false; @@ -1012,10 +1037,10 @@ namespace mRemoteNG.Config.Connections if (this.confVersion > 0.4) //0.5 and 0.6 { - conI.RedirectDiskDrives = bool.Parse(with_1.Attributes["RedirectDiskDrives"].Value); - conI.RedirectPrinters = bool.Parse(with_1.Attributes["RedirectPrinters"].Value); - conI.RedirectPorts = bool.Parse(with_1.Attributes["RedirectPorts"].Value); - conI.RedirectSmartCards = bool.Parse(with_1.Attributes["RedirectSmartCards"].Value); + conI.RedirectDiskDrives = bool.Parse(xmlnode.Attributes["RedirectDiskDrives"].Value); + conI.RedirectPrinters = bool.Parse(xmlnode.Attributes["RedirectPrinters"].Value); + conI.RedirectPorts = bool.Parse(xmlnode.Attributes["RedirectPorts"].Value); + conI.RedirectSmartCards = bool.Parse(xmlnode.Attributes["RedirectSmartCards"].Value); } else { @@ -1027,29 +1052,29 @@ namespace mRemoteNG.Config.Connections if (this.confVersion > 0.6) //0.7 { - conI.Protocol = Tools.Misc.StringToEnum(typeof(Connection.Protocol.Protocols), with_1.Attributes["Protocol"].Value); - conI.Port = (int) (with_1.Attributes["Port"].Value); + conI.Protocol = (Connection.Protocol.Protocols)Tools.Misc.StringToEnum(typeof(Connection.Protocol.Protocols), xmlnode.Attributes["Protocol"].Value); + conI.Port = System.Convert.ToInt32(xmlnode.Attributes["Port"].Value); } if (this.confVersion > 0.9) //1.0 { - conI.RedirectKeys = bool.Parse(with_1.Attributes["RedirectKeys"].Value); + conI.RedirectKeys = bool.Parse(xmlnode.Attributes["RedirectKeys"].Value); } if (this.confVersion > 1.1) //1.2 { - conI.PuttySession = with_1.Attributes["PuttySession"].Value; + conI.PuttySession = xmlnode.Attributes["PuttySession"].Value; } if (this.confVersion > 1.2) //1.3 { - conI.Colors = Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPColors), with_1.Attributes["Colors"].Value); - conI.Resolution = Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPResolutions), System.Convert.ToString(with_1.Attributes["Resolution"].Value)); - conI.RedirectSound = Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPSounds), System.Convert.ToString(with_1.Attributes["RedirectSound"].Value)); + conI.Colors = (Connection.Protocol.RDP.RDPColors)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPColors), xmlnode.Attributes["Colors"].Value); + conI.Resolution = (Connection.Protocol.RDP.RDPResolutions)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPResolutions), System.Convert.ToString(xmlnode.Attributes["Resolution"].Value)); + conI.RedirectSound = (Connection.Protocol.RDP.RDPSounds)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPSounds), System.Convert.ToString(xmlnode.Attributes["RedirectSound"].Value)); } else { - switch (with_1.Attributes["Colors"].Value) + switch (System.Convert.ToInt32(xmlnode.Attributes["Colors"].Value)) { case 0: conI.Colors = Connection.Protocol.RDP.RDPColors.Colors256; @@ -1068,158 +1093,158 @@ namespace mRemoteNG.Config.Connections break; } - conI.RedirectSound = with_1.Attributes["RedirectSound"].Value; + conI.RedirectSound = (Connection.Protocol.RDP.RDPSounds) System.Convert.ToInt32(xmlnode.Attributes["RedirectSound"].Value); } if (this.confVersion > 1.2) //1.3 { conI.Inherit = new Connection.Info.Inheritance(conI); - conI.Inherit.CacheBitmaps = bool.Parse(with_1.Attributes["InheritCacheBitmaps"].Value); - conI.Inherit.Colors = bool.Parse(with_1.Attributes["InheritColors"].Value); - conI.Inherit.Description = bool.Parse(with_1.Attributes["InheritDescription"].Value); - conI.Inherit.DisplayThemes = bool.Parse(with_1.Attributes["InheritDisplayThemes"].Value); - conI.Inherit.DisplayWallpaper = bool.Parse(with_1.Attributes["InheritDisplayWallpaper"].Value); - conI.Inherit.Domain = bool.Parse(with_1.Attributes["InheritDomain"].Value); - conI.Inherit.Icon = bool.Parse(with_1.Attributes["InheritIcon"].Value); - conI.Inherit.Panel = bool.Parse(with_1.Attributes["InheritPanel"].Value); - conI.Inherit.Password = bool.Parse(with_1.Attributes["InheritPassword"].Value); - conI.Inherit.Port = bool.Parse(with_1.Attributes["InheritPort"].Value); - conI.Inherit.Protocol = bool.Parse(with_1.Attributes["InheritProtocol"].Value); - conI.Inherit.PuttySession = bool.Parse(with_1.Attributes["InheritPuttySession"].Value); - conI.Inherit.RedirectDiskDrives = bool.Parse(with_1.Attributes["InheritRedirectDiskDrives"].Value); - conI.Inherit.RedirectKeys = bool.Parse(with_1.Attributes["InheritRedirectKeys"].Value); - conI.Inherit.RedirectPorts = bool.Parse(with_1.Attributes["InheritRedirectPorts"].Value); - conI.Inherit.RedirectPrinters = bool.Parse(with_1.Attributes["InheritRedirectPrinters"].Value); - conI.Inherit.RedirectSmartCards = bool.Parse(with_1.Attributes["InheritRedirectSmartCards"].Value); - conI.Inherit.RedirectSound = bool.Parse(with_1.Attributes["InheritRedirectSound"].Value); - conI.Inherit.Resolution = bool.Parse(with_1.Attributes["InheritResolution"].Value); - conI.Inherit.UseConsoleSession = bool.Parse(with_1.Attributes["InheritUseConsoleSession"].Value); - conI.Inherit.Username = bool.Parse(with_1.Attributes["InheritUsername"].Value); + conI.Inherit.CacheBitmaps = bool.Parse(xmlnode.Attributes["InheritCacheBitmaps"].Value); + conI.Inherit.Colors = bool.Parse(xmlnode.Attributes["InheritColors"].Value); + conI.Inherit.Description = bool.Parse(xmlnode.Attributes["InheritDescription"].Value); + conI.Inherit.DisplayThemes = bool.Parse(xmlnode.Attributes["InheritDisplayThemes"].Value); + conI.Inherit.DisplayWallpaper = bool.Parse(xmlnode.Attributes["InheritDisplayWallpaper"].Value); + conI.Inherit.Domain = bool.Parse(xmlnode.Attributes["InheritDomain"].Value); + conI.Inherit.Icon = bool.Parse(xmlnode.Attributes["InheritIcon"].Value); + conI.Inherit.Panel = bool.Parse(xmlnode.Attributes["InheritPanel"].Value); + conI.Inherit.Password = bool.Parse(xmlnode.Attributes["InheritPassword"].Value); + conI.Inherit.Port = bool.Parse(xmlnode.Attributes["InheritPort"].Value); + conI.Inherit.Protocol = bool.Parse(xmlnode.Attributes["InheritProtocol"].Value); + conI.Inherit.PuttySession = bool.Parse(xmlnode.Attributes["InheritPuttySession"].Value); + conI.Inherit.RedirectDiskDrives = bool.Parse(xmlnode.Attributes["InheritRedirectDiskDrives"].Value); + conI.Inherit.RedirectKeys = bool.Parse(xmlnode.Attributes["InheritRedirectKeys"].Value); + conI.Inherit.RedirectPorts = bool.Parse(xmlnode.Attributes["InheritRedirectPorts"].Value); + conI.Inherit.RedirectPrinters = bool.Parse(xmlnode.Attributes["InheritRedirectPrinters"].Value); + conI.Inherit.RedirectSmartCards = bool.Parse(xmlnode.Attributes["InheritRedirectSmartCards"].Value); + conI.Inherit.RedirectSound = bool.Parse(xmlnode.Attributes["InheritRedirectSound"].Value); + conI.Inherit.Resolution = bool.Parse(xmlnode.Attributes["InheritResolution"].Value); + conI.Inherit.UseConsoleSession = bool.Parse(xmlnode.Attributes["InheritUseConsoleSession"].Value); + conI.Inherit.Username = bool.Parse(xmlnode.Attributes["InheritUsername"].Value); - conI.Icon = with_1.Attributes["Icon"].Value; - conI.Panel = with_1.Attributes["Panel"].Value; + conI.Icon = xmlnode.Attributes["Icon"].Value; + conI.Panel = xmlnode.Attributes["Panel"].Value; } else { - conI.Inherit = new Connection.Info.Inheritance(conI, with_1.Attributes["Inherit"].Value); + conI.Inherit = new Connection.Info.Inheritance(conI, System.Convert.ToBoolean(xmlnode.Attributes["Inherit"].Value)); - conI.Icon = System.Convert.ToString(with_1.Attributes["Icon"].Value.Replace(".ico", "")); + conI.Icon = System.Convert.ToString(xmlnode.Attributes["Icon"].Value.Replace(".ico", "")); conI.Panel = My.Language.strGeneral; } if (this.confVersion > 1.4) //1.5 { - conI.PleaseConnect = bool.Parse(with_1.Attributes["Connected"].Value); + conI.PleaseConnect = bool.Parse(xmlnode.Attributes["Connected"].Value); } if (this.confVersion > 1.5) //1.6 { - conI.ICAEncryption = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.ICA.EncryptionStrength), with_1.Attributes["ICAEncryptionStrength"].Value); - conI.Inherit.ICAEncryption = bool.Parse(with_1.Attributes["InheritICAEncryptionStrength"].Value); + conI.ICAEncryption = (mRemoteNG.Connection.Protocol.ICA.EncryptionStrength)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.ICA.EncryptionStrength), xmlnode.Attributes["ICAEncryptionStrength"].Value); + conI.Inherit.ICAEncryption = bool.Parse(xmlnode.Attributes["InheritICAEncryptionStrength"].Value); - conI.PreExtApp = with_1.Attributes["PreExtApp"].Value; - conI.PostExtApp = with_1.Attributes["PostExtApp"].Value; - conI.Inherit.PreExtApp = bool.Parse(with_1.Attributes["InheritPreExtApp"].Value); - conI.Inherit.PostExtApp = bool.Parse(with_1.Attributes["InheritPostExtApp"].Value); + conI.PreExtApp = xmlnode.Attributes["PreExtApp"].Value; + conI.PostExtApp = xmlnode.Attributes["PostExtApp"].Value; + conI.Inherit.PreExtApp = bool.Parse(xmlnode.Attributes["InheritPreExtApp"].Value); + conI.Inherit.PostExtApp = bool.Parse(xmlnode.Attributes["InheritPostExtApp"].Value); } if (this.confVersion > 1.6) //1.7 { - conI.VNCCompression = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.Compression), with_1.Attributes["VNCCompression"].Value); - conI.VNCEncoding = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.Encoding), System.Convert.ToString(with_1.Attributes["VNCEncoding"].Value)); - conI.VNCAuthMode = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.AuthMode), with_1.Attributes["VNCAuthMode"].Value); - conI.VNCProxyType = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.ProxyType), with_1.Attributes["VNCProxyType"].Value); - conI.VNCProxyIP = with_1.Attributes["VNCProxyIP"].Value; - conI.VNCProxyPort = (int) (with_1.Attributes["VNCProxyPort"].Value); - conI.VNCProxyUsername = with_1.Attributes["VNCProxyUsername"].Value; - conI.VNCProxyPassword = Security.Crypt.Decrypt(with_1.Attributes["VNCProxyPassword"].Value, pW); - conI.VNCColors = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.Colors), with_1.Attributes["VNCColors"].Value); - conI.VNCSmartSizeMode = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.SmartSizeMode), with_1.Attributes["VNCSmartSizeMode"].Value); - conI.VNCViewOnly = bool.Parse(with_1.Attributes["VNCViewOnly"].Value); + conI.VNCCompression = (mRemoteNG.Connection.Protocol.VNC.Compression)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.Compression), xmlnode.Attributes["VNCCompression"].Value); + conI.VNCEncoding = (mRemoteNG.Connection.Protocol.VNC.Encoding)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.Encoding), System.Convert.ToString(xmlnode.Attributes["VNCEncoding"].Value)); + conI.VNCAuthMode = (mRemoteNG.Connection.Protocol.VNC.AuthMode)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.AuthMode), xmlnode.Attributes["VNCAuthMode"].Value); + conI.VNCProxyType = (mRemoteNG.Connection.Protocol.VNC.ProxyType)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.ProxyType), xmlnode.Attributes["VNCProxyType"].Value); + conI.VNCProxyIP = xmlnode.Attributes["VNCProxyIP"].Value; + conI.VNCProxyPort = System.Convert.ToInt32(xmlnode.Attributes["VNCProxyPort"].Value); + conI.VNCProxyUsername = xmlnode.Attributes["VNCProxyUsername"].Value; + conI.VNCProxyPassword = Security.Crypt.Decrypt(xmlnode.Attributes["VNCProxyPassword"].Value, pW); + conI.VNCColors = (mRemoteNG.Connection.Protocol.VNC.Colors)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.Colors), xmlnode.Attributes["VNCColors"].Value); + conI.VNCSmartSizeMode = (mRemoteNG.Connection.Protocol.VNC.SmartSizeMode)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.SmartSizeMode), xmlnode.Attributes["VNCSmartSizeMode"].Value); + conI.VNCViewOnly = bool.Parse(xmlnode.Attributes["VNCViewOnly"].Value); - conI.Inherit.VNCCompression = bool.Parse(with_1.Attributes["InheritVNCCompression"].Value); - conI.Inherit.VNCEncoding = bool.Parse(with_1.Attributes["InheritVNCEncoding"].Value); - conI.Inherit.VNCAuthMode = bool.Parse(with_1.Attributes["InheritVNCAuthMode"].Value); - conI.Inherit.VNCProxyType = bool.Parse(with_1.Attributes["InheritVNCProxyType"].Value); - conI.Inherit.VNCProxyIP = bool.Parse(with_1.Attributes["InheritVNCProxyIP"].Value); - conI.Inherit.VNCProxyPort = bool.Parse(with_1.Attributes["InheritVNCProxyPort"].Value); - conI.Inherit.VNCProxyUsername = bool.Parse(with_1.Attributes["InheritVNCProxyUsername"].Value); - conI.Inherit.VNCProxyPassword = bool.Parse(with_1.Attributes["InheritVNCProxyPassword"].Value); - conI.Inherit.VNCColors = bool.Parse(with_1.Attributes["InheritVNCColors"].Value); - conI.Inherit.VNCSmartSizeMode = bool.Parse(with_1.Attributes["InheritVNCSmartSizeMode"].Value); - conI.Inherit.VNCViewOnly = bool.Parse(with_1.Attributes["InheritVNCViewOnly"].Value); + conI.Inherit.VNCCompression = bool.Parse(xmlnode.Attributes["InheritVNCCompression"].Value); + conI.Inherit.VNCEncoding = bool.Parse(xmlnode.Attributes["InheritVNCEncoding"].Value); + conI.Inherit.VNCAuthMode = bool.Parse(xmlnode.Attributes["InheritVNCAuthMode"].Value); + conI.Inherit.VNCProxyType = bool.Parse(xmlnode.Attributes["InheritVNCProxyType"].Value); + conI.Inherit.VNCProxyIP = bool.Parse(xmlnode.Attributes["InheritVNCProxyIP"].Value); + conI.Inherit.VNCProxyPort = bool.Parse(xmlnode.Attributes["InheritVNCProxyPort"].Value); + conI.Inherit.VNCProxyUsername = bool.Parse(xmlnode.Attributes["InheritVNCProxyUsername"].Value); + conI.Inherit.VNCProxyPassword = bool.Parse(xmlnode.Attributes["InheritVNCProxyPassword"].Value); + conI.Inherit.VNCColors = bool.Parse(xmlnode.Attributes["InheritVNCColors"].Value); + conI.Inherit.VNCSmartSizeMode = bool.Parse(xmlnode.Attributes["InheritVNCSmartSizeMode"].Value); + conI.Inherit.VNCViewOnly = bool.Parse(xmlnode.Attributes["InheritVNCViewOnly"].Value); } if (this.confVersion > 1.7) //1.8 { - conI.RDPAuthenticationLevel = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.AuthenticationLevel), with_1.Attributes["RDPAuthenticationLevel"].Value); + conI.RDPAuthenticationLevel = (mRemoteNG.Connection.Protocol.RDP.AuthenticationLevel)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.AuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value); - conI.Inherit.RDPAuthenticationLevel = bool.Parse(with_1.Attributes["InheritRDPAuthenticationLevel"].Value); + conI.Inherit.RDPAuthenticationLevel = bool.Parse(xmlnode.Attributes["InheritRDPAuthenticationLevel"].Value); } if (this.confVersion > 1.8) //1.9 { - conI.RenderingEngine = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.HTTPBase.RenderingEngine), with_1.Attributes["RenderingEngine"].Value); - conI.MacAddress = with_1.Attributes["MacAddress"].Value; + conI.RenderingEngine = (mRemoteNG.Connection.Protocol.HTTPBase.RenderingEngine)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.HTTPBase.RenderingEngine), xmlnode.Attributes["RenderingEngine"].Value); + conI.MacAddress = xmlnode.Attributes["MacAddress"].Value; - conI.Inherit.RenderingEngine = bool.Parse(with_1.Attributes["InheritRenderingEngine"].Value); - conI.Inherit.MacAddress = bool.Parse(with_1.Attributes["InheritMacAddress"].Value); + conI.Inherit.RenderingEngine = bool.Parse(xmlnode.Attributes["InheritRenderingEngine"].Value); + conI.Inherit.MacAddress = bool.Parse(xmlnode.Attributes["InheritMacAddress"].Value); } if (this.confVersion > 1.9) //2.0 { - conI.UserField = with_1.Attributes["UserField"].Value; - conI.Inherit.UserField = bool.Parse(with_1.Attributes["InheritUserField"].Value); + conI.UserField = xmlnode.Attributes["UserField"].Value; + conI.Inherit.UserField = bool.Parse(xmlnode.Attributes["InheritUserField"].Value); } if (this.confVersion > 2.0) //2.1 { - conI.ExtApp = with_1.Attributes["ExtApp"].Value; - conI.Inherit.ExtApp = bool.Parse(with_1.Attributes["InheritExtApp"].Value); + conI.ExtApp = xmlnode.Attributes["ExtApp"].Value; + conI.Inherit.ExtApp = bool.Parse(xmlnode.Attributes["InheritExtApp"].Value); } if (this.confVersion > 2.1) //2.2 { // Get settings - conI.RDGatewayUsageMethod = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.RDGatewayUsageMethod), System.Convert.ToString(with_1.Attributes["RDGatewayUsageMethod"].Value)); - conI.RDGatewayHostname = with_1.Attributes["RDGatewayHostname"].Value; - conI.RDGatewayUseConnectionCredentials = Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.RDGatewayUseConnectionCredentials), System.Convert.ToString(with_1.Attributes["RDGatewayUseConnectionCredentials"].Value)); - conI.RDGatewayUsername = with_1.Attributes["RDGatewayUsername"].Value; - conI.RDGatewayPassword = Security.Crypt.Decrypt(System.Convert.ToString(with_1.Attributes["RDGatewayPassword"].Value), pW); - conI.RDGatewayDomain = with_1.Attributes["RDGatewayDomain"].Value; + conI.RDGatewayUsageMethod = (mRemoteNG.Connection.Protocol.RDP.RDGatewayUsageMethod)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.RDGatewayUsageMethod), System.Convert.ToString(xmlnode.Attributes["RDGatewayUsageMethod"].Value)); + conI.RDGatewayHostname = xmlnode.Attributes["RDGatewayHostname"].Value; + conI.RDGatewayUseConnectionCredentials = (mRemoteNG.Connection.Protocol.RDP.RDGatewayUseConnectionCredentials)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDP.RDGatewayUseConnectionCredentials), System.Convert.ToString(xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value)); + conI.RDGatewayUsername = xmlnode.Attributes["RDGatewayUsername"].Value; + conI.RDGatewayPassword = Security.Crypt.Decrypt(System.Convert.ToString(xmlnode.Attributes["RDGatewayPassword"].Value), pW); + conI.RDGatewayDomain = xmlnode.Attributes["RDGatewayDomain"].Value; // Get inheritance settings - conI.Inherit.RDGatewayUsageMethod = bool.Parse(with_1.Attributes["InheritRDGatewayUsageMethod"].Value); - conI.Inherit.RDGatewayHostname = bool.Parse(with_1.Attributes["InheritRDGatewayHostname"].Value); - conI.Inherit.RDGatewayUseConnectionCredentials = bool.Parse(with_1.Attributes["InheritRDGatewayUseConnectionCredentials"].Value); - conI.Inherit.RDGatewayUsername = bool.Parse(with_1.Attributes["InheritRDGatewayUsername"].Value); - conI.Inherit.RDGatewayPassword = bool.Parse(with_1.Attributes["InheritRDGatewayPassword"].Value); - conI.Inherit.RDGatewayDomain = bool.Parse(with_1.Attributes["InheritRDGatewayDomain"].Value); + conI.Inherit.RDGatewayUsageMethod = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsageMethod"].Value); + conI.Inherit.RDGatewayHostname = bool.Parse(xmlnode.Attributes["InheritRDGatewayHostname"].Value); + conI.Inherit.RDGatewayUseConnectionCredentials = bool.Parse(xmlnode.Attributes["InheritRDGatewayUseConnectionCredentials"].Value); + conI.Inherit.RDGatewayUsername = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsername"].Value); + conI.Inherit.RDGatewayPassword = bool.Parse(xmlnode.Attributes["InheritRDGatewayPassword"].Value); + conI.Inherit.RDGatewayDomain = bool.Parse(xmlnode.Attributes["InheritRDGatewayDomain"].Value); } if (this.confVersion > 2.2) //2.3 { // Get settings - conI.EnableFontSmoothing = bool.Parse(with_1.Attributes["EnableFontSmoothing"].Value); - conI.EnableDesktopComposition = bool.Parse(with_1.Attributes["EnableDesktopComposition"].Value); + conI.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["EnableFontSmoothing"].Value); + conI.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["EnableDesktopComposition"].Value); // Get inheritance settings - conI.Inherit.EnableFontSmoothing = bool.Parse(with_1.Attributes["InheritEnableFontSmoothing"].Value); - conI.Inherit.EnableDesktopComposition = bool.Parse(with_1.Attributes["InheritEnableDesktopComposition"].Value); + conI.Inherit.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["InheritEnableFontSmoothing"].Value); + conI.Inherit.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["InheritEnableDesktopComposition"].Value); } if (confVersion >= 2.4) { - conI.UseCredSsp = bool.Parse(with_1.Attributes["UseCredSsp"].Value); - conI.Inherit.UseCredSsp = bool.Parse(with_1.Attributes["InheritUseCredSsp"].Value); + conI.UseCredSsp = bool.Parse(xmlnode.Attributes["UseCredSsp"].Value); + conI.Inherit.UseCredSsp = bool.Parse(xmlnode.Attributes["InheritUseCredSsp"].Value); } if (confVersion >= 2.5) { - conI.LoadBalanceInfo = with_1.Attributes["LoadBalanceInfo"].Value; - conI.AutomaticResize = bool.Parse(with_1.Attributes["AutomaticResize"].Value); - conI.Inherit.LoadBalanceInfo = bool.Parse(with_1.Attributes["InheritLoadBalanceInfo"].Value); - conI.Inherit.AutomaticResize = bool.Parse(with_1.Attributes["InheritAutomaticResize"].Value); + conI.LoadBalanceInfo = xmlnode.Attributes["LoadBalanceInfo"].Value; + conI.AutomaticResize = bool.Parse(xmlnode.Attributes["AutomaticResize"].Value); + conI.Inherit.LoadBalanceInfo = bool.Parse(xmlnode.Attributes["InheritLoadBalanceInfo"].Value); + conI.Inherit.AutomaticResize = bool.Parse(xmlnode.Attributes["InheritAutomaticResize"].Value); } } catch (Exception ex) diff --git a/mRemoteV1/CS/Config/Config.Settings.Providers.cs b/mRemoteV1/CS/Config/Config.Settings.Providers.cs index 51e6726ae..316a1063d 100644 --- a/mRemoteV1/CS/Config/Config.Settings.Providers.cs +++ b/mRemoteV1/CS/Config/Config.Settings.Providers.cs @@ -1,4 +1,3 @@ -// VBConversions Note: VB project level imports using System.Collections.Generic; using System; using AxWFICALib; @@ -9,8 +8,6 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports - using System.Configuration; using System.Collections.Specialized; using System.Xml; @@ -20,22 +17,20 @@ namespace mRemoteNG.Config.Settings.Providers { public class ChooseProvider : PortableSettingsProvider { -#if !PORTABLE -#else -#endif + #if !PORTABLE + #else + #endif } public class PortableSettingsProvider : SettingsProvider { - const string SETTINGSROOT = "Settings"; //XML Root Node - public override void Initialize(string name, NameValueCollection col) { base.Initialize(this.ApplicationName, col); } -public override string ApplicationName + public override string ApplicationName { get { @@ -106,7 +101,7 @@ public override string ApplicationName private System.Xml.XmlDocument m_SettingsXML = null; -private System.Xml.XmlDocument SettingsXML + private System.Xml.XmlDocument SettingsXML { get { @@ -132,7 +127,6 @@ private System.Xml.XmlDocument SettingsXML m_SettingsXML.AppendChild(nodeRoot); } } - return m_SettingsXML; } } @@ -151,7 +145,6 @@ private System.Xml.XmlDocument SettingsXML { ret = SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + (new Microsoft.VisualBasic.Devices.Computer()).Name + "/" + setting.Name).InnerText; } - } catch (Exception) { @@ -164,13 +157,11 @@ private System.Xml.XmlDocument SettingsXML ret = ""; } } - return ret; } private void SetValue(SettingsPropertyValue propVal) { - System.Xml.XmlElement MachineNode = default(System.Xml.XmlElement); System.Xml.XmlElement SettingNode = default(System.Xml.XmlElement); @@ -241,8 +232,6 @@ private System.Xml.XmlDocument SettingsXML MachineNode.AppendChild(SettingNode); } } - - } private bool IsRoaming(SettingsProperty prop) @@ -259,4 +248,4 @@ private System.Xml.XmlDocument SettingsXML return true; } } -} +} \ No newline at end of file diff --git a/mRemoteV1/CS/Config/Config.Settings.Save.cs b/mRemoteV1/CS/Config/Config.Settings.Save.cs index 8b6da4e80..72ec58df7 100644 --- a/mRemoteV1/CS/Config/Config.Settings.Save.cs +++ b/mRemoteV1/CS/Config/Config.Settings.Save.cs @@ -22,8 +22,8 @@ namespace mRemoteNG.Config.Settings { try { - frmMain with_1 = frmMain; - Tools.WindowPlacement windowPlacement = new Tools.WindowPlacement(frmMain); + frmMain with_1 = frmMain.Default; + Tools.WindowPlacement windowPlacement = new Tools.WindowPlacement(frmMain.Default); if (with_1.WindowState == FormWindowState.Minimized & windowPlacement.RestoreToMaximized) { with_1.Opacity = 0; diff --git a/mRemoteV1/CS/Config/Import/RemoteDesktopConnectionManager.cs b/mRemoteV1/CS/Config/Import/RemoteDesktopConnectionManager.cs index 988e374c3..5747e5c82 100644 --- a/mRemoteV1/CS/Config/Import/RemoteDesktopConnectionManager.cs +++ b/mRemoteV1/CS/Config/Import/RemoteDesktopConnectionManager.cs @@ -113,8 +113,8 @@ namespace mRemoteNG.Config.Import Runtime.ConnectionList.Add(connectionInfo); } - - private static Protocol.Info ConnectionInfoFromXml(XmlNode xmlNode) + + private static Connection.Info ConnectionInfoFromXml(XmlNode xmlNode) { Connection.Info connectionInfo = new Connection.Info(); connectionInfo.Inherit = new Connection.Info.Inheritance(connectionInfo); diff --git a/mRemoteV1/CS/Connection/Connection.Protocol.ICA.cs b/mRemoteV1/CS/Connection/Connection.Protocol.ICA.cs index 657c2c0c2..6f2c5b309 100644 --- a/mRemoteV1/CS/Connection/Connection.Protocol.ICA.cs +++ b/mRemoteV1/CS/Connection/Connection.Protocol.ICA.cs @@ -49,7 +49,7 @@ namespace mRemoteNG.Connection.Protocol #endregion #region Private Properties - private AxICAClient ICA_Renamed; + private AxICAClient ICAClient; private Connection.Info Info; #endregion @@ -72,54 +72,48 @@ namespace mRemoteNG.Connection.Protocol try { - ICA_Renamed = this.Control; + ICAClient = (AxICAClient)this.Control; Info = this.InterfaceControl.Info; + ICAClient.CreateControl(); - ICA_Renamed.Default.CreateControl(); - - while (!this.ICA_Renamed.Created) + while (!this.ICAClient.Created) { Thread.Sleep(10); System.Windows.Forms.Application.DoEvents(); } - - ICA_Renamed.Address = Info.Hostname; - + + ICAClient.Address = Info.Hostname; this.SetCredentials(); - this.SetResolution(); this.SetColors(); - this.SetSecurity(); //Disable hotkeys for international users - ICA_Renamed.Hotkey1Shift = null; - ICA_Renamed.Hotkey1Char = null; - ICA_Renamed.Hotkey2Shift = null; - ICA_Renamed.Hotkey2Char = null; - ICA_Renamed.Hotkey3Shift = null; - ICA_Renamed.Hotkey3Char = null; - ICA_Renamed.Hotkey4Shift = null; - ICA_Renamed.Hotkey4Char = null; - ICA_Renamed.Hotkey5Shift = null; - ICA_Renamed.Hotkey5Char = null; - ICA_Renamed.Hotkey6Shift = null; - ICA_Renamed.Hotkey6Char = null; - ICA_Renamed.Hotkey7Shift = null; - ICA_Renamed.Hotkey7Char = null; - ICA_Renamed.Hotkey8Shift = null; - ICA_Renamed.Hotkey8Char = null; - ICA_Renamed.Hotkey9Shift = null; - ICA_Renamed.Hotkey9Char = null; - ICA_Renamed.Hotkey10Shift = null; - ICA_Renamed.Hotkey10Char = null; - ICA_Renamed.Hotkey11Shift = null; - ICA_Renamed.Hotkey11Char = null; - - ICA_Renamed.PersistentCacheEnabled = Info.CacheBitmaps; - - ICA_Renamed.Title = Info.Name; + 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) @@ -135,7 +129,7 @@ namespace mRemoteNG.Connection.Protocol try { - ICA_Renamed.Default.Connect(); + ICAClient.Connect(); base.Connect(); return true; } @@ -152,7 +146,7 @@ namespace mRemoteNG.Connection.Protocol { try { - if ((Force & Info.Force.NoCredentials) == (int) Info.Force.NoCredentials) + if (((int)Force & (int)Info.Force.NoCredentials) == (int) Info.Force.NoCredentials) { return ; } @@ -165,16 +159,16 @@ namespace mRemoteNG.Connection.Protocol { if ((string) My.Settings.Default.EmptyCredentials == "windows") { - ICA_Renamed.Username = Environment.UserName; + ICAClient.Username = Environment.UserName; } else if ((string) My.Settings.Default.EmptyCredentials == "custom") { - ICA_Renamed.Username = My.Settings.Default.DefaultUsername; + ICAClient.Username = My.Settings.Default.DefaultUsername; } } else { - ICA_Renamed.Username = _user; + ICAClient.Username = _user; } if (string.IsNullOrEmpty(_pass)) @@ -183,29 +177,29 @@ namespace mRemoteNG.Connection.Protocol { if (My.Settings.Default.DefaultPassword != "") { - ICA_Renamed.SetProp("ClearPassword", Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.General.EncryptionKey)); + ICAClient.SetProp("ClearPassword", Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.General.EncryptionKey)); } } } else { - ICA_Renamed.SetProp("ClearPassword", _pass); + ICAClient.SetProp("ClearPassword", _pass); } if (string.IsNullOrEmpty(_dom)) { if ((string) My.Settings.Default.EmptyCredentials == "windows") { - ICA_Renamed.Domain = Environment.UserDomainName; + ICAClient.Domain = Environment.UserDomainName; } else if ((string) My.Settings.Default.EmptyCredentials == "custom") { - ICA_Renamed.Domain = My.Settings.Default.DefaultDomain; + ICAClient.Domain = My.Settings.Default.DefaultDomain; } } else { - ICA_Renamed.Domain = _dom; + ICAClient.Domain = _dom; } } catch (Exception ex) @@ -220,29 +214,29 @@ namespace mRemoteNG.Connection.Protocol { if ((this.Force & Connection.Info.Force.Fullscreen) == Connection.Info.Force.Fullscreen) { - ICA_Renamed.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain).Bounds.Width, Screen.FromControl(frmMain).Bounds.Height, 0); - ICA_Renamed.FullScreenWindow(); + ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0); + ICAClient.FullScreenWindow(); return; } if (this.InterfaceControl.Info.Resolution == RDP.RDPResolutions.FitToWindow) { - ICA_Renamed.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0); + ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0); } else if (this.InterfaceControl.Info.Resolution == RDP.RDPResolutions.SmartSize) { - ICA_Renamed.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0); + ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0); } else if (this.InterfaceControl.Info.Resolution == RDP.RDPResolutions.Fullscreen) { - ICA_Renamed.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain).Bounds.Width, Screen.FromControl(frmMain).Bounds.Height, 0); - ICA_Renamed.FullScreenWindow(); + ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0); + ICAClient.FullScreenWindow(); } else { Rectangle resolution = RDP.GetResolutionRectangle(Info.Resolution); - ICA_Renamed.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0); + ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0); } } catch (Exception ex) @@ -256,16 +250,16 @@ namespace mRemoteNG.Connection.Protocol switch (Info.Colors) { case RDP.RDPColors.Colors256: - ICA_Renamed.SetProp("DesiredColor", 2); + ICAClient.SetProp("DesiredColor", "2"); break; case RDP.RDPColors.Colors15Bit: - ICA_Renamed.SetProp("DesiredColor", 4); + ICAClient.SetProp("DesiredColor", "4"); break; case RDP.RDPColors.Colors16Bit: - ICA_Renamed.SetProp("DesiredColor", 4); + ICAClient.SetProp("DesiredColor", "4"); break; default: - ICA_Renamed.SetProp("DesiredColor", 8); + ICAClient.SetProp("DesiredColor", "8"); break; } } @@ -275,20 +269,20 @@ namespace mRemoteNG.Connection.Protocol switch (Info.ICAEncryption) { case EncryptionStrength.Encr128BitLogonOnly: - ICA_Renamed.Encrypt = true; - ICA_Renamed.EncryptionLevelSession = "EncRC5-0"; + ICAClient.Encrypt = true; + ICAClient.EncryptionLevelSession = "EncRC5-0"; break; case EncryptionStrength.Encr40Bit: - ICA_Renamed.Encrypt = true; - ICA_Renamed.EncryptionLevelSession = "EncRC5-40"; + ICAClient.Encrypt = true; + ICAClient.EncryptionLevelSession = "EncRC5-40"; break; case EncryptionStrength.Encr56Bit: - ICA_Renamed.Encrypt = true; - ICA_Renamed.EncryptionLevelSession = "EncRC5-56"; + ICAClient.Encrypt = true; + ICAClient.EncryptionLevelSession = "EncRC5-56"; break; case EncryptionStrength.Encr128Bit: - ICA_Renamed.Encrypt = true; - ICA_Renamed.EncryptionLevelSession = "EncRC5-128"; + ICAClient.Encrypt = true; + ICAClient.EncryptionLevelSession = "EncRC5-128"; break; } } @@ -297,10 +291,10 @@ namespace mRemoteNG.Connection.Protocol { try { - ICA_Renamed.OnConnecting += new System.EventHandler(ICAEvent_OnConnecting); - ICA_Renamed.OnConnect += new System.EventHandler(ICAEvent_OnConnected); - ICA_Renamed.OnConnectFailed += new System.EventHandler(ICAEvent_OnConnectFailed); - ICA_Renamed.OnDisconnect += new System.EventHandler(ICAEvent_OnDisconnect); + ICAClient.OnConnecting += new System.EventHandler(ICAEvent_OnConnecting); + ICAClient.OnConnect += new System.EventHandler(ICAEvent_OnConnected); + ICAClient.OnConnectFailed += new System.EventHandler(ICAEvent_OnConnectFailed); + ICAClient.OnDisconnect += new System.EventHandler(ICAEvent_OnDisconnect); } catch (Exception ex) { @@ -357,7 +351,7 @@ namespace mRemoteNG.Connection.Protocol { tmrReconnect.Enabled = false; ReconnectGroup.DisposeReconnectGroup(); - ICA_Renamed.Default.Connect(); + ICAClient.Default.Connect(); } } #endregion diff --git a/mRemoteV1/CS/Connection/Connection.Protocol.RDP.cs b/mRemoteV1/CS/Connection/Connection.Protocol.RDP.cs index 450574dd9..b4817247e 100644 --- a/mRemoteV1/CS/Connection/Connection.Protocol.RDP.cs +++ b/mRemoteV1/CS/Connection/Connection.Protocol.RDP.cs @@ -479,8 +479,8 @@ namespace mRemoteNG.Connection.Protocol if ((this.Force & Connection.Info.Force.Fullscreen) == Connection.Info.Force.Fullscreen) { _rdpClient.FullScreen = true; - _rdpClient.DesktopWidth = Screen.FromControl(frmMain).Bounds.Width; - _rdpClient.DesktopHeight = Screen.FromControl(frmMain).Bounds.Height; + _rdpClient.DesktopWidth = Screen.FromControl(frmMain.Default).Bounds.Width; + _rdpClient.DesktopHeight = Screen.FromControl(frmMain.Default).Bounds.Height; return; } @@ -493,8 +493,8 @@ namespace mRemoteNG.Connection.Protocol else if (this.InterfaceControl.Info.Resolution == RDPResolutions.Fullscreen) { _rdpClient.FullScreen = true; - _rdpClient.DesktopWidth = Screen.FromControl(frmMain).Bounds.Width; - _rdpClient.DesktopHeight = Screen.FromControl(frmMain).Bounds.Height; + _rdpClient.DesktopWidth = Screen.FromControl(frmMain.Default).Bounds.Width; + _rdpClient.DesktopHeight = Screen.FromControl(frmMain.Default).Bounds.Height; } else { diff --git a/mRemoteV1/CS/Images/Images.Enums.cs b/mRemoteV1/CS/Images/Images.Enums.cs index 0c84af9f5..2c4211998 100644 --- a/mRemoteV1/CS/Images/Images.Enums.cs +++ b/mRemoteV1/CS/Images/Images.Enums.cs @@ -1,4 +1,3 @@ -// VBConversions Note: VB project level imports using System.Collections.Generic; using System; using AxWFICALib; @@ -9,31 +8,26 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports -namespace mRemoteNG +namespace mRemoteNG.Images { - namespace Images + public class Enums { - public class Enums + public enum TreeImage { - public enum TreeImage - { - Root = 0, - Container = 1, - ConnectionOpen = 2, - ConnectionClosed = 3, - PuttySessions = 4 - } + Root = 0, + Container = 1, + ConnectionOpen = 2, + ConnectionClosed = 3, + PuttySessions = 4 + } - public enum ErrorImage - { - _Information = 0, - _Warning = 1, - _Error = 2 - } + public enum ErrorImage + { + _Information = 0, + _Warning = 1, + _Error = 2 } } - } diff --git a/mRemoteV1/CS/Properties/Resources.Designer.cs b/mRemoteV1/CS/Properties/Resources.Designer.cs index 8b570c6df..6d65dcd5b 100644 --- a/mRemoteV1/CS/Properties/Resources.Designer.cs +++ b/mRemoteV1/CS/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace My.Resources { +namespace My { using System; diff --git a/mRemoteV1/CS/Tools/PuttyProcessController.cs b/mRemoteV1/CS/Tools/PuttyProcessController.cs index 5e67250d4..cc25b8205 100644 --- a/mRemoteV1/CS/Tools/PuttyProcessController.cs +++ b/mRemoteV1/CS/Tools/PuttyProcessController.cs @@ -1,4 +1,3 @@ -// VBConversions Note: VB project level imports using System.Collections.Generic; using System; using AxWFICALib; @@ -9,27 +8,25 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports - using mRemoteNG.My; namespace mRemoteNG.Tools { public class PuttyProcessController : ProcessController + { + public bool Start(CommandLineArguments arguments = null) { - public bool Start(CommandLineArguments arguments = null) + string filename = ""; + if (Settings.UseCustomPuttyPath) { - string filename = ""; - if (Settings.UseCustomPuttyPath) - { - filename = Settings.CustomPuttyPath; - } - else - { - filename = App.Info.General.PuttyPath; - } - return Start(filename, arguments); + filename = Settings.CustomPuttyPath; } + else + { + filename = App.Info.General.PuttyPath; + } + return Start(filename, arguments); } + } } diff --git a/mRemoteV1/CS/Tools/PuttyTypeDetector.cs b/mRemoteV1/CS/Tools/PuttyTypeDetector.cs index e3bf7cf8c..ddbfd1a24 100644 --- a/mRemoteV1/CS/Tools/PuttyTypeDetector.cs +++ b/mRemoteV1/CS/Tools/PuttyTypeDetector.cs @@ -1,4 +1,3 @@ -// VBConversions Note: VB project level imports using System.Collections.Generic; using System; using AxWFICALib; @@ -9,107 +8,105 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports - using mRemoteNG.Connection.Protocol; namespace mRemoteNG.Tools { public class PuttyTypeDetector + { + public static PuttyType GetPuttyType() { - public static PuttyType GetPuttyType() - { - return GetPuttyType(PuttyBase.PuttyPath); - } - - public static PuttyType GetPuttyType(string filename) - { - if (IsPuttyNg(filename)) - { - return PuttyType.PuttyNg; - } - if (IsKitty(filename)) - { - return PuttyType.Kitty; - } - if (IsXming(filename)) - { - return PuttyType.Xming; - } - - // Check this last - if (IsPutty(filename)) - { - return PuttyType.Putty; - } - - return PuttyType.Unknown; - } - - private static bool IsPutty(string filename) - { - bool result = false; - try - { - result = System.Convert.ToBoolean(FileVersionInfo.GetVersionInfo(filename).InternalName.Contains("PuTTY")); - } - catch - { - result = false; - } - return result; - } - - private static bool IsPuttyNg(string filename) - { - bool result = false; - try - { - result = System.Convert.ToBoolean(FileVersionInfo.GetVersionInfo(filename).InternalName.Contains("PuTTYNG")); - } - catch - { - result = false; - } - return result; - } - - private static bool IsKitty(string filename) - { - bool result = false; - try - { - result = System.Convert.ToBoolean(FileVersionInfo.GetVersionInfo(filename).InternalName.Contains("PuTTY") && FileVersionInfo.GetVersionInfo(filename).Comments.Contains("KiTTY")); - } - catch - { - result = false; - } - return result; - } - - private static bool IsXming(string filename) - { - bool result = false; - try - { - result = System.Convert.ToBoolean(FileVersionInfo.GetVersionInfo(filename).InternalName.Contains("PuTTY") && FileVersionInfo.GetVersionInfo(filename).ProductVersion.Contains("Xming")); - } - catch - { - result = false; - } - return result; - } - - public enum PuttyType - { - Unknown = 0, - Putty, - PuttyNg, - Kitty, - Xming - } + return GetPuttyType(PuttyBase.PuttyPath); } + + public static PuttyType GetPuttyType(string filename) + { + if (IsPuttyNg(filename)) + { + return PuttyType.PuttyNg; + } + if (IsKitty(filename)) + { + return PuttyType.Kitty; + } + if (IsXming(filename)) + { + return PuttyType.Xming; + } + + // Check this last + if (IsPutty(filename)) + { + return PuttyType.Putty; + } + + return PuttyType.Unknown; + } + + private static bool IsPutty(string filename) + { + bool result = false; + try + { + result = System.Convert.ToBoolean(FileVersionInfo.GetVersionInfo(filename).InternalName.Contains("PuTTY")); + } + catch + { + result = false; + } + return result; + } + + private static bool IsPuttyNg(string filename) + { + bool result = false; + try + { + result = System.Convert.ToBoolean(FileVersionInfo.GetVersionInfo(filename).InternalName.Contains("PuTTYNG")); + } + catch + { + result = false; + } + return result; + } + + private static bool IsKitty(string filename) + { + bool result = false; + try + { + result = System.Convert.ToBoolean(FileVersionInfo.GetVersionInfo(filename).InternalName.Contains("PuTTY") && FileVersionInfo.GetVersionInfo(filename).Comments.Contains("KiTTY")); + } + catch + { + result = false; + } + return result; + } + + private static bool IsXming(string filename) + { + bool result = false; + try + { + result = System.Convert.ToBoolean(FileVersionInfo.GetVersionInfo(filename).InternalName.Contains("PuTTY") && FileVersionInfo.GetVersionInfo(filename).ProductVersion.Contains("Xming")); + } + catch + { + result = false; + } + return result; + } + + public enum PuttyType + { + Unknown = 0, + Putty, + PuttyNg, + Kitty, + Xming + } + } } diff --git a/mRemoteV1/CS/Tools/ReconnectGroup.Designer.cs b/mRemoteV1/CS/Tools/ReconnectGroup.Designer.cs index f1b4260aa..33608a0b3 100644 --- a/mRemoteV1/CS/Tools/ReconnectGroup.Designer.cs +++ b/mRemoteV1/CS/Tools/ReconnectGroup.Designer.cs @@ -1,4 +1,3 @@ -// VBConversions Note: VB project level imports using System.Collections.Generic; using System; using AxWFICALib; @@ -9,15 +8,13 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports namespace mRemoteNG { - [global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public - partial class ReconnectGroup : System.Windows.Forms.UserControl + [global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()] + public partial class ReconnectGroup : System.Windows.Forms.UserControl { - //UserControl overrides dispose to clean up the component list. [System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing) { @@ -40,7 +37,8 @@ namespace mRemoteNG //NOTE: The following procedure is required by the Windows Form Designer //It can be modified using the Windows Form Designer. //Do not modify it using the code editor. - [System.Diagnostics.DebuggerStepThrough()]private void InitializeComponent() + [System.Diagnostics.DebuggerStepThrough()] + private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.grpAutomaticReconnect = new System.Windows.Forms.GroupBox(); @@ -137,7 +135,6 @@ namespace mRemoteNG this.grpAutomaticReconnect.PerformLayout(); ((System.ComponentModel.ISupportInitialize) this.pbServerStatus).EndInit(); this.ResumeLayout(false); - } internal System.Windows.Forms.GroupBox grpAutomaticReconnect; internal System.Windows.Forms.Button btnClose; @@ -146,7 +143,5 @@ namespace mRemoteNG internal System.Windows.Forms.PictureBox pbServerStatus; internal System.Windows.Forms.Timer tmrAnimation; internal System.Windows.Forms.Label lblAnimation; - } - -} +} \ No newline at end of file diff --git a/mRemoteV1/CS/Tools/ReconnectGroup.cs b/mRemoteV1/CS/Tools/ReconnectGroup.cs index d2e8d88cd..2c9698655 100644 --- a/mRemoteV1/CS/Tools/ReconnectGroup.cs +++ b/mRemoteV1/CS/Tools/ReconnectGroup.cs @@ -1,4 +1,3 @@ -// VBConversions Note: VB project level imports using System.Collections.Generic; using System; using AxWFICALib; @@ -9,7 +8,6 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports namespace mRemoteNG @@ -21,7 +19,7 @@ namespace mRemoteNG InitializeComponent(); } private bool _ServerReady; -public bool ServerReady + public bool ServerReady { get { @@ -62,7 +60,7 @@ public bool ServerReady } private bool _ReconnectWhenReady; -public bool ReconnectWhenReady + public bool ReconnectWhenReady { get { @@ -157,5 +155,4 @@ public bool ReconnectWhenReady chkReconnectWhenReady.Text = My.Language.strCheckboxReconnectWhenReady; } } - -} +} \ No newline at end of file diff --git a/mRemoteV1/CS/Tools/Tools.Controls.cs b/mRemoteV1/CS/Tools/Tools.Controls.cs index 6ee791ade..019447320 100644 --- a/mRemoteV1/CS/Tools/Tools.Controls.cs +++ b/mRemoteV1/CS/Tools/Tools.Controls.cs @@ -20,14 +20,8 @@ namespace mRemoteNG.Tools private string _Text; public string Text { - get - { - return this._Text; - } - set - { - this._Text = value; - } + get { return this._Text; } + set { this._Text = value; } } private object _Tag; @@ -169,7 +163,7 @@ namespace mRemoteNG.Tools } else if (Tree.Node.GetNodeType(tNode) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(tNode) == Tree.Node.Type.PuttySession) { - tMenItem.Image = Windows.treeForm.imgListTree.Images[tNode.ImageIndex]; + tMenItem.Image = Runtime.Windows.treeForm.imgListTree.Images[tNode.ImageIndex]; tMenItem.Tag = tNode.Tag; menToolStrip.DropDownItems.Add(tMenItem); @@ -308,4 +302,4 @@ namespace mRemoteNG.Tools } } } -} +} \ No newline at end of file diff --git a/mRemoteV1/CS/Tools/Tools.LocalizedAttributes.cs b/mRemoteV1/CS/Tools/Tools.LocalizedAttributes.cs index dc41de67d..871dd8086 100644 --- a/mRemoteV1/CS/Tools/Tools.LocalizedAttributes.cs +++ b/mRemoteV1/CS/Tools/Tools.LocalizedAttributes.cs @@ -1,4 +1,3 @@ -// VBConversions Note: VB project level imports using System.Collections.Generic; using System; using AxWFICALib; @@ -9,167 +8,161 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports - using System.ComponentModel; namespace mRemoteNG.Tools { public class LocalizedAttributes + { + [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] + public class LocalizedCategoryAttribute : CategoryAttribute { - [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]public class LocalizedCategoryAttribute : CategoryAttribute + private const int MaxOrder = 10; + private int Order; + + public LocalizedCategoryAttribute(string value, int Order = 1) : base(value) { - - private const int MaxOrder = 10; - private int Order; - - public LocalizedCategoryAttribute(string value, int Order = 1) : base(value) + if (Order > LocalizedCategoryAttribute.MaxOrder) { - if (Order > LocalizedCategoryAttribute.MaxOrder) - { - this.Order = LocalizedCategoryAttribute.MaxOrder; - } - else - { - this.Order = Order; - } + this.Order = LocalizedCategoryAttribute.MaxOrder; } - - protected override string GetLocalizedString(string value) + else { - string OrderPrefix = ""; - for (int x = 0; x <= LocalizedCategoryAttribute.MaxOrder - this.Order; x++) - { - OrderPrefix += System.Convert.ToString("\t"); - } + this.Order = Order; + } + } + + protected override string GetLocalizedString(string value) + { + string OrderPrefix = ""; + for (int x = 0; x <= LocalizedCategoryAttribute.MaxOrder - this.Order; x++) + { + OrderPrefix += System.Convert.ToString("\t"); + } - return OrderPrefix + My.Language.ResourceManager.GetString(value); - } + return OrderPrefix + My.Language.ResourceManager.GetString(value); } - - [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]public class LocalizedDisplayNameAttribute : DisplayNameAttribute - { - - private bool Localized; - - public LocalizedDisplayNameAttribute(string value) : base(value) - { - this.Localized = false; - } - -public override string DisplayName - { - get - { - if (!this.Localized) - { - this.Localized = true; - this.DisplayNameValue = My.Language.ResourceManager.GetString(this.DisplayNameValue); - } - - return base.DisplayName; - } - } - } - - [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]public class LocalizedDescriptionAttribute : DescriptionAttribute - { - - private bool Localized; - - public LocalizedDescriptionAttribute(string value) : base(value) - { - this.Localized = false; - } - -public override string Description - { - get - { - if (!this.Localized) - { - this.Localized = true; - this.DescriptionValue = My.Language.ResourceManager.GetString(this.DescriptionValue); - } - - return base.Description; - } - } - } - - [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]public class LocalizedDefaultValueAttribute : DefaultValueAttribute - { - - public LocalizedDefaultValueAttribute(string name) : base(My.Language.ResourceManager.GetString(name)) - { - } - - // This allows localized attributes in a derived class to override a matching - // non-localized attribute inherited from its base class -public override object TypeId - { - get - { - return typeof(DefaultValueAttribute); - } - } - } - -#region Special localization - with String.Format - - [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]public class LocalizedDisplayNameInheritAttribute : DisplayNameAttribute - { - - private bool Localized; - - public LocalizedDisplayNameInheritAttribute(string value) : base(value) - { - - this.Localized = false; - } - -public override string DisplayName - { - get - { - if (!this.Localized) - { - this.Localized = true; - this.DisplayNameValue = string.Format(My.Language.strFormatInherit, My.Language.ResourceManager.GetString(this.DisplayNameValue)); - } - - return base.DisplayName; - } - } - } - - [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]public class LocalizedDescriptionInheritAttribute : DescriptionAttribute - { - - private bool Localized; - - public LocalizedDescriptionInheritAttribute(string value) : base(value) - { - - this.Localized = false; - } - -public override string Description - { - get - { - if (!this.Localized) - { - this.Localized = true; - this.DescriptionValue = string.Format(My.Language.strFormatInheritDescription, My.Language.ResourceManager.GetString(this.DescriptionValue)); - } - - return base.Description; - } - } - } -#endregion - } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] + public class LocalizedDisplayNameAttribute : DisplayNameAttribute + { + + private bool Localized; + + public LocalizedDisplayNameAttribute(string value) : base(value) + { + this.Localized = false; + } + + public override string DisplayName + { + get + { + if (!this.Localized) + { + this.Localized = true; + this.DisplayNameValue = My.Language.ResourceManager.GetString(this.DisplayNameValue); + } + + return base.DisplayName; + } + } + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] + public class LocalizedDescriptionAttribute : DescriptionAttribute + { + private bool Localized; + public LocalizedDescriptionAttribute(string value) : base(value) + { + this.Localized = false; + } + + public override string Description + { + get + { + if (!this.Localized) + { + this.Localized = true; + this.DescriptionValue = My.Language.ResourceManager.GetString(this.DescriptionValue); + } + + return base.Description; + } + } + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] + public class LocalizedDefaultValueAttribute : DefaultValueAttribute + { + public LocalizedDefaultValueAttribute(string name) : base(My.Language.ResourceManager.GetString(name)) + { + } + + // This allows localized attributes in a derived class to override a matching + // non-localized attribute inherited from its base class + public override object TypeId + { + get + { + return typeof(DefaultValueAttribute); + } + } + } + + #region Special localization - with String.Format + [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] + public class LocalizedDisplayNameInheritAttribute : DisplayNameAttribute + { + private bool Localized; + public LocalizedDisplayNameInheritAttribute(string value) : base(value) + { + + this.Localized = false; + } + + public override string DisplayName + { + get + { + if (!this.Localized) + { + this.Localized = true; + this.DisplayNameValue = string.Format(My.Language.strFormatInherit, My.Language.ResourceManager.GetString(this.DisplayNameValue)); + } + + return base.DisplayName; + } + } + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] + public class LocalizedDescriptionInheritAttribute : DescriptionAttribute + { + private bool Localized; + public LocalizedDescriptionInheritAttribute(string value) : base(value) + { + + this.Localized = false; + } + + public override string Description + { + get + { + if (!this.Localized) + { + this.Localized = true; + this.DescriptionValue = string.Format(My.Language.strFormatInheritDescription, My.Language.ResourceManager.GetString(this.DescriptionValue)); + } + + return base.Description; + } + } + } + #endregion + } } diff --git a/mRemoteV1/CS/Tools/Tools.Misc.cs b/mRemoteV1/CS/Tools/Tools.Misc.cs index 53d9d83fa..edb70997d 100644 --- a/mRemoteV1/CS/Tools/Tools.Misc.cs +++ b/mRemoteV1/CS/Tools/Tools.Misc.cs @@ -28,12 +28,14 @@ namespace mRemoteNG.Tools public IntPtr hIcon; // : icon public int iIcon; // : icondex public int dwAttributes; // : SFGAO_ flags - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]public string szDisplayName; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]public string szTypeName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string szDisplayName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] + public string szTypeName; } - [DllImport("shell32.dll")]private static extern IntPtr SHGetFileInfo(string pszPath, int dwFileAttributes, ref SHFILEINFO psfi, int cbFileInfo, int uFlags); - + [DllImport("shell32.dll")] + private static extern IntPtr SHGetFileInfo(string pszPath, int dwFileAttributes, ref SHFILEINFO psfi, int cbFileInfo, int uFlags); private const int SHGFI_ICON = 0x100; private const int SHGFI_SMALLICON = 0x1; //Private Const SHGFI_LARGEICON = &H0 ' Large icon @@ -92,7 +94,8 @@ namespace mRemoteNG.Tools public static void IsSQLUpdateAvailableBG() { - System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(IsSQLUpdateAvailable)); + System.Threading.ThreadStart threadDelegate = new System.Threading.ThreadStart(IsSQLUpdateAvailable); + System.Threading.Thread t = new System.Threading.Thread(threadDelegate); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); } @@ -127,7 +130,7 @@ namespace mRemoteNG.Tools { LastUpdateInDB = System.Convert.ToDateTime(sqlRd["LastUpdate"]); - if (LastUpdateInDB > LastSqlUpdate) + if (LastUpdateInDB > Runtime.LastSqlUpdate) { if (SQLUpdateCheckFinishedEvent != null) SQLUpdateCheckFinishedEvent(true); @@ -167,7 +170,7 @@ namespace mRemoteNG.Tools public static string LeadingZero(string Number) { - if (Number < 10) + if (System.Convert.ToInt32(Number) < 10) { return "0" + Number; } diff --git a/mRemoteV1/CS/Tools/Tools.PortScan.cs b/mRemoteV1/CS/Tools/Tools.PortScan.cs index 7191c9629..4d2f1c662 100644 --- a/mRemoteV1/CS/Tools/Tools.PortScan.cs +++ b/mRemoteV1/CS/Tools/Tools.PortScan.cs @@ -19,108 +19,60 @@ namespace mRemoteNG.Tools.PortScan public class ScanHost { #region Properties - private static int _SSHPort = Connection.Protocol.SSH1.Defaults.Port; + private static int _SSHPort = (int)Connection.Protocol.SSH1.Defaults.Port; public static int SSHPort { - get - { - return _SSHPort; - } - set - { - _SSHPort = value; - } + get { return _SSHPort; } + set { _SSHPort = value; } } - - private static int _TelnetPort = Connection.Protocol.Telnet.Defaults.Port; + + private static int _TelnetPort = (int)Connection.Protocol.Telnet.Defaults.Port; public static int TelnetPort { - get - { - return _TelnetPort; - } - set - { - _TelnetPort = value; - } + get { return _TelnetPort; } + set { _TelnetPort = value; } } - - private static int _HTTPPort = Connection.Protocol.HTTP.Defaults.Port; + + private static int _HTTPPort = (int)Connection.Protocol.HTTP.Defaults.Port; public static int HTTPPort { - get - { - return _HTTPPort; - } - set - { - _HTTPPort = value; - } + get { return _HTTPPort; } + set { _HTTPPort = value; } } - - private static int _HTTPSPort = Connection.Protocol.HTTPS.Defaults.Port; + + private static int _HTTPSPort = (int)Connection.Protocol.HTTPS.Defaults.Port; public static int HTTPSPort { - get - { - return _HTTPSPort; - } - set - { - _HTTPSPort = value; - } + get { return _HTTPSPort; } + set { _HTTPSPort = value; } } - - private static int _RloginPort = Connection.Protocol.Rlogin.Defaults.Port; + + private static int _RloginPort = (int)Connection.Protocol.Rlogin.Defaults.Port; public static int RloginPort { - get - { - return _RloginPort; - } - set - { - _RloginPort = value; - } + get { return _RloginPort; } + set { _RloginPort = value; } } - - private static int _RDPPort = Connection.Protocol.RDP.Defaults.Port; + + private static int _RDPPort = (int)Connection.Protocol.RDP.Defaults.Port; public static int RDPPort { - get - { - return _RDPPort; - } - set - { - _RDPPort = value; - } + get { return _RDPPort; } + set { _RDPPort = value; } } - - private static int _VNCPort = Connection.Protocol.VNC.Defaults.Port; + + private static int _VNCPort = (int)Connection.Protocol.VNC.Defaults.Port; public static int VNCPort { - get - { - return _VNCPort; - } - set - { - _VNCPort = value; - } + get { return _VNCPort; } + set { _VNCPort = value; } } private string _hostName = ""; public string HostName { - get - { - return _hostName; - } - set - { - _hostName = value; - } + get { return _hostName; } + set { _hostName = value; } } public string HostNameWithoutDomain @@ -138,131 +90,71 @@ namespace mRemoteNG.Tools.PortScan private string _hostIp; public string HostIp { - get - { - return _hostIp; - } - set - { - _hostIp = value; - } + get { return _hostIp; } + set { _hostIp = value; } } private ArrayList _openPorts = new ArrayList(); public ArrayList OpenPorts { - get - { - return _openPorts; - } - set - { - _openPorts = value; - } + get { return _openPorts; } + set { _openPorts = value; } } private ArrayList _closedPorts; public ArrayList ClosedPorts { - get - { - return _closedPorts; - } - set - { - _closedPorts = value; - } + get { return _closedPorts; } + set { _closedPorts = value; } } private bool _RDP; public bool RDP { - get - { - return _RDP; - } - set - { - _RDP = value; - } + get { return _RDP; } + set { _RDP = value; } } private bool _VNC; public bool VNC { - get - { - return _VNC; - } - set - { - _VNC = value; - } + get { return _VNC; } + set { _VNC = value; } } private bool _SSH; public bool SSH { - get - { - return _SSH; - } - set - { - _SSH = value; - } + get { return _SSH; } + set { _SSH = value; } } private bool _Telnet; public bool Telnet { - get - { - return _Telnet; - } - set - { - _Telnet = value; - } + get { return _Telnet; } + set { _Telnet = value; } } private bool _Rlogin; public bool Rlogin { - get - { - return _Rlogin; - } - set - { - _Rlogin = value; - } + get { return _Rlogin; } + set { _Rlogin = value; } } private bool _HTTP; public bool HTTP { - get - { - return _HTTP; - } - set - { - _HTTP = value; - } + get { return _HTTP; } + set { _HTTP = value; } } private bool _HTTPS; public bool HTTPS { - get - { - return _HTTPS; - } - set - { - _HTTPS = value; - } + get { return _HTTPS; } + set { _HTTPS = value; } } #endregion @@ -370,7 +262,6 @@ namespace mRemoteNG.Tools.PortScan #region Private Members private List _ipAddresses = new List(); private List _ports = new List(); - private Thread _scanThread; private List _scannedHosts = new List(); #endregion @@ -382,14 +273,14 @@ namespace mRemoteNG.Tools.PortScan IPAddress ipAddressEnd = IpAddressMax(ipAddress1, ipAddress2); _ports.Clear(); - _ports.AddRange(new int[] {scanHost.SSHPort, scanHost.TelnetPort, scanHost.HTTPPort, scanHost.HTTPSPort, scanHost.RloginPort, scanHost.RDPPort, scanHost.VNCPort}); + _ports.AddRange(new int[] { ScanHost.SSHPort, ScanHost.TelnetPort, ScanHost.HTTPPort, ScanHost.HTTPSPort, ScanHost.RloginPort, ScanHost.RDPPort, ScanHost.VNCPort }); _ipAddresses.Clear(); _ipAddresses.AddRange(IpAddressArrayFromRange(ipAddressStart, ipAddressEnd)); _scannedHosts.Clear(); } - + public Scanner(IPAddress ipAddress1, IPAddress ipAddress2, int port1, int port2) : this(ipAddress1, ipAddress2) { @@ -420,9 +311,7 @@ namespace mRemoteNG.Tools.PortScan { try { - // ReSharper disable UnusedVariable - System.Net.Sockets.TcpClient tcpClient = new System.Net.Sockets.TcpClient(hostname, (int) port); - // ReSharper restore UnusedVariable + System.Net.Sockets.TcpClient tcpClient = new System.Net.Sockets.TcpClient(hostname, System.Convert.ToInt32(port)); return true; } catch (Exception) @@ -438,7 +327,6 @@ namespace mRemoteNG.Tools.PortScan try { int hostCount = 0; - foreach (IPAddress ipAddress in _ipAddresses) { if (BeginHostScanEvent != null) @@ -457,13 +345,9 @@ namespace mRemoteNG.Tools.PortScan foreach (int port in _ports) { bool isPortOpen = false; - try { - // ReSharper disable UnusedVariable System.Net.Sockets.TcpClient tcpClient = new System.Net.Sockets.TcpClient(ipAddress.ToString(), port); - // ReSharper restore UnusedVariable - isPortOpen = true; scanHost.OpenPorts.Add(port); } @@ -472,32 +356,32 @@ namespace mRemoteNG.Tools.PortScan isPortOpen = false; scanHost.ClosedPorts.Add(port); } - - if (port == scanHost.SSHPort) + + if (port == ScanHost.SSHPort) { scanHost.SSH = isPortOpen; } - else if (port == scanHost.TelnetPort) + else if (port == ScanHost.TelnetPort) { scanHost.Telnet = isPortOpen; } - else if (port == scanHost.HTTPPort) + else if (port == ScanHost.HTTPPort) { scanHost.HTTP = isPortOpen; } - else if (port == scanHost.HTTPSPort) + else if (port == ScanHost.HTTPSPort) { scanHost.HTTPS = isPortOpen; } - else if (port == scanHost.RloginPort) + else if (port == ScanHost.RloginPort) { scanHost.Rlogin = isPortOpen; } - else if (port == scanHost.RDPPort) + else if (port == ScanHost.RDPPort) { scanHost.RDP = isPortOpen; } - else if (port == scanHost.VNCPort) + else if (port == ScanHost.VNCPort) { scanHost.VNC = isPortOpen; } @@ -628,8 +512,8 @@ namespace mRemoteNG.Tools.PortScan Array.Reverse(addressBytes); // to network order (big-endian) } Debug.Assert(addressBytes.Length == 4); - - return new ipAddress(addressBytes); + + return new IPAddress(addressBytes); } #endregion diff --git a/mRemoteV1/CS/Tools/Tools.SystemMenu.cs b/mRemoteV1/CS/Tools/Tools.SystemMenu.cs index 06da4ba0e..a40b795e9 100644 --- a/mRemoteV1/CS/Tools/Tools.SystemMenu.cs +++ b/mRemoteV1/CS/Tools/Tools.SystemMenu.cs @@ -1,4 +1,4 @@ -// VBConversions Note: VB project level imports + using System.Collections.Generic; using System; using AxWFICALib; @@ -9,7 +9,6 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports namespace mRemoteNG.Tools @@ -23,7 +22,6 @@ namespace mRemoteNG.Tools MF_BYCOMMAND = App.Native.MF_BYCOMMAND, MF_BYPOSITION = App.Native.MF_BYPOSITION, MF_POPUP = App.Native.MF_POPUP, - WM_SYSCOMMAND = App.Native.WM_SYSCOMMAND } @@ -40,10 +38,10 @@ namespace mRemoteNG.Tools { SystemMenuHandle = App.Native.GetSystemMenu(FormHandle, true); } - - public void AppendMenuItem(IntPtr ParentMenu, Flags Flags, int ID, string Text) + + public void AppendMenuItem(IntPtr ParentMenu, Flags Flags, IntPtr ID, string Text) { - App.Native.AppendMenu(ParentMenu, Flags, ID, Text); + App.Native.AppendMenu(ParentMenu, (int)Flags, ID, Text); } public IntPtr CreatePopupMenuItem() @@ -53,12 +51,12 @@ namespace mRemoteNG.Tools public bool InsertMenuItem(IntPtr SysMenu, int Position, Flags Flags, IntPtr SubMenu, string Text) { - return App.Native.InsertMenu(SysMenu, Position, Flags, SubMenu, Text); + return App.Native.InsertMenu(SysMenu, Position, (int)Flags, SubMenu, Text); } public IntPtr SetBitmap(IntPtr Menu, int Position, Flags Flags, Bitmap Bitmap) { - return App.Native.SetMenuItemBitmaps(Menu, Position, Flags, Bitmap.GetHbitmap(), Bitmap.GetHbitmap()); + return App.Native.SetMenuItemBitmaps(Menu, Position, (int)Flags, Bitmap.GetHbitmap(), Bitmap.GetHbitmap()); } } -} +} \ No newline at end of file diff --git a/mRemoteV1/CS/Tools/Tools.WindowPlacement.cs b/mRemoteV1/CS/Tools/Tools.WindowPlacement.cs index 98e483abb..0bd201ee5 100644 --- a/mRemoteV1/CS/Tools/Tools.WindowPlacement.cs +++ b/mRemoteV1/CS/Tools/Tools.WindowPlacement.cs @@ -99,7 +99,7 @@ namespace mRemoteNG.Tools get { WINDOWPLACEMENT windowPlacement = GetWindowPlacement(); - return windowPlacement.flags & WPF_RESTORETOMAXIMIZED; + return System.Convert.ToBoolean(windowPlacement.flags & WPF_RESTORETOMAXIMIZED); } set { diff --git a/mRemoteV1/CS/Tree/Tree.Node.cs b/mRemoteV1/CS/Tree/Tree.Node.cs index 1410d4cb4..72ac7390b 100644 --- a/mRemoteV1/CS/Tree/Tree.Node.cs +++ b/mRemoteV1/CS/Tree/Tree.Node.cs @@ -283,18 +283,18 @@ namespace mRemoteNG.Tree case Type.Connection: case Type.PuttySession: defaultName = My.Language.strNewConnection; - treeNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed; - treeNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed; + treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; break; case Type.Container: defaultName = My.Language.strNewFolder; - treeNode.ImageIndex = Images.Enums.TreeImage.Container; - treeNode.SelectedImageIndex = Images.Enums.TreeImage.Container; + treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container; + treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; break; case Type.Root: defaultName = My.Language.strNewRoot; - treeNode.ImageIndex = Images.Enums.TreeImage.Root; - treeNode.SelectedImageIndex = Images.Enums.TreeImage.Root; + treeNode.ImageIndex = (int)Images.Enums.TreeImage.Root; + treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Root; break; } @@ -335,8 +335,8 @@ namespace mRemoteNG.Tree TreeNode newTreeNode = new TreeNode(newConnectionInfo.Name); newTreeNode.Tag = newConnectionInfo; - newTreeNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed; - newTreeNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed; + newTreeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + newTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; newConnectionInfo.TreeNode = newTreeNode; @@ -365,8 +365,8 @@ namespace mRemoteNG.Tree TreeNode newTreeNode = new TreeNode(newContainerInfo.Name); newTreeNode.Tag = newContainerInfo; - newTreeNode.ImageIndex = Images.Enums.TreeImage.Container; - newTreeNode.SelectedImageIndex = Images.Enums.TreeImage.Container; + newTreeNode.ImageIndex = (int)Images.Enums.TreeImage.Container; + newTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; newContainerInfo.ConnectionInfo.Parent = newContainerInfo; Runtime.ContainerList.Add(newContainerInfo); @@ -397,7 +397,7 @@ namespace mRemoteNG.Tree public static void SetNodeImage(TreeNode treeNode, Images.Enums.TreeImage Img) { - SetNodeImageIndex(treeNode, Img); + SetNodeImageIndex(treeNode, (int)Img); } private delegate void SetNodeImageIndexDelegate(TreeNode treeNode, int imageIndex); @@ -684,7 +684,7 @@ namespace mRemoteNG.Tree if (TreeView.InvokeRequired) { ResetTreeDelegate resetTreeDelegate = new ResetTreeDelegate(ResetTree); - Windows.treeForm.Invoke(resetTreeDelegate); + Runtime.Windows.treeForm.Invoke(resetTreeDelegate); } else { diff --git a/mRemoteV1/CS/UI/UI.Window.ActiveDirectoryImport.Designer.cs b/mRemoteV1/CS/UI/UI.Window.ActiveDirectoryImport.Designer.cs index 1cdfc970c..dc160da29 100644 --- a/mRemoteV1/CS/UI/UI.Window.ActiveDirectoryImport.Designer.cs +++ b/mRemoteV1/CS/UI/UI.Window.ActiveDirectoryImport.Designer.cs @@ -106,7 +106,7 @@ namespace mRemoteNG.UI.Window private System.Windows.Forms.TextBox txtDomain; private System.Windows.Forms.Label lblDomain; private System.Windows.Forms.Button btnChangeDomain; - private ADTree.ADTree ActiveDirectoryTree; + private ADTree.ADtree ActiveDirectoryTree; #endregion } } diff --git a/mRemoteV1/CS/UI/UI.Window.Connection.cs b/mRemoteV1/CS/UI/UI.Window.Connection.cs index b277c1a0d..434697939 100644 --- a/mRemoteV1/CS/UI/UI.Window.Connection.cs +++ b/mRemoteV1/CS/UI/UI.Window.Connection.cs @@ -271,8 +271,8 @@ namespace mRemoteNG.UI.Window this.Text = FormText; this.TabText = FormText; } - - public Crownwood.Magic.Controls.TabPage AddConnectionTab(Protocol.Info conI) + + public Crownwood.Magic.Controls.TabPage AddConnectionTab(mRemoteNG.Connection.Info conI) { try { @@ -897,8 +897,8 @@ namespace mRemoteNG.UI.Window Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "RefreshScreen (UI.Window.Connections) failed" + Constants.vbNewLine + ex.Message, true); } } - - private void SendSpecialKeys(mRemoteNG.Protocol.Protocol.VNC.SpecialKeys Keys) + + private void SendSpecialKeys(mRemoteNG.Connection.Protocol.VNC.SpecialKeys Keys) { try { diff --git a/mRemoteV1/CS/UI/UI.Window.List.cs b/mRemoteV1/CS/UI/UI.Window.List.cs index 630a54b04..ca8aa124d 100644 --- a/mRemoteV1/CS/UI/UI.Window.List.cs +++ b/mRemoteV1/CS/UI/UI.Window.List.cs @@ -1,4 +1,3 @@ -// VBConversions Note: VB project level imports using System.Collections.Generic; using System; using AxWFICALib; @@ -9,114 +8,112 @@ using AxMSTSCLib; using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; -// End of VB project level imports namespace mRemoteNG.UI.Window { public class List : CollectionBase + { + #region Public Properties + public UI.Window.Base this[object Index] + { + get { - -#region Public Properties -public UI.Window.Base this[object Index] + this.CleanUp(); + if (Index is UI.Window.Base) { - get + if (Index as UI.Window.Base != null) { - this.CleanUp(); - if (Index is UI.Window.Base) + return (UI.Window.Base)Index; + } + } + else + { + if (List.Count - 1 >= (int)Index) + { + if (List[System.Convert.ToInt32(Index)] != null) { - if (Index as UI.Window.Base != null) - { - return Index; - } - } - else - { - if (List.Count - 1 >= Index) - { - if (List[System.Convert.ToInt32(Index)] != null) - { - return List[System.Convert.ToInt32(Index)] as UI.Window.Base.Default; - } - } + return List[System.Convert.ToInt32(Index)] as UI.Window.Base; } + } + } - return null; - } - } - -public new int Count - { - get - { - this.CleanUp(); - return List.Count; - } - } -#endregion - -#region Public Methods - public void Add(UI.Window.Base uiWindow) - { - this.List.Add(uiWindow); - //AddHandler uiWindow.FormClosing, AddressOf uiFormClosing - } - - public void AddRange(UI.Window.Base[] uiWindow) - { - foreach (Form uW in uiWindow) - { - this.List.Add(uW); - } - } - - public void Remove(UI.Window.Base uiWindow) - { - this.List.Remove(uiWindow); - } - - public UI.Window.Base FromString(string uiWindow) - { - this.CleanUp(); - - for (int i = 0; i <= this.List.Count() - 1; i++) - { - if (this[i].Text == uiWindow.Replace("&", "&&")) - { - return this[i]; - } - } - - return null; - } -#endregion - -#region Private Methods - private void CleanUp() - { - for (int i = 0; i <= this.List.Count() - 1; i++) - { - if (i > this.List.Count() - 1) - { - CleanUp(); - return; - } - if ((this.List[i] as UI.Window.Base).IsDisposed) - { - this.List.RemoveAt(i); - CleanUp(); - return; - } - } - } -#endregion - -#region Event Handlers - private void uiFormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) - { - this.List.Remove(sender); - } -#endregion + return null; } + } + + public new int Count + { + get + { + this.CleanUp(); + return List.Count; + } + } + #endregion + + #region Public Methods + public void Add(UI.Window.Base uiWindow) + { + this.List.Add(uiWindow); + //AddHandler uiWindow.FormClosing, AddressOf uiFormClosing + } + + public void AddRange(UI.Window.Base[] uiWindow) + { + foreach (Form uW in uiWindow) + { + this.List.Add(uW); + } + } + + public void Remove(UI.Window.Base uiWindow) + { + this.List.Remove(uiWindow); + } + + public UI.Window.Base FromString(string uiWindow) + { + this.CleanUp(); + + for (int i = 0; i <= this.List.Count() - 1; i++) + { + if (this[i].Text == uiWindow.Replace("&", "&&")) + { + return this[i]; + } + } + + return null; + } + #endregion + + #region Private Methods + private void CleanUp() + { + for (int i = 0; i <= this.List.Count - 1; i++) + { + if (i > this.List.Count - 1) + { + CleanUp(); + return; + } + if ((this.List[i] as UI.Window.Base).IsDisposed) + { + this.List.RemoveAt(i); + CleanUp(); + return; + } + } + } + #endregion + + #region Event Handlers + private void uiFormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) + { + this.List.Remove(sender); + } + #endregion + } } diff --git a/mRemoteV1/CS/UI/UI.Window.Sessions.cs b/mRemoteV1/CS/UI/UI.Window.Sessions.cs index 49634bfe3..e94b7a403 100644 --- a/mRemoteV1/CS/UI/UI.Window.Sessions.cs +++ b/mRemoteV1/CS/UI/UI.Window.Sessions.cs @@ -208,7 +208,7 @@ namespace mRemoteNG.UI.Window } // Get sessions from an already impersonated and connected TerminalSessions object - private void GetSessions(mRemoteNG.Protocol.Protocol.RDP.TerminalSessions terminalSessions, long serverHandle) + private void GetSessions(mRemoteNG.Connection.Protocol.RDP.TerminalSessions terminalSessions, long serverHandle) { mRemoteNG.Connection.Protocol.RDP.SessionsCollection rdpSessions = terminalSessions.GetSessions(serverHandle); foreach (mRemoteNG.Connection.Protocol.RDP.Session session in rdpSessions) diff --git a/mRemoteV1/CS/mRemoteV1.v12.suo b/mRemoteV1/CS/mRemoteV1.v12.suo index bae31ba9d..2430757aa 100644 Binary files a/mRemoteV1/CS/mRemoteV1.v12.suo and b/mRemoteV1/CS/mRemoteV1.v12.suo differ diff --git a/mRemoteV1/CS/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache b/mRemoteV1/CS/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache index 4755e215e..cf1588193 100644 Binary files a/mRemoteV1/CS/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache and b/mRemoteV1/CS/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/mRemoteV1/CS/obj/Debug Portable/Interop.WFICALib.dll b/mRemoteV1/CS/obj/Debug Portable/Interop.WFICALib.dll index a026cf52b..f5a38fa04 100644 Binary files a/mRemoteV1/CS/obj/Debug Portable/Interop.WFICALib.dll and b/mRemoteV1/CS/obj/Debug Portable/Interop.WFICALib.dll differ diff --git a/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csproj.GenerateResource.Cache b/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csproj.GenerateResource.Cache index c97090bd0..5715ba3ec 100644 Binary files a/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csproj.GenerateResource.Cache and b/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csproj.GenerateResource.Cache differ diff --git a/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csproj.ResolveComReference.cache b/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csproj.ResolveComReference.cache index dd2d9b9f0..386521824 100644 Binary files a/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csproj.ResolveComReference.cache and b/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csproj.ResolveComReference.cache differ diff --git a/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csprojResolveAssemblyReference.cache b/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csprojResolveAssemblyReference.cache index 4e5b3a090..08c112b6f 100644 Binary files a/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csprojResolveAssemblyReference.cache and b/mRemoteV1/CS/obj/Debug Portable/mRemoteV1.csprojResolveAssemblyReference.cache differ diff --git a/mRemoteV1/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache b/mRemoteV1/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache index 47aa13a08..d12272501 100644 Binary files a/mRemoteV1/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache and b/mRemoteV1/obj/Debug Portable/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/mRemoteV1/obj/Debug Portable/Interop.WFICALib.dll b/mRemoteV1/obj/Debug Portable/Interop.WFICALib.dll index 355cb0f76..63fe1db37 100644 Binary files a/mRemoteV1/obj/Debug Portable/Interop.WFICALib.dll and b/mRemoteV1/obj/Debug Portable/Interop.WFICALib.dll differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteV1.vbproj.ResolveComReference.cache b/mRemoteV1/obj/Debug Portable/mRemoteV1.vbproj.ResolveComReference.cache index dd2d9b9f0..386521824 100644 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteV1.vbproj.ResolveComReference.cache and b/mRemoteV1/obj/Debug Portable/mRemoteV1.vbproj.ResolveComReference.cache differ