more fixes

This commit is contained in:
David Sparer
2016-03-06 18:03:06 -07:00
parent 8fe56722a5
commit b4b7dc667f
170 changed files with 19868 additions and 20377 deletions

Binary file not shown.

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,9 +8,6 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
//using System.Environment;
using System.Threading;
@@ -27,7 +23,7 @@ namespace mRemoteNG.App.Info
public static string EncryptionKey = "mR3m";
public static string ReportingFilePath = "";
public static readonly string PuttyPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\PuTTYNG.exe";
public static string UserAgent
public static string UserAgent
{
get
{
@@ -46,7 +42,7 @@ public static string UserAgent
details.Add("WOW64");
}
details.Add(Thread.CurrentThread.CurrentUICulture.Name);
details.Add(string.Format(".NET CLR {0}", Version.ToString()));
details.Add(string.Format(".NET CLR {0}", System.Environment.Version));
string detailsString = string.Join("; ", details.ToArray());
return string.Format("Mozilla/4.0 ({0}) {1}/{2}", detailsString, System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion);
@@ -56,11 +52,11 @@ public static string UserAgent
public class Settings
{
#if !PORTABLE
#if !PORTABLE
public static readonly string SettingsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName;
#else
#else
public static readonly string SettingsPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath;
#endif
#endif
public static readonly string LayoutFileName = "pnlLayout.xml";
public static readonly string ExtAppsFilesName = "extApps.xml";
public const string ThemesFileName = "Themes.xml";
@@ -68,29 +64,25 @@ public static string UserAgent
public class Update
{
public static string FileName
public static string FileName
{
get
{
#if DEBUG
#if DEBUG
return "update-debug.txt";
#endif
//
// if ((string) (My.Settings.Default.UpdateChannel.ToLowerInvariant()) == "beta")
// {
// return "update-beta.txt";
// }
// else if ((string) (My.Settings.Default.UpdateChannel.ToLowerInvariant()) == "debug")
// {
// return "update-debug.txt";
// }
// else
// {
// return "update.txt";
// }
}
}
#else
if ((string) (My.Settings.Default.UpdateChannel.ToLowerInvariant()) == "debug")
{
return "update-debug.txt";
}
else
{
return "update.txt";
}
#endif
}
}
}
public class Connections
{

View File

@@ -297,13 +297,13 @@ namespace mRemoteNG.App
public static DockContent exportPanel = new DockContent();
public static UI.Window.About aboutForm;
public static DockContent aboutPanel = new DockContent();
public static Update updateForm;
public static UI.Window.Update updateForm;
public static DockContent updatePanel = new DockContent();
public static UI.Window.SSHTransfer sshtransferForm;
public static DockContent sshtransferPanel = new DockContent();
public static UI.Window.ActiveDirectoryImport adimportForm;
public static DockContent adimportPanel = new DockContent();
public static Help helpForm;
public static UI.Window.Help helpForm;
public static DockContent helpPanel = new DockContent();
public static UI.Window.ExternalTools externalappsForm;
public static DockContent externalappsPanel = new DockContent();
@@ -316,7 +316,7 @@ namespace mRemoteNG.App
public static UI.Window.Announcement AnnouncementForm;
public static DockContent AnnouncementPanel = new DockContent();
public static void Show(Type windowType, bool portScanImport = false)
public static void Show(UI.Window.Type windowType, bool portScanImport = false)
{
try
{
@@ -516,8 +516,8 @@ namespace mRemoteNG.App
{
return ;
}
cTaskDialog.MessageBox(System.Windows.Forms.Application.ProductName, My.Language.strCompatibilityProblemDetected, string.Format(My.Language.strCompatibilityLenovoAutoScrollUtilityDetected, System.Windows.Forms.Application.ProductName), "", "", My.Language.strCheckboxDoNotShowThisMessageAgain, eTaskDialogButtons.OK, eSysIcons.Warning, null);
cTaskDialog.MessageBox(System.Windows.Forms.Application.ProductName, My.Language.strCompatibilityProblemDetected, string.Format(My.Language.strCompatibilityLenovoAutoScrollUtilityDetected, System.Windows.Forms.Application.ProductName), "", "", My.Language.strCheckboxDoNotShowThisMessageAgain, eTaskDialogButtons.OK, eSysIcons.Warning, eSysIcons.Warning);
if (cTaskDialog.VerificationChecked)
{
My.Settings.Default.CompatibilityWarnLenovoAutoScrollUtility = false;
@@ -628,7 +628,7 @@ namespace mRemoteNG.App
{
foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem WHERE Primary=True").Get())
{
osVersion = System.Convert.ToString(managementObject.GetPropertyValue("Caption").Trim());
osVersion = System.Convert.ToString(managementObject.GetPropertyValue("Caption")).Trim();
int servicePackNumber = System.Convert.ToInt32(managementObject.GetPropertyValue("ServicePackMajorVersion"));
if (!(servicePackNumber == 0))
{
@@ -894,7 +894,7 @@ namespace mRemoteNG.App
{
try
{
LastSqlUpdate = null;
//LastSqlUpdate = null;
Tools.Misc.SQLUpdateCheckFinished -= SQLUpdateCheckFinished;
if (TimerSqlWatcher != null)
{
@@ -1124,13 +1124,13 @@ namespace mRemoteNG.App
//create rename item
ToolStripMenuItem cMenRen = new ToolStripMenuItem();
cMenRen.Text = My.Language.strRename;
cMenRen.Image = global::My.Resources.Rename;
cMenRen.Image = My.Resources.Rename;
cMenRen.Tag = pnlcForm;
cMenRen.Click += cMenConnectionPanelRename_Click;
ToolStripMenuItem cMenScreens = new ToolStripMenuItem();
cMenScreens.Text = My.Language.strSendTo;
cMenScreens.Image = global::My.Resources.Monitor;
cMenScreens.Image = My.Resources.Monitor;
cMenScreens.Tag = pnlcForm;
cMenScreens.DropDownItems.Add("Dummy");
cMenScreens.DropDownOpening += cMenConnectionPanelScreens_DropDownOpening;
@@ -1166,9 +1166,9 @@ namespace mRemoteNG.App
try
{
UI.Window.Connection conW = default(UI.Window.Connection);
conW = sender.Tag;
string nTitle = Interaction.InputBox(Prompt: My.Language.strNewTitle + ":", DefaultResponse: System.Convert.ToString(sender.Tag.Text.Replace("&&", "&")));
conW = (UI.Window.Connection)((System.Windows.Forms.Control)sender).Tag;
string nTitle = Interaction.InputBox(Prompt: My.Language.strNewTitle + ":", DefaultResponse: System.Convert.ToString(((System.Windows.Forms.Control)((System.Windows.Forms.Control)sender).Tag).Text.Replace("&&", "&")));
if (!string.IsNullOrEmpty(nTitle))
{
@@ -1185,18 +1185,17 @@ namespace mRemoteNG.App
{
try
{
ToolStripMenuItem cMenScreens = sender;
ToolStripMenuItem cMenScreens = (ToolStripMenuItem)sender;
cMenScreens.DropDownItems.Clear();
for (int i = 0; i <= Screen.AllScreens.Length - 1; i++)
{
ToolStripMenuItem cMenScreen = new ToolStripMenuItem(My.Language.strScreen + " " + System.Convert.ToString(i + 1));
cMenScreen.Tag = new ArrayList();
cMenScreen.Image = global::My.Resources.Monitor_GoTo;
cMenScreen.Image = My.Resources.Monitor_GoTo;
(cMenScreen.Tag as ArrayList).Add(Screen.AllScreens[i]);
(cMenScreen.Tag as ArrayList).Add(cMenScreens.Tag);
cMenScreen.Click += cMenConnectionPanelScreen_Click;
cMenScreens.DropDownItems.Add(cMenScreen);
}
}
@@ -1210,8 +1209,8 @@ namespace mRemoteNG.App
{
try
{
Screen screen = (sender as ToolStripMenuItem).Tag(0);
DockContent panel = (sender as ToolStripMenuItem).Tag(1);
Screen screen = ((ToolStripMenuItem)sender).Tag(0);
DockContent panel = ((ToolStripMenuItem)sender).Tag(1);
Screens.SendPanelToScreen(panel, screen);
}
catch (Exception)
@@ -1235,7 +1234,7 @@ namespace mRemoteNG.App
ConnectionList = new Connection.List();
ContainerList = new Container.List();
Config.Connections.Load connectionsLoad = new Config.Connections.Load();
mRemoteNG.Config.Connections.Load connectionsLoad = new Config.Connections.Load();
if (filename == GetDefaultStartupConnectionFileName())
{
@@ -1312,7 +1311,7 @@ namespace mRemoteNG.App
public static void LoadConnections(bool withDialog = false, bool update = false)
{
Connections.Load connectionsLoad = new Connections.Load();
mRemoteNG.Config.Connections.Load connectionsLoad = new mRemoteNG.Config.Connections.Load();
try
{
@@ -1414,7 +1413,7 @@ namespace mRemoteNG.App
{
Runtime.MessageCollector.AddExceptionMessage(My.Language.strLoadFromSqlFailed, ex);
string commandButtons = string.Join("|", new[] {My.Language.strCommandTryAgain, My.Language.strCommandOpenConnectionFile, string.Format(My.Language.strCommandExitProgram, System.Windows.Forms.Application.ProductName)});
cTaskDialog.ShowCommandBox(System.Windows.Forms.Application.ProductName, My.Language.strLoadFromSqlFailed, My.Language.strLoadFromSqlFailedContent, Misc.GetExceptionMessageRecursive(ex), "", "", commandButtons, false, eSysIcons.Error, null);
cTaskDialog.ShowCommandBox(System.Windows.Forms.Application.ProductName, My.Language.strLoadFromSqlFailed, My.Language.strLoadFromSqlFailedContent, Misc.GetExceptionMessageRecursive(ex), "", "", commandButtons, false, eSysIcons.Error, eSysIcons.Error);
switch (cTaskDialog.CommandButtonResult)
{
case 0:
@@ -1589,7 +1588,7 @@ namespace mRemoteNG.App
conS.SQLPassword = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.SQLPass), App.Info.General.EncryptionKey);
}
conS.Save_Renamed();
conS.Save();
if (My.Settings.Default.UseSQLServer == true)
{
@@ -1612,7 +1611,7 @@ namespace mRemoteNG.App
public static void SaveConnectionsAs()
{
bool previousTimerState = false;
Connections.Save connectionsSave = new Connections.Save();
mRemoteNG.Config.Connections.Save connectionsSave = new mRemoteNG.Config.Connections.Save();
try
{
@@ -1639,8 +1638,8 @@ namespace mRemoteNG.App
{
return ;
}
connectionsSave.SaveFormat = Connections.Save.Format.mRXML;
connectionsSave.SaveFormat = mRemoteNG.Config.Connections.Save.Format.mRXML;
connectionsSave.ConnectionFileName = saveFileDialog.FileName;
connectionsSave.Export = false;
connectionsSave.SaveSecurity = new Security.Save();
@@ -1743,7 +1742,7 @@ namespace mRemoteNG.App
if (Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.PuttySession)
{
OpenConnection(Windows.treeForm.tvConnections.SelectedNode.Tag, Force);
OpenConnection((mRemoteNG.Connection.Info)Windows.treeForm.tvConnections.SelectedNode.Tag, Force);
}
else if (Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.Container)
{
@@ -1753,7 +1752,7 @@ namespace mRemoteNG.App
{
if (tNode.Tag != null)
{
OpenConnection(tNode.Tag, Force);
OpenConnection((mRemoteNG.Connection.Info)tNode.Tag, Force);
}
}
}
@@ -2019,14 +2018,14 @@ namespace mRemoteNG.App
try
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format(My.Language.strProtocolEventDisconnected, DisconnectedMessage), true);
Connection.Protocol.Base Prot = sender;
Connection.Protocol.Base Prot = (Connection.Protocol.Base)sender;
if (Prot.InterfaceControl.Info.Protocol == Connection.Protocol.Protocols.RDP)
{
string[] Reason = DisconnectedMessage.Split("\r\n");
string[] Reason = DisconnectedMessage.Split("\r\n".ToCharArray());
string ReasonCode = Reason[0];
string ReasonDescription = Reason[1];
if (ReasonCode > 3)
if (System.Convert.ToInt32(ReasonCode) > 3)
{
if (!string.IsNullOrEmpty(ReasonDescription))
{
@@ -2049,7 +2048,7 @@ namespace mRemoteNG.App
{
try
{
Connection.Protocol.Base Prot = sender;
Connection.Protocol.Base Prot = (Connection.Protocol.Base)sender;
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strConnenctionCloseEvent, true);
@@ -2079,7 +2078,7 @@ namespace mRemoteNG.App
public static void Prot_Event_Connected(object sender)
{
mRemoteNG.Connection.Protocol.Base prot = sender;
mRemoteNG.Connection.Protocol.Base prot = (Connection.Protocol.Base)sender;
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strConnectionEventConnected, true);
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ReportMsg, string.Format(My.Language.strConnectionEventConnectedDetail, prot.InterfaceControl.Info.Hostname, prot.InterfaceControl.Info.Protocol.ToString(), (new Microsoft.VisualBasic.ApplicationServices.User()).Name, prot.InterfaceControl.Info.Description, prot.InterfaceControl.Info.UserField));
@@ -2090,12 +2089,12 @@ namespace mRemoteNG.App
try
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strConnectionEventErrorOccured, true);
Connection.Protocol.Base Prot = sender;
Connection.Protocol.Base Prot = (Connection.Protocol.Base)sender;
if (Prot.InterfaceControl.Info.Protocol == Connection.Protocol.Protocols.RDP)
{
if (ErrorMessage > -1)
if (System.Convert.ToInt32(ErrorMessage) > -1)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, string.Format(My.Language.strConnectionRdpErrorDetail, ErrorMessage, Connection.Protocol.RDP.FatalErrors.GetError(ErrorMessage)));
}
@@ -2221,7 +2220,7 @@ namespace mRemoteNG.App
{
if (WindowList[i] is UI.Window.Connection)
{
UI.Window.Connection conW = WindowList[i];
UI.Window.Connection conW = (UI.Window.Connection)WindowList[i];
if (conW.TabController != null)
{
@@ -2231,7 +2230,7 @@ namespace mRemoteNG.App
{
if (t.Controls[0] is Connection.InterfaceControl)
{
Connection.InterfaceControl IC = t.Controls[0];
Connection.InterfaceControl IC = (Connection.InterfaceControl)t.Controls[0];
if (IC.Info == ConI)
{
return IC;

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,85 +8,84 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.App
{
public class SupportedCultures : System.Collections.Generic.Dictionary<string, string>
{
private SupportedCultures()
{
private SupportedCultures()
System.Globalization.CultureInfo CultureInfo = default(System.Globalization.CultureInfo);
foreach (string CultureName in My.Settings.Default.SupportedUICultures.Split(','))
{
System.Globalization.CultureInfo CultureInfo = default(System.Globalization.CultureInfo);
foreach (string CultureName in My.Settings.Default.SupportedUICultures.Split(","))
try
{
try
{
CultureInfo = new System.Globalization.CultureInfo(CultureName.Trim());
Add(CultureInfo.Name, CultureInfo.TextInfo.ToTitleCase(CultureInfo.NativeName));
}
catch (Exception ex)
{
Debug.Print(string.Format("An exception occurred while adding the culture \'{0}\' to the list of supported cultures. {1}", CultureName, ex.ToString()));
}
CultureInfo = new System.Globalization.CultureInfo(CultureName.Trim());
Add(CultureInfo.Name, CultureInfo.TextInfo.ToTitleCase(CultureInfo.NativeName));
}
}
private static SupportedCultures _Instance = null;
public static void InstantiateSingleton()
{
if (_Instance == null)
catch (Exception ex)
{
_Instance = new SupportedCultures();
}
}
public static bool IsNameSupported(string CultureName)
{
return _Instance.ContainsKey(CultureName);
}
public static bool IsNativeNameSupported(string CultureNativeName)
{
return _Instance.ContainsValue(CultureNativeName);
}
public static string get_CultureName(string CultureNativeName)
{
string[] Names = new string[_Instance.Count + 1];
string[] NativeNames = new string[_Instance.Count + 1];
_Instance.Keys.CopyTo(Names, 0);
_Instance.Values.CopyTo(NativeNames, 0);
for (int Index = 0; Index <= _Instance.Count; Index++)
{
if (NativeNames[Index] == CultureNativeName)
{
return Names[Index];
}
}
throw (new System.Collections.Generic.KeyNotFoundException());
}
public static string get_CultureNativeName(string CultureName)
{
return _Instance[CultureName];
}
public static List<string> CultureNativeNames
{
get
{
List<string> ValueList = new List<string>();
foreach (string Value in _Instance.Values)
{
ValueList.Add(Value);
}
return ValueList;
Debug.Print(string.Format("An exception occurred while adding the culture \'{0}\' to the list of supported cultures. {1}", CultureName, ex.ToString()));
}
}
}
private static SupportedCultures _Instance = null;
public static void InstantiateSingleton()
{
if (_Instance == null)
{
_Instance = new SupportedCultures();
}
}
public static bool IsNameSupported(string CultureName)
{
return _Instance.ContainsKey(CultureName);
}
public static bool IsNativeNameSupported(string CultureNativeName)
{
return _Instance.ContainsValue(CultureNativeName);
}
public static string get_CultureName(string CultureNativeName)
{
string[] Names = new string[_Instance.Count + 1];
string[] NativeNames = new string[_Instance.Count + 1];
_Instance.Keys.CopyTo(Names, 0);
_Instance.Values.CopyTo(NativeNames, 0);
for (int Index = 0; Index <= _Instance.Count; Index++)
{
if (NativeNames[Index] == CultureNativeName)
{
return Names[Index];
}
}
throw (new System.Collections.Generic.KeyNotFoundException());
}
public static string get_CultureNativeName(string CultureName)
{
return _Instance[CultureName];
}
public static List<string> CultureNativeNames
{
get
{
List<string> ValueList = new List<string>();
foreach (string Value in _Instance.Values)
{
ValueList.Add(Value);
}
return ValueList;
}
}
}
}

View File

@@ -329,12 +329,12 @@ namespace mRemoteNG.App
private static DownloadStringCompletedEventArgs NewDownloadStringCompletedEventArgs(string result, Exception exception, bool cancelled, object userToken)
{
Type type = typeof(DownloadStringCompletedEventArgs);
const BindingFlags bindingFlags = bindingFlags.NonPublic | bindingFlags.Instance;
const BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance;
Type[] argumentTypes = new Type[] {typeof(string), typeof(Exception), typeof(bool), typeof(object)};
ConstructorInfo constructor = type.GetConstructor(bindingFlags, null, argumentTypes, null);
object[] arguments = new object[] {result, exception, cancelled, userToken};
return constructor.Invoke(arguments);
return (DownloadStringCompletedEventArgs)constructor.Invoke(arguments);
}
private DownloadStringCompletedEventArgs DownloadString(Uri address)
@@ -430,7 +430,7 @@ namespace mRemoteNG.App
updateAuthenticode.RequireThumbprintMatch = true;
updateAuthenticode.ThumbprintToMatch = _currentUpdateInfo.CertificateThumbprint;
if (!(updateAuthenticode.Verify() == (int) Authenticode.StatusValue.Verified))
if (!(updateAuthenticode.Verify() == Authenticode.StatusValue.Verified))
{
if (updateAuthenticode.Status == Authenticode.StatusValue.UnhandledException)
{
@@ -566,17 +566,17 @@ namespace mRemoteNG.App
string[] lines = content.Split(lineSeparators.ToString().ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
{
line = line.Trim();
if (line.Length == 0)
string trimmedLine = line.Trim();
if (trimmedLine.Length == 0)
{
continue;
}
if (!(line.Substring(0, 1).IndexOfAny(commentCharacters.ToString().ToCharArray()) == -1))
if (!(trimmedLine.Substring(0, 1).IndexOfAny(commentCharacters.ToString().ToCharArray()) == -1))
{
continue;
}
string[] parts = line.Split(keyValueSeparators.ToString().ToCharArray(), 2);
string[] parts = trimmedLine.Split(keyValueSeparators.ToString().ToCharArray(), 2);
if (!(parts.Length == 2))
{
continue;
@@ -597,7 +597,7 @@ namespace mRemoteNG.App
{
return string.Empty;
}
return this[key];
return this._items[key];
}
public Version GetVersion(string key)

View File

@@ -45,10 +45,10 @@ namespace mRemoteNG.App
switch (exportForm.Scope)
{
case exportForm.ExportScope.SelectedFolder:
case mRemoteNG.Forms.ExportForm.ExportScope.SelectedFolder:
exportTreeNode = exportForm.SelectedFolder;
break;
case exportForm.ExportScope.SelectedConnection:
case mRemoteNG.Forms.ExportForm.ExportScope.SelectedConnection:
exportTreeNode = exportForm.SelectedConnection;
break;
default:
@@ -77,19 +77,19 @@ namespace mRemoteNG.App
try
{
if (TimerSqlWatcher != null)
if (Runtime.TimerSqlWatcher != null)
{
previousTimerEnabled = TimerSqlWatcher.Enabled;
TimerSqlWatcher.Enabled = false;
previousTimerEnabled = Runtime.TimerSqlWatcher.Enabled;
Runtime.TimerSqlWatcher.Enabled = false;
}
Config.Connections.Save connectionsSave = new Config.Connections.Save();
connectionsSave.Export = true;
connectionsSave.ConnectionFileName = fileName;
connectionsSave.SaveFormat = saveFormat;
connectionsSave.ConnectionList = ConnectionList;
connectionsSave.ContainerList = ContainerList;
connectionsSave.ConnectionList = Runtime.ConnectionList;
connectionsSave.ContainerList = Runtime.ContainerList;
connectionsSave.RootTreeNode = rootNode;
connectionsSave.SaveSecurity = saveSecurity;
@@ -102,9 +102,9 @@ namespace mRemoteNG.App
}
finally
{
if (TimerSqlWatcher != null)
if (Runtime.TimerSqlWatcher != null)
{
TimerSqlWatcher.Enabled = previousTimerEnabled;
Runtime.TimerSqlWatcher.Enabled = previousTimerEnabled;
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,240 +8,238 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.IO;
using mRemoteNG.My;
//using mRemoteNG.App.Runtime;
using mRemoteNG.App;
using PSTaskDialog;
namespace mRemoteNG.App
{
public class Import
{
#region Public Methods
public static void ImportFromFile(TreeNode rootTreeNode, TreeNode selectedTreeNode, bool alwaysUseSelectedTreeNode = false)
{
#region Public Methods
public static void ImportFromFile(TreeNode rootTreeNode, TreeNode selectedTreeNode, bool alwaysUseSelectedTreeNode = false)
try
{
try
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
openFileDialog.CheckFileExists = true;
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
openFileDialog.Multiselect = true;
List<string> fileTypes = new List<string>();
fileTypes.AddRange(new[] {Language.strFilterAllImportable, "*.xml;*.rdp;*.rdg;*.dat"});
fileTypes.AddRange(new[] {Language.strFiltermRemoteXML, "*.xml"});
fileTypes.AddRange(new[] {Language.strFilterRDP, "*.rdp"});
fileTypes.AddRange(new[] {Language.strFilterRdgFiles, "*.rdg"});
fileTypes.AddRange(new[] {Language.strFilterPuttyConnectionManager, "*.dat"});
fileTypes.AddRange(new[] {Language.strFilterAll, "*.*"});
openFileDialog.Filter = string.Join("|", fileTypes.ToArray());
if (!(openFileDialog.ShowDialog() == DialogResult.OK))
{
openFileDialog.CheckFileExists = true;
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
openFileDialog.Multiselect = true;
List<string> fileTypes = new List<string>();
fileTypes.AddRange(new[] {Language.strFilterAllImportable, "*.xml;*.rdp;*.rdg;*.dat"});
fileTypes.AddRange(new[] {Language.strFiltermRemoteXML, "*.xml"});
fileTypes.AddRange(new[] {Language.strFilterRDP, "*.rdp"});
fileTypes.AddRange(new[] {Language.strFilterRdgFiles, "*.rdg"});
fileTypes.AddRange(new[] {Language.strFilterPuttyConnectionManager, "*.dat"});
fileTypes.AddRange(new[] {Language.strFilterAll, "*.*"});
openFileDialog.Filter = string.Join("|", fileTypes.ToArray());
if (!(openFileDialog.ShowDialog() == DialogResult.OK))
{
return ;
}
TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode, alwaysUseSelectedTreeNode);
if (parentTreeNode == null)
{
return ;
}
foreach (string fileName in openFileDialog.FileNames)
{
try
{
switch (DetermineFileType(fileName))
{
case FileType.mRemoteXml:
Config.Import.mRemoteNG.Import(fileName, parentTreeNode);
break;
case FileType.RemoteDesktopConnection:
Config.Import.RemoteDesktopConnection.Import(fileName, parentTreeNode);
break;
case FileType.RemoteDesktopConnectionManager:
Config.Import.RemoteDesktopConnectionManager.Import(fileName, parentTreeNode);
break;
case FileType.PuttyConnectionManager:
Config.Import.PuttyConnectionManager.Import(fileName, parentTreeNode);
break;
default:
throw (new FileFormatException("Unrecognized file format."));
break;
}
}
catch (Exception ex)
{
cTaskDialog.ShowTaskDialogBox(System.Windows.Forms.Application.ProductName, Language.strImportFileFailedMainInstruction, string.Format(Language.strImportFileFailedContent, fileName), Tools.Misc.GetExceptionMessageRecursive(ex), "", "", "", "", eTaskDialogButtons.OK, eSysIcons.Error, null);
}
}
parentTreeNode.Expand();
Container.Info parentContainer = parentTreeNode.Tag as Container.Info;
if (parentContainer != null)
{
parentContainer.IsExpanded = true;
}
SaveConnectionsBG();
return ;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(message: "App.Import.ImportFromFile() failed.", ex: ex, logOnly: true);
}
}
public static void ImportFromActiveDirectory(string ldapPath)
{
try
{
TreeNode rootTreeNode = Tree.Node.TreeView.Nodes[0];
TreeNode selectedTreeNode = Tree.Node.TreeView.SelectedNode;
TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode);
TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode, alwaysUseSelectedTreeNode);
if (parentTreeNode == null)
{
return ;
}
Config.Import.ActiveDirectory.Import(ldapPath, parentTreeNode);
foreach (string fileName in openFileDialog.FileNames)
{
try
{
switch (DetermineFileType(fileName))
{
case FileType.mRemoteXml:
Config.Import.mRemoteNG.Import(fileName, parentTreeNode);
break;
case FileType.RemoteDesktopConnection:
Config.Import.RemoteDesktopConnection.Import(fileName, parentTreeNode);
break;
case FileType.RemoteDesktopConnectionManager:
Config.Import.RemoteDesktopConnectionManager.Import(fileName, parentTreeNode);
break;
case FileType.PuttyConnectionManager:
Config.Import.PuttyConnectionManager.Import(fileName, parentTreeNode);
break;
default:
throw (new FileFormatException("Unrecognized file format."));
break;
}
}
catch (Exception ex)
{
cTaskDialog.ShowTaskDialogBox(System.Windows.Forms.Application.ProductName, Language.strImportFileFailedMainInstruction, string.Format(Language.strImportFileFailedContent, fileName), Tools.Misc.GetExceptionMessageRecursive(ex), "", "", "", "", eTaskDialogButtons.OK, eSysIcons.Error, eSysIcons.Error);
}
}
parentTreeNode.Expand();
Container.Info parentContainer = parentTreeNode.Tag as Container.Info;
if (parentContainer != null)
{
parentContainer.IsExpanded = true;
}
Runtime.SaveConnectionsBG();
}
SaveConnectionsBG();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(message: "App.Import.ImportFromActiveDirectory() failed.", ex: ex, logOnly: true);
}
}
public static void ImportFromPortScan(IEnumerable hosts, Connection.Protocol.Protocols protocol)
catch (Exception ex)
{
try
{
TreeNode rootTreeNode = Tree.Node.TreeView.Nodes[0];
TreeNode selectedTreeNode = Tree.Node.TreeView.SelectedNode;
TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode);
if (parentTreeNode == null)
{
return ;
}
Config.import.PortScan.Import(hosts, protocol, parentTreeNode);
parentTreeNode.Expand();
Container.Info parentContainer = parentTreeNode.Tag as Container.Info;
if (parentContainer != null)
{
parentContainer.IsExpanded = true;
}
SaveConnectionsBG();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(message: "App.Import.ImportFromPortScan() failed.", ex: ex, logOnly: true);
}
Runtime.MessageCollector.AddExceptionMessage(message: "App.Import.ImportFromFile() failed.", ex: ex, logOnly: true);
}
#endregion
#region Private Methods
private static TreeNode GetParentTreeNode(TreeNode rootTreeNode, TreeNode selectedTreeNode, bool alwaysUseSelectedTreeNode = false)
{
TreeNode parentTreeNode = default(TreeNode);
selectedTreeNode = GetContainerTreeNode(selectedTreeNode);
if (selectedTreeNode == null || selectedTreeNode == rootTreeNode)
{
parentTreeNode = rootTreeNode;
}
else
{
if (alwaysUseSelectedTreeNode)
{
parentTreeNode = GetContainerTreeNode(selectedTreeNode);
}
else
{
cTaskDialog.ShowCommandBox(System.Windows.Forms.Application.ProductName, Language.strImportLocationMainInstruction, Language.strImportLocationContent, "", "", "", string.Format(Language.strImportLocationCommandButtons, Constants.vbLf, rootTreeNode.Text, selectedTreeNode.Text), true, eSysIcons.Question, (PSTaskDialog.eSysIcons) 0);
switch (cTaskDialog.CommandButtonResult)
{
case 0: // Root
parentTreeNode = rootTreeNode;
break;
case 1: // Selected Folder
parentTreeNode = GetContainerTreeNode(selectedTreeNode);
break;
default: // Cancel
parentTreeNode = null;
break;
}
}
}
return parentTreeNode;
}
private static TreeNode GetContainerTreeNode(TreeNode treeNode)
{
if ((Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Root) || (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Container))
{
return treeNode;
}
else if (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Connection)
{
return treeNode.Parent;
}
else
{
return null;
}
}
private static FileType DetermineFileType(string fileName)
{
// TODO: Use the file contents to determine the file type instead of trusting the extension
string fileExtension = System.Convert.ToString(Path.GetExtension(fileName).ToLowerInvariant());
switch (fileExtension)
{
case ".xml":
return FileType.mRemoteXml;
case ".rdp":
return FileType.RemoteDesktopConnection;
case ".rdg":
return FileType.RemoteDesktopConnectionManager;
case ".dat":
return FileType.PuttyConnectionManager;
default:
return FileType.Unknown;
}
}
#endregion
#region Private Enumerations
private enum FileType
{
Unknown = 0,
// ReSharper disable once InconsistentNaming
mRemoteXml,
RemoteDesktopConnection,
RemoteDesktopConnectionManager,
PuttyConnectionManager
}
#endregion
}
public static void ImportFromActiveDirectory(string ldapPath)
{
try
{
TreeNode rootTreeNode = Tree.Node.TreeView.Nodes[0];
TreeNode selectedTreeNode = Tree.Node.TreeView.SelectedNode;
TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode);
if (parentTreeNode == null)
{
return ;
}
Config.Import.ActiveDirectory.Import(ldapPath, parentTreeNode);
parentTreeNode.Expand();
Container.Info parentContainer = parentTreeNode.Tag as Container.Info;
if (parentContainer != null)
{
parentContainer.IsExpanded = true;
}
Runtime.SaveConnectionsBG();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(message: "App.Import.ImportFromActiveDirectory() failed.", ex: ex, logOnly: true);
}
}
public static void ImportFromPortScan(IEnumerable hosts, Connection.Protocol.Protocols protocol)
{
try
{
TreeNode rootTreeNode = Tree.Node.TreeView.Nodes[0];
TreeNode selectedTreeNode = Tree.Node.TreeView.SelectedNode;
TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode);
if (parentTreeNode == null)
{
return ;
}
Config.Import.PortScan.Import(hosts, protocol, parentTreeNode);
parentTreeNode.Expand();
Container.Info parentContainer = parentTreeNode.Tag as Container.Info;
if (parentContainer != null)
{
parentContainer.IsExpanded = true;
}
Runtime.SaveConnectionsBG();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(message: "App.Import.ImportFromPortScan() failed.", ex: ex, logOnly: true);
}
}
#endregion
#region Private Methods
private static TreeNode GetParentTreeNode(TreeNode rootTreeNode, TreeNode selectedTreeNode, bool alwaysUseSelectedTreeNode = false)
{
TreeNode parentTreeNode = default(TreeNode);
selectedTreeNode = GetContainerTreeNode(selectedTreeNode);
if (selectedTreeNode == null || selectedTreeNode == rootTreeNode)
{
parentTreeNode = rootTreeNode;
}
else
{
if (alwaysUseSelectedTreeNode)
{
parentTreeNode = GetContainerTreeNode(selectedTreeNode);
}
else
{
cTaskDialog.ShowCommandBox(System.Windows.Forms.Application.ProductName, Language.strImportLocationMainInstruction, Language.strImportLocationContent, "", "", "", string.Format(Language.strImportLocationCommandButtons, Constants.vbLf, rootTreeNode.Text, selectedTreeNode.Text), true, eSysIcons.Question, (PSTaskDialog.eSysIcons) 0);
switch (cTaskDialog.CommandButtonResult)
{
case 0: // Root
parentTreeNode = rootTreeNode;
break;
case 1: // Selected Folder
parentTreeNode = GetContainerTreeNode(selectedTreeNode);
break;
default: // Cancel
parentTreeNode = null;
break;
}
}
}
return parentTreeNode;
}
private static TreeNode GetContainerTreeNode(TreeNode treeNode)
{
if ((Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Root) || (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Container))
{
return treeNode;
}
else if (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Connection)
{
return treeNode.Parent;
}
else
{
return null;
}
}
private static FileType DetermineFileType(string fileName)
{
// TODO: Use the file contents to determine the file type instead of trusting the extension
string fileExtension = System.Convert.ToString(Path.GetExtension(fileName).ToLowerInvariant());
switch (fileExtension)
{
case ".xml":
return FileType.mRemoteXml;
case ".rdp":
return FileType.RemoteDesktopConnection;
case ".rdg":
return FileType.RemoteDesktopConnectionManager;
case ".dat":
return FileType.PuttyConnectionManager;
default:
return FileType.Unknown;
}
}
#endregion
#region Private Enumerations
private enum FileType
{
Unknown = 0,
// ReSharper disable once InconsistentNaming
mRemoteXml,
RemoteDesktopConnection,
RemoteDesktopConnectionManager,
PuttyConnectionManager
}
#endregion
}
}

View File

@@ -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 Microsoft.VisualBasic.CompilerServices;
namespace mRemoteNG.My
@@ -23,75 +20,75 @@ namespace mRemoteNG.My
// StartupNextInstance: Raised when launching a single-instance application and the application is already active.
// NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
partial class MyApplication : global::Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase
{
public System.Threading.Mutex mutex;
private void MyApplication_Startup(object sender, Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
{
public System.Threading.Mutex mutex;
private void MyApplication_Startup(object sender, Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
if (My.Settings.Default.SingleInstance)
{
if (My.Settings.Default.SingleInstance)
string mutexID = "mRemoteNG_SingleInstanceMutex";
mutex = new System.Threading.Mutex(false, mutexID);
if (!mutex.WaitOne(0, false))
{
string mutexID = "mRemoteNG_SingleInstanceMutex";
mutex = new System.Threading.Mutex(false, mutexID);
if (!mutex.WaitOne(0, false))
try
{
try
{
SwitchToCurrentInstance();
}
catch (Exception)
{
}
SwitchToCurrentInstance();
}
catch (Exception)
{
}
ProjectData.EndApp();
}
ProjectData.EndApp();
}
GC.KeepAlive(mutex);
}
}
private IntPtr GetCurrentInstanceWindowHandle()
{
IntPtr hWnd = IntPtr.Zero;
Process curProc = Process.GetCurrentProcess();
foreach (Process proc in Process.GetProcessesByName(curProc.ProcessName))
{
if (proc.Id != curProc.Id && proc.MainModule.FileName == curProc.MainModule.FileName && proc.MainWindowHandle != IntPtr.Zero)
{
hWnd = proc.MainWindowHandle;
break;
}
}
return hWnd;
}
private void SwitchToCurrentInstance()
{
IntPtr hWnd = GetCurrentInstanceWindowHandle();
if (hWnd != IntPtr.Zero)
{
//Restore window if minimized. Do not restore if already in
//normal or maximised window state, since we don't want to
//change the current state of the window.
if (App.Native.IsIconic(hWnd) != 0)
{
App.Native.ShowWindow(hWnd, App.Native.SW_RESTORE);
}
App.Native.SetForegroundWindow(hWnd);
}
}
private void MyApplication_Shutdown(object sender, System.EventArgs e)
{
if (mutex != null)
{
mutex.Close();
}
GC.KeepAlive(mutex);
}
}
private IntPtr GetCurrentInstanceWindowHandle()
{
IntPtr hWnd = IntPtr.Zero;
Process curProc = Process.GetCurrentProcess();
foreach (Process proc in Process.GetProcessesByName(curProc.ProcessName))
{
if (proc.Id != curProc.Id && proc.MainModule.FileName == curProc.MainModule.FileName && proc.MainWindowHandle != IntPtr.Zero)
{
hWnd = proc.MainWindowHandle;
break;
}
}
return hWnd;
}
private void SwitchToCurrentInstance()
{
IntPtr hWnd = GetCurrentInstanceWindowHandle();
if (hWnd != IntPtr.Zero)
{
//Restore window if minimized. Do not restore if already in
//normal or maximised window state, since we don't want to
//change the current state of the window.
if (App.Native.IsIconic(hWnd) != 0)
{
App.Native.ShowWindow(hWnd, App.Native.SW_RESTORE);
}
App.Native.SetForegroundWindow(hWnd);
}
}
private void MyApplication_Shutdown(object sender, System.EventArgs e)
{
if (mutex != null)
{
mutex.Close();
}
}
}
}

View File

@@ -115,7 +115,7 @@ namespace mRemoteNG.Config.Connections
#endregion
#region Public Methods
public void Load_Renamed(bool import)
public void Load(bool import)
{
if (UseSQL)
{

View File

@@ -13,7 +13,7 @@ using System.IO;
using System.Globalization;
using mRemoteNG.App;
using System.Data.SqlClient;
//using mRemoteNG.Tools.Misc;
using mRemoteNG.Tools;
namespace mRemoteNG.Config.Connections
@@ -59,7 +59,7 @@ namespace mRemoteNG.Config.Connections
#endregion
#region Public Methods
public void Save_Renamed()
public void Save()
{
switch (SaveFormat)
{
@@ -182,7 +182,7 @@ namespace mRemoteNG.Config.Connections
}
TreeNode tN = default(TreeNode);
tN = RootTreeNode.Clone();
tN = (TreeNode)RootTreeNode.Clone();
string strProtected = "";
if (tN.Tag != null)
@@ -204,8 +204,8 @@ namespace mRemoteNG.Config.Connections
_sqlQuery = new SqlCommand("DELETE FROM tblRoot", _sqlConnection);
_sqlQuery.ExecuteNonQuery();
_sqlQuery = new SqlCommand("INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" + PrepareValueForDB(tN.Text) + "\', 0, \'" + strProtected + "\'," + App.Info.Connections.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")", _sqlConnection);
_sqlQuery = new SqlCommand("INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" + Misc.PrepareValueForDB(tN.Text) + "\', 0, \'" + strProtected + "\'," + App.Info.Connections.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")", _sqlConnection);
_sqlQuery.ExecuteNonQuery();
_sqlQuery = new SqlCommand("DELETE FROM tblCons", _sqlConnection);
@@ -238,14 +238,14 @@ namespace mRemoteNG.Config.Connections
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(node) == Tree.Node.Type.Container)
{
//_xmlTextWriter.WriteStartElement("Node")
_sqlQuery.CommandText += "\'" + PrepareValueForDB(node.Text) + "\',"; //Name
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(node.Text) + "\',"; //Name
_sqlQuery.CommandText += "\'" + Tree.Node.GetNodeType(node).ToString() + "\',"; //Type
}
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) //container
{
_sqlQuery.CommandText += "\'" + this._ContainerList[node.Tag].IsExpanded + "\',"; //Expanded
curConI = this._ContainerList[node.Tag].ConnectionInfo;
_sqlQuery.CommandText += "\'" + this.ContainerList[node.Tag].IsExpanded + "\',"; //Expanded
curConI = this.ContainerList[node.Tag].ConnectionInfo;
SaveConnectionFieldsSQL(curConI);
_sqlQuery.CommandText = Tools.Misc.PrepareForDB(_sqlQuery.CommandText);
@@ -258,7 +258,7 @@ namespace mRemoteNG.Config.Connections
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
{
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
curConI = this._ConnectionList[node.Tag];
curConI = this.ConnectionList[node.Tag];
SaveConnectionFieldsSQL(curConI);
//_xmlTextWriter.WriteEndElement()
_sqlQuery.CommandText = Tools.Misc.PrepareForDB(_sqlQuery.CommandText);
@@ -272,40 +272,40 @@ namespace mRemoteNG.Config.Connections
private void SaveConnectionFieldsSQL(Connection.Info curConI)
{
Connection.Info with_1 = curConI;
_sqlQuery.CommandText += "\'" + PrepareValueForDB(with_1.Description) + "\',";
_sqlQuery.CommandText += "\'" + PrepareValueForDB(with_1.Icon) + "\',";
_sqlQuery.CommandText += "\'" + PrepareValueForDB(with_1.Panel) + "\',";
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Description) + "\',";
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Icon) + "\',";
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Panel) + "\',";
if (this._SaveSecurity.Username == true)
if (this.SaveSecurity.Username == true)
{
_sqlQuery.CommandText += "\'" + PrepareValueForDB(with_1.Username) + "\',";
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Username) + "\',";
}
else
{
_sqlQuery.CommandText += "\'" + "" + "\',";
}
if (this._SaveSecurity.Domain == true)
if (this.SaveSecurity.Domain == true)
{
_sqlQuery.CommandText += "\'" + PrepareValueForDB(with_1.Domain) + "\',";
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Domain) + "\',";
}
else
{
_sqlQuery.CommandText += "\'" + "" + "\',";
}
if (this._SaveSecurity.Password == true)
if (this.SaveSecurity.Password == true)
{
_sqlQuery.CommandText += "\'" + PrepareValueForDB(Security.Crypt.Encrypt(with_1.Password, _password)) + "\',";
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(Security.Crypt.Encrypt(with_1.Password, _password)) + "\',";
}
else
{
_sqlQuery.CommandText += "\'" + "" + "\',";
}
_sqlQuery.CommandText += "\'" + PrepareValueForDB(with_1.Hostname) + "\',";
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Hostname) + "\',";
_sqlQuery.CommandText += "\'" + with_1.Protocol.ToString() + "\',";
_sqlQuery.CommandText += "\'" + PrepareValueForDB(with_1.PuttySession) + "\',";
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.PuttySession) + "\',";
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Port) + "\',";
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.UseConsoleSession) + "\',";
_sqlQuery.CommandText += "\'" + with_1.RenderingEngine.ToString() + "\',";
@@ -358,7 +358,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + with_1.RDGatewayHostname + "\',";
_sqlQuery.CommandText += "\'" + with_1.RDGatewayUseConnectionCredentials.ToString() + "\',";
if (this._SaveSecurity.Username == true)
if (this.SaveSecurity.Username == true)
{
_sqlQuery.CommandText += "\'" + with_1.RDGatewayUsername + "\',";
}
@@ -367,7 +367,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + "" + "\',";
}
if (this._SaveSecurity.Password == true)
if (this.SaveSecurity.Password == true)
{
_sqlQuery.CommandText += "\'" + Security.Crypt.Encrypt(with_1.RDGatewayPassword, _password) + "\',";
}
@@ -376,7 +376,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + "" + "\',";
}
if (this._SaveSecurity.Domain == true)
if (this.SaveSecurity.Domain == true)
{
_sqlQuery.CommandText += "\'" + with_1.RDGatewayDomain + "\',";
}
@@ -387,7 +387,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.UseCredSsp) + "\',";
if (this._SaveSecurity.Inheritance == true)
if (this.SaveSecurity.Inheritance == true)
{
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.CacheBitmaps) + "\',";
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Colors) + "\',";
@@ -552,7 +552,7 @@ namespace mRemoteNG.Config.Connections
{
try
{
if (!IsConnectionsFileLoaded)
if (!Runtime.IsConnectionsFileLoaded)
{
return;
}
@@ -561,7 +561,7 @@ namespace mRemoteNG.Config.Connections
if (Tree.Node.GetNodeType(RootTreeNode) == Tree.Node.Type.Root)
{
treeNode = RootTreeNode.Clone();
treeNode = (TreeNode)RootTreeNode.Clone();
}
else
{
@@ -646,8 +646,8 @@ namespace mRemoteNG.Config.Connections
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) //container
{
_xmlTextWriter.WriteAttributeString("Expanded", "", System.Convert.ToString(this._ContainerList[node.Tag].TreeNode.IsExpanded));
curConI = this._ContainerList[node.Tag].ConnectionInfo;
_xmlTextWriter.WriteAttributeString("Expanded", "", System.Convert.ToString(this.ContainerList[node.Tag].TreeNode.IsExpanded));
curConI = this.ContainerList[node.Tag].ConnectionInfo;
SaveConnectionFields(curConI);
SaveNode(node.Nodes);
_xmlTextWriter.WriteEndElement();
@@ -655,7 +655,7 @@ namespace mRemoteNG.Config.Connections
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
{
curConI = this._ConnectionList[node.Tag];
curConI = this.ConnectionList[node.Tag];
SaveConnectionFields(curConI);
_xmlTextWriter.WriteEndElement();
}
@@ -677,7 +677,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("Panel", "", curConI.Panel);
if (this._SaveSecurity.Username == true)
if (this.SaveSecurity.Username == true)
{
_xmlTextWriter.WriteAttributeString("Username", "", curConI.Username);
}
@@ -686,7 +686,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("Username", "", "");
}
if (this._SaveSecurity.Domain == true)
if (this.SaveSecurity.Domain == true)
{
_xmlTextWriter.WriteAttributeString("Domain", "", curConI.Domain);
}
@@ -695,7 +695,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("Domain", "", "");
}
if (this._SaveSecurity.Password == true)
if (this.SaveSecurity.Password == true)
{
_xmlTextWriter.WriteAttributeString("Password", "", Security.Crypt.Encrypt(curConI.Password, _password));
}
@@ -784,7 +784,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("RDGatewayUseConnectionCredentials", "", curConI.RDGatewayUseConnectionCredentials.ToString());
if (this._SaveSecurity.Username == true)
if (this.SaveSecurity.Username == true)
{
_xmlTextWriter.WriteAttributeString("RDGatewayUsername", "", curConI.RDGatewayUsername);
}
@@ -793,7 +793,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("RDGatewayUsername", "", "");
}
if (this._SaveSecurity.Password == true)
if (this.SaveSecurity.Password == true)
{
_xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", Security.Crypt.Encrypt(curConI.RDGatewayPassword, _password));
}
@@ -802,7 +802,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", "");
}
if (this._SaveSecurity.Domain == true)
if (this.SaveSecurity.Domain == true)
{
_xmlTextWriter.WriteAttributeString("RDGatewayDomain", "", curConI.RDGatewayDomain);
}
@@ -811,7 +811,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("RDGatewayDomain", "", "");
}
if (this._SaveSecurity.Inheritance == true)
if (this.SaveSecurity.Inheritance == true)
{
_xmlTextWriter.WriteAttributeString("InheritCacheBitmaps", "", System.Convert.ToString(curConI.Inherit.CacheBitmaps));
_xmlTextWriter.WriteAttributeString("InheritColors", "", System.Convert.ToString(curConI.Inherit.Colors));
@@ -937,7 +937,7 @@ namespace mRemoteNG.Config.Connections
}
TreeNode tN = default(TreeNode);
tN = RootTreeNode.Clone();
tN = (TreeNode)RootTreeNode.Clone();
TreeNodeCollection tNC = default(TreeNodeCollection);
tNC = tN.Nodes;
@@ -984,7 +984,7 @@ namespace mRemoteNG.Config.Connections
{
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
{
Connection.Info curConI = node.Tag;
Connection.Info curConI = (Connection.Info)node.Tag;
WritemRCSVLine(curConI);
}
@@ -1052,7 +1052,7 @@ namespace mRemoteNG.Config.Connections
}
TreeNode tN = default(TreeNode);
tN = RootTreeNode.Clone();
tN = (TreeNode)RootTreeNode.Clone();
TreeNodeCollection tNC = default(TreeNodeCollection);
tNC = tN.Nodes;
@@ -1070,7 +1070,7 @@ namespace mRemoteNG.Config.Connections
{
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
{
Connection.Info curConI = node.Tag;
Connection.Info curConI = (Connection.Info)node.Tag;
if (curConI.Protocol == Connection.Protocol.Protocols.RDP)
{
@@ -1114,7 +1114,7 @@ namespace mRemoteNG.Config.Connections
}
TreeNode tN = default(TreeNode);
tN = RootTreeNode.Clone();
tN = (TreeNode)RootTreeNode.Clone();
TreeNodeCollection tNC = default(TreeNodeCollection);
tNC = tN.Nodes;
@@ -1143,7 +1143,7 @@ namespace mRemoteNG.Config.Connections
{
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
{
Connection.Info curConI = node.Tag;
Connection.Info curConI = (Connection.Info)node.Tag;
if (curConI.Protocol == Connection.Protocol.Protocols.RDP)
{

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,357 +8,354 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.IO;
using WeifenLuo.WinFormsUI.Docking;
//using mRemoteNG.App.Runtime;
using mRemoteNG.App;
using System.Xml;
//using System.Environment;
namespace mRemoteNG.Config.Settings
{
public class Load
{
#region Public Properties
private frmMain _MainForm;
public frmMain MainForm
{
get
{
#region Public Properties
private frmMain _MainForm;
public frmMain MainForm
{
get
{
return this._MainForm;
}
set
{
this._MainForm = value;
}
}
#endregion
#region Public Methods
public Load(frmMain MainForm)
{
this._MainForm = MainForm;
}
public void Load_Renamed()
{
try
{
// Migrate settings from previous version
if (My.Settings.Default.DoUpgrade)
{
try
{
My.Settings.Default.Upgrade();
}
catch (Exception ex)
{
Log.Error("My.Settings.Upgrade() failed" + Constants.vbNewLine + ex.Message);
}
My.Settings.Default.DoUpgrade = false;
// Clear pending update flag
// This is used for automatic updates, not for settings migration, but it
// needs to be cleared here because we know that we just updated.
My.Settings.Default.UpdatePending = false;
}
App.SupportedCultures.InstantiateSingleton();
if (!(My.Settings.Default.OverrideUICulture == "") && App.SupportedCultures.IsNameSupported(System.Convert.ToString(My.Settings.Default.OverrideUICulture)))
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(System.Convert.ToString(My.Settings.Default.OverrideUICulture));
Log.InfoFormat("Override Culture: {0}/{1}", System.Threading.Thread.CurrentThread.CurrentUICulture.Name, System.Threading.Thread.CurrentThread.CurrentUICulture.NativeName);
}
Themes.ThemeManager.LoadTheme(System.Convert.ToString(My.Settings.Default.ThemeName));
this._MainForm.WindowState = FormWindowState.Normal;
if (My.Settings.Default.MainFormState == FormWindowState.Normal)
{
if (!My.Settings.Default.MainFormLocation.IsEmpty)
{
this._MainForm.Location = My.Settings.Default.MainFormLocation;
}
if (!My.Settings.Default.MainFormSize.IsEmpty)
{
this._MainForm.Size = My.Settings.Default.MainFormSize;
}
}
else
{
if (!My.Settings.Default.MainFormRestoreLocation.IsEmpty)
{
this._MainForm.Location = My.Settings.Default.MainFormRestoreLocation;
}
if (!My.Settings.Default.MainFormRestoreSize.IsEmpty)
{
this._MainForm.Size = My.Settings.Default.MainFormRestoreSize;
}
}
if (My.Settings.Default.MainFormState == FormWindowState.Maximized)
{
this._MainForm.WindowState = FormWindowState.Maximized;
}
// Make sure the form is visible on the screen
const int minHorizontal = 300;
const int minVertical = 150;
System.Drawing.Rectangle screenBounds = Screen.FromHandle(this._MainForm.Handle).Bounds;
System.Drawing.Rectangle newBounds = this._MainForm.Bounds;
if (newBounds.Right < screenBounds.Left + minHorizontal)
{
newBounds.X = screenBounds.Left + minHorizontal - newBounds.Width;
}
if (newBounds.Left > screenBounds.Right - minHorizontal)
{
newBounds.X = screenBounds.Right - minHorizontal;
}
if (newBounds.Bottom < screenBounds.Top + minVertical)
{
newBounds.Y = screenBounds.Top + minVertical - newBounds.Height;
}
if (newBounds.Top > screenBounds.Bottom - minVertical)
{
newBounds.Y = screenBounds.Bottom - minVertical;
}
this._MainForm.Location = newBounds.Location;
if (My.Settings.Default.MainFormKiosk == true)
{
this._MainForm.Fullscreen.Value = true;
this._MainForm.mMenViewFullscreen.Checked = true;
}
if (My.Settings.Default.UseCustomPuttyPath)
{
Connection.Protocol.PuttyBase.PuttyPath = System.Convert.ToString(My.Settings.Default.CustomPuttyPath);
}
else
{
Connection.Protocol.PuttyBase.PuttyPath = App.Info.General.PuttyPath;
}
if (My.Settings.Default.ShowSystemTrayIcon)
{
App.Runtime.NotificationAreaIcon = new Tools.Controls.NotificationAreaIcon();
}
if (My.Settings.Default.AutoSaveEveryMinutes > 0)
{
this._MainForm.tmrAutoSave.Interval = System.Convert.ToInt32(My.Settings.Default.AutoSaveEveryMinutes * 60000);
this._MainForm.tmrAutoSave.Enabled = true;
}
My.Settings.Default.ConDefaultPassword = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.ConDefaultPassword), App.Info.General.EncryptionKey);
this.LoadPanelsFromXML();
this.LoadExternalAppsFromXML();
if (My.Settings.Default.AlwaysShowPanelTabs)
{
frmMain.Default.pnlDock.DocumentStyle = DocumentStyle.DockingWindow;
}
if (My.Settings.Default.ResetToolbars == false)
{
LoadToolbarsFromSettings();
}
else
{
SetToolbarsDefault();
}
}
catch (Exception ex)
{
Log.Error("Loading settings failed" + Constants.vbNewLine + ex.Message);
}
}
public void SetToolbarsDefault()
{
ToolStripPanelFromString("top").Join(MainForm.tsQuickConnect, new Point(300, 0));
MainForm.tsQuickConnect.Visible = true;
ToolStripPanelFromString("bottom").Join(MainForm.tsExternalTools, new Point(3, 0));
MainForm.tsExternalTools.Visible = false;
}
public void LoadToolbarsFromSettings()
{
if (My.Settings.Default.QuickyTBLocation.X > My.Settings.Default.ExtAppsTBLocation.X)
{
AddDynamicPanels();
AddStaticPanels();
}
else
{
AddStaticPanels();
AddDynamicPanels();
}
}
private void AddStaticPanels()
{
ToolStripPanelFromString(System.Convert.ToString(My.Settings.Default.QuickyTBParentDock)).Join(MainForm.tsQuickConnect, My.Settings.Default.QuickyTBLocation);
MainForm.tsQuickConnect.Visible = System.Convert.ToBoolean(My.Settings.Default.QuickyTBVisible);
}
private void AddDynamicPanels()
{
ToolStripPanelFromString(System.Convert.ToString(My.Settings.Default.ExtAppsTBParentDock)).Join(MainForm.tsExternalTools, My.Settings.Default.ExtAppsTBLocation);
MainForm.tsExternalTools.Visible = System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBVisible);
}
private ToolStripPanel ToolStripPanelFromString(string Panel)
{
switch (Panel.ToLower())
{
case "top":
return MainForm.tsContainer.TopToolStripPanel;
case "bottom":
return MainForm.tsContainer.BottomToolStripPanel;
case "left":
return MainForm.tsContainer.LeftToolStripPanel;
case "right":
return MainForm.tsContainer.RightToolStripPanel;
default:
return MainForm.tsContainer.TopToolStripPanel;
}
}
public void LoadPanelsFromXML()
{
try
{
Windows.treePanel = null;
Windows.configPanel = null;
Windows.errorsPanel = null;
while (MainForm.pnlDock.Contents.Count > 0)
{
WeifenLuo.WinFormsUI.Docking.DockContent dc = MainForm.pnlDock.Contents[0];
dc.Close();
}
Startup.CreatePanels();
string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.Settings.LayoutFileName;
string newPath = App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.LayoutFileName;
if (File.Exists(newPath))
{
MainForm.pnlDock.LoadFromXml(newPath, GetContentFromPersistString);
#if !PORTABLE
}
else if (File.Exists(oldPath))
{
MainForm.pnlDock.LoadFromXml(oldPath, GetContentFromPersistString);
#endif
}
else
{
Startup.SetDefaultLayout();
}
}
catch (Exception ex)
{
Log.Error("LoadPanelsFromXML failed" + Constants.vbNewLine + ex.Message);
}
}
public void LoadExternalAppsFromXML()
{
string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.Settings.ExtAppsFilesName;
string newPath = App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.ExtAppsFilesName;
XmlDocument xDom = new XmlDocument();
if (File.Exists(newPath))
{
xDom.Load(newPath);
#if !PORTABLE
}
else if (File.Exists(oldPath))
{
xDom.Load(oldPath);
#endif
}
else
{
return;
}
foreach (XmlElement xEl in xDom.DocumentElement.ChildNodes)
{
Tools.ExternalTool extA = new Tools.ExternalTool();
extA.DisplayName = xEl.Attributes["DisplayName"].Value;
extA.FileName = xEl.Attributes["FileName"].Value;
extA.Arguments = xEl.Attributes["Arguments"].Value;
if (xEl.HasAttribute("WaitForExit"))
{
extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value);
}
if (xEl.HasAttribute("TryToIntegrate"))
{
extA.TryIntegrate = bool.Parse(xEl.Attributes["TryToIntegrate"].Value);
}
ExternalTools.Add(extA);
}
MainForm.SwitchToolBarText(System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBShowText));
xDom = null;
frmMain.Default.AddExternalToolsToToolBar();
}
#endregion
#region Private Methods
private IDockContent GetContentFromPersistString(string persistString)
{
// pnlLayout.xml persistence XML fix for refactoring to mRemoteNG
if (persistString.StartsWith("mRemote."))
{
persistString = persistString.Replace("mRemote.", "mRemoteNG.");
}
try
{
if (persistString == typeof(UI.Window.Config).ToString())
{
return Windows.configPanel;
}
if (persistString == typeof(UI.Window.Tree).ToString())
{
return Windows.treePanel;
}
if (persistString == typeof(UI.Window.ErrorsAndInfos).ToString())
{
return Windows.errorsPanel;
}
if (persistString == typeof(UI.Window.Sessions).ToString())
{
return Windows.sessionsPanel;
}
if (persistString == typeof(UI.Window.ScreenshotManager).ToString())
{
return Windows.screenshotPanel;
}
}
catch (Exception ex)
{
Log.Error("GetContentFromPersistString failed" + Constants.vbNewLine + ex.Message);
}
return null;
}
#endregion
return this._MainForm;
}
set
{
this._MainForm = value;
}
}
#endregion
#region Public Methods
public Load(frmMain MainForm)
{
this._MainForm = MainForm;
}
public void Load_Renamed()
{
try
{
// Migrate settings from previous version
if (My.Settings.Default.DoUpgrade)
{
try
{
My.Settings.Default.Upgrade();
}
catch (Exception ex)
{
Runtime.Log.Error("My.Settings.Upgrade() failed" + Constants.vbNewLine + ex.Message);
}
My.Settings.Default.DoUpgrade = false;
// Clear pending update flag
// This is used for automatic updates, not for settings migration, but it
// needs to be cleared here because we know that we just updated.
My.Settings.Default.UpdatePending = false;
}
App.SupportedCultures.InstantiateSingleton();
if (!(My.Settings.Default.OverrideUICulture == "") && App.SupportedCultures.IsNameSupported(System.Convert.ToString(My.Settings.Default.OverrideUICulture)))
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(System.Convert.ToString(My.Settings.Default.OverrideUICulture));
Runtime.Log.InfoFormat("Override Culture: {0}/{1}", System.Threading.Thread.CurrentThread.CurrentUICulture.Name, System.Threading.Thread.CurrentThread.CurrentUICulture.NativeName);
}
Themes.ThemeManager.LoadTheme(System.Convert.ToString(My.Settings.Default.ThemeName));
this._MainForm.WindowState = FormWindowState.Normal;
if (My.Settings.Default.MainFormState == FormWindowState.Normal)
{
if (!My.Settings.Default.MainFormLocation.IsEmpty)
{
this._MainForm.Location = My.Settings.Default.MainFormLocation;
}
if (!My.Settings.Default.MainFormSize.IsEmpty)
{
this._MainForm.Size = My.Settings.Default.MainFormSize;
}
}
else
{
if (!My.Settings.Default.MainFormRestoreLocation.IsEmpty)
{
this._MainForm.Location = My.Settings.Default.MainFormRestoreLocation;
}
if (!My.Settings.Default.MainFormRestoreSize.IsEmpty)
{
this._MainForm.Size = My.Settings.Default.MainFormRestoreSize;
}
}
if (My.Settings.Default.MainFormState == FormWindowState.Maximized)
{
this._MainForm.WindowState = FormWindowState.Maximized;
}
// Make sure the form is visible on the screen
const int minHorizontal = 300;
const int minVertical = 150;
System.Drawing.Rectangle screenBounds = Screen.FromHandle(this._MainForm.Handle).Bounds;
System.Drawing.Rectangle newBounds = this._MainForm.Bounds;
if (newBounds.Right < screenBounds.Left + minHorizontal)
{
newBounds.X = screenBounds.Left + minHorizontal - newBounds.Width;
}
if (newBounds.Left > screenBounds.Right - minHorizontal)
{
newBounds.X = screenBounds.Right - minHorizontal;
}
if (newBounds.Bottom < screenBounds.Top + minVertical)
{
newBounds.Y = screenBounds.Top + minVertical - newBounds.Height;
}
if (newBounds.Top > screenBounds.Bottom - minVertical)
{
newBounds.Y = screenBounds.Bottom - minVertical;
}
this._MainForm.Location = newBounds.Location;
if (My.Settings.Default.MainFormKiosk == true)
{
this._MainForm.Fullscreen.Value = true;
this._MainForm.mMenViewFullscreen.Checked = true;
}
if (My.Settings.Default.UseCustomPuttyPath)
{
Connection.Protocol.PuttyBase.PuttyPath = System.Convert.ToString(My.Settings.Default.CustomPuttyPath);
}
else
{
Connection.Protocol.PuttyBase.PuttyPath = App.Info.General.PuttyPath;
}
if (My.Settings.Default.ShowSystemTrayIcon)
{
App.Runtime.NotificationAreaIcon = new Tools.Controls.NotificationAreaIcon();
}
if (My.Settings.Default.AutoSaveEveryMinutes > 0)
{
this._MainForm.tmrAutoSave.Interval = System.Convert.ToInt32(My.Settings.Default.AutoSaveEveryMinutes * 60000);
this._MainForm.tmrAutoSave.Enabled = true;
}
My.Settings.Default.ConDefaultPassword = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.ConDefaultPassword), App.Info.General.EncryptionKey);
this.LoadPanelsFromXML();
this.LoadExternalAppsFromXML();
if (My.Settings.Default.AlwaysShowPanelTabs)
{
frmMain.Default.pnlDock.DocumentStyle = DocumentStyle.DockingWindow;
}
if (My.Settings.Default.ResetToolbars == false)
{
LoadToolbarsFromSettings();
}
else
{
SetToolbarsDefault();
}
}
catch (Exception ex)
{
Runtime.Log.Error("Loading settings failed" + Constants.vbNewLine + ex.Message);
}
}
public void SetToolbarsDefault()
{
ToolStripPanelFromString("top").Join(MainForm.tsQuickConnect, new Point(300, 0));
MainForm.tsQuickConnect.Visible = true;
ToolStripPanelFromString("bottom").Join(MainForm.tsExternalTools, new Point(3, 0));
MainForm.tsExternalTools.Visible = false;
}
public void LoadToolbarsFromSettings()
{
if (My.Settings.Default.QuickyTBLocation.X > My.Settings.Default.ExtAppsTBLocation.X)
{
AddDynamicPanels();
AddStaticPanels();
}
else
{
AddStaticPanels();
AddDynamicPanels();
}
}
private void AddStaticPanels()
{
ToolStripPanelFromString(System.Convert.ToString(My.Settings.Default.QuickyTBParentDock)).Join(MainForm.tsQuickConnect, My.Settings.Default.QuickyTBLocation);
MainForm.tsQuickConnect.Visible = System.Convert.ToBoolean(My.Settings.Default.QuickyTBVisible);
}
private void AddDynamicPanels()
{
ToolStripPanelFromString(System.Convert.ToString(My.Settings.Default.ExtAppsTBParentDock)).Join(MainForm.tsExternalTools, My.Settings.Default.ExtAppsTBLocation);
MainForm.tsExternalTools.Visible = System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBVisible);
}
private ToolStripPanel ToolStripPanelFromString(string Panel)
{
switch (Panel.ToLower())
{
case "top":
return MainForm.tsContainer.TopToolStripPanel;
case "bottom":
return MainForm.tsContainer.BottomToolStripPanel;
case "left":
return MainForm.tsContainer.LeftToolStripPanel;
case "right":
return MainForm.tsContainer.RightToolStripPanel;
default:
return MainForm.tsContainer.TopToolStripPanel;
}
}
public void LoadPanelsFromXML()
{
try
{
Runtime.Windows.treePanel = null;
Runtime.Windows.configPanel = null;
Runtime.Windows.errorsPanel = null;
while (MainForm.pnlDock.Contents.Count > 0)
{
WeifenLuo.WinFormsUI.Docking.DockContent dc = (WeifenLuo.WinFormsUI.Docking.DockContent)MainForm.pnlDock.Contents[0];
dc.Close();
}
Runtime.Startup.CreatePanels();
string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.Settings.LayoutFileName;
string newPath = App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.LayoutFileName;
if (File.Exists(newPath))
{
MainForm.pnlDock.LoadFromXml(newPath, GetContentFromPersistString);
#if !PORTABLE
}
else if (File.Exists(oldPath))
{
MainForm.pnlDock.LoadFromXml(oldPath, GetContentFromPersistString);
#endif
}
else
{
Runtime.Startup.SetDefaultLayout();
}
}
catch (Exception ex)
{
Runtime.Log.Error("LoadPanelsFromXML failed" + Constants.vbNewLine + ex.Message);
}
}
public void LoadExternalAppsFromXML()
{
string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.Settings.ExtAppsFilesName;
string newPath = App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.ExtAppsFilesName;
XmlDocument xDom = new XmlDocument();
if (File.Exists(newPath))
{
xDom.Load(newPath);
#if !PORTABLE
}
else if (File.Exists(oldPath))
{
xDom.Load(oldPath);
#endif
}
else
{
return;
}
foreach (XmlElement xEl in xDom.DocumentElement.ChildNodes)
{
Tools.ExternalTool extA = new Tools.ExternalTool();
extA.DisplayName = xEl.Attributes["DisplayName"].Value;
extA.FileName = xEl.Attributes["FileName"].Value;
extA.Arguments = xEl.Attributes["Arguments"].Value;
if (xEl.HasAttribute("WaitForExit"))
{
extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value);
}
if (xEl.HasAttribute("TryToIntegrate"))
{
extA.TryIntegrate = bool.Parse(xEl.Attributes["TryToIntegrate"].Value);
}
Runtime.ExternalTools.Add(extA);
}
MainForm.SwitchToolBarText(System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBShowText));
xDom = null;
frmMain.Default.AddExternalToolsToToolBar();
}
#endregion
#region Private Methods
private IDockContent GetContentFromPersistString(string persistString)
{
// pnlLayout.xml persistence XML fix for refactoring to mRemoteNG
if (persistString.StartsWith("mRemote."))
{
persistString = persistString.Replace("mRemote.", "mRemoteNG.");
}
try
{
if (persistString == typeof(UI.Window.Config).ToString())
{
return Runtime.Windows.configPanel;
}
if (persistString == typeof(UI.Window.Tree).ToString())
{
return Runtime.Windows.treePanel;
}
if (persistString == typeof(UI.Window.ErrorsAndInfos).ToString())
{
return Runtime.Windows.errorsPanel;
}
if (persistString == typeof(UI.Window.Sessions).ToString())
{
return Runtime.Windows.sessionsPanel;
}
if (persistString == typeof(UI.Window.ScreenshotManager).ToString())
{
return Runtime.Windows.screenshotPanel;
}
}
catch (Exception ex)
{
Runtime.Log.Error("GetContentFromPersistString failed" + Constants.vbNewLine + ex.Message);
}
return null;
}
#endregion
}
}

View File

@@ -109,7 +109,7 @@ namespace mRemoteNG.Config.Settings
xmlTextWriter.WriteStartDocument();
xmlTextWriter.WriteStartElement("Apps");
foreach (Tools.ExternalTool extA in ExternalTools)
foreach (Tools.ExternalTool extA in Runtime.ExternalTools)
{
xmlTextWriter.WriteStartElement("App");
xmlTextWriter.WriteAttributeString("DisplayName", "", extA.DisplayName);

View File

@@ -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.Config

View File

@@ -54,7 +54,7 @@ namespace mRemoteNG.Config.Import
treeNode.Text = name;
treeNode.Name = name;
treeNode.Tag = containerInfo;
ContainerList.Add(containerInfo);
Runtime.ContainerList.Add(containerInfo);
ImportComputers(ldapPath, treeNode);
@@ -102,7 +102,7 @@ namespace mRemoteNG.Config.Import
inheritanceInfo.Description = false;
if (parentTreeNode.Tag is Container.Info)
{
connectionInfo.Parent = parentTreeNode.Tag;
connectionInfo.Parent = (Container.Info)parentTreeNode.Tag;
}
connectionInfo.Inherit = inheritanceInfo;
connectionInfo.Name = strDisplayName;
@@ -112,7 +112,7 @@ namespace mRemoteNG.Config.Import
treeNode.Name = strDisplayName;
treeNode.Tag = connectionInfo; //set the nodes tag to the conI
//add connection to connections
ConnectionList.Add(connectionInfo);
Runtime.ConnectionList.Add(connectionInfo);
parentTreeNode.Nodes.Add(treeNode);
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,99 +8,97 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
//using mRemoteNG.App.Runtime;
using mRemoteNG.App;
namespace mRemoteNG.Config.Import
{
public class PortScan
{
public static void Import(IEnumerable hosts, Connection.Protocol.Protocols protocol, TreeNode parentTreeNode)
{
public static void Import(IEnumerable hosts, Connection.Protocol.Protocols protocol, TreeNode parentTreeNode)
foreach (Tools.PortScan.ScanHost host in hosts)
{
foreach (Tools.PortScan.ScanHost host in hosts)
Connection.Protocol.Protocols finalProtocol = default(Connection.Protocol.Protocols);
bool protocolValid = false;
TreeNode treeNode = Tree.Node.AddNode(Tree.Node.Type.Connection, host.HostNameWithoutDomain);
Connection.Info connectionInfo = new Connection.Info();
connectionInfo.Inherit = new Connection.Info.Inheritance(connectionInfo);
connectionInfo.Name = host.HostNameWithoutDomain;
connectionInfo.Hostname = host.HostName;
switch (protocol)
{
Connection.Protocol.Protocols finalProtocol = default(Connection.Protocol.Protocols);
bool protocolValid = false;
TreeNode treeNode = Tree.Node.AddNode(Tree.Node.Type.Connection, host.HostNameWithoutDomain);
Connection.Info connectionInfo = new Connection.Info();
connectionInfo.Inherit = new Connection.Info.Inheritance(connectionInfo);
connectionInfo.Name = host.HostNameWithoutDomain;
connectionInfo.Hostname = host.HostName;
switch (protocol)
{
case Connection.Protocol.Protocols.SSH2:
if (host.SSH)
{
finalProtocol = Connection.Protocol.Protocols.SSH2;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.Telnet:
if (host.Telnet)
{
finalProtocol = Connection.Protocol.Protocols.Telnet;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.HTTP:
if (host.HTTP)
{
finalProtocol = Connection.Protocol.Protocols.HTTP;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.HTTPS:
if (host.HTTPS)
{
finalProtocol = Connection.Protocol.Protocols.HTTPS;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.Rlogin:
if (host.Rlogin)
{
finalProtocol = Connection.Protocol.Protocols.Rlogin;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.RDP:
if (host.RDP)
{
finalProtocol = Connection.Protocol.Protocols.RDP;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.VNC:
if (host.VNC)
{
finalProtocol = Connection.Protocol.Protocols.VNC;
protocolValid = true;
}
break;
}
if (protocolValid)
{
connectionInfo.Protocol = finalProtocol;
connectionInfo.SetDefaultPort();
treeNode.Tag = connectionInfo;
parentTreeNode.Nodes.Add(treeNode);
if (parentTreeNode.Tag is Container.Info)
case Connection.Protocol.Protocols.SSH2:
if (host.SSH)
{
connectionInfo.Parent = parentTreeNode.Tag;
finalProtocol = Connection.Protocol.Protocols.SSH2;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.Telnet:
if (host.Telnet)
{
finalProtocol = Connection.Protocol.Protocols.Telnet;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.HTTP:
if (host.HTTP)
{
finalProtocol = Connection.Protocol.Protocols.HTTP;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.HTTPS:
if (host.HTTPS)
{
finalProtocol = Connection.Protocol.Protocols.HTTPS;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.Rlogin:
if (host.Rlogin)
{
finalProtocol = Connection.Protocol.Protocols.Rlogin;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.RDP:
if (host.RDP)
{
finalProtocol = Connection.Protocol.Protocols.RDP;
protocolValid = true;
}
break;
case Connection.Protocol.Protocols.VNC:
if (host.VNC)
{
finalProtocol = Connection.Protocol.Protocols.VNC;
protocolValid = true;
}
break;
}
if (protocolValid)
{
connectionInfo.Protocol = finalProtocol;
connectionInfo.SetDefaultPort();
ConnectionList.Add(connectionInfo);
treeNode.Tag = connectionInfo;
parentTreeNode.Nodes.Add(treeNode);
if (parentTreeNode.Tag is Container.Info)
{
connectionInfo.Parent = (Container.Info)parentTreeNode.Tag;
}
Runtime.ConnectionList.Add(connectionInfo);
}
}
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,197 +8,195 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.Xml;
using System.IO;
//using mRemoteNG.App.Runtime;
using mRemoteNG.App;
using mRemoteNG.Connection.Protocol;
namespace mRemoteNG.Config.Import
{
public class PuttyConnectionManager
{
public static void Import(string fileName, TreeNode parentTreeNode)
{
public static void Import(string fileName, TreeNode parentTreeNode)
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(fileName);
XmlNode configurationNode = xmlDocument.SelectSingleNode("/configuration");
//Dim version As New Version(configurationNode.Attributes("version").Value)
//If Not version = New Version(0, 7, 1, 136) Then
// Throw New FileFormatException(String.Format("Unsupported file version ({0}).", version))
//End If
foreach (XmlNode rootNode in configurationNode.SelectNodes("./root"))
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(fileName);
XmlNode configurationNode = xmlDocument.SelectSingleNode("/configuration");
//Dim version As New Version(configurationNode.Attributes("version").Value)
//If Not version = New Version(0, 7, 1, 136) Then
// Throw New FileFormatException(String.Format("Unsupported file version ({0}).", version))
//End If
foreach (XmlNode rootNode in configurationNode.SelectNodes("./root"))
{
ImportRootOrContainer(rootNode, parentTreeNode);
}
}
private static void ImportRootOrContainer(XmlNode xmlNode, TreeNode parentTreeNode)
{
string xmlNodeType = xmlNode.Attributes["type"].Value;
switch (xmlNode.Name)
{
case "root":
if (!(string.Compare(strA: ref xmlNodeType, strB: "database", ignoreCase: true) == 0))
{
throw (new FileFormatException(string.Format("Unrecognized root node type ({0}).", xmlNodeType)));
}
break;
case "container":
if (!(string.Compare(strA: ref xmlNodeType, strB: "folder", ignoreCase: true) == 0))
{
throw (new FileFormatException(string.Format("Unrecognized root node type ({0}).", xmlNodeType)));
}
break;
default:
// ReSharper disable once LocalizableElement
throw (new ArgumentException("Argument must be either a root or a container node.", "xmlNode"));
break;
}
if (parentTreeNode == null)
{
throw (new InvalidOperationException("parentInfo.TreeNode must not be null."));
}
string name = xmlNode.Attributes["name"].Value;
TreeNode treeNode = new TreeNode(name);
parentTreeNode.Nodes.Add(treeNode);
Container.Info containerInfo = new Container.Info();
containerInfo.TreeNode = treeNode;
containerInfo.Name = name;
Connection.Info connectionInfo = CreateConnectionInfo(name);
connectionInfo.Parent = containerInfo;
connectionInfo.IsContainer = true;
containerInfo.ConnectionInfo = connectionInfo;
// We can only inherit from a container node, not the root node or connection nodes
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container)
{
containerInfo.Parent = parentTreeNode.Tag;
}
else
{
connectionInfo.Inherit.TurnOffInheritanceCompletely();
}
treeNode.Name = name;
treeNode.Tag = containerInfo;
treeNode.ImageIndex = Images.Enums.TreeImage.Container;
treeNode.SelectedImageIndex = Images.Enums.TreeImage.Container;
foreach (XmlNode childNode in xmlNode.SelectNodes("./*"))
{
switch (childNode.Name)
{
case "container":
ImportRootOrContainer(childNode, treeNode);
break;
case "connection":
ImportConnection(childNode, treeNode);
break;
default:
throw (new FileFormatException(string.Format("Unrecognized child node ({0}).", childNode.Name)));
break;
}
}
containerInfo.IsExpanded = bool.Parse(xmlNode.Attributes["expanded"].InnerText);
if (containerInfo.IsExpanded)
{
treeNode.Expand();
}
ContainerList.Add(containerInfo);
}
private static void ImportConnection(XmlNode connectionNode, TreeNode parentTreeNode)
{
string connectionNodeType = connectionNode.Attributes["type"].Value;
if (!(string.Compare(strA: ref connectionNodeType, strB: "PuTTY", ignoreCase: true) == 0))
{
throw (new FileFormatException(string.Format("Unrecognized connection node type ({0}).", connectionNodeType)));
}
string name = connectionNode.Attributes["name"].Value;
TreeNode treeNode = new TreeNode(name);
parentTreeNode.Nodes.Add(treeNode);
Connection.Info connectionInfo = ConnectionInfoFromXml(connectionNode);
connectionInfo.TreeNode = treeNode;
connectionInfo.Parent = parentTreeNode.Tag;
treeNode.Name = name;
treeNode.Tag = connectionInfo;
treeNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed;
treeNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed;
ConnectionList.Add(connectionInfo);
}
private static Connection.Info CreateConnectionInfo(string name)
{
Connection.Info connectionInfo = new Connection.Info();
connectionInfo.Inherit = new Connection.Info.Inheritance(connectionInfo);
connectionInfo.Name = name;
return connectionInfo;
}
private static Connection.Info ConnectionInfoFromXml(XmlNode xmlNode)
{
XmlNode connectionInfoNode = xmlNode.SelectSingleNode("./connection_info");
string name = connectionInfoNode.SelectSingleNode("./name").InnerText;
Connection.Info connectionInfo = CreateConnectionInfo(name);
string protocol = connectionInfoNode.SelectSingleNode("./protocol").InnerText;
switch (protocol.ToLowerInvariant())
{
case "telnet":
connectionInfo.Protocol = Protocols.Telnet;
break;
case "ssh":
connectionInfo.Protocol = Protocols.SSH2;
break;
default:
throw (new FileFormatException(string.Format("Unrecognized protocol ({0}).", protocol)));
break;
}
connectionInfo.Hostname = connectionInfoNode.SelectSingleNode("./host").InnerText;
connectionInfo.Port = (int) (connectionInfoNode.SelectSingleNode("./port").InnerText);
connectionInfo.PuttySession = connectionInfoNode.SelectSingleNode("./session").InnerText;
// ./commandline
connectionInfo.Description = connectionInfoNode.SelectSingleNode("./description").InnerText;
XmlNode loginNode = xmlNode.SelectSingleNode("./login");
connectionInfo.Username = loginNode.SelectSingleNode("login").InnerText;
connectionInfo.Password = loginNode.SelectSingleNode("password").InnerText;
// ./prompt
// ./timeout/connectiontimeout
// ./timeout/logintimeout
// ./timeout/passwordtimeout
// ./timeout/commandtimeout
// ./command/command1
// ./command/command2
// ./command/command3
// ./command/command4
// ./command/command5
// ./options/loginmacro
// ./options/postcommands
// ./options/endlinechar
return connectionInfo;
ImportRootOrContainer(rootNode, parentTreeNode);
}
}
private static void ImportRootOrContainer(XmlNode xmlNode, TreeNode parentTreeNode)
{
string xmlNodeType = xmlNode.Attributes["type"].Value;
switch (xmlNode.Name)
{
case "root":
if (!(string.Compare(xmlNodeType, "database", ignoreCase: true) == 0))
{
throw (new FileFormatException(string.Format("Unrecognized root node type ({0}).", xmlNodeType)));
}
break;
case "container":
if (!(string.Compare(xmlNodeType, "folder", ignoreCase: true) == 0))
{
throw (new FileFormatException(string.Format("Unrecognized root node type ({0}).", xmlNodeType)));
}
break;
default:
// ReSharper disable once LocalizableElement
throw (new ArgumentException("Argument must be either a root or a container node.", "xmlNode"));
break;
}
if (parentTreeNode == null)
{
throw (new InvalidOperationException("parentInfo.TreeNode must not be null."));
}
string name = xmlNode.Attributes["name"].Value;
TreeNode treeNode = new TreeNode(name);
parentTreeNode.Nodes.Add(treeNode);
Container.Info containerInfo = new Container.Info();
containerInfo.TreeNode = treeNode;
containerInfo.Name = name;
Connection.Info connectionInfo = CreateConnectionInfo(name);
connectionInfo.Parent = containerInfo;
connectionInfo.IsContainer = true;
containerInfo.ConnectionInfo = connectionInfo;
// We can only inherit from a container node, not the root node or connection nodes
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container)
{
containerInfo.Parent = parentTreeNode.Tag;
}
else
{
connectionInfo.Inherit.TurnOffInheritanceCompletely();
}
treeNode.Name = name;
treeNode.Tag = containerInfo;
treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container;
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container;
foreach (XmlNode childNode in xmlNode.SelectNodes("./*"))
{
switch (childNode.Name)
{
case "container":
ImportRootOrContainer(childNode, treeNode);
break;
case "connection":
ImportConnection(childNode, treeNode);
break;
default:
throw (new FileFormatException(string.Format("Unrecognized child node ({0}).", childNode.Name)));
break;
}
}
containerInfo.IsExpanded = bool.Parse(xmlNode.Attributes["expanded"].InnerText);
if (containerInfo.IsExpanded)
{
treeNode.Expand();
}
Runtime.ContainerList.Add(containerInfo);
}
private static void ImportConnection(XmlNode connectionNode, TreeNode parentTreeNode)
{
string connectionNodeType = connectionNode.Attributes["type"].Value;
if (!(string.Compare(connectionNodeType, "PuTTY", ignoreCase: true) == 0))
{
throw (new FileFormatException(string.Format("Unrecognized connection node type ({0}).", connectionNodeType)));
}
string name = connectionNode.Attributes["name"].Value;
TreeNode treeNode = new TreeNode(name);
parentTreeNode.Nodes.Add(treeNode);
Connection.Info connectionInfo = ConnectionInfoFromXml(connectionNode);
connectionInfo.TreeNode = treeNode;
connectionInfo.Parent = (Container.Info)parentTreeNode.Tag;
treeNode.Name = name;
treeNode.Tag = connectionInfo;
treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
Runtime.ConnectionList.Add(connectionInfo);
}
private static Connection.Info CreateConnectionInfo(string name)
{
Connection.Info connectionInfo = new Connection.Info();
connectionInfo.Inherit = new Connection.Info.Inheritance(connectionInfo);
connectionInfo.Name = name;
return connectionInfo;
}
private static Connection.Info ConnectionInfoFromXml(XmlNode xmlNode)
{
XmlNode connectionInfoNode = xmlNode.SelectSingleNode("./connection_info");
string name = connectionInfoNode.SelectSingleNode("./name").InnerText;
Connection.Info connectionInfo = CreateConnectionInfo(name);
string protocol = connectionInfoNode.SelectSingleNode("./protocol").InnerText;
switch (protocol.ToLowerInvariant())
{
case "telnet":
connectionInfo.Protocol = Protocols.Telnet;
break;
case "ssh":
connectionInfo.Protocol = Protocols.SSH2;
break;
default:
throw (new FileFormatException(string.Format("Unrecognized protocol ({0}).", protocol)));
break;
}
connectionInfo.Hostname = connectionInfoNode.SelectSingleNode("./host").InnerText;
connectionInfo.Port = System.Convert.ToInt32(connectionInfoNode.SelectSingleNode("./port").InnerText);
connectionInfo.PuttySession = connectionInfoNode.SelectSingleNode("./session").InnerText;
// ./commandline
connectionInfo.Description = connectionInfoNode.SelectSingleNode("./description").InnerText;
XmlNode loginNode = xmlNode.SelectSingleNode("./login");
connectionInfo.Username = loginNode.SelectSingleNode("login").InnerText;
connectionInfo.Password = loginNode.SelectSingleNode("password").InnerText;
// ./prompt
// ./timeout/connectiontimeout
// ./timeout/logintimeout
// ./timeout/passwordtimeout
// ./timeout/commandtimeout
// ./command/command1
// ./command/command2
// ./command/command3
// ./command/command4
// ./command/command5
// ./options/loginmacro
// ./options/postcommands
// ./options/endlinechar
return connectionInfo;
}
}
}

View File

@@ -31,13 +31,13 @@ namespace mRemoteNG.Config.Import
if (treeNode.Parent.Tag is Container.Info)
{
connectionInfo.Parent = treeNode.Parent.Tag;
connectionInfo.Parent = (Container.Info)treeNode.Parent.Tag;
}
treeNode.Name = name;
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;
foreach (string line in lines)
{
@@ -53,7 +53,7 @@ namespace mRemoteNG.Config.Import
SetConnectionInfoParameter(connectionInfo, key, value);
}
ConnectionList.Add(connectionInfo);
Runtime.ConnectionList.Add(connectionInfo);
}
private static void SetConnectionInfoParameter(Connection.Info connectionInfo, string key, string value)
@@ -72,7 +72,7 @@ namespace mRemoteNG.Config.Import
}
break;
case "server port":
connectionInfo.Port = value;
connectionInfo.Port = System.Convert.ToInt32(value);
break;
case "username":
connectionInfo.Username = value;

View File

@@ -25,7 +25,7 @@ namespace mRemoteNG.Config.Import
xmlDocument.Load(fileName);
XmlNode rdcManNode = xmlDocument.SelectSingleNode("/RDCMan");
int schemaVersion = (int) (rdcManNode.Attributes["schemaVersion"].Value);
int schemaVersion = System.Convert.ToInt32(rdcManNode.Attributes["schemaVersion"].Value);
if (!(schemaVersion == 1))
{
throw (new FileFormatException(string.Format("Unsupported schema version ({0}).", schemaVersion)));
@@ -71,8 +71,8 @@ namespace mRemoteNG.Config.Import
treeNode.Name = name;
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;
foreach (XmlNode childNode in xmlNode.SelectNodes("./group|./server"))
{
@@ -104,12 +104,12 @@ namespace mRemoteNG.Config.Import
Connection.Info connectionInfo = ConnectionInfoFromXml(serverNode);
connectionInfo.TreeNode = treeNode;
connectionInfo.Parent = parentTreeNode.Tag;
connectionInfo.Parent = (Container.Info)parentTreeNode.Tag;
treeNode.Name = name;
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;
Runtime.ConnectionList.Add(connectionInfo);
}
@@ -166,7 +166,7 @@ namespace mRemoteNG.Config.Import
connectionInfo.UseConsoleSession = bool.Parse(connectionSettingsNode.SelectSingleNode("./connectToConsole").InnerText);
// ./startProgram
// ./workingDir
connectionInfo.Port = (int) (connectionSettingsNode.SelectSingleNode("./port").InnerText);
connectionInfo.Port = System.Convert.ToInt32(connectionSettingsNode.SelectSingleNode("./port").InnerText);
}
else
{
@@ -219,7 +219,7 @@ namespace mRemoteNG.Config.Import
string resolutionString = System.Convert.ToString(remoteDesktopNode.SelectSingleNode("./size").InnerText.Replace(" ", ""));
try
{
connectionInfo.Resolution = "Res" + System.Convert.ToString(Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDP.RDPResolutions), resolutionString));
connectionInfo.Resolution = (Connection.Protocol.RDP.RDPResolutions)Enum.Parse(typeof(Connection.Protocol.RDP.RDPResolutions), "Res" + resolutionString);
}
catch (ArgumentException)
{
@@ -235,8 +235,9 @@ namespace mRemoteNG.Config.Import
{
connectionInfo.Resolution = RDP.RDPResolutions.Fullscreen;
}
connectionInfo.Colors = remoteDesktopNode.SelectSingleNode("./colorDepth").InnerText;
connectionInfo.Colors = (Connection.Protocol.RDP.RDPColors)Enum.Parse(typeof(Connection.Protocol.RDP.RDPColors), remoteDesktopNode.SelectSingleNode("./colorDepth").InnerText);
}
else
{
@@ -249,13 +250,13 @@ namespace mRemoteNG.Config.Import
{
switch (localResourcesNode.SelectSingleNode("./audioRedirection").InnerText)
{
case 0: // Bring to this computer
case "0": // Bring to this computer
connectionInfo.RedirectSound = RDP.RDPSounds.BringToThisComputer;
break;
case 1: // Leave at remote computer
case "1": // Leave at remote computer
connectionInfo.RedirectSound = RDP.RDPSounds.LeaveAtRemoteComputer;
break;
case 2: // Do not play
case "2": // Do not play
connectionInfo.RedirectSound = RDP.RDPSounds.DoNotPlay;
break;
}
@@ -265,13 +266,13 @@ namespace mRemoteNG.Config.Import
switch (localResourcesNode.SelectSingleNode("./keyboardHook").InnerText)
{
case 0: // On the local computer
case "0": // On the local computer
connectionInfo.RedirectKeys = false;
break;
case 1: // On the remote computer
case "1": // On the remote computer
connectionInfo.RedirectKeys = true;
break;
case 2: // In full screen mode only
case "2": // In full screen mode only
connectionInfo.RedirectKeys = false;
break;
}
@@ -297,13 +298,13 @@ namespace mRemoteNG.Config.Import
{
switch (securitySettingsNode.SelectSingleNode("./authentication").InnerText)
{
case 0: // No authentication
case "0": // No authentication
connectionInfo.RDPAuthenticationLevel = RDP.AuthenticationLevel.NoAuth;
break;
case 1: // Do not connect if authentication fails
case "1": // Do not connect if authentication fails
connectionInfo.RDPAuthenticationLevel = RDP.AuthenticationLevel.AuthRequired;
break;
case 2: // Warn if authentication fails
case "2": // Warn if authentication fails
connectionInfo.RDPAuthenticationLevel = RDP.AuthenticationLevel.WarnOnFailedAuth;
break;
}
@@ -337,10 +338,10 @@ namespace mRemoteNG.Config.Import
Win32.DATA_BLOB ciphertextData = new Win32.DATA_BLOB();
ciphertextData.cbData = ciphertextArray.Length;
ciphertextData.pbData = gcHandle.AddrOfPinnedObject();
Win32.DATA_BLOB temp_optionalEntropy = null;
IntPtr temp_promptStruct = null;
if (!Win32.CryptUnprotectData(ref ciphertextData, null, ref temp_optionalEntropy, null, ref temp_promptStruct, 0, ref plaintextData))
Win32.DATA_BLOB temp_optionalEntropy = new Win32.DATA_BLOB();
IntPtr temp_promptStruct = IntPtr.Zero;
if (!Win32.CryptUnprotectData(ref ciphertextData, null, ref temp_optionalEntropy, IntPtr.Zero, ref temp_promptStruct, 0, ref plaintextData))
{
return null;
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,59 +8,57 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.IO;
//using mRemoteNG.App.Runtime;
using mRemoteNG.App;
namespace mRemoteNG.Config.Import
{
// ReSharper disable once InconsistentNaming
public class mRemoteNG
{
public static void Import(string fileName, TreeNode parentTreeNode)
{
public static void Import(string fileName, TreeNode parentTreeNode)
string name = Path.GetFileNameWithoutExtension(fileName);
TreeNode treeNode = new TreeNode(name);
parentTreeNode.Nodes.Add(treeNode);
Container.Info containerInfo = new Container.Info();
containerInfo.TreeNode = treeNode;
containerInfo.Name = name;
Connection.Info connectionInfo = new Connection.Info();
connectionInfo.Inherit = new Connection.Info.Inheritance(connectionInfo);
connectionInfo.Name = name;
connectionInfo.TreeNode = treeNode;
connectionInfo.Parent = containerInfo;
connectionInfo.IsContainer = true;
containerInfo.ConnectionInfo = connectionInfo;
// We can only inherit from a container node, not the root node or connection nodes
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container)
{
string name = Path.GetFileNameWithoutExtension(fileName);
TreeNode treeNode = new TreeNode(name);
parentTreeNode.Nodes.Add(treeNode);
Container.Info containerInfo = new Container.Info();
containerInfo.TreeNode = treeNode;
containerInfo.Name = name;
Connection.Info connectionInfo = new Connection.Info();
connectionInfo.Inherit = new Connection.Info.Inheritance(connectionInfo);
connectionInfo.Name = name;
connectionInfo.TreeNode = treeNode;
connectionInfo.Parent = containerInfo;
connectionInfo.IsContainer = true;
containerInfo.ConnectionInfo = connectionInfo;
// We can only inherit from a container node, not the root node or connection nodes
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container)
{
containerInfo.Parent = parentTreeNode.Tag;
}
else
{
connectionInfo.Inherit.TurnOffInheritanceCompletely();
}
treeNode.Name = name;
treeNode.Tag = containerInfo;
treeNode.ImageIndex = Images.Enums.TreeImage.Container;
treeNode.SelectedImageIndex = Images.Enums.TreeImage.Container;
Connections.Load connectionsLoad = new Connections.Load();
connectionsLoad.ConnectionFileName = fileName;
connectionsLoad.RootTreeNode = treeNode;
connectionsLoad.ConnectionList = ConnectionList;
connectionsLoad.ContainerList = ContainerList;
connectionsLoad.Load_Renamed(true);
ContainerList.Add(containerInfo);
containerInfo.Parent = parentTreeNode.Tag;
}
else
{
connectionInfo.Inherit.TurnOffInheritanceCompletely();
}
treeNode.Name = name;
treeNode.Tag = containerInfo;
treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container;
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container;
Connections.Load connectionsLoad = new Connections.Load();
connectionsLoad.ConnectionFileName = fileName;
connectionsLoad.RootTreeNode = treeNode;
connectionsLoad.ConnectionList = Runtime.ConnectionList;
connectionsLoad.ContainerList = Runtime.ContainerList;
connectionsLoad.Load_Renamed(true);
Runtime.ContainerList.Add(containerInfo);
}
}
}

View File

@@ -69,7 +69,7 @@ namespace mRemoteNG.Config
public static ShortcutCommand CommandFromHookKeyMessage(Message m)
{
KeyboardHook.HookKeyMsgData msgData = Marshal.PtrToStructure(m.LParam, typeof(KeyboardHook.HookKeyMsgData));
KeyboardHook.HookKeyMsgData msgData = (SharedLibraryNG.KeyboardHook.HookKeyMsgData)Marshal.PtrToStructure(m.LParam, typeof(KeyboardHook.HookKeyMsgData));
return Map.GetCommand(msgData.KeyCode, msgData.ModifierKeys);
}
#endregion
@@ -386,7 +386,7 @@ namespace mRemoteNG.Config
#region Public Methods
public string ToConfigString()
{
return string.Join("/", new string[] {KeyCode, Convert.ToInt32(ModifierKeys)});
return string.Join("/", new string[] {KeyCode.ToString(), (Convert.ToInt32(ModifierKeys)).ToString()});
}
public static ShortcutKey FromConfigString(string shortcutKeyString)
@@ -396,12 +396,12 @@ namespace mRemoteNG.Config
{
throw (new ArgumentException(string.Format("ShortcutKey.FromString({0}) failed. parts.Length != 2", shortcutKeyString), shortcutKeyString));
}
return new ShortcutKey(Convert.ToInt32(parts[0]), Convert.ToInt32(parts[1]));
return new ShortcutKey(Convert.ToInt32(parts[0]), (SharedLibraryNG.KeyboardHook.ModifierKeys)Convert.ToInt32(parts[1]));
}
public override string ToString()
{
return HotkeyControl.KeysToString(this);
return HotkeyControl.KeysToString((System.Windows.Forms.Keys)this.KeyCode);
}
public bool Equals(ShortcutKey other)

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,152 +8,149 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.My;
namespace mRemoteNG.Config.Putty
{
public abstract class Provider
{
#region Public Methods
private TreeNode _rootTreeNode;
public TreeNode RootTreeNode
{
#region Public Methods
private TreeNode _rootTreeNode;
public TreeNode RootTreeNode
get
{
get
if (_rootTreeNode == null)
{
if (_rootTreeNode == null)
{
_rootTreeNode = CreateRootTreeNode();
}
return _rootTreeNode;
_rootTreeNode = CreateRootTreeNode();
}
return _rootTreeNode;
}
private Root.PuttySessions.Info _rootInfo;
public Root.PuttySessions.Info RootInfo
{
get
{
if (_rootInfo == null)
{
_rootInfo = CreateRootInfo();
}
return _rootInfo;
}
}
public abstract string[] GetSessionNames(bool raw = false);
public abstract Connection.PuttySession.Info GetSession(string sessionName);
public virtual Connection.PuttySession.Info[] GetSessions()
{
List<Connection.PuttySession.Info> sessionList = new List<Connection.PuttySession.Info>();
Connection.Info sessionInfo = default(Connection.Info);
foreach (string sessionName in GetSessionNames(true))
{
sessionInfo = GetSession(sessionName);
if (sessionInfo == null || string.IsNullOrEmpty(sessionInfo.Hostname))
{
continue;
}
sessionList.Add(sessionInfo);
}
return sessionList.ToArray();
}
public virtual void StartWatcher()
{
}
public virtual void StopWatcher()
{
}
#endregion
#region Public Events
public delegate void SessionChangedEventHandler(object sender, SessionChangedEventArgs e);
private SessionChangedEventHandler SessionChangedEvent;
public event SessionChangedEventHandler SessionChanged
{
add
{
SessionChangedEvent = (SessionChangedEventHandler) System.Delegate.Combine(SessionChangedEvent, value);
}
remove
{
SessionChangedEvent = (SessionChangedEventHandler) System.Delegate.Remove(SessionChangedEvent, value);
}
}
#endregion
#region Public Classes
public class SessionChangedEventArgs : EventArgs
{
}
#endregion
#region Protected Methods
private delegate TreeNode CreateRootTreeNodeDelegate();
protected virtual TreeNode CreateRootTreeNode()
{
TreeView treeView = Tree.Node.TreeView;
if (treeView == null)
{
return null;
}
if (treeView.InvokeRequired)
{
return treeView.Invoke(new CreateRootTreeNodeDelegate(CreateRootTreeNode));
}
TreeNode newTreeNode = new TreeNode();
RootInfo.TreeNode = newTreeNode;
newTreeNode.Name = _rootInfo.Name;
newTreeNode.Text = _rootInfo.Name;
newTreeNode.Tag = _rootInfo;
newTreeNode.ImageIndex = Images.Enums.TreeImage.PuttySessions;
newTreeNode.SelectedImageIndex = Images.Enums.TreeImage.PuttySessions;
return newTreeNode;
}
protected virtual Root.PuttySessions.Info CreateRootInfo()
{
Root.PuttySessions.Info newRootInfo = new Root.PuttySessions.Info();
if (string.IsNullOrEmpty(System.Convert.ToString(My.Settings.Default.PuttySavedSessionsName)))
{
newRootInfo.Name = Language.strPuttySavedSessionsRootName;
}
else
{
newRootInfo.Name = System.Convert.ToString(My.Settings.Default.PuttySavedSessionsName);
}
if (string.IsNullOrEmpty(System.Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel)))
{
newRootInfo.Panel = Language.strGeneral;
}
else
{
newRootInfo.Panel = System.Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel);
}
return newRootInfo;
}
protected virtual void OnSessionChanged(SessionChangedEventArgs e)
{
if (SessionChangedEvent != null)
SessionChangedEvent(this, new SessionChangedEventArgs());
}
#endregion
}
private Root.PuttySessions.Info _rootInfo;
public Root.PuttySessions.Info RootInfo
{
get
{
if (_rootInfo == null)
{
_rootInfo = CreateRootInfo();
}
return _rootInfo;
}
}
public abstract string[] GetSessionNames(bool raw = false);
public abstract Connection.PuttySession.Info GetSession(string sessionName);
public virtual Connection.PuttySession.Info[] GetSessions()
{
List<Connection.PuttySession.Info> sessionList = new List<Connection.PuttySession.Info>();
Connection.PuttySession.Info sessionInfo = (Connection.PuttySession.Info)default(Connection.Info);
foreach (string sessionName in GetSessionNames(true))
{
sessionInfo = GetSession(sessionName);
if (sessionInfo == null || string.IsNullOrEmpty(sessionInfo.Hostname))
{
continue;
}
sessionList.Add(sessionInfo);
}
return sessionList.ToArray();
}
public virtual void StartWatcher()
{
}
public virtual void StopWatcher()
{
}
#endregion
#region Public Events
public delegate void SessionChangedEventHandler(object sender, SessionChangedEventArgs e);
private SessionChangedEventHandler SessionChangedEvent;
public event SessionChangedEventHandler SessionChanged
{
add
{
SessionChangedEvent = (SessionChangedEventHandler) System.Delegate.Combine(SessionChangedEvent, value);
}
remove
{
SessionChangedEvent = (SessionChangedEventHandler) System.Delegate.Remove(SessionChangedEvent, value);
}
}
#endregion
#region Public Classes
public class SessionChangedEventArgs : EventArgs
{
}
#endregion
#region Protected Methods
private delegate TreeNode CreateRootTreeNodeDelegate();
protected virtual TreeNode CreateRootTreeNode()
{
TreeView treeView = Tree.Node.TreeView;
if (treeView == null)
{
return null;
}
if (treeView.InvokeRequired)
{
return (TreeNode)treeView.Invoke(new CreateRootTreeNodeDelegate(CreateRootTreeNode));
}
TreeNode newTreeNode = new TreeNode();
RootInfo.TreeNode = newTreeNode;
newTreeNode.Name = _rootInfo.Name;
newTreeNode.Text = _rootInfo.Name;
newTreeNode.Tag = _rootInfo;
newTreeNode.ImageIndex = (int)Images.Enums.TreeImage.PuttySessions;
newTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.PuttySessions;
return newTreeNode;
}
protected virtual Root.PuttySessions.Info CreateRootInfo()
{
Root.PuttySessions.Info newRootInfo = new Root.PuttySessions.Info();
if (string.IsNullOrEmpty(System.Convert.ToString(My.Settings.Default.PuttySavedSessionsName)))
{
newRootInfo.Name = Language.strPuttySavedSessionsRootName;
}
else
{
newRootInfo.Name = System.Convert.ToString(My.Settings.Default.PuttySavedSessionsName);
}
if (string.IsNullOrEmpty(System.Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel)))
{
newRootInfo.Panel = Language.strGeneral;
}
else
{
newRootInfo.Panel = System.Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel);
}
return newRootInfo;
}
protected virtual void OnSessionChanged(SessionChangedEventArgs e)
{
if (SessionChangedEvent != null)
SessionChangedEvent(this, new SessionChangedEventArgs());
}
#endregion
}
}

View File

@@ -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.Management;
using mRemoteNG.App;
using mRemoteNG.Messages;
@@ -22,158 +19,157 @@ using System.Security.Principal;
namespace mRemoteNG.Config.Putty
{
public class RegistryProvider : Provider
{
#region Public Methods
public override string[] GetSessionNames(bool raw = false)
{
#region Public Methods
public override string[] GetSessionNames(bool raw = false)
RegistryKey sessionsKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey);
if (sessionsKey == null)
{
RegistryKey sessionsKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey);
if (sessionsKey == null)
{
return new string[] {};
}
List<string> sessionNames = new List<string>();
foreach (string sessionName in sessionsKey.GetSubKeyNames())
{
if (raw)
{
sessionNames.Add(sessionName);
}
else
{
sessionNames.Add(System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B")));
}
}
return new string[] {};
}
List<string> sessionNames = new List<string>();
foreach (string sessionName in sessionsKey.GetSubKeyNames())
{
if (raw)
{
if (!sessionNames.Contains("Default%20Settings")) // Do not localize
{
sessionNames.Insert(0, "Default%20Settings");
}
sessionNames.Add(sessionName);
}
else
{
if (!sessionNames.Contains("Default Settings"))
{
sessionNames.Insert(0, "Default Settings");
}
sessionNames.Add(System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B")));
}
return sessionNames.ToArray();
}
public override Connection.PuttySession.Info GetSession(string sessionName)
if (raw)
{
RegistryKey sessionsKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey);
if (sessionsKey == null)
if (!sessionNames.Contains("Default%20Settings")) // Do not localize
{
sessionNames.Insert(0, "Default%20Settings");
}
}
else
{
if (!sessionNames.Contains("Default Settings"))
{
sessionNames.Insert(0, "Default Settings");
}
}
return sessionNames.ToArray();
}
public override Connection.PuttySession.Info GetSession(string sessionName)
{
RegistryKey sessionsKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey);
if (sessionsKey == null)
{
return null;
}
RegistryKey sessionKey = sessionsKey.OpenSubKey(sessionName);
if (sessionKey == null)
{
return null;
}
sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"));
Connection.PuttySession.Info sessionInfo = new Connection.PuttySession.Info();
sessionInfo.PuttySession = sessionName;
sessionInfo.Name = sessionName;
sessionInfo.Hostname = System.Convert.ToString(sessionKey.GetValue("HostName"));
sessionInfo.Username = System.Convert.ToString(sessionKey.GetValue("UserName"));
string protocol = System.Convert.ToString(sessionKey.GetValue("Protocol"));
if (protocol == null)
{
protocol = "ssh";
}
switch (protocol.ToLowerInvariant())
{
case "raw":
sessionInfo.Protocol = Protocols.RAW;
break;
case "rlogin":
sessionInfo.Protocol = Protocols.Rlogin;
break;
case "serial":
return null;
}
RegistryKey sessionKey = sessionsKey.OpenSubKey(sessionName);
if (sessionKey == null)
{
return null;
}
sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"));
Connection.PuttySession.Info sessionInfo = new Connection.PuttySession.Info();
sessionInfo.PuttySession = sessionName;
sessionInfo.Name = sessionName;
sessionInfo.Hostname = System.Convert.ToString(sessionKey.GetValue("HostName"));
sessionInfo.Username = System.Convert.ToString(sessionKey.GetValue("UserName"));
string protocol = System.Convert.ToString(sessionKey.GetValue("Protocol"));
if (protocol == null)
{
protocol = "ssh";
}
switch (protocol.ToLowerInvariant())
{
case "raw":
sessionInfo.Protocol = Protocols.RAW;
break;
case "rlogin":
sessionInfo.Protocol = Protocols.Rlogin;
break;
case "serial":
return null;
case "ssh":
object sshVersionObject = sessionKey.GetValue("SshProt");
if (sshVersionObject != null)
{
int sshVersion = System.Convert.ToInt32(sshVersionObject);
if (sshVersion >= 2)
{
sessionInfo.Protocol = Protocols.SSH2;
}
else
{
sessionInfo.Protocol = Protocols.SSH1;
}
}
else
case "ssh":
object sshVersionObject = sessionKey.GetValue("SshProt");
if (sshVersionObject != null)
{
int sshVersion = System.Convert.ToInt32(sshVersionObject);
if (sshVersion >= 2)
{
sessionInfo.Protocol = Protocols.SSH2;
}
break;
case "telnet":
sessionInfo.Protocol = Protocols.Telnet;
break;
default:
return null;
}
sessionInfo.Port = System.Convert.ToInt32(sessionKey.GetValue("PortNumber"));
else
{
sessionInfo.Protocol = Protocols.SSH1;
}
}
else
{
sessionInfo.Protocol = Protocols.SSH2;
}
break;
case "telnet":
sessionInfo.Protocol = Protocols.Telnet;
break;
default:
return null;
}
sessionInfo.Port = System.Convert.ToInt32(sessionKey.GetValue("PortNumber"));
return sessionInfo;
}
public override void StartWatcher()
{
if (_eventWatcher != null)
{
return ;
}
try
{
string currentUserSid = WindowsIdentity.GetCurrent().User.Value;
string key = System.Convert.ToString(string.Join("\\", new[] {currentUserSid, PuttySessionsKey}).Replace("\\", "\\\\"));
WqlEventQuery query = new WqlEventQuery(string.Format("SELECT * FROM RegistryTreeChangeEvent WHERE Hive = \'HKEY_USERS\' AND RootPath = \'{0}\'", key));
_eventWatcher = new ManagementEventWatcher(query);
_eventWatcher.EventArrived += OnManagementEventArrived;
_eventWatcher.Start();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("PuttySessions.Watcher.StartWatching() failed.", ex, MessageClass.WarningMsg, true);
}
}
public override void StopWatcher()
{
if (_eventWatcher == null)
{
return ;
}
_eventWatcher.Stop();
_eventWatcher.Dispose();
_eventWatcher = null;
}
#endregion
#region Private Fields
private const string PuttySessionsKey = "Software\\SimonTatham\\PuTTY\\Sessions";
private static ManagementEventWatcher _eventWatcher;
#endregion
#region Private Methods
private void OnManagementEventArrived(object sender, EventArrivedEventArgs e)
{
OnSessionChanged(new SessionChangedEventArgs());
}
#endregion
return sessionInfo;
}
public override void StartWatcher()
{
if (_eventWatcher != null)
{
return ;
}
try
{
string currentUserSid = WindowsIdentity.GetCurrent().User.Value;
string key = System.Convert.ToString(string.Join("\\", new[] {currentUserSid, PuttySessionsKey}).Replace("\\", "\\\\"));
WqlEventQuery query = new WqlEventQuery(string.Format("SELECT * FROM RegistryTreeChangeEvent WHERE Hive = \'HKEY_USERS\' AND RootPath = \'{0}\'", key));
_eventWatcher = new ManagementEventWatcher(query);
_eventWatcher.EventArrived += OnManagementEventArrived;
_eventWatcher.Start();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("PuttySessions.Watcher.StartWatching() failed.", ex, MessageClass.WarningMsg, true);
}
}
public override void StopWatcher()
{
if (_eventWatcher == null)
{
return ;
}
_eventWatcher.Stop();
_eventWatcher.Dispose();
_eventWatcher = null;
}
#endregion
#region Private Fields
private const string PuttySessionsKey = "Software\\SimonTatham\\PuTTY\\Sessions";
private static ManagementEventWatcher _eventWatcher;
#endregion
#region Private Methods
private void OnManagementEventArrived(object sender, EventArrivedEventArgs e)
{
OnSessionChanged(new SessionChangedEventArgs());
}
#endregion
}
}

View File

@@ -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.ComponentModel;
using mRemoteNG.Tools;
@@ -18,223 +15,223 @@ using mRemoteNG.Tools;
namespace mRemoteNG.Config.Putty
{
public class Sessions
{
#region Public Methods
private delegate void AddSessionsToTreeDelegate();
public static void AddSessionsToTree()
{
#region Public Methods
private delegate void AddSessionsToTreeDelegate();
public static void AddSessionsToTree()
TreeView treeView = Tree.Node.TreeView;
if (treeView == null)
{
TreeView treeView = Tree.Node.TreeView;
if (treeView == null)
{
return ;
}
if (treeView.InvokeRequired)
{
treeView.Invoke(new AddSessionsToTreeDelegate(AddSessionsToTree));
return ;
}
return ;
}
if (treeView.InvokeRequired)
{
treeView.Invoke(new AddSessionsToTreeDelegate(AddSessionsToTree));
return ;
}
foreach (Provider provider in Providers)
foreach (Provider provider in Providers)
{
TreeNode rootTreeNode = provider.RootTreeNode;
bool inUpdate = false;
List<Connection.Info> savedSessions = new List<Connection.Info>(provider.GetSessions());
if (!IsProviderEnabled(provider) || savedSessions == null || savedSessions.Count == 0)
{
TreeNode rootTreeNode = provider.RootTreeNode;
bool inUpdate = false;
List<Connection.Info> savedSessions = new List<Connection.Info>(provider.GetSessions());
if (!IsProviderEnabled(provider) || savedSessions == null || savedSessions.Count == 0)
if (rootTreeNode != null && treeView.Nodes.Contains(rootTreeNode))
{
if (rootTreeNode != null && treeView.Nodes.Contains(rootTreeNode))
{
treeView.BeginUpdate();
treeView.Nodes.Remove(rootTreeNode);
treeView.EndUpdate();
}
continue;
}
if (!treeView.Nodes.Contains(rootTreeNode))
{
if (!inUpdate)
{
treeView.BeginUpdate();
inUpdate = true;
}
treeView.Nodes.Add(rootTreeNode);
}
List<TreeNode> newTreeNodes = new List<TreeNode>();
foreach (Connection.PuttySession.Info sessionInfo in savedSessions)
{
TreeNode treeNode = default(TreeNode);
bool isNewNode = false;
if (rootTreeNode.Nodes.ContainsKey(sessionInfo.Name))
{
treeNode = rootTreeNode.Nodes[sessionInfo.Name];
isNewNode = false;
}
else
{
treeNode = Tree.Node.AddNode(Tree.Node.Type.PuttySession, sessionInfo.Name);
if (treeNode == null)
{
continue;
}
treeNode.Name = treeNode.Text;
treeNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed;
treeNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed;
isNewNode = true;
}
sessionInfo.RootPuttySessionsInfo = provider.RootInfo;
sessionInfo.TreeNode = treeNode;
sessionInfo.Inherit.TurnOffInheritanceCompletely();
treeNode.Tag = sessionInfo;
if (isNewNode)
{
newTreeNodes.Add(treeNode);
}
}
foreach (TreeNode treeNode in rootTreeNode.Nodes)
{
if (!savedSessions.Contains(treeNode.Tag))
{
if (!inUpdate)
{
treeView.BeginUpdate();
inUpdate = true;
}
rootTreeNode.Nodes.Remove(treeNode);
}
}
if (!(newTreeNodes.Count == 0))
{
if (!inUpdate)
{
treeView.BeginUpdate();
inUpdate = true;
}
rootTreeNode.Nodes.AddRange(newTreeNodes.ToArray());
}
if (inUpdate)
{
Tree.Node.Sort(rootTreeNode, SortOrder.Ascending);
rootTreeNode.Expand();
treeView.BeginUpdate();
treeView.Nodes.Remove(rootTreeNode);
treeView.EndUpdate();
}
continue;
}
}
public static void StartWatcher()
{
foreach (Provider provider in Providers)
if (!treeView.Nodes.Contains(rootTreeNode))
{
provider.StartWatcher();
provider.SessionChanged += SessionChanged;
}
}
public static void StopWatcher()
{
foreach (Provider provider in Providers)
{
provider.StopWatcher();
provider.SessionChanged -= SessionChanged;
}
}
public static void SessionChanged(object sender, Provider.SessionChangedEventArgs e)
{
AddSessionsToTree();
}
#endregion
#region Private Methods
private static List<Provider> _providers;
private static List<Provider> Providers
{
get
{
if (_providers == null || _providers.Count == 0)
if (!inUpdate)
{
AddProviders();
treeView.BeginUpdate();
inUpdate = true;
}
return _providers;
treeView.Nodes.Add(rootTreeNode);
}
}
private static void AddProviders()
{
_providers = new List<Provider>();
_providers.Add(new RegistryProvider());
_providers.Add(new XmingProvider());
}
private static string[] GetSessionNames(bool raw = false)
{
List<string> sessionNames = new List<string>();
foreach (Provider provider in Providers)
List<TreeNode> newTreeNodes = new List<TreeNode>();
foreach (Connection.PuttySession.Info sessionInfo in savedSessions)
{
if (!IsProviderEnabled(provider))
TreeNode treeNode = default(TreeNode);
bool isNewNode = false;
if (rootTreeNode.Nodes.ContainsKey(sessionInfo.Name))
{
continue;
treeNode = rootTreeNode.Nodes[sessionInfo.Name];
isNewNode = false;
}
sessionNames.AddRange(provider.GetSessionNames(raw));
}
return sessionNames.ToArray();
}
private static bool IsProviderEnabled(Provider provider)
{
bool enabled = true;
if (PuttyTypeDetector.GetPuttyType() == PuttyTypeDetector.PuttyType.Xming)
{
if ((provider) is RegistryProvider)
else
{
enabled = false;
treeNode = Tree.Node.AddNode(Tree.Node.Type.PuttySession, sessionInfo.Name);
if (treeNode == null)
{
continue;
}
treeNode.Name = treeNode.Text;
treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
isNewNode = true;
}
sessionInfo.RootPuttySessionsInfo = provider.RootInfo;
sessionInfo.TreeNode = treeNode;
sessionInfo.Inherit.TurnOffInheritanceCompletely();
treeNode.Tag = sessionInfo;
if (isNewNode)
{
newTreeNodes.Add(treeNode);
}
}
else
foreach (TreeNode treeNode in rootTreeNode.Nodes)
{
if ((provider) is XmingProvider)
if (!savedSessions.Contains((Connection.Info)treeNode.Tag))
{
enabled = false;
if (!inUpdate)
{
treeView.BeginUpdate();
inUpdate = true;
}
rootTreeNode.Nodes.Remove(treeNode);
}
}
return enabled;
}
#endregion
#region Public Classes
public class SessionList : StringConverter
{
public static string[] Names
if (!(newTreeNodes.Count == 0))
{
get
if (!inUpdate)
{
return GetSessionNames();
treeView.BeginUpdate();
inUpdate = true;
}
rootTreeNode.Nodes.AddRange(newTreeNodes.ToArray());
}
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context)
if (inUpdate)
{
return new StandardValuesCollection(Names);
}
public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
Tree.Node.Sort(rootTreeNode, SortOrder.Ascending);
rootTreeNode.Expand();
treeView.EndUpdate();
}
}
#endregion
}
public static void StartWatcher()
{
foreach (Provider provider in Providers)
{
provider.StartWatcher();
provider.SessionChanged += SessionChanged;
}
}
public static void StopWatcher()
{
foreach (Provider provider in Providers)
{
provider.StopWatcher();
provider.SessionChanged -= SessionChanged;
}
}
public static void SessionChanged(object sender, Provider.SessionChangedEventArgs e)
{
AddSessionsToTree();
}
#endregion
#region Private Methods
private static List<Provider> _providers;
private static List<Provider> Providers
{
get
{
if (_providers == null || _providers.Count == 0)
{
AddProviders();
}
return _providers;
}
}
private static void AddProviders()
{
_providers = new List<Provider>();
_providers.Add(new RegistryProvider());
_providers.Add(new XmingProvider());
}
private static string[] GetSessionNames(bool raw = false)
{
List<string> sessionNames = new List<string>();
foreach (Provider provider in Providers)
{
if (!IsProviderEnabled(provider))
{
continue;
}
sessionNames.AddRange(provider.GetSessionNames(raw));
}
return sessionNames.ToArray();
}
private static bool IsProviderEnabled(Provider provider)
{
bool enabled = true;
if (PuttyTypeDetector.GetPuttyType() == PuttyTypeDetector.PuttyType.Xming)
{
if ((provider) is RegistryProvider)
{
enabled = false;
}
}
else
{
if ((provider) is XmingProvider)
{
enabled = false;
}
}
return enabled;
}
#endregion
#region Public Classes
public class SessionList : StringConverter
{
public static string[] Names
{
get
{
return GetSessionNames();
}
}
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context)
{
return new StandardValuesCollection(Names);
}
public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
}
#endregion
}
}

View File

@@ -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.IO;
using mRemoteNG.App;
using mRemoteNG.Messages;
@@ -21,373 +18,372 @@ using System.Text.RegularExpressions;
namespace mRemoteNG.Config.Putty
{
public class XmingProvider : Provider
{
#region Public Methods
public override string[] GetSessionNames(bool raw = false)
{
#region Public Methods
public override string[] GetSessionNames(bool raw = false)
string sessionsFolderPath = GetSessionsFolderPath();
if (!Directory.Exists(sessionsFolderPath))
{
string sessionsFolderPath = GetSessionsFolderPath();
if (!Directory.Exists(sessionsFolderPath))
{
return new string[] {};
}
List<string> sessionNames = new List<string>();
foreach (string sessionName in Directory.GetFiles(sessionsFolderPath))
{
sessionName = Path.GetFileName(sessionName);
if (raw)
{
sessionNames.Add(sessionName);
}
else
{
sessionNames.Add(System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B")));
}
}
return new string[] {};
}
List<string> sessionNames = new List<string>();
foreach (string sessionName in Directory.GetFiles(sessionsFolderPath))
{
string _sessionFileName = Path.GetFileName(sessionName);
if (raw)
{
if (!sessionNames.Contains("Default%20Settings")) // Do not localize
{
sessionNames.Insert(0, "Default%20Settings");
}
sessionNames.Add(_sessionFileName);
}
else
{
if (!sessionNames.Contains("Default Settings"))
{
sessionNames.Insert(0, "Default Settings");
}
sessionNames.Add(System.Web.HttpUtility.UrlDecode(_sessionFileName.Replace("+", "%2B")));
}
List<string> registrySessionNames = new List<string>();
foreach (string sessionName in RegistryProvider.GetSessionNames(raw))
{
registrySessionNames.Add(string.Format(RegistrySessionNameFormat, sessionName));
}
sessionNames.AddRange(registrySessionNames);
sessionNames.Sort();
return sessionNames.ToArray();
}
public override Connection.PuttySession.Info GetSession(string sessionName)
if (raw)
{
string registrySessionName = GetRegistrySessionName(sessionName);
if (!string.IsNullOrEmpty(registrySessionName))
if (!sessionNames.Contains("Default%20Settings")) // Do not localize
{
return ModifyRegistrySessionInfo(RegistryProvider.GetSession(registrySessionName));
sessionNames.Insert(0, "Default%20Settings");
}
string sessionsFolderPath = GetSessionsFolderPath();
if (!Directory.Exists(sessionsFolderPath))
}
else
{
if (!sessionNames.Contains("Default Settings"))
{
sessionNames.Insert(0, "Default Settings");
}
}
List<string> registrySessionNames = new List<string>();
foreach (string sessionName in RegistryProvider.GetSessionNames(raw))
{
registrySessionNames.Add(string.Format(RegistrySessionNameFormat, sessionName));
}
sessionNames.AddRange(registrySessionNames);
sessionNames.Sort();
return sessionNames.ToArray();
}
public override Connection.PuttySession.Info GetSession(string sessionName)
{
string registrySessionName = GetRegistrySessionName(sessionName);
if (!string.IsNullOrEmpty(registrySessionName))
{
return ModifyRegistrySessionInfo(RegistryProvider.GetSession(registrySessionName));
}
string sessionsFolderPath = GetSessionsFolderPath();
if (!Directory.Exists(sessionsFolderPath))
{
return null;
}
string sessionFile = Path.Combine(sessionsFolderPath, sessionName);
if (!File.Exists(sessionFile))
{
return null;
}
sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"));
SessionFileReader sessionFileReader = new SessionFileReader(sessionFile);
Connection.PuttySession.Info sessionInfo = new Connection.PuttySession.Info();
sessionInfo.PuttySession = sessionName;
sessionInfo.Name = sessionName;
sessionInfo.Hostname = sessionFileReader.GetValue("HostName");
sessionInfo.Username = sessionFileReader.GetValue("UserName");
string protocol = sessionFileReader.GetValue("Protocol");
if (protocol == null)
{
protocol = "ssh";
}
switch (protocol.ToLowerInvariant())
{
case "raw":
sessionInfo.Protocol = Protocols.RAW;
break;
case "rlogin":
sessionInfo.Protocol = Protocols.Rlogin;
break;
case "serial":
return null;
}
string sessionFile = Path.Combine(sessionsFolderPath, sessionName);
if (!File.Exists(sessionFile))
{
return null;
}
sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"));
SessionFileReader sessionFileReader = new SessionFileReader(sessionFile);
Connection.PuttySession.Info sessionInfo = new Connection.PuttySession.Info();
sessionInfo.PuttySession = sessionName;
sessionInfo.Name = sessionName;
sessionInfo.Hostname = sessionFileReader.GetValue("HostName");
sessionInfo.Username = sessionFileReader.GetValue("UserName");
string protocol = sessionFileReader.GetValue("Protocol");
if (protocol == null)
{
protocol = "ssh";
}
switch (protocol.ToLowerInvariant())
{
case "raw":
sessionInfo.Protocol = Protocols.RAW;
break;
case "rlogin":
sessionInfo.Protocol = Protocols.Rlogin;
break;
case "serial":
return null;
case "ssh":
object sshVersionObject = sessionFileReader.GetValue("SshProt");
if (sshVersionObject != null)
{
int sshVersion = System.Convert.ToInt32(sshVersionObject);
if (sshVersion >= 2)
{
sessionInfo.Protocol = Protocols.SSH2;
}
else
{
sessionInfo.Protocol = Protocols.SSH1;
}
}
else
case "ssh":
object sshVersionObject = sessionFileReader.GetValue("SshProt");
if (sshVersionObject != null)
{
int sshVersion = System.Convert.ToInt32(sshVersionObject);
if (sshVersion >= 2)
{
sessionInfo.Protocol = Protocols.SSH2;
}
break;
case "telnet":
sessionInfo.Protocol = Protocols.Telnet;
break;
default:
return null;
}
sessionInfo.Port = (int) (sessionFileReader.GetValue("PortNumber"));
return sessionInfo;
else
{
sessionInfo.Protocol = Protocols.SSH1;
}
}
else
{
sessionInfo.Protocol = Protocols.SSH2;
}
break;
case "telnet":
sessionInfo.Protocol = Protocols.Telnet;
break;
default:
return null;
}
sessionInfo.Port = System.Convert.ToInt32(sessionFileReader.GetValue("PortNumber"));
public override void StartWatcher()
return sessionInfo;
}
public override void StartWatcher()
{
RegistryProvider.StartWatcher();
RegistryProvider.SessionChanged += OnRegistrySessionChanged;
if (_eventWatcher != null)
{
RegistryProvider.StartWatcher();
RegistryProvider.SessionChanged += OnRegistrySessionChanged;
return ;
}
if (_eventWatcher != null)
{
return ;
}
try
{
_eventWatcher = new FileSystemWatcher(GetSessionsFolderPath());
_eventWatcher.NotifyFilter = (System.IO.NotifyFilters) (NotifyFilters.FileName | NotifyFilters.LastWrite);
_eventWatcher.Changed += OnFileSystemEventArrived;
_eventWatcher.Created += OnFileSystemEventArrived;
_eventWatcher.Deleted += OnFileSystemEventArrived;
_eventWatcher.Renamed += OnFileSystemEventArrived;
_eventWatcher.EnableRaisingEvents = true;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("XmingPortablePuttySessions.Watcher.StartWatching() failed.", ex, MessageClass.WarningMsg, true);
}
}
public override void StopWatcher()
{
RegistryProvider.StopWatcher();
RegistryProvider.SessionChanged -= OnRegistrySessionChanged;
if (_eventWatcher == null)
{
return ;
}
_eventWatcher.EnableRaisingEvents = false;
_eventWatcher.Dispose();
_eventWatcher = null;
}
#endregion
#region Private Fields
private const string RegistrySessionNameFormat = "{0} [registry]";
private const string RegistrySessionNamePattern = "(.*)\\ \\[registry\\]";
private static readonly RegistryProvider RegistryProvider = new RegistryProvider();
private static FileSystemWatcher _eventWatcher;
#endregion
#region Private Methods
private static string GetPuttyConfPath()
{
string puttyPath = "";
if (My.Settings.Default.UseCustomPuttyPath)
{
puttyPath = System.Convert.ToString(My.Settings.Default.CustomPuttyPath);
}
else
{
puttyPath = App.Info.General.PuttyPath;
}
return Path.Combine(Path.GetDirectoryName(puttyPath), "putty.conf");
}
private static string GetSessionsFolderPath()
{
string puttyConfPath = GetPuttyConfPath();
PuttyConfFileReader sessionFileReader = new PuttyConfFileReader(puttyConfPath);
string basePath = Environment.ExpandEnvironmentVariables(sessionFileReader.GetValue("sshk&sess"));
return Path.Combine(basePath, "sessions");
}
private static string GetRegistrySessionName(string sessionName)
{
Regex regex = new Regex(RegistrySessionNamePattern);
MatchCollection matches = regex.Matches(sessionName);
if (matches.Count < 1)
{
return string.Empty;
}
GroupCollection groups = matches[0].Groups;
if (groups.Count < 1)
{
return string.Empty; // This should always include at least one item, but check anyway
}
return groups[1].Value;
}
private static Connection.PuttySession.Info ModifyRegistrySessionInfo(Connection.PuttySession.Info sessionInfo)
{
sessionInfo.Name = string.Format(RegistrySessionNameFormat, sessionInfo.Name);
sessionInfo.PuttySession = string.Format(RegistrySessionNameFormat, sessionInfo.PuttySession);
return sessionInfo;
}
private void OnFileSystemEventArrived(object sender, FileSystemEventArgs e)
{
OnSessionChanged(new SessionChangedEventArgs());
}
private void OnRegistrySessionChanged(object sender, SessionChangedEventArgs e)
{
OnSessionChanged(new SessionChangedEventArgs());
}
#endregion
#region Private Classes
private class PuttyConfFileReader
{
public PuttyConfFileReader(string puttyConfFile)
{
_puttyConfFile = puttyConfFile;
}
private string _puttyConfFile;
private bool _configurationLoaded = false;
private Dictionary<string, string> _configuration = new Dictionary<string, string>();
private void LoadConfiguration()
{
_configurationLoaded = true;
try
{
_eventWatcher = new FileSystemWatcher(GetSessionsFolderPath());
_eventWatcher.NotifyFilter = (System.IO.NotifyFilters) (NotifyFilters.FileName | NotifyFilters.LastWrite);
_eventWatcher.Changed += OnFileSystemEventArrived;
_eventWatcher.Created += OnFileSystemEventArrived;
_eventWatcher.Deleted += OnFileSystemEventArrived;
_eventWatcher.Renamed += OnFileSystemEventArrived;
_eventWatcher.EnableRaisingEvents = true;
if (!File.Exists(_puttyConfFile))
{
return ;
}
using (StreamReader streamReader = new StreamReader(_puttyConfFile))
{
string line = "";
do
{
line = streamReader.ReadLine();
if (line == null)
{
break;
}
line = line.Trim();
if (line == string.Empty)
{
continue; // Blank line
}
if (line.Substring(0, 1) == ";")
{
continue; // Comment
}
string[] parts = line.Split(new char[] {'='}, 2);
if (parts.Length < 2)
{
continue;
}
if (_configuration.ContainsKey(parts[0]))
{
continue; // As per http://www.straightrunning.com/XmingNotes/portableputty.php only first entry is used
}
_configuration.Add(parts[0], parts[1]);
} while (true);
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("XmingPortablePuttySessions.Watcher.StartWatching() failed.", ex, MessageClass.WarningMsg, true);
Runtime.MessageCollector.AddExceptionMessage("PuttyConfFileReader.LoadConfiguration() failed.", ex, MessageClass.ErrorMsg, true);
}
}
public override void StopWatcher()
{
RegistryProvider.StopWatcher();
RegistryProvider.SessionChanged -= OnRegistrySessionChanged;
if (_eventWatcher == null)
{
return ;
}
_eventWatcher.EnableRaisingEvents = false;
_eventWatcher.Dispose();
_eventWatcher = null;
}
#endregion
#region Private Fields
private const string RegistrySessionNameFormat = "{0} [registry]";
private const string RegistrySessionNamePattern = "(.*)\\ \\[registry\\]";
private static readonly RegistryProvider RegistryProvider = new RegistryProvider();
private static FileSystemWatcher _eventWatcher;
#endregion
#region Private Methods
private static string GetPuttyConfPath()
public string GetValue(string setting)
{
string puttyPath = "";
if (My.Settings.Default.UseCustomPuttyPath)
if (!_configurationLoaded)
{
puttyPath = System.Convert.ToString(My.Settings.Default.CustomPuttyPath);
LoadConfiguration();
}
else
{
puttyPath = App.Info.General.PuttyPath;
}
return Path.Combine(Path.GetDirectoryName(puttyPath), "putty.conf");
}
private static string GetSessionsFolderPath()
{
string puttyConfPath = GetPuttyConfPath();
PuttyConfFileReader sessionFileReader = new PuttyConfFileReader(puttyConfPath);
string basePath = Environment.ExpandEnvironmentVariables(sessionFileReader.GetValue("sshk&sess"));
return Path.Combine(basePath, "sessions");
}
private static string GetRegistrySessionName(string sessionName)
{
Regex regex = new Regex(RegistrySessionNamePattern);
MatchCollection matches = regex.Matches(sessionName);
if (matches.Count < 1)
if (!_configuration.ContainsKey(setting))
{
return string.Empty;
}
GroupCollection groups = matches[0].Groups;
if (groups.Count < 1)
{
return string.Empty; // This should always include at least one item, but check anyway
}
return groups[1].Value;
return _configuration[setting];
}
private static Connection.PuttySession.Info ModifyRegistrySessionInfo(Connection.PuttySession.Info sessionInfo)
{
sessionInfo.Name = string.Format(RegistrySessionNameFormat, sessionInfo.Name);
sessionInfo.PuttySession = string.Format(RegistrySessionNameFormat, sessionInfo.PuttySession);
return sessionInfo;
}
private void OnFileSystemEventArrived(object sender, FileSystemEventArgs e)
{
OnSessionChanged(new SessionChangedEventArgs());
}
private void OnRegistrySessionChanged(object sender, SessionChangedEventArgs e)
{
OnSessionChanged(new SessionChangedEventArgs());
}
#endregion
#region Private Classes
private class PuttyConfFileReader
{
public PuttyConfFileReader(string puttyConfFile)
{
_puttyConfFile = puttyConfFile;
}
private string _puttyConfFile;
private bool _configurationLoaded = false;
private Dictionary<string, string> _configuration = new Dictionary<string, string>();
private void LoadConfiguration()
{
_configurationLoaded = true;
try
{
if (!File.Exists(_puttyConfFile))
{
return ;
}
using (StreamReader streamReader = new StreamReader(_puttyConfFile))
{
string line = "";
do
{
line = streamReader.ReadLine();
if (line == null)
{
break;
}
line = line.Trim();
if (line == string.Empty)
{
continue; // Blank line
}
if (line.Substring(0, 1) == ";")
{
continue; // Comment
}
string[] parts = line.Split(new char[] {'='}, 2);
if (parts.Length < 2)
{
continue;
}
if (_configuration.ContainsKey(parts[0]))
{
continue; // As per http://www.straightrunning.com/XmingNotes/portableputty.php only first entry is used
}
_configuration.Add(parts[0], parts[1]);
} while (true);
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("PuttyConfFileReader.LoadConfiguration() failed.", ex, MessageClass.ErrorMsg, true);
}
}
public string GetValue(string setting)
{
if (!_configurationLoaded)
{
LoadConfiguration();
}
if (!_configuration.ContainsKey(setting))
{
return string.Empty;
}
return _configuration[setting];
}
}
private class SessionFileReader
{
public SessionFileReader(string sessionFile)
{
_sessionFile = sessionFile;
}
private string _sessionFile;
private bool _sessionInfoLoaded = false;
private Dictionary<string, string> _sessionInfo = new Dictionary<string, string>();
private void LoadSessionInfo()
{
_sessionInfoLoaded = true;
try
{
if (!File.Exists(_sessionFile))
{
return ;
}
using (StreamReader streamReader = new StreamReader(_sessionFile))
{
string line = "";
do
{
line = streamReader.ReadLine();
if (line == null)
{
break;
}
string[] parts = line.Split(new char[] {'\\'});
if (parts.Length < 2)
{
continue;
}
_sessionInfo.Add(parts[0], parts[1]);
} while (true);
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("SessionFileReader.LoadSessionInfo() failed.", ex, MessageClass.ErrorMsg, true);
}
}
public string GetValue(string setting)
{
if (!_sessionInfoLoaded)
{
LoadSessionInfo();
}
if (!_sessionInfo.ContainsKey(setting))
{
return string.Empty;
}
return _sessionInfo[setting];
}
}
#endregion
}
private class SessionFileReader
{
public SessionFileReader(string sessionFile)
{
_sessionFile = sessionFile;
}
private string _sessionFile;
private bool _sessionInfoLoaded = false;
private Dictionary<string, string> _sessionInfo = new Dictionary<string, string>();
private void LoadSessionInfo()
{
_sessionInfoLoaded = true;
try
{
if (!File.Exists(_sessionFile))
{
return ;
}
using (StreamReader streamReader = new StreamReader(_sessionFile))
{
string line = "";
do
{
line = streamReader.ReadLine();
if (line == null)
{
break;
}
string[] parts = line.Split(new char[] {'\\'});
if (parts.Length < 2)
{
continue;
}
_sessionInfo.Add(parts[0], parts[1]);
} while (true);
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("SessionFileReader.LoadSessionInfo() failed.", ex, MessageClass.ErrorMsg, true);
}
}
public string GetValue(string setting)
{
if (!_sessionInfoLoaded)
{
LoadSessionInfo();
}
if (!_sessionInfo.ContainsKey(setting))
{
return string.Empty;
}
return _sessionInfo[setting];
}
}
#endregion
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -10,11 +9,8 @@ using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
using mRemoteNG.Tools;
// End of VB project level imports
using System.ComponentModel;
using mRemoteNG.Tools;
//using mRemoteNG.Tools.LocalizedAttributes;
namespace mRemoteNG.Connection
@@ -23,8 +19,8 @@ namespace mRemoteNG.Connection
{
public class Inheritance
{
#region Public Properties
#region General
#region Public Properties
#region General
[LocalizedAttributes.LocalizedCategory("strCategoryGeneral", 1),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAll"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAll"),
@@ -55,8 +51,8 @@ namespace mRemoteNG.Connection
SetAllValues(value);
}
}
#endregion
#region Display
#endregion
#region Display
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDescription"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDescription"),
@@ -71,8 +67,8 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePanel"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPanel"),
TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Panel {get; set;}
#endregion
#region Connection
#endregion
#region Connection
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUsername"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUsername"),
@@ -87,8 +83,8 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDomain"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDomain"),
TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Domain {get; set;}
#endregion
#region Protocol
#endregion
#region Protocol
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameProtocol"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionProtocol"),
@@ -138,8 +134,8 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseCredSsp"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseCredSsp"),
TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool UseCredSsp {get; set;}
#endregion
#region RD Gateway
#endregion
#region RD Gateway
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsageMethod"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsageMethod"),
@@ -175,8 +171,8 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayDomain"),
TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]
public bool RDGatewayDomain {get; set;}
#endregion
#region Appearance
#endregion
#region Appearance
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameResolution"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionResolution"),
@@ -216,8 +212,8 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableDesktopComposition"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableEnableDesktopComposition"),
TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool EnableDesktopComposition {get; set;}
#endregion
#region Redirect
#endregion
#region Redirect
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectKeys"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectKeys"),
@@ -247,8 +243,8 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSounds"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSounds"),
TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool RedirectSound {get; set;}
#endregion
#region Misc
#endregion
#region Misc
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolBefore"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolBefore"),
@@ -268,8 +264,8 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUser1"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUser1"),
TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool UserField {get; set;}
#endregion
#region VNC
#endregion
#region VNC
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCompression"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCompression"),
@@ -324,14 +320,16 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameViewOnly"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionViewOnly"),
TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCViewOnly {get; set;}
#endregion
#endregion
[Browsable(false)]public object Parent {get; set;}
[Browsable(false)]
public object Parent {get; set;}
[Browsable(false)]public bool IsDefault {get; set;}
#endregion
[Browsable(false)]
public bool IsDefault {get; set;}
#endregion
#region Constructors
#region Constructors
public Inheritance(object parent, bool inheritEverything = false)
{
this.Parent = parent;
@@ -340,9 +338,9 @@ namespace mRemoteNG.Connection
TurnOnInheritanceCompletely();
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
public Inheritance Copy()
{
return (Inheritance)MemberwiseClone();
@@ -357,9 +355,9 @@ namespace mRemoteNG.Connection
{
SetAllValues(false);
}
#endregion
#endregion
#region Private Methods
#region Private Methods
private void SetAllValues(bool value)
{
// Display
@@ -429,7 +427,7 @@ namespace mRemoteNG.Connection
VNCSmartSizeMode = value;
VNCViewOnly = value;
}
#endregion
#endregion
}
}
}

View File

@@ -9,7 +9,6 @@ using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
using System.ComponentModel;
using mRemoteNG.Config;
using mRemoteNG.Tools;
using System.Reflection;
using mRemoteNG.App;
@@ -203,8 +202,8 @@ namespace mRemoteNG.Connection
private string _puttySession; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNamePuttySession"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPuttySession"),
TypeConverter(typeof(Putty.Sessions.SessionList))]
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPuttySession"),
TypeConverter(typeof(Config.Putty.Sessions.SessionList))]
public virtual string PuttySession
{
get
@@ -1100,7 +1099,7 @@ namespace mRemoteNG.Connection
Info parentConnectionInfo = default(Info);
if (IsContainer)
{
parentConnectionInfo = Parent.Parent.ConnectionInfo;
parentConnectionInfo = ((Container.Info)Parent.Parent).ConnectionInfo;
}
else
{
@@ -1109,7 +1108,7 @@ namespace mRemoteNG.Connection
Type connectionInfoType = parentConnectionInfo.GetType();
PropertyInfo parentPropertyInfo = connectionInfoType.GetProperty(propertyName);
TPropertyType parentPropertyValue = parentPropertyInfo.GetValue(parentConnectionInfo, BindingFlags.GetProperty, null, null, null);
TPropertyType parentPropertyValue = (TPropertyType)parentPropertyInfo.GetValue(parentConnectionInfo, BindingFlags.GetProperty, null, null, null);
return parentPropertyValue;
}
@@ -1167,10 +1166,12 @@ namespace mRemoteNG.Connection
{
return (int)Connection.Protocol.IntegratedProgram.Defaults.Port;
}
return 0;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(My.Language.strConnectionSetDefaultPortFailed, ex, Messages.MessageClass.ErrorMsg);
return 0;
}
}
#endregion

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,46 +8,40 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG
namespace mRemoteNG.Connection
{
namespace Protocol
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class InterfaceControl : System.Windows.Forms.Panel
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class InterfaceControl : System.Windows.Forms.Panel
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]
protected override void Dispose(bool disposing)
{
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
try
{
try
if (disposing && components != null)
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
components.Dispose();
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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()
finally
{
components = new System.ComponentModel.Container();
//Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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()
{
components = new System.ComponentModel.Container();
//Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
}
}
}

View File

@@ -14,32 +14,20 @@ using mRemoteNG.App;
namespace mRemoteNG.Connection
{
public partial class InterfaceControl
{
#region Properties
private Connection.Protocol.Base _Protocol;
{
#region Public Properties
private Connection.Protocol.Base _Protocol;
public Connection.Protocol.Base Protocol
{
get
{
return this._Protocol;
}
set
{
this._Protocol = value;
}
get { return this._Protocol; }
set { this._Protocol = value; }
}
private Info _Info;
public Info Info
{
get
{
return this._Info;
}
set
{
this._Info = value;
}
get { return this._Info; }
set { this._Info = value; }
}
#endregion
@@ -50,10 +38,10 @@ namespace mRemoteNG.Connection
{
this._Protocol = Protocol;
this._Info = Info;
this.Parent = Parent;
this.Location = new Point(0, 0);
this.Size = this.Parent.Size;
this.Anchor = (System.Windows.Forms.AnchorStyles) (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top);
this.Parent = Parent;
this.Location = new Point(0, 0);
this.Size = this.Parent.Size;
this.Anchor = (System.Windows.Forms.AnchorStyles)(AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top);
InitializeComponent();
}
catch (Exception ex)

View File

@@ -21,23 +21,14 @@ namespace mRemoteNG.Connection.Protocol
private string _Name;
public string Name
{
get
{
return this._Name;
}
set
{
this._Name = value;
}
get { return this._Name; }
set { this._Name = value; }
}
private UI.Window.Connection _connectionWindow;
public UI.Window.Connection ConnectionWindow
{
get
{
return _connectionWindow;
}
get { return _connectionWindow; }
set
{
_connectionWindow = value;
@@ -78,14 +69,8 @@ namespace mRemoteNG.Connection.Protocol
private mRemoteNG.Connection.Info.Force _Force;
public mRemoteNG.Connection.Info.Force Force
{
get
{
return this._Force;
}
set
{
this._Force = value;
}
get { return this._Force; }
set { this._Force = value; }
}
public System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
@@ -149,9 +134,13 @@ namespace mRemoteNG.Connection.Protocol
{
if (InterfaceControl.Info.Protocol != Protocols.RDP)
{
if (ConnectedEvent != null)
ConnectedEvent(this);
if (ConnectedEvent != null)
{
ConnectedEvent(this);
return true;
}
}
return false;
}
public virtual void Disconnect()

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,29 +8,28 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Connection.Protocol
{
public class HTTP : HTTPBase
{
{
public HTTP(RenderingEngine RenderingEngine) : base(RenderingEngine)
{
}
public HTTP(RenderingEngine RenderingEngine) : base(RenderingEngine)
{
}
public override void NewExtended()
{
base.NewExtended();
public override void NewExtended()
{
base.NewExtended();
httpOrS = "http";
defaultPort = Defaults.Port;
}
httpOrS = "http";
defaultPort = (int)Defaults.Port;
}
public enum Defaults
{
Port = 80
}
}
public enum Defaults
{
Port = 80
}
}
}

View File

@@ -10,8 +10,6 @@ using System.Collections;
using System.Windows.Forms;
using mRemoteNG.Tools;
using mRemoteNG.App;
//using mRemoteNG.Tools.LocalizedAttributes;
namespace mRemoteNG.Connection.Protocol
{
@@ -72,7 +70,6 @@ namespace mRemoteNG.Connection.Protocol
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
{
MiniGeckoBrowser.MiniGeckoBrowser objMiniGeckoBrowser = wBrowser as MiniGeckoBrowser.MiniGeckoBrowser;
objMiniGeckoBrowser.TitleChanged += wBrowser_DocumentTitleChanged;
objMiniGeckoBrowser.LastTabRemoved += wBrowser_LastTabRemoved;
}
@@ -80,9 +77,7 @@ namespace mRemoteNG.Connection.Protocol
{
WebBrowser objWebBrowser = wBrowser as WebBrowser;
SHDocVw.WebBrowser objAxWebBrowser = (SHDocVw.WebBrowser) objWebBrowser.ActiveXInstance;
objWebBrowser.ScrollBarsEnabled = true;
objWebBrowser.Navigated += wBrowser_Navigated;
objWebBrowser.DocumentTitleChanged += wBrowser_DocumentTitleChanged;
objAxWebBrowser.NewWindow3 += wBrowser_NewWindow3;
@@ -103,8 +98,8 @@ namespace mRemoteNG.Connection.Protocol
{
string strHost = System.Convert.ToString(this.InterfaceControl.Info.Hostname);
string strAuth = "";
if (!((Force & Info.Force.NoCredentials) == (int) Info.Force.NoCredentials) && !string.IsNullOrEmpty(InterfaceControl.Info.Username) && !string.IsNullOrEmpty(InterfaceControl.Info.Password))
if (!(((int)Force & (int)Info.Force.NoCredentials) == (int)Info.Force.NoCredentials) && !string.IsNullOrEmpty(InterfaceControl.Info.Username) && !string.IsNullOrEmpty(InterfaceControl.Info.Password))
{
strAuth = "Authorization: Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(this.InterfaceControl.Info.Username + ":" + this.InterfaceControl.Info.Password)) + Constants.vbNewLine;
}
@@ -123,14 +118,11 @@ namespace mRemoteNG.Connection.Protocol
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
{
(wBrowser as MiniGeckoBrowser.MiniGeckoBrowser).Navigate(strHost + ":" + this.InterfaceControl.Info.Port);
((MiniGeckoBrowser.MiniGeckoBrowser)wBrowser).Navigate(strHost + ":" + this.InterfaceControl.Info.Port);
}
else
{
object temp_Flags = null;
object temp_TargetFrameName = null;
object null_object = null;
(wBrowser as WebBrowser).Navigate(strHost + ":" + this.InterfaceControl.Info.Port, ref temp_Flags, ref temp_TargetFrameName, ref strAuth, ref null_object);
((WebBrowser)wBrowser).Navigate(strHost + ":" + this.InterfaceControl.Info.Port);
}
}
else
@@ -146,10 +138,7 @@ namespace mRemoteNG.Connection.Protocol
}
else
{
object temp_Flags2 = null;
object temp_TargetFrameName2 = null;
object null_object2 = null;
(wBrowser as WebBrowser).Navigate(strHost, ref temp_Flags2, ref temp_TargetFrameName2, ref strAuth, ref null_object2);
((WebBrowser)wBrowser).Navigate(strHost);
}
}
@@ -184,7 +173,7 @@ namespace mRemoteNG.Connection.Protocol
private void wBrowser_NewWindow3(object ppDisp, ref bool Cancel, long dwFlags, string bstrUrlContext, string bstrUrl)
{
if (dwFlags & NWMF.NWMF_OVERRIDEKEY)
if ((dwFlags & (long)NWMF.NWMF_OVERRIDEKEY) > 0)
{
Cancel = false;
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,29 +8,27 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Connection.Protocol
{
public class HTTPS : HTTPBase
{
{
public HTTPS(RenderingEngine RenderingEngine) : base(RenderingEngine)
{
}
public HTTPS(RenderingEngine RenderingEngine) : base(RenderingEngine)
{
}
public override void NewExtended()
{
base.NewExtended();
httpOrS = "https";
defaultPort = Defaults.Port;
}
public override void NewExtended()
{
base.NewExtended();
httpOrS = "https";
defaultPort = (int)Defaults.Port;
}
public enum Defaults
{
Port = 443
}
}
public enum Defaults
{
Port = 443
}
}
}

View File

@@ -11,7 +11,6 @@ using System.Windows.Forms;
using mRemoteNG.App;
using System.Threading;
using mRemoteNG.Tools;
//using mRemoteNG.Tools.LocalizedAttributes;
namespace mRemoteNG.Connection.Protocol
@@ -31,7 +30,7 @@ namespace mRemoteNG.Connection.Protocol
if (defaultInstance == null)
{
defaultInstance = new ICA();
defaultInstance.FormClosed += new FormClosedEventHandler(defaultInstance_FormClosed);
//defaultInstance.FormClosed += new FormClosedEventHandler(defaultInstance_FormClosed);
}
return defaultInstance;
@@ -47,10 +46,10 @@ namespace mRemoteNG.Connection.Protocol
defaultInstance = null;
}
#endregion
#region Private Properties
private AxICAClient ICAClient;
private Connection.Info Info;
private AxICAClient _ICAClient;
private Connection.Info _Info;
#endregion
#region Public Methods
@@ -72,48 +71,48 @@ namespace mRemoteNG.Connection.Protocol
try
{
ICAClient = (AxICAClient)this.Control;
Info = this.InterfaceControl.Info;
ICAClient.CreateControl();
_ICAClient = (AxICAClient)this.Control;
_Info = this.InterfaceControl.Info;
_ICAClient.CreateControl();
while (!this.ICAClient.Created)
while (!this._ICAClient.Created)
{
Thread.Sleep(10);
System.Windows.Forms.Application.DoEvents();
}
ICAClient.Address = Info.Hostname;
_ICAClient.Address = _Info.Hostname;
this.SetCredentials();
this.SetResolution();
this.SetColors();
this.SetSecurity();
//Disable hotkeys for international users
ICAClient.Hotkey1Shift = null;
ICAClient.Hotkey1Char = null;
ICAClient.Hotkey2Shift = null;
ICAClient.Hotkey2Char = null;
ICAClient.Hotkey3Shift = null;
ICAClient.Hotkey3Char = null;
ICAClient.Hotkey4Shift = null;
ICAClient.Hotkey4Char = null;
ICAClient.Hotkey5Shift = null;
ICAClient.Hotkey5Char = null;
ICAClient.Hotkey6Shift = null;
ICAClient.Hotkey6Char = null;
ICAClient.Hotkey7Shift = null;
ICAClient.Hotkey7Char = null;
ICAClient.Hotkey8Shift = null;
ICAClient.Hotkey8Char = null;
ICAClient.Hotkey9Shift = null;
ICAClient.Hotkey9Char = null;
ICAClient.Hotkey10Shift = null;
ICAClient.Hotkey10Char = null;
ICAClient.Hotkey11Shift = null;
ICAClient.Hotkey11Char = null;
_ICAClient.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;
_ICAClient.PersistentCacheEnabled = _Info.CacheBitmaps;
_ICAClient.Title = _Info.Name;
return true;
}
catch (Exception ex)
@@ -129,7 +128,7 @@ namespace mRemoteNG.Connection.Protocol
try
{
ICAClient.Connect();
_ICAClient.Connect();
base.Connect();
return true;
}
@@ -146,29 +145,29 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
if (((int)Force & (int)Info.Force.NoCredentials) == (int) Info.Force.NoCredentials)
if (((int)Force & (int)Connection.Info.Force.NoCredentials) == (int)Connection.Info.Force.NoCredentials)
{
return ;
}
string _user = this.Info.Username;
string _pass = this.Info.Password;
string _dom = this.Info.Domain;
string _user = this._Info.Username;
string _pass = this._Info.Password;
string _dom = this._Info.Domain;
if (string.IsNullOrEmpty(_user))
{
if ((string) My.Settings.Default.EmptyCredentials == "windows")
{
ICAClient.Username = Environment.UserName;
_ICAClient.Username = Environment.UserName;
}
else if ((string) My.Settings.Default.EmptyCredentials == "custom")
{
ICAClient.Username = My.Settings.Default.DefaultUsername;
_ICAClient.Username = My.Settings.Default.DefaultUsername;
}
}
else
{
ICAClient.Username = _user;
_ICAClient.Username = _user;
}
if (string.IsNullOrEmpty(_pass))
@@ -177,29 +176,29 @@ namespace mRemoteNG.Connection.Protocol
{
if (My.Settings.Default.DefaultPassword != "")
{
ICAClient.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
{
ICAClient.SetProp("ClearPassword", _pass);
_ICAClient.SetProp("ClearPassword", _pass);
}
if (string.IsNullOrEmpty(_dom))
{
if ((string) My.Settings.Default.EmptyCredentials == "windows")
{
ICAClient.Domain = Environment.UserDomainName;
_ICAClient.Domain = Environment.UserDomainName;
}
else if ((string) My.Settings.Default.EmptyCredentials == "custom")
{
ICAClient.Domain = My.Settings.Default.DefaultDomain;
_ICAClient.Domain = My.Settings.Default.DefaultDomain;
}
}
else
{
ICAClient.Domain = _dom;
_ICAClient.Domain = _dom;
}
}
catch (Exception ex)
@@ -214,29 +213,29 @@ namespace mRemoteNG.Connection.Protocol
{
if ((this.Force & Connection.Info.Force.Fullscreen) == Connection.Info.Force.Fullscreen)
{
ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0);
ICAClient.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)
{
ICAClient.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)
{
ICAClient.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)
{
ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0);
ICAClient.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);
ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0);
Rectangle resolution = RDP.GetResolutionRectangle(_Info.Resolution);
_ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0);
}
}
catch (Exception ex)
@@ -247,42 +246,42 @@ namespace mRemoteNG.Connection.Protocol
private void SetColors()
{
switch (Info.Colors)
switch (_Info.Colors)
{
case RDP.RDPColors.Colors256:
ICAClient.SetProp("DesiredColor", "2");
_ICAClient.SetProp("DesiredColor", "2");
break;
case RDP.RDPColors.Colors15Bit:
ICAClient.SetProp("DesiredColor", "4");
_ICAClient.SetProp("DesiredColor", "4");
break;
case RDP.RDPColors.Colors16Bit:
ICAClient.SetProp("DesiredColor", "4");
_ICAClient.SetProp("DesiredColor", "4");
break;
default:
ICAClient.SetProp("DesiredColor", "8");
_ICAClient.SetProp("DesiredColor", "8");
break;
}
}
private void SetSecurity()
{
switch (Info.ICAEncryption)
switch (_Info.ICAEncryption)
{
case EncryptionStrength.Encr128BitLogonOnly:
ICAClient.Encrypt = true;
ICAClient.EncryptionLevelSession = "EncRC5-0";
_ICAClient.Encrypt = true;
_ICAClient.EncryptionLevelSession = "EncRC5-0";
break;
case EncryptionStrength.Encr40Bit:
ICAClient.Encrypt = true;
ICAClient.EncryptionLevelSession = "EncRC5-40";
_ICAClient.Encrypt = true;
_ICAClient.EncryptionLevelSession = "EncRC5-40";
break;
case EncryptionStrength.Encr56Bit:
ICAClient.Encrypt = true;
ICAClient.EncryptionLevelSession = "EncRC5-56";
_ICAClient.Encrypt = true;
_ICAClient.EncryptionLevelSession = "EncRC5-56";
break;
case EncryptionStrength.Encr128Bit:
ICAClient.Encrypt = true;
ICAClient.EncryptionLevelSession = "EncRC5-128";
_ICAClient.Encrypt = true;
_ICAClient.EncryptionLevelSession = "EncRC5-128";
break;
}
}
@@ -291,10 +290,10 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
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);
_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)
{
@@ -326,7 +325,7 @@ namespace mRemoteNG.Connection.Protocol
if (My.Settings.Default.ReconnectOnDisconnect)
{
ReconnectGroup = new ReconnectGroup();
this.Load += ReconnectGroup_Load;
//this.Load += ReconnectGroup_Load;
ReconnectGroup.Left = (int) (((double) Control.Width / 2) - ((double) ReconnectGroup.Width / 2));
ReconnectGroup.Top = (int) (((double) Control.Height / 2) - ((double) ReconnectGroup.Height / 2));
ReconnectGroup.Parent = Control;
@@ -343,7 +342,7 @@ namespace mRemoteNG.Connection.Protocol
#region Reconnect Stuff
public void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
bool srvReady = Tools.PortScan.Scanner.IsPortOpen(Info.Hostname, System.Convert.ToString(Info.Port));
bool srvReady = Tools.PortScan.Scanner.IsPortOpen(_Info.Hostname, System.Convert.ToString(_Info.Port));
ReconnectGroup.ServerReady = srvReady;
@@ -351,7 +350,7 @@ namespace mRemoteNG.Connection.Protocol
{
tmrReconnect.Enabled = false;
ReconnectGroup.DisposeReconnectGroup();
ICAClient.Default.Connect();
_ICAClient.Connect();
}
}
#endregion

View File

@@ -8,7 +8,6 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
//using mRemoteNG.App.Native;
using System.Threading;
using mRemoteNG.App;
using mRemoteNG.Tools;
@@ -23,7 +22,7 @@ namespace mRemoteNG.Connection.Protocol
{
if (InterfaceControl.Info != null)
{
_externalTool = GetExtAppByName(System.Convert.ToString(InterfaceControl.Info.ExtApp));
_externalTool = Runtime.GetExtAppByName(System.Convert.ToString(InterfaceControl.Info.ExtApp));
_externalTool.ConnectionInfo = InterfaceControl.Info;
}
@@ -38,7 +37,7 @@ namespace mRemoteNG.Connection.Protocol
{
_externalTool.Start(InterfaceControl.Info);
Close();
return null;
return false;
}
_process = new Process();
@@ -67,16 +66,13 @@ namespace mRemoteNG.Connection.Protocol
}
}
SetParent(_handle, InterfaceControl.Handle);
Native.SetParent(_handle, InterfaceControl.Handle);
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strIntAppStuff, true);
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format(My.Language.strIntAppHandle, _handle.ToString()), true);
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format(My.Language.strIntAppTitle, _process.MainWindowTitle), true);
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format(My.Language.strIntAppParentHandle, InterfaceControl.Parent.Handle.ToString()), true);
Resize(this, new EventArgs());
base.Connect();
return true;
}
@@ -95,7 +91,7 @@ namespace mRemoteNG.Connection.Protocol
{
return ;
}
SetForegroundWindow(_handle);
Native.SetForegroundWindow(_handle);
}
catch (Exception ex)
{
@@ -111,7 +107,7 @@ namespace mRemoteNG.Connection.Protocol
{
return ;
}
MoveWindow(_handle, System.Convert.ToInt32(- SystemInformation.FrameBorderSize.Width), System.Convert.ToInt32(- (SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height)), InterfaceControl.Width + (SystemInformation.FrameBorderSize.Width * 2), InterfaceControl.Height + SystemInformation.CaptionHeight + (SystemInformation.FrameBorderSize.Height * 2), true);
Native.MoveWindow(_handle, System.Convert.ToInt32(-SystemInformation.FrameBorderSize.Width), System.Convert.ToInt32(-(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height)), InterfaceControl.Width + (SystemInformation.FrameBorderSize.Width * 2), InterfaceControl.Height + SystemInformation.CaptionHeight + (SystemInformation.FrameBorderSize.Height * 2), true);
}
catch (Exception ex)
{

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,69 +8,67 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Connection.Protocol
{
public class List : CollectionBase
{
#region Public Properties
public Connection.Protocol.Base this[object Index]
{
get
{
#region Public Properties
public Connection.Protocol.Base this[object Index]
if (Index is Connection.Protocol.Base)
{
get
{
if (Index is Connection.Protocol.Base)
{
return Index;
}
else
{
return ((Connection.Protocol.Base.Default) (List[System.Convert.ToInt32(Index)]));
}
}
return (Connection.Protocol.Base)Index;
}
public new int Count
else
{
get
{
return List.Count;
}
return ((Connection.Protocol.Base) (List[System.Convert.ToInt32(Index)]));
}
#endregion
#region Public Methods
public Connection.Protocol.Base Add(Connection.Protocol.Base cProt)
{
this.List.Add(cProt);
return cProt;
}
public void AddRange(Connection.Protocol.Base[] cProt)
{
foreach (Connection.Protocol.Base cP in cProt)
{
List.Add(cP);
}
}
public void Remove(Connection.Protocol.Base cProt)
{
try
{
this.List.Remove(cProt);
}
catch (Exception)
{
}
}
public new void Clear()
{
this.List.Clear();
}
#endregion
}
}
public new int Count
{
get
{
return List.Count;
}
}
#endregion
#region Public Methods
public Connection.Protocol.Base Add(Connection.Protocol.Base cProt)
{
this.List.Add(cProt);
return cProt;
}
public void AddRange(Connection.Protocol.Base[] cProt)
{
foreach (Connection.Protocol.Base cP in cProt)
{
List.Add(cP);
}
}
public void Remove(Connection.Protocol.Base cProt)
{
try
{
this.List.Remove(cProt);
}
catch (Exception)
{
}
}
public new void Clear()
{
this.List.Clear();
}
#endregion
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -10,9 +9,6 @@ using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
using mRemoteNG.Tools;
// End of VB project level imports
//using mRemoteNG.Tools.LocalizedAttributes;
namespace mRemoteNG.Connection.Protocol

View File

@@ -11,7 +11,6 @@ using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.ComponentModel;
using mRemoteNG.Messages;
//using mRemoteNG.App.Native;
using System.Threading;
using Microsoft.Win32;
using mRemoteNG.App;
@@ -101,7 +100,7 @@ namespace mRemoteNG.Connection.Protocol
{
get
{
if (GetForegroundWindow() == PuttyHandle)
if (Native.GetForegroundWindow() == PuttyHandle)
{
return true;
}
@@ -116,7 +115,7 @@ namespace mRemoteNG.Connection.Protocol
#region Private Events & Handlers
private void ProcessExited(object sender, System.EventArgs e)
{
base.EVENT_CLOSED(this);
base.Event_Closed(this);
}
#endregion
@@ -180,7 +179,7 @@ namespace mRemoteNG.Connection.Protocol
arguments.Add("-" + System.Convert.ToString(_PuttySSHVersion));
if (!((Force & Info.Force.NoCredentials) == (int) Info.Force.NoCredentials))
if (!(((int)Force & (int)Info.Force.NoCredentials) == (int)Info.Force.NoCredentials))
{
if (!string.IsNullOrEmpty(username))
{
@@ -215,7 +214,8 @@ namespace mRemoteNG.Connection.Protocol
{
if (_isPuttyNg)
{
PuttyHandle = FindWindowEx(InterfaceControl.Handle, 0, Constants.vbNullString, Constants.vbNullString);
PuttyHandle = Native.FindWindowEx(
InterfaceControl.Handle, new IntPtr(0), Constants.vbNullString, Constants.vbNullString);
}
else
{
@@ -230,17 +230,15 @@ namespace mRemoteNG.Connection.Protocol
if (!_isPuttyNg)
{
SetParent(PuttyHandle, InterfaceControl.Handle);
Native.SetParent(PuttyHandle, InterfaceControl.Handle);
}
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, My.Language.strPuttyStuff, true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(My.Language.strPuttyHandle, PuttyHandle.ToString()), true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(My.Language.strPuttyTitle, PuttyProcess.MainWindowTitle), true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(My.Language.strPuttyParentHandle, InterfaceControl.Parent.Handle.ToString()), true);
Resize(this, new EventArgs());
base.Connect();
return true;
}
@@ -259,7 +257,7 @@ namespace mRemoteNG.Connection.Protocol
{
return ;
}
SetForegroundWindow(PuttyHandle);
Native.SetForegroundWindow(PuttyHandle);
}
catch (Exception ex)
{
@@ -275,7 +273,7 @@ namespace mRemoteNG.Connection.Protocol
{
return ;
}
MoveWindow(PuttyHandle, System.Convert.ToInt32(- SystemInformation.FrameBorderSize.Width), System.Convert.ToInt32(- (SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height)), InterfaceControl.Width + (SystemInformation.FrameBorderSize.Width * 2), InterfaceControl.Height + SystemInformation.CaptionHeight + (SystemInformation.FrameBorderSize.Height * 2), true);
Native.MoveWindow(PuttyHandle, System.Convert.ToInt32(-SystemInformation.FrameBorderSize.Width), System.Convert.ToInt32(-(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height)), InterfaceControl.Width + (SystemInformation.FrameBorderSize.Width * 2), InterfaceControl.Height + SystemInformation.CaptionHeight + (SystemInformation.FrameBorderSize.Height * 2), true);
}
catch (Exception ex)
{
@@ -313,8 +311,8 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
PostMessage(this.PuttyHandle, WM_SYSCOMMAND, IDM_RECONF, 0);
SetForegroundWindow(this.PuttyHandle);
Native.PostMessage(this.PuttyHandle, Native.WM_SYSCOMMAND, IDM_RECONF, 0);
Native.SetForegroundWindow(this.PuttyHandle);
}
catch (Exception ex)
{

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,22 +8,20 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Connection.Protocol
{
public class RAW : Connection.Protocol.PuttyBase
{
{
public RAW()
{
this.PuttyProtocol = Putty_Protocol.raw;
}
public RAW()
{
this.PuttyProtocol = Putty_Protocol.raw;
}
public enum Defaults
{
Port = 23
}
}
public enum Defaults
{
Port = 23
}
}
}

View File

@@ -13,7 +13,6 @@ using EOLWTSCOM;
using System.ComponentModel;
using mRemoteNG.Messages;
using mRemoteNG.App;
//using mRemoteNG.Tools.LocalizedAttributes;
using MSTSCLib;
using mRemoteNG.Tools;
@@ -107,8 +106,8 @@ namespace mRemoteNG.Connection.Protocol
Thread.Sleep(0);
System.Windows.Forms.Application.DoEvents();
}
_rdpClient = ((AxMsRdpClient5NotSafeForScripting) Control).GetOcx();
_rdpClient = (MsRdpClient5NotSafeForScripting)((AxMsRdpClient5NotSafeForScripting)Control).GetOcx();
}
catch (System.Runtime.InteropServices.COMException ex)
{
@@ -135,7 +134,7 @@ namespace mRemoteNG.Connection.Protocol
_rdpClient.AdvancedSettings2.overallConnectionTimeout = 20;
_rdpClient.AdvancedSettings2.BitmapPeristence = this._connectionInfo.CacheBitmaps;
_rdpClient.AdvancedSettings2.BitmapPeristence = System.Convert.ToInt32(this._connectionInfo.CacheBitmaps);
if (_rdpVersion >= Versions.RDC61)
{
_rdpClient.AdvancedSettings7.EnableCredSspSupport = _connectionInfo.UseCredSsp;
@@ -314,9 +313,9 @@ namespace mRemoteNG.Connection.Protocol
{
size = Screen.FromControl(Control).Bounds.Size;
}
IMsRdpClient8 msRdpClient8 = _rdpClient;
msRdpClient8.Reconnect(size.Width, size.Height);
IMsRdpClient8 msRdpClient8 = (IMsRdpClient8)_rdpClient;
msRdpClient8.Reconnect((uint)size.Width, (uint)size.Height);
}
private void SetRdGateway()
@@ -335,7 +334,7 @@ namespace mRemoteNG.Connection.Protocol
if (!(_connectionInfo.RDGatewayUsageMethod == RDGatewayUsageMethod.Never))
{
_rdpClient.TransportSettings.GatewayUsageMethod = _connectionInfo.RDGatewayUsageMethod;
_rdpClient.TransportSettings.GatewayUsageMethod = (uint)_connectionInfo.RDGatewayUsageMethod;
_rdpClient.TransportSettings.GatewayHostname = _connectionInfo.RDGatewayHostname;
_rdpClient.TransportSettings.GatewayProfileUsageMethod = 1; // TSC_PROXY_PROFILE_MODE_EXPLICIT
if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard)
@@ -513,7 +512,7 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
if (_connectionInfo.Port != Defaults.Port)
if (_connectionInfo.Port != (int)Defaults.Port)
{
_rdpClient.AdvancedSettings2.RDPPort = _connectionInfo.Port;
}
@@ -577,7 +576,7 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
_rdpClient.AdvancedSettings5.AuthenticationLevel = this._connectionInfo.RDPAuthenticationLevel;
_rdpClient.AdvancedSettings5.AuthenticationLevel = (uint)this._connectionInfo.RDPAuthenticationLevel;
}
catch (Exception ex)
{
@@ -630,7 +629,7 @@ namespace mRemoteNG.Connection.Protocol
const int UI_ERR_NORMAL_DISCONNECT = 0xB08;
if (!(discReason == UI_ERR_NORMAL_DISCONNECT))
{
string reason = _rdpClient.GetErrorDescription(discReason, (System.UInt32) _rdpClient.ExtendedDisconnectReason);
string reason = _rdpClient.GetErrorDescription((uint)discReason, (System.UInt32) _rdpClient.ExtendedDisconnectReason);
Event_Disconnected(this, discReason + "\r\n" + reason);
}
@@ -800,7 +799,7 @@ namespace mRemoteNG.Connection.Protocol
string[] resolutionParts = null;
if (!(resolution == RDPResolutions.FitToWindow) & !(resolution == RDPResolutions.Fullscreen) & !(resolution == RDPResolutions.SmartSize))
{
resolutionParts = resolution.ToString().Replace("Res", "").Split("x");
resolutionParts = resolution.ToString().Replace("Res", "").Split('x');
}
if (resolutionParts == null || !(resolutionParts.Length == 2))
{
@@ -808,7 +807,7 @@ namespace mRemoteNG.Connection.Protocol
}
else
{
return new Rectangle(0, 0, (int) (resolutionParts[0]), (int) (resolutionParts[1]));
return new Rectangle(0, 0, System.Convert.ToInt32(resolutionParts[0]), System.Convert.ToInt32(resolutionParts[1]));
}
}
#endregion
@@ -838,7 +837,7 @@ namespace mRemoteNG.Connection.Protocol
}
}
public long OpenConnection(string hostname)
public int OpenConnection(string hostname)
{
if (_wtsCom == null)
{
@@ -853,9 +852,10 @@ namespace mRemoteNG.Connection.Protocol
{
Runtime.MessageCollector.AddExceptionMessage(My.Language.strRdpOpenConnectionFailed, ex, MessageClass.ErrorMsg, true);
}
return 0;
}
public void CloseConnection(long serverHandle)
public void CloseConnection(int serverHandle)
{
if (_wtsCom == null)
{
@@ -871,8 +871,8 @@ namespace mRemoteNG.Connection.Protocol
Runtime.MessageCollector.AddExceptionMessage(My.Language.strRdpCloseConnectionFailed, ex, MessageClass.ErrorMsg, true);
}
}
public SessionsCollection GetSessions(long serverHandle)
public SessionsCollection GetSessions(int serverHandle)
{
if (_wtsCom == null)
{
@@ -885,7 +885,7 @@ namespace mRemoteNG.Connection.Protocol
{
WTSSessions wtsSessions = _wtsCom.WTSEnumerateSessions(serverHandle);
long sessionId = 0;
int sessionId = 0;
string sessionUser = "";
long sessionState;
string sessionName = "";
@@ -917,8 +917,8 @@ namespace mRemoteNG.Connection.Protocol
return sessions;
}
public bool KillSession(long serverHandle, long sessionId)
public bool KillSession(int serverHandle, int sessionId)
{
if (_wtsCom == null)
{
@@ -955,11 +955,11 @@ namespace mRemoteNG.Connection.Protocol
{
get
{
return List.Count();
return List.Count;
}
}
public Session Add(long sessionId, string sessionState, string sessionUser, string sessionName)
public Session Add(int sessionId, string sessionState, string sessionUser, string sessionName)
{
Session newSession = new Session();
@@ -989,7 +989,7 @@ namespace mRemoteNG.Connection.Protocol
public class Session : CollectionBase
{
public long SessionId {get; set;}
public int SessionId {get; set;}
public string SessionState {get; set;}
public string SessionUser {get; set;}
public string SessionName {get; set;}
@@ -999,19 +999,30 @@ namespace mRemoteNG.Connection.Protocol
#region Fatal Errors
public class FatalErrors
{
public FatalErrors()
{
// VBConversions Note: Non-static class variable initialization is below. Class variables cannot be initially assigned non-static values in C#.
_description = new string[] {System.Convert.ToString(0 == My.Language.strRdpErrorUnknown), System.Convert.ToString(1 == My.Language.strRdpErrorCode1), System.Convert.ToString(2 == My.Language.strRdpErrorOutOfMemory), System.Convert.ToString(3 == My.Language.strRdpErrorWindowCreation), System.Convert.ToString(4 == My.Language.strRdpErrorCode2), System.Convert.ToString(5 == My.Language.strRdpErrorCode3), System.Convert.ToString(6 == My.Language.strRdpErrorCode4), System.Convert.ToString(7 == My.Language.strRdpErrorConnection), System.Convert.ToString(100 == My.Language.strRdpErrorWinsock)};
}
protected static string[] _description; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
protected static Hashtable _description;
protected static void InitDescription()
{
_description = new Hashtable();
_description.Add("0", "My.Language.strRdpErrorUnknown");
_description.Add("1", "My.Language.strRdpErrorCode1");
_description.Add("2", "My.Language.strRdpErrorOutOfMemory");
_description.Add("3", "My.Language.strRdpErrorWindowCreation");
_description.Add("4", "My.Language.strRdpErrorCode2");
_description.Add("5", "My.Language.strRdpErrorCode3");
_description.Add("6", "My.Language.strRdpErrorCode4");
_description.Add("7", "My.Language.strRdpErrorConnection");
_description.Add("100", "My.Language.strRdpErrorWinsock");
}
public static string GetError(string id)
{
if (_description == null)
{
InitDescription();
}
try
{
return (_description[int.Parse(id)]);
return ((string)_description[id]);
}
catch (Exception ex)
{

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,22 +8,21 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Connection.Protocol
{
public class Rlogin : PuttyBase
{
{
public Rlogin()
{
this.PuttyProtocol = Putty_Protocol.rlogin;
}
public Rlogin()
{
this.PuttyProtocol = Putty_Protocol.rlogin;
}
public enum Defaults
{
Port = 513
}
}
public enum Defaults
{
Port = 513
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,23 +8,22 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Connection.Protocol
{
public class SSH1 : PuttyBase
{
{
public SSH1()
{
this.PuttyProtocol = Putty_Protocol.ssh;
this.PuttySSHVersion = Putty_SSHVersion.ssh1;
}
public SSH1()
{
this.PuttyProtocol = Putty_Protocol.ssh;
this.PuttySSHVersion = Putty_SSHVersion.ssh1;
}
public enum Defaults
{
Port = 22
}
}
public enum Defaults
{
Port = 22
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,23 +8,22 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Connection.Protocol
{
public class SSH2 : PuttyBase
{
{
public SSH2()
{
this.PuttyProtocol = Putty_Protocol.ssh;
this.PuttySSHVersion = Putty_SSHVersion.ssh2;
}
public SSH2()
{
this.PuttyProtocol = Putty_Protocol.ssh;
this.PuttySSHVersion = Putty_SSHVersion.ssh2;
}
public enum Defaults
{
Port = 22
}
}
public enum Defaults
{
Port = 22
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,22 +8,21 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Connection.Protocol
{
public class Serial : PuttyBase
{
{
public Serial()
{
this.PuttyProtocol = Putty_Protocol.serial;
}
public Serial()
{
this.PuttyProtocol = Putty_Protocol.serial;
}
public enum Defaults
{
Port = 9600
}
}
public enum Defaults
{
Port = 9600
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,22 +8,21 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Connection.Protocol
{
public class Telnet : PuttyBase
{
{
public Telnet()
{
this.PuttyProtocol = Putty_Protocol.telnet;
}
public Telnet()
{
this.PuttyProtocol = Putty_Protocol.telnet;
}
public enum Defaults
{
Port = 23
}
}
public enum Defaults
{
Port = 23
}
}
}

View File

@@ -11,7 +11,6 @@ using System.Windows.Forms;
using mRemoteNG.App;
using System.ComponentModel;
using mRemoteNG.Tools;
//using mRemoteNG.Tools.LocalizedAttributes;
namespace mRemoteNG.Connection.Protocol
@@ -21,19 +20,19 @@ namespace mRemoteNG.Connection.Protocol
#region Properties
public bool SmartSize
{
get { return VNC_Renamed.Scaled; }
set { VNC_Renamed.Scaled = value; }
get { return _VNC.Scaled; }
set { _VNC.Scaled = value; }
}
public bool ViewOnly
{
get { return VNC_Renamed.ViewOnly; }
set { VNC_Renamed.ViewOnly = value; }
get { return _VNC.ViewOnly; }
set { _VNC.ViewOnly = value; }
}
#endregion
#region Private Declarations
private VncSharp.RemoteDesktop VNC_Renamed;
private VncSharp.RemoteDesktop _VNC;
private Connection.Info Info;
#endregion
@@ -49,11 +48,11 @@ namespace mRemoteNG.Connection.Protocol
try
{
VNC_Renamed = this.Control;
_VNC = (VncSharp.RemoteDesktop)this.Control;
Info = this.InterfaceControl.Info;
VNC_Renamed.VncPort = this.Info.Port;
_VNC.VncPort = this.Info.Port;
//If Info.VNCCompression <> Compression.CompNone Then
// VNC.JPEGCompression = True
@@ -133,7 +132,7 @@ namespace mRemoteNG.Connection.Protocol
try
{
VNC_Renamed.Connect(this.Info.Hostname, this.Info.VNCViewOnly, Info.VNCSmartSizeMode != SmartSizeMode.SmartSNo);
_VNC.Connect(this.Info.Hostname, this.Info.VNCViewOnly, Info.VNCSmartSizeMode != SmartSizeMode.SmartSNo);
}
catch (Exception ex)
{
@@ -148,7 +147,7 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
VNC_Renamed.Disconnect();
_VNC.Disconnect();
}
catch (Exception ex)
{
@@ -162,11 +161,11 @@ namespace mRemoteNG.Connection.Protocol
{
switch (Keys)
{
case SpecialKeys.CtrlAltDel:
VNC_Renamed.SendSpecialKeys(SpecialKeys.CtrlAltDel);
case Connection.Protocol.VNC.SpecialKeys.CtrlAltDel:
_VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlAltDel);
break;
case SpecialKeys.CtrlEsc:
VNC_Renamed.SendSpecialKeys(SpecialKeys.CtrlEsc);
case Connection.Protocol.VNC.SpecialKeys.CtrlEsc:
_VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlEsc);
break;
}
}
@@ -238,7 +237,7 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
VNC_Renamed.FullScreenUpdate();
_VNC.FullScreenUpdate();
}
catch (Exception ex)
{
@@ -252,12 +251,12 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
VNC_Renamed.ConnectComplete += VNCEvent_Connected;
VNC_Renamed.ConnectionLost += VNCEvent_Disconnected;
_VNC.ConnectComplete += VNCEvent_Connected;
_VNC.ConnectionLost += VNCEvent_Disconnected;
mRemoteNG.frmMain.clipboardchange += VNCEvent_ClipboardChanged;
if (!((Force & Info.Force.NoCredentials) == (int) Info.Force.NoCredentials) && !string.IsNullOrEmpty(Info.Password))
if (!(((int)Force & (int)Info.Force.NoCredentials) == (int)Info.Force.NoCredentials) && !string.IsNullOrEmpty(Info.Password))
{
VNC_Renamed.GetPassword = new System.EventHandler(VNCEvent_Authenticate);
_VNC.GetPassword = VNCEvent_Authenticate;
}
}
catch (Exception ex)
@@ -271,7 +270,7 @@ namespace mRemoteNG.Connection.Protocol
private void VNCEvent_Connected(object sender, EventArgs e)
{
base.Event_Connected(this);
VNC_Renamed.AutoScroll = Info.VNCSmartSizeMode == SmartSizeMode.SmartSNo;
_VNC.AutoScroll = Info.VNCSmartSizeMode == SmartSizeMode.SmartSNo;
}
private void VNCEvent_Disconnected(object sender, EventArgs e)
@@ -282,7 +281,7 @@ namespace mRemoteNG.Connection.Protocol
private void VNCEvent_ClipboardChanged()
{
this.VNC_Renamed.FillServerClipboard();
this._VNC.FillServerClipboard();
}
private string VNCEvent_Authenticate()

View File

@@ -17,7 +17,7 @@ namespace mRemoteNG.Container
[DefaultProperty("Name")]
public class Info
{
#region Properties
#region Properties
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1),
Browsable(true),
ReadOnly(false),
@@ -60,7 +60,8 @@ namespace mRemoteNG.Container
private object _Parent;
[Category(""),
Browsable(false)]public object Parent
Browsable(false)]
public object Parent
{
get
{
@@ -115,9 +116,9 @@ namespace mRemoteNG.Container
this._ConnectionInfo = value;
}
}
#endregion
#endregion
#region Methods
#region Methods
public Container.Info Copy()
{
return (Info)this.MemberwiseClone();
@@ -135,7 +136,7 @@ namespace mRemoteNG.Container
this.IsExpanded = true;
}
}
#endregion
#endregion
public class Attributes
{

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,84 +8,82 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Container
{
public class List : CollectionBase
{
#region Public Properties
public Container.Info this[object Index]
{
#region Public Properties
public Container.Info this[object Index]
get
{
get
if (Index is Container.Info)
{
if (Index is Container.Info)
{
return Index;
}
else
{
return ((Container.Info) (List[System.Convert.ToInt32(Index)]));
}
return (Container.Info)Index;
}
else
{
return ((Container.Info) (List[System.Convert.ToInt32(Index)]));
}
}
public new int Count
{
get
{
return List.Count;
}
}
#endregion
#region Public Methods
public Container.Info Add(Container.Info cInfo)
{
this.List.Add(cInfo);
return cInfo;
}
public void AddRange(Container.Info[] cInfo)
{
foreach (Container.Info cI in cInfo)
{
List.Add(cI);
}
}
public Container.Info FindByConstantID(string id)
{
foreach (Container.Info contI in List)
{
if (contI.ConnectionInfo.ConstantID == id)
{
return contI;
}
}
return null;
}
public Container.List Copy()
{
try
{
return this.MemberwiseClone();
}
catch (Exception)
{
}
return null;
}
public new void Clear()
{
this.List.Clear();
}
#endregion
}
public new int Count
{
get
{
return List.Count;
}
}
#endregion
#region Public Methods
public Container.Info Add(Container.Info cInfo)
{
this.List.Add(cInfo);
return cInfo;
}
public void AddRange(Container.Info[] cInfo)
{
foreach (Container.Info cI in cInfo)
{
List.Add(cI);
}
}
public Container.Info FindByConstantID(string id)
{
foreach (Container.Info contI in List)
{
if (contI.ConnectionInfo.ConstantID == id)
{
return contI;
}
}
return null;
}
public Container.List Copy()
{
try
{
return (Container.List)this.MemberwiseClone();
}
catch (Exception)
{
}
return null;
}
public new void Clear()
{
this.List.Clear();
}
#endregion
}
}

View File

@@ -1,81 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.ComponentModel;
// Adapted from http://stackoverflow.com/a/3678888/2101395
namespace mRemoteNG
{
namespace Controls
{
public class TextBox : System.Windows.Forms.TextBox
{
#region Public Properties
[Category("Behavior"),
DefaultValue(false)]private bool _SelectAllOnFocus = false;
private bool SelectAllOnFocus
{
get
{
return _SelectAllOnFocus;
}
set
{
_SelectAllOnFocus = value;
}
}
#endregion
#region Protected Methods
protected override void OnEnter(EventArgs e)
{
base.OnEnter(e);
if (MouseButtons == MouseButtons.None)
{
SelectAll();
_focusHandled = true;
}
}
protected override void OnLeave(EventArgs e)
{
base.OnLeave(e);
_focusHandled = false;
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
if (!_focusHandled)
{
if (SelectionLength == 0)
{
SelectAll();
}
_focusHandled = true;
}
}
#endregion
#region Private Fields
private bool _focusHandled = false;
#endregion
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -10,102 +9,100 @@ using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
using mRemoteNG.Tools;
// End of VB project level imports
using System.ComponentModel;
//using mRemoteNG.Tools.LocalizedAttributes;
namespace mRemoteNG.Credential
{
public class Info
{
#region 1 Display
private string _Name;
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameName"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionName")]
public string Name
{
#region 1 Display
private string _Name;
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameName"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionName")]
public string Name
get
{
get
{
return _Name;
}
set
{
_Name = value;
}
return _Name;
}
private string _Description;
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameDescription"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDescription")]
public string Description
set
{
get
{
return _Description;
}
set
{
_Description = value;
}
_Name = value;
}
#endregion
#region 2 Credentials
private string _Username;
[LocalizedAttributes.LocalizedCategory("strCategoryCredentials", 2),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameUsername"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUsername")]
public string Username
{
get
{
return _Username;
}
set
{
_Username = value;
}
}
private string _Password;
[LocalizedAttributes.LocalizedCategory("strCategoryCredentials", 2),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNamePassword"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPassword"),
PasswordPropertyText(true)]public string Password
{
get
{
return _Password;
}
set
{
_Password = value;
}
}
private string _Domain;
[LocalizedAttributes.LocalizedCategory("strCategoryCredentials", 2),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameDomain"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDomain")]
public string Domain
{
get
{
return _Domain;
}
set
{
_Domain = value;
}
}
#endregion
}
private string _Description;
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameDescription"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDescription")]
public string Description
{
get
{
return _Description;
}
set
{
_Description = value;
}
}
#endregion
#region 2 Credentials
private string _Username;
[LocalizedAttributes.LocalizedCategory("strCategoryCredentials", 2),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameUsername"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUsername")]
public string Username
{
get
{
return _Username;
}
set
{
_Username = value;
}
}
private string _Password;
[LocalizedAttributes.LocalizedCategory("strCategoryCredentials", 2),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNamePassword"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPassword"),
PasswordPropertyText(true)]public string Password
{
get
{
return _Password;
}
set
{
_Password = value;
}
}
private string _Domain;
[LocalizedAttributes.LocalizedCategory("strCategoryCredentials", 2),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameDomain"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDomain")]
public string Domain
{
get
{
return _Domain;
}
set
{
_Domain = value;
}
}
#endregion
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,71 +8,69 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Credential
{
public class List : CollectionBase
{
#region Public Properties
public Credential.Info this[object Index]
{
#region Public Properties
public Credential.Info this[object Index]
get
{
get
if (Index is Credential.Info)
{
if (Index is Credential.Info)
{
return Index;
}
else
{
return ((Credential.Info) (List[System.Convert.ToInt32(Index)]));
}
return (Credential.Info)Index;
}
else
{
return ((Credential.Info) (List[System.Convert.ToInt32(Index)]));
}
}
public new int Count
{
get
{
return List.Count;
}
}
#endregion
#region Public Methods
public Credential.Info Add(Credential.Info cInfo)
{
List.Add(cInfo);
return cInfo;
}
public void AddRange(Credential.Info[] cInfo)
{
foreach (Credential.Info cI in cInfo)
{
List.Add(cI);
}
}
public Credential.List Copy()
{
try
{
return this.MemberwiseClone();
}
catch (Exception)
{
}
return null;
}
public new void Clear()
{
List.Clear();
}
#endregion
}
public new int Count
{
get
{
return List.Count;
}
}
#endregion
#region Public Methods
public Credential.Info Add(Credential.Info cInfo)
{
List.Add(cInfo);
return cInfo;
}
public void AddRange(Credential.Info[] cInfo)
{
foreach (Credential.Info cI in cInfo)
{
List.Add(cI);
}
}
public Credential.List Copy()
{
try
{
return (Credential.List)this.MemberwiseClone();
}
catch (Exception)
{
}
return null;
}
public new void Clear()
{
List.Clear();
}
#endregion
}
}

View File

@@ -1,315 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms
{
public partial class ExportForm : Form
{
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.btnCancel = new System.Windows.Forms.Button();
this.Load += new System.EventHandler(ExportForm_Load);
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
this.btnOK = new System.Windows.Forms.Button();
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
this.lblUncheckProperties = new System.Windows.Forms.Label();
this.chkUsername = new System.Windows.Forms.CheckBox();
this.chkPassword = new System.Windows.Forms.CheckBox();
this.chkDomain = new System.Windows.Forms.CheckBox();
this.chkInheritance = new System.Windows.Forms.CheckBox();
this.txtFileName = new System.Windows.Forms.TextBox();
this.txtFileName.TextChanged += new System.EventHandler(this.txtFileName_TextChanged);
this.btnBrowse = new System.Windows.Forms.Button();
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
this.grpProperties = new System.Windows.Forms.GroupBox();
this.grpFile = new System.Windows.Forms.GroupBox();
this.lblFileFormat = new System.Windows.Forms.Label();
this.lblFileName = new System.Windows.Forms.Label();
this.cboFileFormat = new System.Windows.Forms.ComboBox();
this.grpItems = new System.Windows.Forms.GroupBox();
this.lblSelectedConnection = new System.Windows.Forms.Label();
this.lblSelectedFolder = new System.Windows.Forms.Label();
this.rdoExportSelectedConnection = new System.Windows.Forms.RadioButton();
this.rdoExportSelectedFolder = new System.Windows.Forms.RadioButton();
this.rdoExportEverything = new System.Windows.Forms.RadioButton();
this.grpProperties.SuspendLayout();
this.grpFile.SuspendLayout();
this.grpItems.SuspendLayout();
this.SuspendLayout();
//
//btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(447, 473);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "&Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
//btnOK
//
this.btnOK.Location = new System.Drawing.Point(366, 473);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 2;
this.btnOK.Text = "&OK";
this.btnOK.UseVisualStyleBackColor = true;
//
//lblUncheckProperties
//
this.lblUncheckProperties.AutoSize = true;
this.lblUncheckProperties.Location = new System.Drawing.Point(12, 134);
this.lblUncheckProperties.Name = "lblUncheckProperties";
this.lblUncheckProperties.Size = new System.Drawing.Size(244, 13);
this.lblUncheckProperties.TabIndex = 4;
this.lblUncheckProperties.Text = "Uncheck the properties you want not to be saved!";
//
//chkUsername
//
this.chkUsername.AutoSize = true;
this.chkUsername.Checked = true;
this.chkUsername.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkUsername.Location = new System.Drawing.Point(15, 32);
this.chkUsername.Name = "chkUsername";
this.chkUsername.Size = new System.Drawing.Size(74, 17);
this.chkUsername.TabIndex = 0;
this.chkUsername.Text = "Username";
this.chkUsername.UseVisualStyleBackColor = true;
//
//chkPassword
//
this.chkPassword.AutoSize = true;
this.chkPassword.Checked = true;
this.chkPassword.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkPassword.Location = new System.Drawing.Point(15, 55);
this.chkPassword.Name = "chkPassword";
this.chkPassword.Size = new System.Drawing.Size(72, 17);
this.chkPassword.TabIndex = 1;
this.chkPassword.Text = "Password";
this.chkPassword.UseVisualStyleBackColor = true;
//
//chkDomain
//
this.chkDomain.AutoSize = true;
this.chkDomain.Checked = true;
this.chkDomain.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkDomain.Location = new System.Drawing.Point(15, 78);
this.chkDomain.Name = "chkDomain";
this.chkDomain.Size = new System.Drawing.Size(62, 17);
this.chkDomain.TabIndex = 2;
this.chkDomain.Text = "Domain";
this.chkDomain.UseVisualStyleBackColor = true;
//
//chkInheritance
//
this.chkInheritance.AutoSize = true;
this.chkInheritance.Checked = true;
this.chkInheritance.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkInheritance.Location = new System.Drawing.Point(15, 101);
this.chkInheritance.Name = "chkInheritance";
this.chkInheritance.Size = new System.Drawing.Size(79, 17);
this.chkInheritance.TabIndex = 3;
this.chkInheritance.Text = "Inheritance";
this.chkInheritance.UseVisualStyleBackColor = true;
//
//txtFileName
//
this.txtFileName.Location = new System.Drawing.Point(15, 48);
this.txtFileName.Name = "txtFileName";
this.txtFileName.Size = new System.Drawing.Size(396, 20);
this.txtFileName.TabIndex = 1;
//
//btnBrowse
//
this.btnBrowse.Location = new System.Drawing.Point(417, 46);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(75, 23);
this.btnBrowse.TabIndex = 2;
this.btnBrowse.Text = "&Browse";
this.btnBrowse.UseVisualStyleBackColor = true;
//
//grpProperties
//
this.grpProperties.Controls.Add(this.lblUncheckProperties);
this.grpProperties.Controls.Add(this.chkInheritance);
this.grpProperties.Controls.Add(this.chkUsername);
this.grpProperties.Controls.Add(this.chkDomain);
this.grpProperties.Controls.Add(this.chkPassword);
this.grpProperties.Location = new System.Drawing.Point(12, 304);
this.grpProperties.Name = "grpProperties";
this.grpProperties.Size = new System.Drawing.Size(510, 163);
this.grpProperties.TabIndex = 1;
this.grpProperties.TabStop = false;
this.grpProperties.Text = "Export Properties";
//
//grpFile
//
this.grpFile.Controls.Add(this.lblFileFormat);
this.grpFile.Controls.Add(this.lblFileName);
this.grpFile.Controls.Add(this.cboFileFormat);
this.grpFile.Controls.Add(this.txtFileName);
this.grpFile.Controls.Add(this.btnBrowse);
this.grpFile.Location = new System.Drawing.Point(12, 12);
this.grpFile.Name = "grpFile";
this.grpFile.Size = new System.Drawing.Size(510, 140);
this.grpFile.TabIndex = 0;
this.grpFile.TabStop = false;
this.grpFile.Text = "Export File";
//
//lblFileFormat
//
this.lblFileFormat.AutoSize = true;
this.lblFileFormat.Location = new System.Drawing.Point(12, 84);
this.lblFileFormat.Name = "lblFileFormat";
this.lblFileFormat.Size = new System.Drawing.Size(61, 13);
this.lblFileFormat.TabIndex = 3;
this.lblFileFormat.Text = "File &Format:";
//
//lblFileName
//
this.lblFileName.AutoSize = true;
this.lblFileName.Location = new System.Drawing.Point(12, 32);
this.lblFileName.Name = "lblFileName";
this.lblFileName.Size = new System.Drawing.Size(52, 13);
this.lblFileName.TabIndex = 0;
this.lblFileName.Text = "Filename:";
//
//cboFileFormat
//
this.cboFileFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboFileFormat.FormattingEnabled = true;
this.cboFileFormat.Location = new System.Drawing.Point(15, 100);
this.cboFileFormat.Name = "cboFileFormat";
this.cboFileFormat.Size = new System.Drawing.Size(294, 21);
this.cboFileFormat.TabIndex = 4;
//
//grpItems
//
this.grpItems.Controls.Add(this.lblSelectedConnection);
this.grpItems.Controls.Add(this.lblSelectedFolder);
this.grpItems.Controls.Add(this.rdoExportSelectedConnection);
this.grpItems.Controls.Add(this.rdoExportSelectedFolder);
this.grpItems.Controls.Add(this.rdoExportEverything);
this.grpItems.Location = new System.Drawing.Point(12, 158);
this.grpItems.Name = "grpItems";
this.grpItems.Size = new System.Drawing.Size(510, 140);
this.grpItems.TabIndex = 4;
this.grpItems.TabStop = false;
this.grpItems.Text = "Export Items";
//
//lblSelectedConnection
//
this.lblSelectedConnection.AutoSize = true;
this.lblSelectedConnection.Location = new System.Drawing.Point(48, 111);
this.lblSelectedConnection.Name = "lblSelectedConnection";
this.lblSelectedConnection.Size = new System.Drawing.Size(92, 13);
this.lblSelectedConnection.TabIndex = 4;
this.lblSelectedConnection.Text = "Connection Name";
//
//lblSelectedFolder
//
this.lblSelectedFolder.AutoSize = true;
this.lblSelectedFolder.Location = new System.Drawing.Point(48, 75);
this.lblSelectedFolder.Name = "lblSelectedFolder";
this.lblSelectedFolder.Size = new System.Drawing.Size(67, 13);
this.lblSelectedFolder.TabIndex = 3;
this.lblSelectedFolder.Text = "Folder Name";
//
//rdoExportSelectedConnection
//
this.rdoExportSelectedConnection.AutoSize = true;
this.rdoExportSelectedConnection.Location = new System.Drawing.Point(15, 91);
this.rdoExportSelectedConnection.Name = "rdoExportSelectedConnection";
this.rdoExportSelectedConnection.Size = new System.Drawing.Size(215, 17);
this.rdoExportSelectedConnection.TabIndex = 2;
this.rdoExportSelectedConnection.TabStop = true;
this.rdoExportSelectedConnection.Text = "Export the currently selected connection";
this.rdoExportSelectedConnection.UseVisualStyleBackColor = true;
//
//rdoExportSelectedFolder
//
this.rdoExportSelectedFolder.AutoSize = true;
this.rdoExportSelectedFolder.Location = new System.Drawing.Point(15, 55);
this.rdoExportSelectedFolder.Name = "rdoExportSelectedFolder";
this.rdoExportSelectedFolder.Size = new System.Drawing.Size(188, 17);
this.rdoExportSelectedFolder.TabIndex = 1;
this.rdoExportSelectedFolder.TabStop = true;
this.rdoExportSelectedFolder.Text = "Export the currently selected folder";
this.rdoExportSelectedFolder.UseVisualStyleBackColor = true;
//
//rdoExportEverything
//
this.rdoExportEverything.AutoSize = true;
this.rdoExportEverything.Checked = true;
this.rdoExportEverything.Location = new System.Drawing.Point(15, 32);
this.rdoExportEverything.Name = "rdoExportEverything";
this.rdoExportEverything.Size = new System.Drawing.Size(107, 17);
this.rdoExportEverything.TabIndex = 0;
this.rdoExportEverything.TabStop = true;
this.rdoExportEverything.Text = "Export everything";
this.rdoExportEverything.UseVisualStyleBackColor = true;
//
//ExportForm
//
this.AcceptButton = this.btnOK;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(534, 508);
this.Controls.Add(this.grpItems);
this.Controls.Add(this.grpFile);
this.Controls.Add(this.grpProperties);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = global::My.Resources.Resources.Connections_SaveAs_Icon;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ExportForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Export Connections";
this.grpProperties.ResumeLayout(false);
this.grpProperties.PerformLayout();
this.grpFile.ResumeLayout(false);
this.grpFile.PerformLayout();
this.grpItems.ResumeLayout(false);
this.grpItems.PerformLayout();
this.ResumeLayout(false);
}
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Label lblUncheckProperties;
private System.Windows.Forms.CheckBox chkUsername;
private System.Windows.Forms.CheckBox chkPassword;
private System.Windows.Forms.CheckBox chkDomain;
private System.Windows.Forms.CheckBox chkInheritance;
private System.Windows.Forms.TextBox txtFileName;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.GroupBox grpProperties;
private System.Windows.Forms.GroupBox grpFile;
private System.Windows.Forms.Label lblFileFormat;
private System.Windows.Forms.Label lblFileName;
private System.Windows.Forms.ComboBox cboFileFormat;
private System.Windows.Forms.GroupBox grpItems;
private System.Windows.Forms.Label lblSelectedConnection;
private System.Windows.Forms.Label lblSelectedFolder;
private System.Windows.Forms.RadioButton rdoExportSelectedConnection;
private System.Windows.Forms.RadioButton rdoExportSelectedFolder;
private System.Windows.Forms.RadioButton rdoExportEverything;
#endregion
}
}

View File

@@ -1,341 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.ComponentModel;
//using mRemoteNG.Config.Connections;
using mRemoteNG.App;
using mRemoteNG.My;
namespace mRemoteNG.Forms
{
public partial class ExportForm : Form
{
#region Public Properties
public string FileName
{
get
{
return txtFileName.Text;
}
set
{
txtFileName.Text = value;
}
}
public Config.Connections.Save.Format SaveFormat
{
get
{
ExportFormat exportFormat = cboFileFormat.SelectedItem as ExportFormat;
if (exportFormat == null)
{
return Config.Connections.Save_Renamed.Format.mRXML;
}
else
{
return exportFormat.Format;
}
}
set
{
foreach (object item in cboFileFormat.Items)
{
ExportFormat exportFormat = item as ExportFormat;
if (exportFormat == null)
{
continue;
}
if (exportFormat.Format == value)
{
cboFileFormat.SelectedItem = item;
break;
}
}
}
}
public ExportScope Scope
{
get
{
if (rdoExportSelectedFolder.Checked)
{
return ExportScope.SelectedFolder;
}
else if (rdoExportSelectedConnection.Checked)
{
return ExportScope.SelectedConnection;
}
else
{
return ExportScope.Everything;
}
}
set
{
switch (value)
{
case ExportScope.Everything:
rdoExportEverything.Checked = true;
break;
case ExportScope.SelectedFolder:
rdoExportSelectedFolder.Checked = true;
break;
case ExportScope.SelectedConnection:
rdoExportSelectedConnection.Checked = true;
break;
}
}
}
private TreeNode _selectedFolder;
public TreeNode SelectedFolder
{
get
{
return _selectedFolder;
}
set
{
_selectedFolder = value;
if (value == null)
{
lblSelectedFolder.Text = string.Empty;
}
else
{
lblSelectedFolder.Text = value.Text;
}
rdoExportSelectedFolder.Enabled = value != null;
}
}
private TreeNode _selectedConnection;
public TreeNode SelectedConnection
{
get
{
return _selectedConnection;
}
set
{
_selectedConnection = value;
if (value == null)
{
lblSelectedConnection.Text = string.Empty;
}
else
{
lblSelectedConnection.Text = value.Text;
}
rdoExportSelectedConnection.Enabled = value != null;
}
}
public bool IncludeUsername
{
get
{
return chkUsername.Checked;
}
set
{
chkUsername.Checked = value;
}
}
public bool IncludePassword
{
get
{
return chkPassword.Checked;
}
set
{
chkPassword.Checked = value;
}
}
public bool IncludeDomain
{
get
{
return chkDomain.Checked;
}
set
{
chkDomain.Checked = value;
}
}
public bool IncludeInheritance
{
get
{
return chkInheritance.Checked;
}
set
{
chkInheritance.Checked = value;
}
}
#endregion
#region Constructors
public ExportForm()
{
InitializeComponent();
Runtime.FontOverride(this);
SelectedFolder = null;
SelectedConnection = null;
btnOK.Enabled = false;
}
#endregion
#region Private Methods
#region Event Handlers
public void ExportForm_Load(object sender, EventArgs e)
{
cboFileFormat.Items.Clear();
cboFileFormat.Items.Add(new ExportFormat(Save().Format.mRXML));
cboFileFormat.Items.Add(new ExportFormat(Save().Format.mRCSV));
cboFileFormat.Items.Add(new ExportFormat(Save().Format.vRDCSV));
cboFileFormat.SelectedIndex = 0;
ApplyLanguage();
}
public void txtFileName_TextChanged(System.Object sender, EventArgs e)
{
btnOK.Enabled = !string.IsNullOrEmpty(txtFileName.Text);
}
public void btnBrowse_Click(System.Object sender, EventArgs e)
{
using (SaveFileDialog saveFileDialog = new SaveFileDialog())
{
saveFileDialog.CheckPathExists = true;
saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
saveFileDialog.OverwritePrompt = true;
List<string> fileTypes = new List<string>();
fileTypes.AddRange(new[] {Language.strFiltermRemoteXML, "*.xml"});
fileTypes.AddRange(new[] {Language.strFiltermRemoteCSV, "*.csv"});
fileTypes.AddRange(new[] {Language.strFiltervRD2008CSV, "*.csv"});
fileTypes.AddRange(new[] {Language.strFilterAll, "*.*"});
saveFileDialog.Filter = string.Join("|", fileTypes.ToArray());
if (!(saveFileDialog.ShowDialog(this) == DialogResult.OK))
{
return ;
}
txtFileName.Text = saveFileDialog.FileName;
}
}
public void btnOK_Click(System.Object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
public void btnCancel_Click(System.Object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
#endregion
private void ApplyLanguage()
{
Text = Language.strExport;
grpFile.Text = Language.strExportFile;
lblFileName.Text = Language.strLabelFilename;
btnBrowse.Text = Language.strButtonBrowse;
lblFileFormat.Text = Language.strFileFormatLabel;
grpItems.Text = Language.strExportItems;
rdoExportEverything.Text = Language.strExportEverything;
rdoExportSelectedFolder.Text = Language.strExportSelectedFolder;
rdoExportSelectedConnection.Text = Language.strExportSelectedConnection;
grpProperties.Text = Language.strExportProperties;
chkUsername.Text = Language.strCheckboxUsername;
chkPassword.Text = Language.strCheckboxPassword;
chkDomain.Text = Language.strCheckboxDomain;
chkInheritance.Text = Language.strCheckboxInheritance;
lblUncheckProperties.Text = Language.strUncheckProperties;
btnOK.Text = Language.strButtonOK;
btnCancel.Text = Language.strButtonCancel;
}
#endregion
#region Public Enumerations
public enum ExportScope
{
Everything,
SelectedFolder,
SelectedConnection
}
#endregion
#region Private Classes
[ImmutableObject(true)]private class ExportFormat
{
#region Public Properties
private Config.Connections.Save.Format _format;
public Config.Connections.Save.Format Format
{
get
{
return _format;
}
}
#endregion
#region Constructors
public ExportFormat(Config.Connections.Save.Format format)
{
_format = format;
}
#endregion
#region Public Methods
public override string ToString()
{
switch (Format)
{
case Config.Connections.Save_Renamed.Format.mRXML:
return Language.strMremoteNgXml;
case Config.Connections.Save_Renamed.Format.mRCSV:
return Language.strMremoteNgCsv;
case Config.Connections.Save_Renamed.Format.vRDCSV:
return Language.strVisionAppRemoteDesktopCsv;
default:
return Format.ToString();
}
}
#endregion
}
#endregion
}
}

View File

@@ -1,117 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class OptionsForm : System.Windows.Forms.Form
{
//Form overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm));
mRemoteNG.Controls.Alignment Alignment2 = new mRemoteNG.Controls.Alignment();
this.PagePanel = new System.Windows.Forms.Panel();
base.Load += new System.EventHandler(OptionsForm_Load);
base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(OptionsForm_FormClosing);
this.OkButton = new System.Windows.Forms.Button();
this.OkButton.Click += new System.EventHandler(this.OkButton_Click);
this.CancelButtonControl = new System.Windows.Forms.Button();
this.CancelButtonControl.Click += new System.EventHandler(this.CancelButtonControl_Click);
this.PageListView = new mRemoteNG.Controls.ListView();
this.PageListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.PageListView_ItemSelectionChanged);
this.PageListView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PageListView_MouseUp);
this.SuspendLayout();
//
//PagePanel
//
resources.ApplyResources(this.PagePanel, "PagePanel");
this.PagePanel.Name = "PagePanel";
//
//OkButton
//
resources.ApplyResources(this.OkButton, "OkButton");
this.OkButton.Name = "OkButton";
this.OkButton.UseVisualStyleBackColor = true;
//
//CancelButtonControl
//
this.CancelButtonControl.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.CancelButtonControl, "CancelButtonControl");
this.CancelButtonControl.Name = "CancelButtonControl";
this.CancelButtonControl.UseVisualStyleBackColor = true;
//
//PageListView
//
this.PageListView.InactiveHighlightBackColor = System.Drawing.SystemColors.Highlight;
this.PageListView.InactiveHighlightBorderColor = System.Drawing.SystemColors.HotTrack;
this.PageListView.InactiveHighlightForeColor = System.Drawing.SystemColors.HighlightText;
Alignment2.Horizontal = mRemoteNG.Controls.HorizontalAlignment.Left;
Alignment2.Vertical = mRemoteNG.Controls.VerticalAlignment.Middle;
this.PageListView.LabelAlignment = Alignment2;
resources.ApplyResources(this.PageListView, "PageListView");
this.PageListView.MultiSelect = false;
this.PageListView.Name = "PageListView";
this.PageListView.OwnerDraw = true;
this.PageListView.ShowFocusCues = false;
this.PageListView.TileSize = new System.Drawing.Size(150, 30);
this.PageListView.UseCompatibleStateImageBehavior = false;
this.PageListView.View = System.Windows.Forms.View.Tile;
//
//OptionsForm
//
this.AcceptButton = this.OkButton;
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.CancelButtonControl;
this.Controls.Add(this.CancelButtonControl);
this.Controls.Add(this.OkButton);
this.Controls.Add(this.PagePanel);
this.Controls.Add(this.PageListView);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "OptionsForm";
this.ShowInTaskbar = false;
this.ResumeLayout(false);
}
internal mRemoteNG.Controls.ListView PageListView;
internal System.Windows.Forms.Panel PagePanel;
internal System.Windows.Forms.Button OkButton;
internal System.Windows.Forms.Button CancelButtonControl;
}
}

View File

@@ -1,286 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class AdvancedPage : OptionsPage
{
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AdvancedPage));
this.chkWriteLogFile = new System.Windows.Forms.CheckBox();
this.chkAutomaticallyGetSessionInfo = new System.Windows.Forms.CheckBox();
this.lblXulRunnerPath = new System.Windows.Forms.Label();
this.lblMaximumPuttyWaitTime = new System.Windows.Forms.Label();
this.chkEncryptCompleteFile = new System.Windows.Forms.CheckBox();
this.chkAutomaticReconnect = new System.Windows.Forms.CheckBox();
this.btnBrowseXulRunnerPath = new System.Windows.Forms.Button();
this.btnBrowseXulRunnerPath.Click += new System.EventHandler(this.btnBrowseXulRunnerPath_Click);
this.numPuttyWaitTime = new System.Windows.Forms.NumericUpDown();
this.chkUseCustomPuttyPath = new System.Windows.Forms.CheckBox();
this.chkUseCustomPuttyPath.CheckedChanged += new System.EventHandler(this.chkUseCustomPuttyPath_CheckedChanged);
this.lblConfigurePuttySessions = new System.Windows.Forms.Label();
this.txtXULrunnerPath = new System.Windows.Forms.TextBox();
this.numUVNCSCPort = new System.Windows.Forms.NumericUpDown();
this.txtCustomPuttyPath = new System.Windows.Forms.TextBox();
this.txtCustomPuttyPath.TextChanged += new System.EventHandler(this.txtCustomPuttyPath_TextChanged);
this.btnLaunchPutty = new System.Windows.Forms.Button();
this.btnLaunchPutty.Click += new System.EventHandler(this.btnLaunchPutty_Click);
this.lblUVNCSCPort = new System.Windows.Forms.Label();
this.lblSeconds = new System.Windows.Forms.Label();
this.btnBrowseCustomPuttyPath = new System.Windows.Forms.Button();
this.btnBrowseCustomPuttyPath.Click += new System.EventHandler(this.btnBrowseCustomPuttyPath_Click);
((System.ComponentModel.ISupportInitialize) this.numPuttyWaitTime).BeginInit();
((System.ComponentModel.ISupportInitialize) this.numUVNCSCPort).BeginInit();
this.SuspendLayout();
//
//chkWriteLogFile
//
this.chkWriteLogFile.AutoSize = true;
this.chkWriteLogFile.Location = new System.Drawing.Point(3, 0);
this.chkWriteLogFile.Name = "chkWriteLogFile";
this.chkWriteLogFile.Size = new System.Drawing.Size(171, 17);
this.chkWriteLogFile.TabIndex = 17;
this.chkWriteLogFile.Text = "Write log file (mRemoteNG.log)";
this.chkWriteLogFile.UseVisualStyleBackColor = true;
//
//chkAutomaticallyGetSessionInfo
//
this.chkAutomaticallyGetSessionInfo.AutoSize = true;
this.chkAutomaticallyGetSessionInfo.Location = new System.Drawing.Point(3, 46);
this.chkAutomaticallyGetSessionInfo.Name = "chkAutomaticallyGetSessionInfo";
this.chkAutomaticallyGetSessionInfo.Size = new System.Drawing.Size(198, 17);
this.chkAutomaticallyGetSessionInfo.TabIndex = 19;
this.chkAutomaticallyGetSessionInfo.Text = "Automatically get session information";
this.chkAutomaticallyGetSessionInfo.UseVisualStyleBackColor = true;
//
//lblXulRunnerPath
//
this.lblXulRunnerPath.AutoSize = true;
this.lblXulRunnerPath.Location = new System.Drawing.Point(3, 217);
this.lblXulRunnerPath.Name = "lblXulRunnerPath";
this.lblXulRunnerPath.Size = new System.Drawing.Size(85, 13);
this.lblXulRunnerPath.TabIndex = 29;
this.lblXulRunnerPath.Text = "XULrunner path:";
//
//lblMaximumPuttyWaitTime
//
this.lblMaximumPuttyWaitTime.Location = new System.Drawing.Point(3, 185);
this.lblMaximumPuttyWaitTime.Name = "lblMaximumPuttyWaitTime";
this.lblMaximumPuttyWaitTime.Size = new System.Drawing.Size(364, 13);
this.lblMaximumPuttyWaitTime.TabIndex = 26;
this.lblMaximumPuttyWaitTime.Text = "Maximum PuTTY wait time:";
this.lblMaximumPuttyWaitTime.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//chkEncryptCompleteFile
//
this.chkEncryptCompleteFile.AutoSize = true;
this.chkEncryptCompleteFile.Location = new System.Drawing.Point(3, 23);
this.chkEncryptCompleteFile.Name = "chkEncryptCompleteFile";
this.chkEncryptCompleteFile.Size = new System.Drawing.Size(180, 17);
this.chkEncryptCompleteFile.TabIndex = 18;
this.chkEncryptCompleteFile.Text = "Encrypt complete connection file";
this.chkEncryptCompleteFile.UseVisualStyleBackColor = true;
//
//chkAutomaticReconnect
//
this.chkAutomaticReconnect.AutoSize = true;
this.chkAutomaticReconnect.Location = new System.Drawing.Point(3, 69);
this.chkAutomaticReconnect.Name = "chkAutomaticReconnect";
this.chkAutomaticReconnect.Size = new System.Drawing.Size(399, 17);
this.chkAutomaticReconnect.TabIndex = 20;
this.chkAutomaticReconnect.Text = "Automatically try to reconnect when disconnected from server (RDP && ICA only)";
this.chkAutomaticReconnect.UseVisualStyleBackColor = true;
//
//btnBrowseXulRunnerPath
//
this.btnBrowseXulRunnerPath.Location = new System.Drawing.Point(373, 233);
this.btnBrowseXulRunnerPath.Name = "btnBrowseXulRunnerPath";
this.btnBrowseXulRunnerPath.Size = new System.Drawing.Size(75, 23);
this.btnBrowseXulRunnerPath.TabIndex = 31;
this.btnBrowseXulRunnerPath.Text = "Browse...";
this.btnBrowseXulRunnerPath.UseVisualStyleBackColor = true;
//
//numPuttyWaitTime
//
this.numPuttyWaitTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.numPuttyWaitTime.Location = new System.Drawing.Point(373, 183);
this.numPuttyWaitTime.Maximum = new decimal(new int[] {999, 0, 0, 0});
this.numPuttyWaitTime.Name = "numPuttyWaitTime";
this.numPuttyWaitTime.Size = new System.Drawing.Size(49, 20);
this.numPuttyWaitTime.TabIndex = 27;
this.numPuttyWaitTime.Value = new decimal(new int[] {5, 0, 0, 0});
//
//chkUseCustomPuttyPath
//
this.chkUseCustomPuttyPath.AutoSize = true;
this.chkUseCustomPuttyPath.Location = new System.Drawing.Point(3, 92);
this.chkUseCustomPuttyPath.Name = "chkUseCustomPuttyPath";
this.chkUseCustomPuttyPath.Size = new System.Drawing.Size(146, 17);
this.chkUseCustomPuttyPath.TabIndex = 21;
this.chkUseCustomPuttyPath.Text = "Use custom PuTTY path:";
this.chkUseCustomPuttyPath.UseVisualStyleBackColor = true;
//
//lblConfigurePuttySessions
//
this.lblConfigurePuttySessions.Location = new System.Drawing.Point(3, 154);
this.lblConfigurePuttySessions.Name = "lblConfigurePuttySessions";
this.lblConfigurePuttySessions.Size = new System.Drawing.Size(364, 13);
this.lblConfigurePuttySessions.TabIndex = 24;
this.lblConfigurePuttySessions.Text = "To configure PuTTY sessions click this button:";
this.lblConfigurePuttySessions.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//txtXULrunnerPath
//
this.txtXULrunnerPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtXULrunnerPath.Location = new System.Drawing.Point(21, 235);
this.txtXULrunnerPath.Name = "txtXULrunnerPath";
this.txtXULrunnerPath.Size = new System.Drawing.Size(346, 20);
this.txtXULrunnerPath.TabIndex = 30;
//
//numUVNCSCPort
//
this.numUVNCSCPort.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.numUVNCSCPort.Location = new System.Drawing.Point(373, 276);
this.numUVNCSCPort.Maximum = new decimal(new int[] {65535, 0, 0, 0});
this.numUVNCSCPort.Name = "numUVNCSCPort";
this.numUVNCSCPort.Size = new System.Drawing.Size(72, 20);
this.numUVNCSCPort.TabIndex = 33;
this.numUVNCSCPort.Value = new decimal(new int[] {5500, 0, 0, 0});
this.numUVNCSCPort.Visible = false;
//
//txtCustomPuttyPath
//
this.txtCustomPuttyPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCustomPuttyPath.Enabled = false;
this.txtCustomPuttyPath.Location = new System.Drawing.Point(21, 115);
this.txtCustomPuttyPath.Name = "txtCustomPuttyPath";
this.txtCustomPuttyPath.Size = new System.Drawing.Size(346, 20);
this.txtCustomPuttyPath.TabIndex = 22;
//
//btnLaunchPutty
//
this.btnLaunchPutty.Image = global::My.Resources.Resources.PuttyConfig;
this.btnLaunchPutty.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnLaunchPutty.Location = new System.Drawing.Point(373, 149);
this.btnLaunchPutty.Name = "btnLaunchPutty";
this.btnLaunchPutty.Size = new System.Drawing.Size(110, 23);
this.btnLaunchPutty.TabIndex = 25;
this.btnLaunchPutty.Text = "Launch PuTTY";
this.btnLaunchPutty.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnLaunchPutty.UseVisualStyleBackColor = true;
//
//lblUVNCSCPort
//
this.lblUVNCSCPort.Location = new System.Drawing.Point(3, 278);
this.lblUVNCSCPort.Name = "lblUVNCSCPort";
this.lblUVNCSCPort.Size = new System.Drawing.Size(364, 13);
this.lblUVNCSCPort.TabIndex = 32;
this.lblUVNCSCPort.Text = "UltraVNC SingleClick Listening Port:";
this.lblUVNCSCPort.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.lblUVNCSCPort.Visible = false;
//
//lblSeconds
//
this.lblSeconds.AutoSize = true;
this.lblSeconds.Location = new System.Drawing.Point(428, 185);
this.lblSeconds.Name = "lblSeconds";
this.lblSeconds.Size = new System.Drawing.Size(47, 13);
this.lblSeconds.TabIndex = 28;
this.lblSeconds.Text = "seconds";
//
//btnBrowseCustomPuttyPath
//
this.btnBrowseCustomPuttyPath.Enabled = false;
this.btnBrowseCustomPuttyPath.Location = new System.Drawing.Point(373, 113);
this.btnBrowseCustomPuttyPath.Name = "btnBrowseCustomPuttyPath";
this.btnBrowseCustomPuttyPath.Size = new System.Drawing.Size(75, 23);
this.btnBrowseCustomPuttyPath.TabIndex = 23;
this.btnBrowseCustomPuttyPath.Text = "Browse...";
this.btnBrowseCustomPuttyPath.UseVisualStyleBackColor = true;
//
//AdvancedPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.chkWriteLogFile);
this.Controls.Add(this.chkAutomaticallyGetSessionInfo);
this.Controls.Add(this.lblXulRunnerPath);
this.Controls.Add(this.lblMaximumPuttyWaitTime);
this.Controls.Add(this.chkEncryptCompleteFile);
this.Controls.Add(this.chkAutomaticReconnect);
this.Controls.Add(this.btnBrowseXulRunnerPath);
this.Controls.Add(this.numPuttyWaitTime);
this.Controls.Add(this.chkUseCustomPuttyPath);
this.Controls.Add(this.lblConfigurePuttySessions);
this.Controls.Add(this.txtXULrunnerPath);
this.Controls.Add(this.numUVNCSCPort);
this.Controls.Add(this.txtCustomPuttyPath);
this.Controls.Add(this.btnLaunchPutty);
this.Controls.Add(this.lblUVNCSCPort);
this.Controls.Add(this.lblSeconds);
this.Controls.Add(this.btnBrowseCustomPuttyPath);
this.Name = "AdvancedPage";
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
this.Size = new System.Drawing.Size(610, 489);
((System.ComponentModel.ISupportInitialize) this.numPuttyWaitTime).EndInit();
((System.ComponentModel.ISupportInitialize) this.numUVNCSCPort).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
internal System.Windows.Forms.CheckBox chkWriteLogFile;
internal System.Windows.Forms.CheckBox chkAutomaticallyGetSessionInfo;
internal System.Windows.Forms.Label lblXulRunnerPath;
internal System.Windows.Forms.Label lblMaximumPuttyWaitTime;
internal System.Windows.Forms.CheckBox chkEncryptCompleteFile;
internal System.Windows.Forms.CheckBox chkAutomaticReconnect;
internal System.Windows.Forms.Button btnBrowseXulRunnerPath;
internal System.Windows.Forms.NumericUpDown numPuttyWaitTime;
internal System.Windows.Forms.CheckBox chkUseCustomPuttyPath;
internal System.Windows.Forms.Label lblConfigurePuttySessions;
internal System.Windows.Forms.TextBox txtXULrunnerPath;
internal System.Windows.Forms.NumericUpDown numUVNCSCPort;
internal System.Windows.Forms.TextBox txtCustomPuttyPath;
internal System.Windows.Forms.Button btnLaunchPutty;
internal System.Windows.Forms.Label lblUVNCSCPort;
internal System.Windows.Forms.Label lblSeconds;
internal System.Windows.Forms.Button btnBrowseCustomPuttyPath;
}
}

View File

@@ -1,226 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.IO;
//using mRemoteNG.App.Info;
using mRemoteNG.My;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Tools;
using PSTaskDialog;
namespace mRemoteNG.Forms.OptionsPages
{
public partial class AdvancedPage
{
public AdvancedPage()
{
InitializeComponent();
}
#region Public Methods
public override string PageName
{
get
{
return Language.strTabAdvanced;
}
set
{
}
}
public override void ApplyLanguage()
{
base.ApplyLanguage();
lblSeconds.Text = Language.strLabelSeconds;
lblMaximumPuttyWaitTime.Text = Language.strLabelPuttyTimeout;
chkAutomaticReconnect.Text = Language.strCheckboxAutomaticReconnect;
lblConfigurePuttySessions.Text = Language.strLabelPuttySessionsConfig;
btnLaunchPutty.Text = Language.strButtonLaunchPutty;
btnBrowseCustomPuttyPath.Text = Language.strButtonBrowse;
chkUseCustomPuttyPath.Text = Language.strCheckboxPuttyPath;
chkAutomaticallyGetSessionInfo.Text = Language.strAutomaticallyGetSessionInfo;
chkWriteLogFile.Text = Language.strWriteLogFile;
lblUVNCSCPort.Text = Language.strUltraVNCSCListeningPort;
lblXulRunnerPath.Text = Language.strXULrunnerPath;
btnBrowseXulRunnerPath.Text = Language.strButtonBrowse;
chkEncryptCompleteFile.Text = Language.strEncryptCompleteConnectionFile;
}
public override void LoadSettings()
{
base.SaveSettings();
chkWriteLogFile.Checked = System.Convert.ToBoolean(My.Settings.Default.WriteLogFile);
chkEncryptCompleteFile.Checked = System.Convert.ToBoolean(My.Settings.Default.EncryptCompleteConnectionsFile);
chkAutomaticallyGetSessionInfo.Checked = System.Convert.ToBoolean(My.Settings.Default.AutomaticallyGetSessionInfo);
chkAutomaticReconnect.Checked = System.Convert.ToBoolean(My.Settings.Default.ReconnectOnDisconnect);
numPuttyWaitTime.Value = System.Convert.ToDecimal(My.Settings.Default.MaxPuttyWaitTime);
chkUseCustomPuttyPath.Checked = MySettingsProperty.Settings.UseCustomPuttyPath;
txtCustomPuttyPath.Text = MySettingsProperty.Settings.CustomPuttyPath;
SetPuttyLaunchButtonEnabled();
numUVNCSCPort.Value = System.Convert.ToDecimal(My.Settings.Default.UVNCSCPort);
txtXULrunnerPath.Text = System.Convert.ToString(My.Settings.Default.XULRunnerPath);
}
public override void SaveSettings()
{
base.SaveSettings();
My.Settings.Default.WriteLogFile = chkWriteLogFile.Checked;
My.Settings.Default.EncryptCompleteConnectionsFile = chkEncryptCompleteFile.Checked;
My.Settings.Default.AutomaticallyGetSessionInfo = chkAutomaticallyGetSessionInfo.Checked;
My.Settings.Default.ReconnectOnDisconnect = chkAutomaticReconnect.Checked;
bool puttyPathChanged = false;
if (!(MySettingsProperty.Settings.CustomPuttyPath == txtCustomPuttyPath.Text))
{
puttyPathChanged = true;
MySettingsProperty.Settings.CustomPuttyPath = txtCustomPuttyPath.Text;
}
if (!(MySettingsProperty.Settings.UseCustomPuttyPath == chkUseCustomPuttyPath.Checked))
{
puttyPathChanged = true;
MySettingsProperty.Settings.UseCustomPuttyPath = chkUseCustomPuttyPath.Checked;
}
if (puttyPathChanged)
{
if (MySettingsProperty.Settings.UseCustomPuttyPath)
{
PuttyBase.PuttyPath = MySettingsProperty.Settings.CustomPuttyPath;
}
else
{
PuttyBase.PuttyPath = App.Info.General.PuttyPath;
}
Config.Putty.Sessions.AddSessionsToTree();
}
My.Settings.Default.MaxPuttyWaitTime = numPuttyWaitTime.Value;
My.Settings.Default.UVNCSCPort = numUVNCSCPort.Value;
My.Settings.Default.XULRunnerPath = txtXULrunnerPath.Text;
}
#endregion
#region Private Methods
#region Event Handlers
public void chkUseCustomPuttyPath_CheckedChanged(object sender, EventArgs e)
{
txtCustomPuttyPath.Enabled = chkUseCustomPuttyPath.Checked;
btnBrowseCustomPuttyPath.Enabled = chkUseCustomPuttyPath.Checked;
SetPuttyLaunchButtonEnabled();
}
public void txtCustomPuttyPath_TextChanged(object sender, EventArgs e)
{
SetPuttyLaunchButtonEnabled();
}
public void btnBrowseCustomPuttyPath_Click(object sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Filter = string.Format("{0}|*.exe|{1}|*.*", Language.strFilterApplication, Language.strFilterAll);
openFileDialog.FileName = Path.GetFileName(App.Info.General.PuttyPath);
openFileDialog.CheckFileExists = true;
openFileDialog.Multiselect = false;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
txtCustomPuttyPath.Text = openFileDialog.FileName;
SetPuttyLaunchButtonEnabled();
}
}
}
public void btnLaunchPutty_Click(object sender, EventArgs e)
{
try
{
PuttyProcessController puttyProcess = new PuttyProcessController();
string fileName = "";
if (chkUseCustomPuttyPath.Checked)
{
fileName = txtCustomPuttyPath.Text;
}
else
{
fileName = App.Info.General.PuttyPath;
}
puttyProcess.Start(fileName);
puttyProcess.SetControlText("Button", "&Cancel", "&Close");
puttyProcess.SetControlVisible("Button", "&Open", false);
puttyProcess.WaitForExit();
}
catch (Exception ex)
{
cTaskDialog.MessageBox(System.Convert.ToString(Application.Info.ProductName), Language.strErrorCouldNotLaunchPutty, "", ex.Message, "", "", eTaskDialogButtons.OK, eSysIcons.Error, null);
}
}
public void btnBrowseXulRunnerPath_Click(object sender, EventArgs e)
{
FolderBrowserDialog oDlg = new FolderBrowserDialog();
oDlg.ShowNewFolderButton = false;
if (oDlg.ShowDialog() == DialogResult.OK)
{
txtXULrunnerPath.Text = oDlg.SelectedPath;
}
oDlg.Dispose();
}
#endregion
private void SetPuttyLaunchButtonEnabled()
{
string puttyPath = "";
if (chkUseCustomPuttyPath.Checked)
{
puttyPath = txtCustomPuttyPath.Text;
}
else
{
puttyPath = App.Info.General.PuttyPath;
}
bool exists = false;
try
{
exists = File.Exists(puttyPath);
}
catch
{
}
if (exists)
{
lblConfigurePuttySessions.Enabled = true;
btnLaunchPutty.Enabled = true;
}
else
{
lblConfigurePuttySessions.Enabled = false;
btnLaunchPutty.Enabled = false;
}
}
#endregion
}
}

View File

@@ -1,149 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class AppearancePage : OptionsPage
{
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AppearancePage));
this.lblLanguageRestartRequired = new System.Windows.Forms.Label();
this.cboLanguage = new System.Windows.Forms.ComboBox();
this.lblLanguage = new System.Windows.Forms.Label();
this.chkShowFullConnectionsFilePathInTitle = new System.Windows.Forms.CheckBox();
this.chkShowDescriptionTooltipsInTree = new System.Windows.Forms.CheckBox();
this.chkShowSystemTrayIcon = new System.Windows.Forms.CheckBox();
this.chkMinimizeToSystemTray = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
//lblLanguageRestartRequired
//
this.lblLanguageRestartRequired.AutoSize = true;
this.lblLanguageRestartRequired.Location = new System.Drawing.Point(3, 56);
this.lblLanguageRestartRequired.Name = "lblLanguageRestartRequired";
this.lblLanguageRestartRequired.Size = new System.Drawing.Size(380, 13);
this.lblLanguageRestartRequired.TabIndex = 9;
this.lblLanguageRestartRequired.Text = "mRemoteNG must be restarted before changes to the language will take effect.";
//
//cboLanguage
//
this.cboLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboLanguage.FormattingEnabled = true;
this.cboLanguage.Location = new System.Drawing.Point(3, 24);
this.cboLanguage.Name = "cboLanguage";
this.cboLanguage.Size = new System.Drawing.Size(304, 21);
this.cboLanguage.Sorted = true;
this.cboLanguage.TabIndex = 8;
//
//lblLanguage
//
this.lblLanguage.AutoSize = true;
this.lblLanguage.Location = new System.Drawing.Point(3, 0);
this.lblLanguage.Name = "lblLanguage";
this.lblLanguage.Size = new System.Drawing.Size(55, 13);
this.lblLanguage.TabIndex = 7;
this.lblLanguage.Text = "Language";
//
//chkShowFullConnectionsFilePathInTitle
//
this.chkShowFullConnectionsFilePathInTitle.AutoSize = true;
this.chkShowFullConnectionsFilePathInTitle.Location = new System.Drawing.Point(3, 141);
this.chkShowFullConnectionsFilePathInTitle.Name = "chkShowFullConnectionsFilePathInTitle";
this.chkShowFullConnectionsFilePathInTitle.Size = new System.Drawing.Size(239, 17);
this.chkShowFullConnectionsFilePathInTitle.TabIndex = 11;
this.chkShowFullConnectionsFilePathInTitle.Text = "Show full connections file path in window title";
this.chkShowFullConnectionsFilePathInTitle.UseVisualStyleBackColor = true;
//
//chkShowDescriptionTooltipsInTree
//
this.chkShowDescriptionTooltipsInTree.AutoSize = true;
this.chkShowDescriptionTooltipsInTree.Location = new System.Drawing.Point(3, 118);
this.chkShowDescriptionTooltipsInTree.Name = "chkShowDescriptionTooltipsInTree";
this.chkShowDescriptionTooltipsInTree.Size = new System.Drawing.Size(231, 17);
this.chkShowDescriptionTooltipsInTree.TabIndex = 10;
this.chkShowDescriptionTooltipsInTree.Text = "Show description tooltips in connection tree";
this.chkShowDescriptionTooltipsInTree.UseVisualStyleBackColor = true;
//
//chkShowSystemTrayIcon
//
this.chkShowSystemTrayIcon.AutoSize = true;
this.chkShowSystemTrayIcon.Location = new System.Drawing.Point(3, 187);
this.chkShowSystemTrayIcon.Name = "chkShowSystemTrayIcon";
this.chkShowSystemTrayIcon.Size = new System.Drawing.Size(172, 17);
this.chkShowSystemTrayIcon.TabIndex = 12;
this.chkShowSystemTrayIcon.Text = "Always show System Tray Icon";
this.chkShowSystemTrayIcon.UseVisualStyleBackColor = true;
//
//chkMinimizeToSystemTray
//
this.chkMinimizeToSystemTray.AutoSize = true;
this.chkMinimizeToSystemTray.Location = new System.Drawing.Point(3, 210);
this.chkMinimizeToSystemTray.Name = "chkMinimizeToSystemTray";
this.chkMinimizeToSystemTray.Size = new System.Drawing.Size(139, 17);
this.chkMinimizeToSystemTray.TabIndex = 13;
this.chkMinimizeToSystemTray.Text = "Minimize to System Tray";
this.chkMinimizeToSystemTray.UseVisualStyleBackColor = true;
//
//AppearancePage
//
this.Controls.Add(this.lblLanguageRestartRequired);
this.Controls.Add(this.cboLanguage);
this.Controls.Add(this.lblLanguage);
this.Controls.Add(this.chkShowFullConnectionsFilePathInTitle);
this.Controls.Add(this.chkShowDescriptionTooltipsInTree);
this.Controls.Add(this.chkShowSystemTrayIcon);
this.Controls.Add(this.chkMinimizeToSystemTray);
this.Name = "AppearancePage";
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
this.Size = new System.Drawing.Size(610, 489);
this.ResumeLayout(false);
this.PerformLayout();
}
internal System.Windows.Forms.Label Label1;
internal System.Windows.Forms.Label lblLanguageRestartRequired;
internal System.Windows.Forms.ComboBox cboLanguage;
internal System.Windows.Forms.Label lblLanguage;
internal System.Windows.Forms.CheckBox chkShowFullConnectionsFilePathInTitle;
internal System.Windows.Forms.CheckBox chkShowDescriptionTooltipsInTree;
internal System.Windows.Forms.CheckBox chkShowSystemTrayIcon;
internal System.Windows.Forms.CheckBox chkMinimizeToSystemTray;
}
}

View File

@@ -1,112 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.App;
using mRemoteNG.My;
namespace mRemoteNG.Forms.OptionsPages
{
public partial class AppearancePage
{
public AppearancePage()
{
InitializeComponent();
}
public override string PageName
{
get
{
return Language.strTabAppearance;
}
set
{
}
}
public override void ApplyLanguage()
{
base.ApplyLanguage();
lblLanguage.Text = Language.strLanguage;
lblLanguageRestartRequired.Text = string.Format(Language.strLanguageRestartRequired, Application.Info.ProductName);
chkShowDescriptionTooltipsInTree.Text = Language.strShowDescriptionTooltips;
chkShowFullConnectionsFilePathInTitle.Text = Language.strShowFullConsFilePath;
chkShowSystemTrayIcon.Text = Language.strAlwaysShowSysTrayIcon;
chkMinimizeToSystemTray.Text = Language.strMinimizeToSysTray;
}
public override void LoadSettings()
{
base.SaveSettings();
cboLanguage.Items.Clear();
cboLanguage.Items.Add(Language.strLanguageDefault);
foreach (string nativeName in SupportedCultures.CultureNativeNames)
{
cboLanguage.Items.Add(nativeName);
}
if (!string.IsNullOrEmpty(Settings.OverrideUICulture) && SupportedCultures.IsNameSupported(Settings.OverrideUICulture))
{
cboLanguage.SelectedItem = SupportedCultures.get_CultureNativeName(Settings.OverrideUICulture);
}
if (cboLanguage.SelectedIndex == -1)
{
cboLanguage.SelectedIndex = 0;
}
chkShowDescriptionTooltipsInTree.Checked = Settings.ShowDescriptionTooltipsInTree;
chkShowFullConnectionsFilePathInTitle.Checked = Settings.ShowCompleteConsPathInTitle;
chkShowSystemTrayIcon.Checked = Settings.ShowSystemTrayIcon;
chkMinimizeToSystemTray.Checked = Settings.MinimizeToTray;
}
public override void SaveSettings()
{
base.SaveSettings();
if (cboLanguage.SelectedIndex > 0 && SupportedCultures.IsNativeNameSupported(System.Convert.ToString(cboLanguage.SelectedItem)))
{
Settings.OverrideUICulture = SupportedCultures.get_CultureName(System.Convert.ToString(cboLanguage.SelectedItem));
}
else
{
Settings.OverrideUICulture = string.Empty;
}
Settings.ShowDescriptionTooltipsInTree = chkShowDescriptionTooltipsInTree.Checked;
Settings.ShowCompleteConsPathInTitle = chkShowFullConnectionsFilePathInTitle.Checked;
frmMain.Default.ShowFullPathInTitle = chkShowFullConnectionsFilePathInTitle.Checked;
Settings.ShowSystemTrayIcon = chkShowSystemTrayIcon.Checked;
if (Settings.ShowSystemTrayIcon)
{
if (Runtime.NotificationAreaIcon == null)
{
Runtime.NotificationAreaIcon = new Tools.Controls.NotificationAreaIcon();
}
}
else
{
if (Runtime.NotificationAreaIcon != null)
{
Runtime.NotificationAreaIcon.Dispose();
Runtime.NotificationAreaIcon = null;
}
}
Settings.MinimizeToTray = chkMinimizeToSystemTray.Checked;
}
}
}

View File

@@ -1,414 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class ConnectionsPage : OptionsPage
{
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConnectionsPage));
this.pnlRdpReconnectionCount = new System.Windows.Forms.Panel();
this.lblRdpReconnectionCount = new System.Windows.Forms.Label();
this.numRdpReconnectionCount = new System.Windows.Forms.NumericUpDown();
this.chkSingleClickOnConnectionOpensIt = new System.Windows.Forms.CheckBox();
this.chkHostnameLikeDisplayName = new System.Windows.Forms.CheckBox();
this.pnlDefaultCredentials = new System.Windows.Forms.Panel();
this.radCredentialsCustom = new System.Windows.Forms.RadioButton();
this.radCredentialsCustom.CheckedChanged += new System.EventHandler(this.radCredentialsCustom_CheckedChanged);
this.lblDefaultCredentials = new System.Windows.Forms.Label();
this.radCredentialsNoInfo = new System.Windows.Forms.RadioButton();
this.radCredentialsWindows = new System.Windows.Forms.RadioButton();
this.txtCredentialsDomain = new System.Windows.Forms.TextBox();
this.lblCredentialsUsername = new System.Windows.Forms.Label();
this.txtCredentialsPassword = new System.Windows.Forms.TextBox();
this.lblCredentialsPassword = new System.Windows.Forms.Label();
this.txtCredentialsUsername = new System.Windows.Forms.TextBox();
this.lblCredentialsDomain = new System.Windows.Forms.Label();
this.chkSingleClickOnOpenedConnectionSwitchesToIt = new System.Windows.Forms.CheckBox();
this.pnlAutoSave = new System.Windows.Forms.Panel();
this.lblAutoSave1 = new System.Windows.Forms.Label();
this.numAutoSave = new System.Windows.Forms.NumericUpDown();
this.lblAutoSave2 = new System.Windows.Forms.Label();
this.pnlConfirmCloseConnection = new System.Windows.Forms.Panel();
this.lblClosingConnections = new System.Windows.Forms.Label();
this.radCloseWarnAll = new System.Windows.Forms.RadioButton();
this.radCloseWarnMultiple = new System.Windows.Forms.RadioButton();
this.radCloseWarnExit = new System.Windows.Forms.RadioButton();
this.radCloseWarnNever = new System.Windows.Forms.RadioButton();
this.pnlRdpReconnectionCount.SuspendLayout();
((System.ComponentModel.ISupportInitialize) this.numRdpReconnectionCount).BeginInit();
this.pnlDefaultCredentials.SuspendLayout();
this.pnlAutoSave.SuspendLayout();
((System.ComponentModel.ISupportInitialize) this.numAutoSave).BeginInit();
this.pnlConfirmCloseConnection.SuspendLayout();
this.SuspendLayout();
//
//pnlRdpReconnectionCount
//
this.pnlRdpReconnectionCount.Controls.Add(this.lblRdpReconnectionCount);
this.pnlRdpReconnectionCount.Controls.Add(this.numRdpReconnectionCount);
this.pnlRdpReconnectionCount.Location = new System.Drawing.Point(3, 69);
this.pnlRdpReconnectionCount.Name = "pnlRdpReconnectionCount";
this.pnlRdpReconnectionCount.Size = new System.Drawing.Size(596, 29);
this.pnlRdpReconnectionCount.TabIndex = 10;
//
//lblRdpReconnectionCount
//
this.lblRdpReconnectionCount.Location = new System.Drawing.Point(6, 9);
this.lblRdpReconnectionCount.Name = "lblRdpReconnectionCount";
this.lblRdpReconnectionCount.Size = new System.Drawing.Size(288, 13);
this.lblRdpReconnectionCount.TabIndex = 0;
this.lblRdpReconnectionCount.Text = "RDP Reconnection Count";
this.lblRdpReconnectionCount.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//numRdpReconnectionCount
//
this.numRdpReconnectionCount.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.numRdpReconnectionCount.Location = new System.Drawing.Point(300, 7);
this.numRdpReconnectionCount.Maximum = new decimal(new int[] {20, 0, 0, 0});
this.numRdpReconnectionCount.Name = "numRdpReconnectionCount";
this.numRdpReconnectionCount.Size = new System.Drawing.Size(53, 20);
this.numRdpReconnectionCount.TabIndex = 1;
this.numRdpReconnectionCount.Value = new decimal(new int[] {5, 0, 0, 0});
//
//chkSingleClickOnConnectionOpensIt
//
this.chkSingleClickOnConnectionOpensIt.AutoSize = true;
this.chkSingleClickOnConnectionOpensIt.Location = new System.Drawing.Point(3, 0);
this.chkSingleClickOnConnectionOpensIt.Name = "chkSingleClickOnConnectionOpensIt";
this.chkSingleClickOnConnectionOpensIt.Size = new System.Drawing.Size(191, 17);
this.chkSingleClickOnConnectionOpensIt.TabIndex = 7;
this.chkSingleClickOnConnectionOpensIt.Text = "Single click on connection opens it";
this.chkSingleClickOnConnectionOpensIt.UseVisualStyleBackColor = true;
//
//chkHostnameLikeDisplayName
//
this.chkHostnameLikeDisplayName.AutoSize = true;
this.chkHostnameLikeDisplayName.Location = new System.Drawing.Point(3, 46);
this.chkHostnameLikeDisplayName.Name = "chkHostnameLikeDisplayName";
this.chkHostnameLikeDisplayName.Size = new System.Drawing.Size(328, 17);
this.chkHostnameLikeDisplayName.TabIndex = 9;
this.chkHostnameLikeDisplayName.Text = "Set hostname like display name when creating new connections";
this.chkHostnameLikeDisplayName.UseVisualStyleBackColor = true;
//
//pnlDefaultCredentials
//
this.pnlDefaultCredentials.Controls.Add(this.radCredentialsCustom);
this.pnlDefaultCredentials.Controls.Add(this.lblDefaultCredentials);
this.pnlDefaultCredentials.Controls.Add(this.radCredentialsNoInfo);
this.pnlDefaultCredentials.Controls.Add(this.radCredentialsWindows);
this.pnlDefaultCredentials.Controls.Add(this.txtCredentialsDomain);
this.pnlDefaultCredentials.Controls.Add(this.lblCredentialsUsername);
this.pnlDefaultCredentials.Controls.Add(this.txtCredentialsPassword);
this.pnlDefaultCredentials.Controls.Add(this.lblCredentialsPassword);
this.pnlDefaultCredentials.Controls.Add(this.txtCredentialsUsername);
this.pnlDefaultCredentials.Controls.Add(this.lblCredentialsDomain);
this.pnlDefaultCredentials.Location = new System.Drawing.Point(3, 139);
this.pnlDefaultCredentials.Name = "pnlDefaultCredentials";
this.pnlDefaultCredentials.Size = new System.Drawing.Size(596, 175);
this.pnlDefaultCredentials.TabIndex = 12;
//
//radCredentialsCustom
//
this.radCredentialsCustom.AutoSize = true;
this.radCredentialsCustom.Location = new System.Drawing.Point(16, 69);
this.radCredentialsCustom.Name = "radCredentialsCustom";
this.radCredentialsCustom.Size = new System.Drawing.Size(87, 17);
this.radCredentialsCustom.TabIndex = 3;
this.radCredentialsCustom.Text = "the following:";
this.radCredentialsCustom.UseVisualStyleBackColor = true;
//
//lblDefaultCredentials
//
this.lblDefaultCredentials.AutoSize = true;
this.lblDefaultCredentials.Location = new System.Drawing.Point(3, 9);
this.lblDefaultCredentials.Name = "lblDefaultCredentials";
this.lblDefaultCredentials.Size = new System.Drawing.Size(257, 13);
this.lblDefaultCredentials.TabIndex = 0;
this.lblDefaultCredentials.Text = "For empty Username, Password or Domain fields use:";
//
//radCredentialsNoInfo
//
this.radCredentialsNoInfo.AutoSize = true;
this.radCredentialsNoInfo.Checked = true;
this.radCredentialsNoInfo.Location = new System.Drawing.Point(16, 31);
this.radCredentialsNoInfo.Name = "radCredentialsNoInfo";
this.radCredentialsNoInfo.Size = new System.Drawing.Size(91, 17);
this.radCredentialsNoInfo.TabIndex = 1;
this.radCredentialsNoInfo.TabStop = true;
this.radCredentialsNoInfo.Text = "no information";
this.radCredentialsNoInfo.UseVisualStyleBackColor = true;
//
//radCredentialsWindows
//
this.radCredentialsWindows.AutoSize = true;
this.radCredentialsWindows.Location = new System.Drawing.Point(16, 50);
this.radCredentialsWindows.Name = "radCredentialsWindows";
this.radCredentialsWindows.Size = new System.Drawing.Size(227, 17);
this.radCredentialsWindows.TabIndex = 2;
this.radCredentialsWindows.Text = "my current credentials (windows logon info)";
this.radCredentialsWindows.UseVisualStyleBackColor = true;
//
//txtCredentialsDomain
//
this.txtCredentialsDomain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCredentialsDomain.Enabled = false;
this.txtCredentialsDomain.Location = new System.Drawing.Point(140, 147);
this.txtCredentialsDomain.Name = "txtCredentialsDomain";
this.txtCredentialsDomain.Size = new System.Drawing.Size(150, 20);
this.txtCredentialsDomain.TabIndex = 9;
//
//lblCredentialsUsername
//
this.lblCredentialsUsername.Enabled = false;
this.lblCredentialsUsername.Location = new System.Drawing.Point(37, 95);
this.lblCredentialsUsername.Name = "lblCredentialsUsername";
this.lblCredentialsUsername.Size = new System.Drawing.Size(97, 13);
this.lblCredentialsUsername.TabIndex = 4;
this.lblCredentialsUsername.Text = "Username:";
this.lblCredentialsUsername.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//txtCredentialsPassword
//
this.txtCredentialsPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCredentialsPassword.Enabled = false;
this.txtCredentialsPassword.Location = new System.Drawing.Point(140, 120);
this.txtCredentialsPassword.Name = "txtCredentialsPassword";
this.txtCredentialsPassword.Size = new System.Drawing.Size(150, 20);
this.txtCredentialsPassword.TabIndex = 7;
this.txtCredentialsPassword.UseSystemPasswordChar = true;
//
//lblCredentialsPassword
//
this.lblCredentialsPassword.Enabled = false;
this.lblCredentialsPassword.Location = new System.Drawing.Point(34, 123);
this.lblCredentialsPassword.Name = "lblCredentialsPassword";
this.lblCredentialsPassword.Size = new System.Drawing.Size(100, 13);
this.lblCredentialsPassword.TabIndex = 6;
this.lblCredentialsPassword.Text = "Password:";
this.lblCredentialsPassword.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//txtCredentialsUsername
//
this.txtCredentialsUsername.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCredentialsUsername.Enabled = false;
this.txtCredentialsUsername.Location = new System.Drawing.Point(140, 93);
this.txtCredentialsUsername.Name = "txtCredentialsUsername";
this.txtCredentialsUsername.Size = new System.Drawing.Size(150, 20);
this.txtCredentialsUsername.TabIndex = 5;
//
//lblCredentialsDomain
//
this.lblCredentialsDomain.Enabled = false;
this.lblCredentialsDomain.Location = new System.Drawing.Point(34, 150);
this.lblCredentialsDomain.Name = "lblCredentialsDomain";
this.lblCredentialsDomain.Size = new System.Drawing.Size(100, 13);
this.lblCredentialsDomain.TabIndex = 8;
this.lblCredentialsDomain.Text = "Domain:";
this.lblCredentialsDomain.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//chkSingleClickOnOpenedConnectionSwitchesToIt
//
this.chkSingleClickOnOpenedConnectionSwitchesToIt.AutoSize = true;
this.chkSingleClickOnOpenedConnectionSwitchesToIt.Location = new System.Drawing.Point(3, 23);
this.chkSingleClickOnOpenedConnectionSwitchesToIt.Name = "chkSingleClickOnOpenedConnectionSwitchesToIt";
this.chkSingleClickOnOpenedConnectionSwitchesToIt.Size = new System.Drawing.Size(254, 17);
this.chkSingleClickOnOpenedConnectionSwitchesToIt.TabIndex = 8;
this.chkSingleClickOnOpenedConnectionSwitchesToIt.Text = "Single click on opened connection switches to it";
this.chkSingleClickOnOpenedConnectionSwitchesToIt.UseVisualStyleBackColor = true;
//
//pnlAutoSave
//
this.pnlAutoSave.Controls.Add(this.lblAutoSave1);
this.pnlAutoSave.Controls.Add(this.numAutoSave);
this.pnlAutoSave.Controls.Add(this.lblAutoSave2);
this.pnlAutoSave.Location = new System.Drawing.Point(3, 104);
this.pnlAutoSave.Name = "pnlAutoSave";
this.pnlAutoSave.Size = new System.Drawing.Size(596, 29);
this.pnlAutoSave.TabIndex = 11;
//
//lblAutoSave1
//
this.lblAutoSave1.Location = new System.Drawing.Point(6, 9);
this.lblAutoSave1.Name = "lblAutoSave1";
this.lblAutoSave1.Size = new System.Drawing.Size(288, 13);
this.lblAutoSave1.TabIndex = 0;
this.lblAutoSave1.Text = "Auto Save every:";
this.lblAutoSave1.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//numAutoSave
//
this.numAutoSave.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.numAutoSave.Location = new System.Drawing.Point(300, 7);
this.numAutoSave.Maximum = new decimal(new int[] {9999, 0, 0, 0});
this.numAutoSave.Name = "numAutoSave";
this.numAutoSave.Size = new System.Drawing.Size(53, 20);
this.numAutoSave.TabIndex = 1;
//
//lblAutoSave2
//
this.lblAutoSave2.AutoSize = true;
this.lblAutoSave2.Location = new System.Drawing.Point(359, 9);
this.lblAutoSave2.Name = "lblAutoSave2";
this.lblAutoSave2.Size = new System.Drawing.Size(135, 13);
this.lblAutoSave2.TabIndex = 2;
this.lblAutoSave2.Text = "Minutes (0 means disabled)";
//
//pnlConfirmCloseConnection
//
this.pnlConfirmCloseConnection.Controls.Add(this.lblClosingConnections);
this.pnlConfirmCloseConnection.Controls.Add(this.radCloseWarnAll);
this.pnlConfirmCloseConnection.Controls.Add(this.radCloseWarnMultiple);
this.pnlConfirmCloseConnection.Controls.Add(this.radCloseWarnExit);
this.pnlConfirmCloseConnection.Controls.Add(this.radCloseWarnNever);
this.pnlConfirmCloseConnection.Location = new System.Drawing.Point(3, 320);
this.pnlConfirmCloseConnection.Name = "pnlConfirmCloseConnection";
this.pnlConfirmCloseConnection.Size = new System.Drawing.Size(596, 137);
this.pnlConfirmCloseConnection.TabIndex = 13;
//
//lblClosingConnections
//
this.lblClosingConnections.AutoSize = true;
this.lblClosingConnections.Location = new System.Drawing.Point(3, 9);
this.lblClosingConnections.Name = "lblClosingConnections";
this.lblClosingConnections.Size = new System.Drawing.Size(136, 13);
this.lblClosingConnections.TabIndex = 0;
this.lblClosingConnections.Text = "When closing connections:";
//
//radCloseWarnAll
//
this.radCloseWarnAll.AutoSize = true;
this.radCloseWarnAll.Location = new System.Drawing.Point(16, 31);
this.radCloseWarnAll.Name = "radCloseWarnAll";
this.radCloseWarnAll.Size = new System.Drawing.Size(194, 17);
this.radCloseWarnAll.TabIndex = 1;
this.radCloseWarnAll.TabStop = true;
this.radCloseWarnAll.Text = "Warn me when closing connections";
this.radCloseWarnAll.UseVisualStyleBackColor = true;
//
//radCloseWarnMultiple
//
this.radCloseWarnMultiple.AutoSize = true;
this.radCloseWarnMultiple.Location = new System.Drawing.Point(16, 54);
this.radCloseWarnMultiple.Name = "radCloseWarnMultiple";
this.radCloseWarnMultiple.Size = new System.Drawing.Size(254, 17);
this.radCloseWarnMultiple.TabIndex = 2;
this.radCloseWarnMultiple.TabStop = true;
this.radCloseWarnMultiple.Text = "Warn me only when closing multiple connections";
this.radCloseWarnMultiple.UseVisualStyleBackColor = true;
//
//radCloseWarnExit
//
this.radCloseWarnExit.AutoSize = true;
this.radCloseWarnExit.Location = new System.Drawing.Point(16, 77);
this.radCloseWarnExit.Name = "radCloseWarnExit";
this.radCloseWarnExit.Size = new System.Drawing.Size(216, 17);
this.radCloseWarnExit.TabIndex = 3;
this.radCloseWarnExit.TabStop = true;
this.radCloseWarnExit.Text = "Warn me only when exiting mRemoteNG";
this.radCloseWarnExit.UseVisualStyleBackColor = true;
//
//radCloseWarnNever
//
this.radCloseWarnNever.AutoSize = true;
this.radCloseWarnNever.Location = new System.Drawing.Point(16, 100);
this.radCloseWarnNever.Name = "radCloseWarnNever";
this.radCloseWarnNever.Size = new System.Drawing.Size(226, 17);
this.radCloseWarnNever.TabIndex = 4;
this.radCloseWarnNever.TabStop = true;
this.radCloseWarnNever.Text = "Do not warn me when closing connections";
this.radCloseWarnNever.UseVisualStyleBackColor = true;
//
//ConnectionsPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.pnlRdpReconnectionCount);
this.Controls.Add(this.chkSingleClickOnConnectionOpensIt);
this.Controls.Add(this.chkHostnameLikeDisplayName);
this.Controls.Add(this.pnlDefaultCredentials);
this.Controls.Add(this.chkSingleClickOnOpenedConnectionSwitchesToIt);
this.Controls.Add(this.pnlAutoSave);
this.Controls.Add(this.pnlConfirmCloseConnection);
this.Name = "ConnectionsPage";
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
this.Size = new System.Drawing.Size(610, 489);
this.pnlRdpReconnectionCount.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize) this.numRdpReconnectionCount).EndInit();
this.pnlDefaultCredentials.ResumeLayout(false);
this.pnlDefaultCredentials.PerformLayout();
this.pnlAutoSave.ResumeLayout(false);
this.pnlAutoSave.PerformLayout();
((System.ComponentModel.ISupportInitialize) this.numAutoSave).EndInit();
this.pnlConfirmCloseConnection.ResumeLayout(false);
this.pnlConfirmCloseConnection.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
internal System.Windows.Forms.Panel pnlRdpReconnectionCount;
internal System.Windows.Forms.Label lblRdpReconnectionCount;
internal System.Windows.Forms.NumericUpDown numRdpReconnectionCount;
internal System.Windows.Forms.CheckBox chkSingleClickOnConnectionOpensIt;
internal System.Windows.Forms.CheckBox chkHostnameLikeDisplayName;
internal System.Windows.Forms.Panel pnlDefaultCredentials;
internal System.Windows.Forms.RadioButton radCredentialsCustom;
internal System.Windows.Forms.Label lblDefaultCredentials;
internal System.Windows.Forms.RadioButton radCredentialsNoInfo;
internal System.Windows.Forms.RadioButton radCredentialsWindows;
internal System.Windows.Forms.TextBox txtCredentialsDomain;
internal System.Windows.Forms.Label lblCredentialsUsername;
internal System.Windows.Forms.TextBox txtCredentialsPassword;
internal System.Windows.Forms.Label lblCredentialsPassword;
internal System.Windows.Forms.TextBox txtCredentialsUsername;
internal System.Windows.Forms.Label lblCredentialsDomain;
internal System.Windows.Forms.CheckBox chkSingleClickOnOpenedConnectionSwitchesToIt;
internal System.Windows.Forms.Panel pnlAutoSave;
internal System.Windows.Forms.Label lblAutoSave1;
internal System.Windows.Forms.NumericUpDown numAutoSave;
internal System.Windows.Forms.Label lblAutoSave2;
internal System.Windows.Forms.Panel pnlConfirmCloseConnection;
internal System.Windows.Forms.Label lblClosingConnections;
internal System.Windows.Forms.RadioButton radCloseWarnAll;
internal System.Windows.Forms.RadioButton radCloseWarnMultiple;
internal System.Windows.Forms.RadioButton radCloseWarnExit;
internal System.Windows.Forms.RadioButton radCloseWarnNever;
}
}

View File

@@ -1,182 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.My;
using mRemoteNG.Config;
//using mRemoteNG.App.Info;
using mRemoteNG.Security;
namespace mRemoteNG.Forms.OptionsPages
{
public partial class ConnectionsPage
{
public ConnectionsPage()
{
InitializeComponent();
}
public override string PageName
{
get
{
return Language.strConnections;
}
set
{
}
}
public override void ApplyLanguage()
{
base.ApplyLanguage();
chkSingleClickOnConnectionOpensIt.Text = Language.strSingleClickOnConnectionOpensIt;
chkSingleClickOnOpenedConnectionSwitchesToIt.Text = Language.strSingleClickOnOpenConnectionSwitchesToIt;
chkHostnameLikeDisplayName.Text = Language.strSetHostnameLikeDisplayName;
lblRdpReconnectionCount.Text = Language.strRdpReconnectCount;
lblAutoSave1.Text = Language.strAutoSaveEvery;
lblAutoSave2.Text = Language.strAutoSaveMins;
lblDefaultCredentials.Text = Language.strEmptyUsernamePasswordDomainFields;
radCredentialsNoInfo.Text = Language.strNoInformation;
radCredentialsWindows.Text = Language.strMyCurrentWindowsCreds;
radCredentialsCustom.Text = Language.strTheFollowing;
lblCredentialsUsername.Text = Language.strLabelUsername;
lblCredentialsPassword.Text = Language.strLabelPassword;
lblCredentialsDomain.Text = Language.strLabelDomain;
lblClosingConnections.Text = Language.strLabelClosingConnections;
radCloseWarnAll.Text = Language.strRadioCloseWarnAll;
radCloseWarnMultiple.Text = Language.strRadioCloseWarnMultiple;
radCloseWarnExit.Text = Language.strRadioCloseWarnExit;
radCloseWarnNever.Text = Language.strRadioCloseWarnNever;
}
public override void LoadSettings()
{
base.SaveSettings();
chkSingleClickOnConnectionOpensIt.Checked = System.Convert.ToBoolean(My.Settings.Default.SingleClickOnConnectionOpensIt);
chkSingleClickOnOpenedConnectionSwitchesToIt.Checked = System.Convert.ToBoolean(My.Settings.Default.SingleClickSwitchesToOpenConnection);
chkHostnameLikeDisplayName.Checked = System.Convert.ToBoolean(My.Settings.Default.SetHostnameLikeDisplayName);
numRdpReconnectionCount.Value = System.Convert.ToDecimal(My.Settings.Default.RdpReconnectionCount);
numAutoSave.Value = System.Convert.ToDecimal(My.Settings.Default.AutoSaveEveryMinutes);
// ReSharper disable once StringLiteralTypo
if ((string) My.Settings.Default.EmptyCredentials == "noinfo")
{
radCredentialsNoInfo.Checked = true;
}
else if ((string) My.Settings.Default.EmptyCredentials == "windows")
{
radCredentialsWindows.Checked = true;
}
else if ((string) My.Settings.Default.EmptyCredentials == "custom")
{
radCredentialsCustom.Checked = true;
}
txtCredentialsUsername.Text = System.Convert.ToString(My.Settings.Default.DefaultUsername);
txtCredentialsPassword.Text = Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.General.EncryptionKey);
txtCredentialsDomain.Text = System.Convert.ToString(My.Settings.Default.DefaultDomain);
if (My.Settings.Default.ConfirmCloseConnection == ConfirmClose.Never)
{
radCloseWarnNever.Checked = true;
}
else if (My.Settings.Default.ConfirmCloseConnection == ConfirmClose.Exit)
{
radCloseWarnExit.Checked = true;
}
else if (My.Settings.Default.ConfirmCloseConnection == ConfirmClose.Multiple)
{
radCloseWarnMultiple.Checked = true;
}
else
{
radCloseWarnAll.Checked = true;
}
}
public override void SaveSettings()
{
base.SaveSettings();
My.Settings.Default.SingleClickOnConnectionOpensIt = chkSingleClickOnConnectionOpensIt.Checked;
My.Settings.Default.SingleClickSwitchesToOpenConnection = chkSingleClickOnOpenedConnectionSwitchesToIt.Checked;
My.Settings.Default.SetHostnameLikeDisplayName = chkHostnameLikeDisplayName.Checked;
My.Settings.Default.RdpReconnectionCount = numRdpReconnectionCount.Value;
My.Settings.Default.AutoSaveEveryMinutes = numAutoSave.Value;
if (My.Settings.Default.AutoSaveEveryMinutes > 0)
{
frmMain.Default.tmrAutoSave.Interval = System.Convert.ToInt32(My.Settings.Default.AutoSaveEveryMinutes * 60000);
frmMain.Default.tmrAutoSave.Enabled = true;
}
else
{
frmMain.Default.tmrAutoSave.Enabled = false;
}
if (radCredentialsNoInfo.Checked)
{
// ReSharper disable once StringLiteralTypo
My.Settings.Default.EmptyCredentials = "noinfo";
}
else if (radCredentialsWindows.Checked)
{
My.Settings.Default.EmptyCredentials = "windows";
}
else if (radCredentialsCustom.Checked)
{
My.Settings.Default.EmptyCredentials = "custom";
}
My.Settings.Default.DefaultUsername = txtCredentialsUsername.Text;
My.Settings.Default.DefaultPassword = Crypt.Encrypt(txtCredentialsPassword.Text, App.Info.General.EncryptionKey);
My.Settings.Default.DefaultDomain = txtCredentialsDomain.Text;
if (radCloseWarnAll.Checked)
{
My.Settings.Default.ConfirmCloseConnection = ConfirmClose.All;
}
if (radCloseWarnMultiple.Checked)
{
My.Settings.Default.ConfirmCloseConnection = ConfirmClose.Multiple;
}
if (radCloseWarnExit.Checked)
{
My.Settings.Default.ConfirmCloseConnection = ConfirmClose.Exit;
}
if (radCloseWarnNever.Checked)
{
My.Settings.Default.ConfirmCloseConnection = ConfirmClose.Never;
}
}
public void radCredentialsCustom_CheckedChanged(object sender, EventArgs e)
{
lblCredentialsUsername.Enabled = radCredentialsCustom.Checked;
lblCredentialsPassword.Enabled = radCredentialsCustom.Checked;
lblCredentialsDomain.Enabled = radCredentialsCustom.Checked;
txtCredentialsUsername.Enabled = radCredentialsCustom.Checked;
txtCredentialsPassword.Enabled = radCredentialsCustom.Checked;
txtCredentialsDomain.Enabled = radCredentialsCustom.Checked;
}
}
}

View File

@@ -1,54 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.ComponentModel;
namespace mRemoteNG.Forms.OptionsPages
{
public class OptionsPage : UserControl
{
public OptionsPage()
{
InitializeComponent();
}
#region Public Properties
[Browsable(false)]public virtual string PageName {get; set;}
public virtual Icon PageIcon {get; set;}
#endregion
#region Public Methods
public virtual void ApplyLanguage()
{
}
public virtual void LoadSettings()
{
}
public virtual void SaveSettings()
{
}
public virtual void RevertSettings()
{
}
#endregion
}
}

View File

@@ -1,210 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class SqlServerPage : OptionsPage
{
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SqlServerPage));
this.lblSQLDatabaseName = new System.Windows.Forms.Label();
this.txtSQLDatabaseName = new System.Windows.Forms.TextBox();
this.lblExperimental = new System.Windows.Forms.Label();
this.chkUseSQLServer = new System.Windows.Forms.CheckBox();
this.chkUseSQLServer.CheckedChanged += new System.EventHandler(this.chkUseSQLServer_CheckedChanged);
this.lblSQLUsername = new System.Windows.Forms.Label();
this.txtSQLPassword = new System.Windows.Forms.TextBox();
this.lblSQLInfo = new System.Windows.Forms.Label();
this.lblSQLServer = new System.Windows.Forms.Label();
this.txtSQLUsername = new System.Windows.Forms.TextBox();
this.txtSQLServer = new System.Windows.Forms.TextBox();
this.lblSQLPassword = new System.Windows.Forms.Label();
this.SuspendLayout();
//
//lblSQLDatabaseName
//
this.lblSQLDatabaseName.Enabled = false;
this.lblSQLDatabaseName.Location = new System.Drawing.Point(23, 132);
this.lblSQLDatabaseName.Name = "lblSQLDatabaseName";
this.lblSQLDatabaseName.Size = new System.Drawing.Size(111, 13);
this.lblSQLDatabaseName.TabIndex = 16;
this.lblSQLDatabaseName.Text = "Database:";
this.lblSQLDatabaseName.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//txtSQLDatabaseName
//
this.txtSQLDatabaseName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSQLDatabaseName.Enabled = false;
this.txtSQLDatabaseName.Location = new System.Drawing.Point(140, 130);
this.txtSQLDatabaseName.Name = "txtSQLDatabaseName";
this.txtSQLDatabaseName.Size = new System.Drawing.Size(153, 20);
this.txtSQLDatabaseName.TabIndex = 17;
//
//lblExperimental
//
this.lblExperimental.Anchor = (System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.lblExperimental.Font = new System.Drawing.Font("Segoe UI", (float) (12.0F), System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.World);
this.lblExperimental.ForeColor = System.Drawing.Color.FromArgb(System.Convert.ToInt32(System.Convert.ToByte(192)), System.Convert.ToInt32(System.Convert.ToByte(0)), System.Convert.ToInt32(System.Convert.ToByte(0)));
this.lblExperimental.Location = new System.Drawing.Point(3, 0);
this.lblExperimental.Name = "lblExperimental";
this.lblExperimental.Size = new System.Drawing.Size(596, 25);
this.lblExperimental.TabIndex = 11;
this.lblExperimental.Text = "EXPERIMENTAL";
this.lblExperimental.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
//chkUseSQLServer
//
this.chkUseSQLServer.AutoSize = true;
this.chkUseSQLServer.Location = new System.Drawing.Point(3, 76);
this.chkUseSQLServer.Name = "chkUseSQLServer";
this.chkUseSQLServer.Size = new System.Drawing.Size(234, 17);
this.chkUseSQLServer.TabIndex = 13;
this.chkUseSQLServer.Text = "Use SQL Server to load && save connections";
this.chkUseSQLServer.UseVisualStyleBackColor = true;
//
//lblSQLUsername
//
this.lblSQLUsername.Enabled = false;
this.lblSQLUsername.Location = new System.Drawing.Point(23, 158);
this.lblSQLUsername.Name = "lblSQLUsername";
this.lblSQLUsername.Size = new System.Drawing.Size(111, 13);
this.lblSQLUsername.TabIndex = 18;
this.lblSQLUsername.Text = "Username:";
this.lblSQLUsername.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//txtSQLPassword
//
this.txtSQLPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSQLPassword.Enabled = false;
this.txtSQLPassword.Location = new System.Drawing.Point(140, 182);
this.txtSQLPassword.Name = "txtSQLPassword";
this.txtSQLPassword.Size = new System.Drawing.Size(153, 20);
this.txtSQLPassword.TabIndex = 21;
this.txtSQLPassword.UseSystemPasswordChar = true;
//
//lblSQLInfo
//
this.lblSQLInfo.Anchor = (System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.lblSQLInfo.Font = new System.Drawing.Font("Segoe UI", (float) (12.0F), System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.World);
this.lblSQLInfo.ForeColor = System.Drawing.Color.FromArgb(System.Convert.ToInt32(System.Convert.ToByte(192)), System.Convert.ToInt32(System.Convert.ToByte(0)), System.Convert.ToInt32(System.Convert.ToByte(0)));
this.lblSQLInfo.Location = new System.Drawing.Point(3, 25);
this.lblSQLInfo.Name = "lblSQLInfo";
this.lblSQLInfo.Size = new System.Drawing.Size(596, 25);
this.lblSQLInfo.TabIndex = 12;
this.lblSQLInfo.Text = "Please see Help - Getting started - SQL Configuration for more Info!";
this.lblSQLInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
//lblSQLServer
//
this.lblSQLServer.Enabled = false;
this.lblSQLServer.Location = new System.Drawing.Point(23, 106);
this.lblSQLServer.Name = "lblSQLServer";
this.lblSQLServer.Size = new System.Drawing.Size(111, 13);
this.lblSQLServer.TabIndex = 14;
this.lblSQLServer.Text = "SQL Server:";
this.lblSQLServer.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//txtSQLUsername
//
this.txtSQLUsername.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSQLUsername.Enabled = false;
this.txtSQLUsername.Location = new System.Drawing.Point(140, 156);
this.txtSQLUsername.Name = "txtSQLUsername";
this.txtSQLUsername.Size = new System.Drawing.Size(153, 20);
this.txtSQLUsername.TabIndex = 19;
//
//txtSQLServer
//
this.txtSQLServer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSQLServer.Enabled = false;
this.txtSQLServer.Location = new System.Drawing.Point(140, 103);
this.txtSQLServer.Name = "txtSQLServer";
this.txtSQLServer.Size = new System.Drawing.Size(153, 20);
this.txtSQLServer.TabIndex = 15;
//
//lblSQLPassword
//
this.lblSQLPassword.Enabled = false;
this.lblSQLPassword.Location = new System.Drawing.Point(23, 184);
this.lblSQLPassword.Name = "lblSQLPassword";
this.lblSQLPassword.Size = new System.Drawing.Size(111, 13);
this.lblSQLPassword.TabIndex = 20;
this.lblSQLPassword.Text = "Password:";
this.lblSQLPassword.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
//SqlServerPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lblSQLDatabaseName);
this.Controls.Add(this.txtSQLDatabaseName);
this.Controls.Add(this.lblExperimental);
this.Controls.Add(this.chkUseSQLServer);
this.Controls.Add(this.lblSQLUsername);
this.Controls.Add(this.txtSQLPassword);
this.Controls.Add(this.lblSQLInfo);
this.Controls.Add(this.lblSQLServer);
this.Controls.Add(this.txtSQLUsername);
this.Controls.Add(this.txtSQLServer);
this.Controls.Add(this.lblSQLPassword);
this.Name = "SqlServerPage";
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
this.Size = new System.Drawing.Size(610, 489);
this.ResumeLayout(false);
this.PerformLayout();
}
internal System.Windows.Forms.Label lblSQLDatabaseName;
internal System.Windows.Forms.TextBox txtSQLDatabaseName;
internal System.Windows.Forms.Label lblExperimental;
internal System.Windows.Forms.CheckBox chkUseSQLServer;
internal System.Windows.Forms.Label lblSQLUsername;
internal System.Windows.Forms.TextBox txtSQLPassword;
internal System.Windows.Forms.Label lblSQLInfo;
internal System.Windows.Forms.Label lblSQLServer;
internal System.Windows.Forms.TextBox txtSQLUsername;
internal System.Windows.Forms.TextBox txtSQLServer;
internal System.Windows.Forms.Label lblSQLPassword;
}
}

View File

@@ -1,94 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.My;
using mRemoteNG.App;
//using mRemoteNG.App.Info;
using mRemoteNG.Security;
namespace mRemoteNG.Forms.OptionsPages
{
public partial class SqlServerPage
{
public SqlServerPage()
{
InitializeComponent();
}
public override string PageName
{
get
{
return Language.strSQLServer.TrimEnd(':');
}
set
{
}
}
public override void ApplyLanguage()
{
base.ApplyLanguage();
lblExperimental.Text = Language.strExperimental.ToUpper();
lblSQLInfo.Text = Language.strSQLInfo;
chkUseSQLServer.Text = Language.strUseSQLServer;
lblSQLServer.Text = Language.strLabelHostname;
lblSQLDatabaseName.Text = Language.strLabelSQLServerDatabaseName;
lblSQLUsername.Text = Language.strLabelUsername;
lblSQLPassword.Text = Language.strLabelPassword;
}
public override void LoadSettings()
{
base.SaveSettings();
chkUseSQLServer.Checked = System.Convert.ToBoolean(My.Settings.Default.UseSQLServer);
txtSQLServer.Text = System.Convert.ToString(My.Settings.Default.SQLHost);
txtSQLDatabaseName.Text = System.Convert.ToString(My.Settings.Default.SQLDatabaseName);
txtSQLUsername.Text = System.Convert.ToString(My.Settings.Default.SQLUser);
txtSQLPassword.Text = Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.SQLPass), App.Info.General.EncryptionKey);
}
public override void SaveSettings()
{
base.SaveSettings();
My.Settings.Default.UseSQLServer = chkUseSQLServer.Checked;
My.Settings.Default.SQLHost = txtSQLServer.Text;
My.Settings.Default.SQLDatabaseName = txtSQLDatabaseName.Text;
My.Settings.Default.SQLUser = txtSQLUsername.Text;
My.Settings.Default.SQLPass = Crypt.Encrypt(txtSQLPassword.Text, App.Info.General.EncryptionKey);
Runtime.Startup.DestroySQLUpdateHandlerAndStopTimer();
frmMain.Default.UsingSqlServer = System.Convert.ToBoolean(My.Settings.Default.UseSQLServer);
if (My.Settings.Default.UseSQLServer)
{
Runtime.Startup.CreateSQLUpdateHandlerAndStartTimer();
}
}
public void chkUseSQLServer_CheckedChanged(object sender, EventArgs e)
{
lblSQLServer.Enabled = chkUseSQLServer.Checked;
lblSQLDatabaseName.Enabled = chkUseSQLServer.Checked;
lblSQLUsername.Enabled = chkUseSQLServer.Checked;
lblSQLPassword.Enabled = chkUseSQLServer.Checked;
txtSQLServer.Enabled = chkUseSQLServer.Checked;
txtSQLDatabaseName.Enabled = chkUseSQLServer.Checked;
txtSQLUsername.Enabled = chkUseSQLServer.Checked;
txtSQLPassword.Enabled = chkUseSQLServer.Checked;
}
}
}

View File

@@ -1,114 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class StartupExitPage : OptionsPage
{
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StartupExitPage));
this.chkReconnectOnStart = new System.Windows.Forms.CheckBox();
base.Load += new System.EventHandler(StartupExitPage_Load);
this.chkSaveConsOnExit = new System.Windows.Forms.CheckBox();
this.chkSingleInstance = new System.Windows.Forms.CheckBox();
this.chkProperInstallationOfComponentsAtStartup = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
//chkReconnectOnStart
//
this.chkReconnectOnStart.AutoSize = true;
this.chkReconnectOnStart.Location = new System.Drawing.Point(3, 24);
this.chkReconnectOnStart.Name = "chkReconnectOnStart";
this.chkReconnectOnStart.Size = new System.Drawing.Size(273, 17);
this.chkReconnectOnStart.TabIndex = 7;
this.chkReconnectOnStart.Text = "Reconnect to previously opened sessions on startup";
this.chkReconnectOnStart.UseVisualStyleBackColor = true;
//
//chkSaveConsOnExit
//
this.chkSaveConsOnExit.AutoSize = true;
this.chkSaveConsOnExit.Location = new System.Drawing.Point(3, 0);
this.chkSaveConsOnExit.Name = "chkSaveConsOnExit";
this.chkSaveConsOnExit.Size = new System.Drawing.Size(146, 17);
this.chkSaveConsOnExit.TabIndex = 6;
this.chkSaveConsOnExit.Text = "Save connections on exit";
this.chkSaveConsOnExit.UseVisualStyleBackColor = true;
//
//chkSingleInstance
//
this.chkSingleInstance.AutoSize = true;
this.chkSingleInstance.Location = new System.Drawing.Point(3, 48);
this.chkSingleInstance.Name = "chkSingleInstance";
this.chkSingleInstance.Size = new System.Drawing.Size(366, 17);
this.chkSingleInstance.TabIndex = 8;
this.chkSingleInstance.Text = "Allow only a single instance of the application (mRemote restart required)";
this.chkSingleInstance.UseVisualStyleBackColor = true;
//
//chkProperInstallationOfComponentsAtStartup
//
this.chkProperInstallationOfComponentsAtStartup.AutoSize = true;
this.chkProperInstallationOfComponentsAtStartup.Location = new System.Drawing.Point(3, 72);
this.chkProperInstallationOfComponentsAtStartup.Name = "chkProperInstallationOfComponentsAtStartup";
this.chkProperInstallationOfComponentsAtStartup.Size = new System.Drawing.Size(262, 17);
this.chkProperInstallationOfComponentsAtStartup.TabIndex = 9;
this.chkProperInstallationOfComponentsAtStartup.Text = "Check proper installation of components at startup";
this.chkProperInstallationOfComponentsAtStartup.UseVisualStyleBackColor = true;
//
//StartupExitPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.chkReconnectOnStart);
this.Controls.Add(this.chkSaveConsOnExit);
this.Controls.Add(this.chkSingleInstance);
this.Controls.Add(this.chkProperInstallationOfComponentsAtStartup);
this.Name = "StartupExitPage";
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
this.Size = new System.Drawing.Size(610, 489);
this.ResumeLayout(false);
this.PerformLayout();
}
internal System.Windows.Forms.CheckBox chkReconnectOnStart;
internal System.Windows.Forms.CheckBox chkSaveConsOnExit;
internal System.Windows.Forms.CheckBox chkSingleInstance;
internal System.Windows.Forms.CheckBox chkProperInstallationOfComponentsAtStartup;
}
}

View File

@@ -1,64 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.My;
namespace mRemoteNG.Forms.OptionsPages
{
public partial class StartupExitPage
{
public StartupExitPage()
{
InitializeComponent();
}
public override string PageName
{
get
{
return Language.strStartupExit;
}
set
{
}
}
public override void ApplyLanguage()
{
base.ApplyLanguage();
chkSaveConsOnExit.Text = Language.strSaveConsOnExit;
chkReconnectOnStart.Text = Language.strReconnectAtStartup;
chkSingleInstance.Text = Language.strAllowOnlySingleInstance;
chkProperInstallationOfComponentsAtStartup.Text = Language.strCheckProperInstallationOfComponentsAtStartup;
}
public override void SaveSettings()
{
base.SaveSettings();
Settings.SaveConsOnExit = chkSaveConsOnExit.Checked;
Settings.OpenConsFromLastSession = chkReconnectOnStart.Checked;
Settings.SingleInstance = chkSingleInstance.Checked;
Settings.StartupComponentsCheck = chkProperInstallationOfComponentsAtStartup.Checked;
}
public void StartupExitPage_Load(System.Object sender, EventArgs e)
{
chkSaveConsOnExit.Checked = Settings.SaveConsOnExit;
chkReconnectOnStart.Checked = Settings.OpenConsFromLastSession;
chkSingleInstance.Checked = Settings.SingleInstance;
chkProperInstallationOfComponentsAtStartup.Checked = Settings.StartupComponentsCheck;
}
}
}

View File

@@ -1,220 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class TabsPanelsPage : OptionsPage
{
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TabsPanelsPage));
this.chkAlwaysShowPanelTabs = new System.Windows.Forms.CheckBox();
this.chkIdentifyQuickConnectTabs = new System.Windows.Forms.CheckBox();
this.chkUseOnlyErrorsAndInfosPanel = new System.Windows.Forms.CheckBox();
this.chkUseOnlyErrorsAndInfosPanel.CheckedChanged += new System.EventHandler(this.chkUseOnlyErrorsAndInfosPanel_CheckedChanged);
this.chkOpenNewTabRightOfSelected = new System.Windows.Forms.CheckBox();
this.lblSwitchToErrorsAndInfos = new System.Windows.Forms.Label();
this.chkAlwaysShowPanelSelectionDlg = new System.Windows.Forms.CheckBox();
this.chkMCInformation = new System.Windows.Forms.CheckBox();
this.chkShowLogonInfoOnTabs = new System.Windows.Forms.CheckBox();
this.chkMCErrors = new System.Windows.Forms.CheckBox();
this.chkDoubleClickClosesTab = new System.Windows.Forms.CheckBox();
this.chkMCWarnings = new System.Windows.Forms.CheckBox();
this.chkShowProtocolOnTabs = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
//chkAlwaysShowPanelTabs
//
this.chkAlwaysShowPanelTabs.AutoSize = true;
this.chkAlwaysShowPanelTabs.Location = new System.Drawing.Point(3, 0);
this.chkAlwaysShowPanelTabs.Name = "chkAlwaysShowPanelTabs";
this.chkAlwaysShowPanelTabs.Size = new System.Drawing.Size(139, 17);
this.chkAlwaysShowPanelTabs.TabIndex = 12;
this.chkAlwaysShowPanelTabs.Text = "Always show panel tabs";
this.chkAlwaysShowPanelTabs.UseVisualStyleBackColor = true;
//
//chkIdentifyQuickConnectTabs
//
this.chkIdentifyQuickConnectTabs.AutoSize = true;
this.chkIdentifyQuickConnectTabs.Location = new System.Drawing.Point(3, 92);
this.chkIdentifyQuickConnectTabs.Name = "chkIdentifyQuickConnectTabs";
this.chkIdentifyQuickConnectTabs.Size = new System.Drawing.Size(293, 17);
this.chkIdentifyQuickConnectTabs.TabIndex = 16;
this.chkIdentifyQuickConnectTabs.Text = global::mRemoteNG.My.Language.strIdentifyQuickConnectTabs;
this.chkIdentifyQuickConnectTabs.UseVisualStyleBackColor = true;
//
//chkUseOnlyErrorsAndInfosPanel
//
this.chkUseOnlyErrorsAndInfosPanel.AutoSize = true;
this.chkUseOnlyErrorsAndInfosPanel.Location = new System.Drawing.Point(3, 185);
this.chkUseOnlyErrorsAndInfosPanel.Name = "chkUseOnlyErrorsAndInfosPanel";
this.chkUseOnlyErrorsAndInfosPanel.Size = new System.Drawing.Size(278, 17);
this.chkUseOnlyErrorsAndInfosPanel.TabIndex = 19;
this.chkUseOnlyErrorsAndInfosPanel.Text = "Use only Notifications panel (no messagebox popups)";
this.chkUseOnlyErrorsAndInfosPanel.UseVisualStyleBackColor = true;
//
//chkOpenNewTabRightOfSelected
//
this.chkOpenNewTabRightOfSelected.AutoSize = true;
this.chkOpenNewTabRightOfSelected.Location = new System.Drawing.Point(3, 23);
this.chkOpenNewTabRightOfSelected.Name = "chkOpenNewTabRightOfSelected";
this.chkOpenNewTabRightOfSelected.Size = new System.Drawing.Size(280, 17);
this.chkOpenNewTabRightOfSelected.TabIndex = 13;
this.chkOpenNewTabRightOfSelected.Text = "Open new tab to the right of the currently selected tab";
this.chkOpenNewTabRightOfSelected.UseVisualStyleBackColor = true;
//
//lblSwitchToErrorsAndInfos
//
this.lblSwitchToErrorsAndInfos.AutoSize = true;
this.lblSwitchToErrorsAndInfos.Location = new System.Drawing.Point(3, 210);
this.lblSwitchToErrorsAndInfos.Name = "lblSwitchToErrorsAndInfos";
this.lblSwitchToErrorsAndInfos.Size = new System.Drawing.Size(159, 13);
this.lblSwitchToErrorsAndInfos.TabIndex = 20;
this.lblSwitchToErrorsAndInfos.Text = "Switch to Notifications panel on:";
//
//chkAlwaysShowPanelSelectionDlg
//
this.chkAlwaysShowPanelSelectionDlg.AutoSize = true;
this.chkAlwaysShowPanelSelectionDlg.Location = new System.Drawing.Point(3, 138);
this.chkAlwaysShowPanelSelectionDlg.Name = "chkAlwaysShowPanelSelectionDlg";
this.chkAlwaysShowPanelSelectionDlg.Size = new System.Drawing.Size(317, 17);
this.chkAlwaysShowPanelSelectionDlg.TabIndex = 18;
this.chkAlwaysShowPanelSelectionDlg.Text = "Always show panel selection dialog when opening connectins";
this.chkAlwaysShowPanelSelectionDlg.UseVisualStyleBackColor = true;
//
//chkMCInformation
//
this.chkMCInformation.AutoSize = true;
this.chkMCInformation.Enabled = false;
this.chkMCInformation.Location = new System.Drawing.Point(19, 230);
this.chkMCInformation.Name = "chkMCInformation";
this.chkMCInformation.Size = new System.Drawing.Size(83, 17);
this.chkMCInformation.TabIndex = 21;
this.chkMCInformation.Text = "Informations";
this.chkMCInformation.UseVisualStyleBackColor = true;
//
//chkShowLogonInfoOnTabs
//
this.chkShowLogonInfoOnTabs.AutoSize = true;
this.chkShowLogonInfoOnTabs.Location = new System.Drawing.Point(3, 46);
this.chkShowLogonInfoOnTabs.Name = "chkShowLogonInfoOnTabs";
this.chkShowLogonInfoOnTabs.Size = new System.Drawing.Size(203, 17);
this.chkShowLogonInfoOnTabs.TabIndex = 14;
this.chkShowLogonInfoOnTabs.Text = "Show logon information on tab names";
this.chkShowLogonInfoOnTabs.UseVisualStyleBackColor = true;
//
//chkMCErrors
//
this.chkMCErrors.AutoSize = true;
this.chkMCErrors.Enabled = false;
this.chkMCErrors.Location = new System.Drawing.Point(19, 276);
this.chkMCErrors.Name = "chkMCErrors";
this.chkMCErrors.Size = new System.Drawing.Size(53, 17);
this.chkMCErrors.TabIndex = 23;
this.chkMCErrors.Text = "Errors";
this.chkMCErrors.UseVisualStyleBackColor = true;
//
//chkDoubleClickClosesTab
//
this.chkDoubleClickClosesTab.AutoSize = true;
this.chkDoubleClickClosesTab.Location = new System.Drawing.Point(3, 115);
this.chkDoubleClickClosesTab.Name = "chkDoubleClickClosesTab";
this.chkDoubleClickClosesTab.Size = new System.Drawing.Size(159, 17);
this.chkDoubleClickClosesTab.TabIndex = 17;
this.chkDoubleClickClosesTab.Text = "Double click on tab closes it";
this.chkDoubleClickClosesTab.UseVisualStyleBackColor = true;
//
//chkMCWarnings
//
this.chkMCWarnings.AutoSize = true;
this.chkMCWarnings.Enabled = false;
this.chkMCWarnings.Location = new System.Drawing.Point(19, 253);
this.chkMCWarnings.Name = "chkMCWarnings";
this.chkMCWarnings.Size = new System.Drawing.Size(71, 17);
this.chkMCWarnings.TabIndex = 22;
this.chkMCWarnings.Text = "Warnings";
this.chkMCWarnings.UseVisualStyleBackColor = true;
//
//chkShowProtocolOnTabs
//
this.chkShowProtocolOnTabs.AutoSize = true;
this.chkShowProtocolOnTabs.Location = new System.Drawing.Point(3, 69);
this.chkShowProtocolOnTabs.Name = "chkShowProtocolOnTabs";
this.chkShowProtocolOnTabs.Size = new System.Drawing.Size(166, 17);
this.chkShowProtocolOnTabs.TabIndex = 15;
this.chkShowProtocolOnTabs.Text = "Show protocols on tab names";
this.chkShowProtocolOnTabs.UseVisualStyleBackColor = true;
//
//TabsPanelsPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.chkAlwaysShowPanelTabs);
this.Controls.Add(this.chkIdentifyQuickConnectTabs);
this.Controls.Add(this.chkUseOnlyErrorsAndInfosPanel);
this.Controls.Add(this.chkOpenNewTabRightOfSelected);
this.Controls.Add(this.lblSwitchToErrorsAndInfos);
this.Controls.Add(this.chkAlwaysShowPanelSelectionDlg);
this.Controls.Add(this.chkMCInformation);
this.Controls.Add(this.chkShowLogonInfoOnTabs);
this.Controls.Add(this.chkMCErrors);
this.Controls.Add(this.chkDoubleClickClosesTab);
this.Controls.Add(this.chkMCWarnings);
this.Controls.Add(this.chkShowProtocolOnTabs);
this.Name = "TabsPanelsPage";
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
this.Size = new System.Drawing.Size(610, 489);
this.ResumeLayout(false);
this.PerformLayout();
}
internal System.Windows.Forms.CheckBox chkAlwaysShowPanelTabs;
internal System.Windows.Forms.CheckBox chkIdentifyQuickConnectTabs;
internal System.Windows.Forms.CheckBox chkUseOnlyErrorsAndInfosPanel;
internal System.Windows.Forms.CheckBox chkOpenNewTabRightOfSelected;
internal System.Windows.Forms.Label lblSwitchToErrorsAndInfos;
internal System.Windows.Forms.CheckBox chkAlwaysShowPanelSelectionDlg;
internal System.Windows.Forms.CheckBox chkMCInformation;
internal System.Windows.Forms.CheckBox chkShowLogonInfoOnTabs;
internal System.Windows.Forms.CheckBox chkMCErrors;
internal System.Windows.Forms.CheckBox chkDoubleClickClosesTab;
internal System.Windows.Forms.CheckBox chkMCWarnings;
internal System.Windows.Forms.CheckBox chkShowProtocolOnTabs;
}
}

View File

@@ -1,100 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.My;
namespace mRemoteNG.Forms.OptionsPages
{
public partial class TabsPanelsPage
{
public TabsPanelsPage()
{
InitializeComponent();
}
public override string PageName
{
get
{
return Language.strTabsAndPanels.Replace("&&", "&");
}
set
{
}
}
public override void ApplyLanguage()
{
base.ApplyLanguage();
chkAlwaysShowPanelTabs.Text = Language.strAlwaysShowPanelTabs;
chkOpenNewTabRightOfSelected.Text = Language.strOpenNewTabRight;
chkShowLogonInfoOnTabs.Text = Language.strShowLogonInfoOnTabs;
chkShowProtocolOnTabs.Text = Language.strShowProtocolOnTabs;
chkIdentifyQuickConnectTabs.Text = Language.strIdentifyQuickConnectTabs;
chkDoubleClickClosesTab.Text = Language.strDoubleClickTabClosesIt;
chkAlwaysShowPanelSelectionDlg.Text = Language.strAlwaysShowPanelSelection;
chkUseOnlyErrorsAndInfosPanel.Text = Language.strUseOnlyErrorsAndInfosPanel;
lblSwitchToErrorsAndInfos.Text = Language.strSwitchToErrorsAndInfos;
chkMCInformation.Text = Language.strInformations;
chkMCWarnings.Text = Language.strWarnings;
chkMCErrors.Text = Language.strErrors;
}
public override void LoadSettings()
{
base.SaveSettings();
chkAlwaysShowPanelTabs.Checked = Settings.AlwaysShowPanelTabs;
chkOpenNewTabRightOfSelected.Checked = Settings.OpenTabsRightOfSelected;
chkShowLogonInfoOnTabs.Checked = Settings.ShowLogonInfoOnTabs;
chkShowProtocolOnTabs.Checked = Settings.ShowProtocolOnTabs;
chkIdentifyQuickConnectTabs.Checked = Settings.IdentifyQuickConnectTabs;
chkDoubleClickClosesTab.Checked = Settings.DoubleClickOnTabClosesIt;
chkAlwaysShowPanelSelectionDlg.Checked = Settings.AlwaysShowPanelSelectionDlg;
chkUseOnlyErrorsAndInfosPanel.Checked = Settings.ShowNoMessageBoxes;
chkMCInformation.Checked = Settings.SwitchToMCOnInformation;
chkMCWarnings.Checked = Settings.SwitchToMCOnWarning;
chkMCErrors.Checked = Settings.SwitchToMCOnError;
}
public override void SaveSettings()
{
base.SaveSettings();
Settings.AlwaysShowPanelTabs = chkAlwaysShowPanelTabs.Checked;
frmMain.Default.ShowHidePanelTabs();
Settings.OpenTabsRightOfSelected = chkOpenNewTabRightOfSelected.Checked;
Settings.ShowLogonInfoOnTabs = chkShowLogonInfoOnTabs.Checked;
Settings.ShowProtocolOnTabs = chkShowProtocolOnTabs.Checked;
Settings.IdentifyQuickConnectTabs = chkIdentifyQuickConnectTabs.Checked;
Settings.DoubleClickOnTabClosesIt = chkDoubleClickClosesTab.Checked;
Settings.AlwaysShowPanelSelectionDlg = chkAlwaysShowPanelSelectionDlg.Checked;
Settings.ShowNoMessageBoxes = chkUseOnlyErrorsAndInfosPanel.Checked;
Settings.SwitchToMCOnInformation = chkMCInformation.Checked;
Settings.SwitchToMCOnWarning = chkMCWarnings.Checked;
Settings.SwitchToMCOnError = chkMCErrors.Checked;
}
public void chkUseOnlyErrorsAndInfosPanel_CheckedChanged(object sender, EventArgs e)
{
chkMCInformation.Enabled = chkUseOnlyErrorsAndInfosPanel.Checked;
chkMCWarnings.Enabled = chkUseOnlyErrorsAndInfosPanel.Checked;
chkMCErrors.Enabled = chkUseOnlyErrorsAndInfosPanel.Checked;
}
}
}

View File

@@ -1,113 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class ThemePage : OptionsPage
{
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ThemePage));
this.btnThemeDelete = new System.Windows.Forms.Button();
this.btnThemeDelete.Click += new System.EventHandler(this.btnThemeDelete_Click);
this.btnThemeNew = new System.Windows.Forms.Button();
this.btnThemeNew.Click += new System.EventHandler(this.btnThemeNew_Click);
this.cboTheme = new System.Windows.Forms.ComboBox();
this.cboTheme.DropDown += new System.EventHandler(this.cboTheme_DropDown);
this.cboTheme.SelectionChangeCommitted += new System.EventHandler(this.cboTheme_SelectionChangeCommitted);
this.ThemePropertyGrid = new System.Windows.Forms.PropertyGrid();
this.SuspendLayout();
//
//btnThemeDelete
//
this.btnThemeDelete.Location = new System.Drawing.Point(535, 0);
this.btnThemeDelete.Name = "btnThemeDelete";
this.btnThemeDelete.Size = new System.Drawing.Size(75, 23);
this.btnThemeDelete.TabIndex = 6;
this.btnThemeDelete.Text = "&Delete";
this.btnThemeDelete.UseVisualStyleBackColor = true;
//
//btnThemeNew
//
this.btnThemeNew.Location = new System.Drawing.Point(454, 0);
this.btnThemeNew.Name = "btnThemeNew";
this.btnThemeNew.Size = new System.Drawing.Size(75, 23);
this.btnThemeNew.TabIndex = 5;
this.btnThemeNew.Text = "&New";
this.btnThemeNew.UseVisualStyleBackColor = true;
//
//cboTheme
//
this.cboTheme.FormattingEnabled = true;
this.cboTheme.Location = new System.Drawing.Point(3, 1);
this.cboTheme.Name = "cboTheme";
this.cboTheme.Size = new System.Drawing.Size(445, 21);
this.cboTheme.TabIndex = 4;
//
//ThemePropertyGrid
//
this.ThemePropertyGrid.Anchor = (System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.ThemePropertyGrid.Location = new System.Drawing.Point(3, 29);
this.ThemePropertyGrid.Name = "ThemePropertyGrid";
this.ThemePropertyGrid.Size = new System.Drawing.Size(607, 460);
this.ThemePropertyGrid.TabIndex = 7;
this.ThemePropertyGrid.UseCompatibleTextRendering = true;
//
//ThemePage
//
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnThemeDelete);
this.Controls.Add(this.btnThemeNew);
this.Controls.Add(this.cboTheme);
this.Controls.Add(this.ThemePropertyGrid);
this.Name = "ThemePage";
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
this.Size = new System.Drawing.Size(610, 489);
this.ResumeLayout(false);
}
internal System.Windows.Forms.Button btnThemeDelete;
internal System.Windows.Forms.Button btnThemeNew;
internal System.Windows.Forms.ComboBox cboTheme;
internal System.Windows.Forms.PropertyGrid ThemePropertyGrid;
}
}

View File

@@ -1,143 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.ComponentModel;
using mRemoteNG.My;
using mRemoteNG.Themes;
namespace mRemoteNG.Forms.OptionsPages
{
public partial class ThemePage
{
public ThemePage()
{
InitializeComponent();
}
public override string PageName
{
get
{
return Language.strOptionsTabTheme;
}
set
{
}
}
public override void ApplyLanguage()
{
base.ApplyLanguage();
btnThemeDelete.Text = Language.strOptionsThemeButtonDelete;
btnThemeNew.Text = Language.strOptionsThemeButtonNew;
}
public override void LoadSettings()
{
base.SaveSettings();
_themeList = new BindingList<ThemeInfo>(ThemeManager.LoadThemes());
cboTheme.DataSource = _themeList;
cboTheme.SelectedItem = ThemeManager.ActiveTheme;
cboTheme_SelectionChangeCommitted(this, new EventArgs());
ThemePropertyGrid.PropertySort = PropertySort.Categorized;
_originalTheme = ThemeManager.ActiveTheme;
}
public override void SaveSettings()
{
base.SaveSettings();
ThemeManager.SaveThemes(_themeList);
Settings.ThemeName = ThemeManager.ActiveTheme.Name;
}
public override void RevertSettings()
{
ThemeManager.ActiveTheme = _originalTheme;
}
#region Private Fields
private BindingList<ThemeInfo> _themeList;
private ThemeInfo _originalTheme;
#endregion
#region Private Methods
#region Event Handlers
public void cboTheme_DropDown(object sender, EventArgs e)
{
if (ThemeManager.ActiveTheme == ThemeManager.DefaultTheme)
{
return ;
}
ThemeManager.ActiveTheme.Name = cboTheme.Text;
}
public void cboTheme_SelectionChangeCommitted(object sender, EventArgs e)
{
if (cboTheme.SelectedItem == null)
{
cboTheme.SelectedItem = ThemeManager.DefaultTheme;
}
if (cboTheme.SelectedItem == ThemeManager.DefaultTheme)
{
cboTheme.DropDownStyle = ComboBoxStyle.DropDownList;
btnThemeDelete.Enabled = false;
ThemePropertyGrid.Enabled = false;
}
else
{
cboTheme.DropDownStyle = ComboBoxStyle.DropDown;
btnThemeDelete.Enabled = true;
ThemePropertyGrid.Enabled = true;
}
ThemeManager.ActiveTheme = cboTheme.SelectedItem;
ThemePropertyGrid.SelectedObject = ThemeManager.ActiveTheme;
ThemePropertyGrid.Refresh();
}
public void btnThemeNew_Click(object sender, EventArgs e)
{
ThemeInfo newTheme = ThemeManager.ActiveTheme.Clone();
newTheme.Name = Language.strUnnamedTheme;
_themeList.Add(newTheme);
cboTheme.SelectedItem = newTheme;
cboTheme_SelectionChangeCommitted(this, new EventArgs());
cboTheme.Focus();
}
public void btnThemeDelete_Click(object sender, EventArgs e)
{
ThemeInfo theme = cboTheme.SelectedItem;
if (theme == null)
{
return ;
}
_themeList.Remove(theme);
cboTheme.SelectedItem = ThemeManager.DefaultTheme;
cboTheme_SelectionChangeCommitted(this, new EventArgs());
}
#endregion
#endregion
}
}

View File

@@ -1,305 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class UpdatesPage : OptionsPage
{
//UserControl overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdatesPage));
this.lblUpdatesExplanation = new System.Windows.Forms.Label();
this.pnlUpdateCheck = new System.Windows.Forms.Panel();
this.btnUpdateCheckNow = new System.Windows.Forms.Button();
this.btnUpdateCheckNow.Click += new System.EventHandler(this.btnUpdateCheckNow_Click);
this.chkCheckForUpdatesOnStartup = new System.Windows.Forms.CheckBox();
this.chkCheckForUpdatesOnStartup.CheckedChanged += new System.EventHandler(this.chkCheckForUpdatesOnStartup_CheckedChanged);
this.cboUpdateCheckFrequency = new System.Windows.Forms.ComboBox();
this.pnlProxy = new System.Windows.Forms.Panel();
this.pnlProxyBasic = new System.Windows.Forms.Panel();
this.lblProxyAddress = new System.Windows.Forms.Label();
this.txtProxyAddress = new System.Windows.Forms.TextBox();
this.lblProxyPort = new System.Windows.Forms.Label();
this.numProxyPort = new System.Windows.Forms.NumericUpDown();
this.chkUseProxyForAutomaticUpdates = new System.Windows.Forms.CheckBox();
this.chkUseProxyForAutomaticUpdates.CheckedChanged += new System.EventHandler(this.chkUseProxyForAutomaticUpdates_CheckedChanged);
this.chkUseProxyAuthentication = new System.Windows.Forms.CheckBox();
this.chkUseProxyAuthentication.CheckedChanged += new System.EventHandler(this.chkUseProxyAuthentication_CheckedChanged);
this.pnlProxyAuthentication = new System.Windows.Forms.Panel();
this.lblProxyUsername = new System.Windows.Forms.Label();
this.txtProxyUsername = new System.Windows.Forms.TextBox();
this.lblProxyPassword = new System.Windows.Forms.Label();
this.txtProxyPassword = new System.Windows.Forms.TextBox();
this.btnTestProxy = new System.Windows.Forms.Button();
this.btnTestProxy.Click += new System.EventHandler(this.btnTestProxy_Click);
this.pnlUpdateCheck.SuspendLayout();
this.pnlProxy.SuspendLayout();
this.pnlProxyBasic.SuspendLayout();
((System.ComponentModel.ISupportInitialize) this.numProxyPort).BeginInit();
this.pnlProxyAuthentication.SuspendLayout();
this.SuspendLayout();
//
//lblUpdatesExplanation
//
this.lblUpdatesExplanation.Location = new System.Drawing.Point(3, 0);
this.lblUpdatesExplanation.Name = "lblUpdatesExplanation";
this.lblUpdatesExplanation.Size = new System.Drawing.Size(536, 40);
this.lblUpdatesExplanation.TabIndex = 3;
this.lblUpdatesExplanation.Text = "mRemoteNG can periodically connect to the mRemoteNG website to check for updates " +
"and product announcements.";
//
//pnlUpdateCheck
//
this.pnlUpdateCheck.Controls.Add(this.btnUpdateCheckNow);
this.pnlUpdateCheck.Controls.Add(this.chkCheckForUpdatesOnStartup);
this.pnlUpdateCheck.Controls.Add(this.cboUpdateCheckFrequency);
this.pnlUpdateCheck.Location = new System.Drawing.Point(0, 48);
this.pnlUpdateCheck.Name = "pnlUpdateCheck";
this.pnlUpdateCheck.Size = new System.Drawing.Size(610, 120);
this.pnlUpdateCheck.TabIndex = 4;
//
//btnUpdateCheckNow
//
this.btnUpdateCheckNow.Location = new System.Drawing.Point(3, 80);
this.btnUpdateCheckNow.Name = "btnUpdateCheckNow";
this.btnUpdateCheckNow.Size = new System.Drawing.Size(120, 32);
this.btnUpdateCheckNow.TabIndex = 2;
this.btnUpdateCheckNow.Text = "Check Now";
this.btnUpdateCheckNow.UseVisualStyleBackColor = true;
//
//chkCheckForUpdatesOnStartup
//
this.chkCheckForUpdatesOnStartup.AutoSize = true;
this.chkCheckForUpdatesOnStartup.Location = new System.Drawing.Point(3, 8);
this.chkCheckForUpdatesOnStartup.Name = "chkCheckForUpdatesOnStartup";
this.chkCheckForUpdatesOnStartup.Size = new System.Drawing.Size(213, 17);
this.chkCheckForUpdatesOnStartup.TabIndex = 0;
this.chkCheckForUpdatesOnStartup.Text = "Check for updates and announcements";
this.chkCheckForUpdatesOnStartup.UseVisualStyleBackColor = true;
//
//cboUpdateCheckFrequency
//
this.cboUpdateCheckFrequency.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboUpdateCheckFrequency.FormattingEnabled = true;
this.cboUpdateCheckFrequency.Location = new System.Drawing.Point(48, 40);
this.cboUpdateCheckFrequency.Name = "cboUpdateCheckFrequency";
this.cboUpdateCheckFrequency.Size = new System.Drawing.Size(128, 21);
this.cboUpdateCheckFrequency.TabIndex = 1;
//
//pnlProxy
//
this.pnlProxy.Controls.Add(this.pnlProxyBasic);
this.pnlProxy.Controls.Add(this.chkUseProxyForAutomaticUpdates);
this.pnlProxy.Controls.Add(this.chkUseProxyAuthentication);
this.pnlProxy.Controls.Add(this.pnlProxyAuthentication);
this.pnlProxy.Controls.Add(this.btnTestProxy);
this.pnlProxy.Location = new System.Drawing.Point(0, 200);
this.pnlProxy.Name = "pnlProxy";
this.pnlProxy.Size = new System.Drawing.Size(610, 224);
this.pnlProxy.TabIndex = 5;
//
//pnlProxyBasic
//
this.pnlProxyBasic.Controls.Add(this.lblProxyAddress);
this.pnlProxyBasic.Controls.Add(this.txtProxyAddress);
this.pnlProxyBasic.Controls.Add(this.lblProxyPort);
this.pnlProxyBasic.Controls.Add(this.numProxyPort);
this.pnlProxyBasic.Enabled = false;
this.pnlProxyBasic.Location = new System.Drawing.Point(3, 32);
this.pnlProxyBasic.Name = "pnlProxyBasic";
this.pnlProxyBasic.Size = new System.Drawing.Size(604, 40);
this.pnlProxyBasic.TabIndex = 1;
//
//lblProxyAddress
//
this.lblProxyAddress.Location = new System.Drawing.Point(8, 4);
this.lblProxyAddress.Name = "lblProxyAddress";
this.lblProxyAddress.Size = new System.Drawing.Size(96, 24);
this.lblProxyAddress.TabIndex = 0;
this.lblProxyAddress.Text = "Address:";
this.lblProxyAddress.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
//txtProxyAddress
//
this.txtProxyAddress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtProxyAddress.Location = new System.Drawing.Point(104, 8);
this.txtProxyAddress.Name = "txtProxyAddress";
this.txtProxyAddress.Size = new System.Drawing.Size(240, 20);
this.txtProxyAddress.TabIndex = 1;
//
//lblProxyPort
//
this.lblProxyPort.Location = new System.Drawing.Point(350, 5);
this.lblProxyPort.Name = "lblProxyPort";
this.lblProxyPort.Size = new System.Drawing.Size(64, 23);
this.lblProxyPort.TabIndex = 2;
this.lblProxyPort.Text = "Port:";
this.lblProxyPort.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
//numProxyPort
//
this.numProxyPort.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.numProxyPort.Location = new System.Drawing.Point(420, 8);
this.numProxyPort.Maximum = new decimal(new int[] {65535, 0, 0, 0});
this.numProxyPort.Minimum = new decimal(new int[] {1, 0, 0, 0});
this.numProxyPort.Name = "numProxyPort";
this.numProxyPort.Size = new System.Drawing.Size(64, 20);
this.numProxyPort.TabIndex = 3;
this.numProxyPort.Value = new decimal(new int[] {80, 0, 0, 0});
//
//chkUseProxyForAutomaticUpdates
//
this.chkUseProxyForAutomaticUpdates.AutoSize = true;
this.chkUseProxyForAutomaticUpdates.Location = new System.Drawing.Point(3, 8);
this.chkUseProxyForAutomaticUpdates.Name = "chkUseProxyForAutomaticUpdates";
this.chkUseProxyForAutomaticUpdates.Size = new System.Drawing.Size(168, 17);
this.chkUseProxyForAutomaticUpdates.TabIndex = 0;
this.chkUseProxyForAutomaticUpdates.Text = "Use a proxy server to connect";
this.chkUseProxyForAutomaticUpdates.UseVisualStyleBackColor = true;
//
//chkUseProxyAuthentication
//
this.chkUseProxyAuthentication.AutoSize = true;
this.chkUseProxyAuthentication.Enabled = false;
this.chkUseProxyAuthentication.Location = new System.Drawing.Point(27, 80);
this.chkUseProxyAuthentication.Name = "chkUseProxyAuthentication";
this.chkUseProxyAuthentication.Size = new System.Drawing.Size(216, 17);
this.chkUseProxyAuthentication.TabIndex = 2;
this.chkUseProxyAuthentication.Text = "This proxy server requires authentication";
this.chkUseProxyAuthentication.UseVisualStyleBackColor = true;
//
//pnlProxyAuthentication
//
this.pnlProxyAuthentication.Controls.Add(this.lblProxyUsername);
this.pnlProxyAuthentication.Controls.Add(this.txtProxyUsername);
this.pnlProxyAuthentication.Controls.Add(this.lblProxyPassword);
this.pnlProxyAuthentication.Controls.Add(this.txtProxyPassword);
this.pnlProxyAuthentication.Enabled = false;
this.pnlProxyAuthentication.Location = new System.Drawing.Point(3, 104);
this.pnlProxyAuthentication.Name = "pnlProxyAuthentication";
this.pnlProxyAuthentication.Size = new System.Drawing.Size(604, 72);
this.pnlProxyAuthentication.TabIndex = 3;
//
//lblProxyUsername
//
this.lblProxyUsername.Location = new System.Drawing.Point(8, 4);
this.lblProxyUsername.Name = "lblProxyUsername";
this.lblProxyUsername.Size = new System.Drawing.Size(96, 24);
this.lblProxyUsername.TabIndex = 0;
this.lblProxyUsername.Text = "Username:";
this.lblProxyUsername.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
//txtProxyUsername
//
this.txtProxyUsername.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtProxyUsername.Location = new System.Drawing.Point(104, 8);
this.txtProxyUsername.Name = "txtProxyUsername";
this.txtProxyUsername.Size = new System.Drawing.Size(240, 20);
this.txtProxyUsername.TabIndex = 1;
//
//lblProxyPassword
//
this.lblProxyPassword.Location = new System.Drawing.Point(8, 36);
this.lblProxyPassword.Name = "lblProxyPassword";
this.lblProxyPassword.Size = new System.Drawing.Size(96, 24);
this.lblProxyPassword.TabIndex = 2;
this.lblProxyPassword.Text = "Password:";
this.lblProxyPassword.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
//txtProxyPassword
//
this.txtProxyPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtProxyPassword.Location = new System.Drawing.Point(104, 40);
this.txtProxyPassword.Name = "txtProxyPassword";
this.txtProxyPassword.Size = new System.Drawing.Size(240, 20);
this.txtProxyPassword.TabIndex = 3;
this.txtProxyPassword.UseSystemPasswordChar = true;
//
//btnTestProxy
//
this.btnTestProxy.Location = new System.Drawing.Point(3, 184);
this.btnTestProxy.Name = "btnTestProxy";
this.btnTestProxy.Size = new System.Drawing.Size(120, 32);
this.btnTestProxy.TabIndex = 4;
this.btnTestProxy.Text = "Test Proxy";
this.btnTestProxy.UseVisualStyleBackColor = true;
//
//UpdatesPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lblUpdatesExplanation);
this.Controls.Add(this.pnlUpdateCheck);
this.Controls.Add(this.pnlProxy);
this.Name = "UpdatesPage";
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
this.Size = new System.Drawing.Size(610, 489);
this.pnlUpdateCheck.ResumeLayout(false);
this.pnlUpdateCheck.PerformLayout();
this.pnlProxy.ResumeLayout(false);
this.pnlProxy.PerformLayout();
this.pnlProxyBasic.ResumeLayout(false);
this.pnlProxyBasic.PerformLayout();
((System.ComponentModel.ISupportInitialize) this.numProxyPort).EndInit();
this.pnlProxyAuthentication.ResumeLayout(false);
this.pnlProxyAuthentication.PerformLayout();
this.ResumeLayout(false);
}
internal System.Windows.Forms.Label lblUpdatesExplanation;
internal System.Windows.Forms.Panel pnlUpdateCheck;
internal System.Windows.Forms.Button btnUpdateCheckNow;
internal System.Windows.Forms.CheckBox chkCheckForUpdatesOnStartup;
internal System.Windows.Forms.ComboBox cboUpdateCheckFrequency;
internal System.Windows.Forms.Panel pnlProxy;
internal System.Windows.Forms.Panel pnlProxyBasic;
internal System.Windows.Forms.Label lblProxyAddress;
internal System.Windows.Forms.TextBox txtProxyAddress;
internal System.Windows.Forms.Label lblProxyPort;
internal System.Windows.Forms.NumericUpDown numProxyPort;
internal System.Windows.Forms.CheckBox chkUseProxyForAutomaticUpdates;
internal System.Windows.Forms.CheckBox chkUseProxyAuthentication;
internal System.Windows.Forms.Panel pnlProxyAuthentication;
internal System.Windows.Forms.Label lblProxyUsername;
internal System.Windows.Forms.TextBox txtProxyUsername;
internal System.Windows.Forms.Label lblProxyPassword;
internal System.Windows.Forms.TextBox txtProxyPassword;
internal System.Windows.Forms.Button btnTestProxy;
}
}

View File

@@ -1,261 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.ComponentModel;
using mRemoteNG.My;
using mRemoteNG.App;
//using mRemoteNG.App.Info;
using mRemoteNG.Security;
using mRemoteNG.Tools;
using mRemoteNG.UI.Window;
using PSTaskDialog;
namespace mRemoteNG.Forms.OptionsPages
{
public partial class UpdatesPage
{
public UpdatesPage()
{
InitializeComponent();
}
#region Public Methods
public override string PageName
{
get
{
return Language.strTabUpdates;
}
set
{
}
}
public override void ApplyLanguage()
{
base.ApplyLanguage();
#if !PORTABLE
lblUpdatesExplanation.Text = Language.strUpdateCheck;
#else
lblUpdatesExplanation.Text = Language.strUpdateCheckPortableEdition;
#endif
chkCheckForUpdatesOnStartup.Text = Language.strCheckForUpdatesOnStartup;
btnUpdateCheckNow.Text = Language.strCheckNow;
chkUseProxyForAutomaticUpdates.Text = Language.strCheckboxUpdateUseProxy;
lblProxyAddress.Text = Language.strLabelAddress;
lblProxyPort.Text = Language.strLabelPort;
chkUseProxyAuthentication.Text = Language.strCheckboxProxyAuthentication;
lblProxyUsername.Text = Language.strLabelUsername;
lblProxyPassword.Text = Language.strLabelPassword;
btnTestProxy.Text = Language.strButtonTestProxy;
}
public override void LoadSettings()
{
base.SaveSettings();
chkCheckForUpdatesOnStartup.Checked = System.Convert.ToBoolean(My.Settings.Default.CheckForUpdatesOnStartup);
cboUpdateCheckFrequency.Enabled = chkCheckForUpdatesOnStartup.Checked;
cboUpdateCheckFrequency.Items.Clear();
int nDaily = cboUpdateCheckFrequency.Items.Add(Language.strUpdateFrequencyDaily);
int nWeekly = cboUpdateCheckFrequency.Items.Add(Language.strUpdateFrequencyWeekly);
int nMonthly = cboUpdateCheckFrequency.Items.Add(Language.strUpdateFrequencyMonthly);
if (My.Settings.Default.CheckForUpdatesFrequencyDays < 1)
{
chkCheckForUpdatesOnStartup.Checked = false;
cboUpdateCheckFrequency.SelectedIndex = nDaily;
} // Daily
else if ((int) My.Settings.Default.CheckForUpdatesFrequencyDays == 1)
{
cboUpdateCheckFrequency.SelectedIndex = nDaily;
} // Weekly
else if ((int) My.Settings.Default.CheckForUpdatesFrequencyDays == 7)
{
cboUpdateCheckFrequency.SelectedIndex = nWeekly;
} // Monthly
else if ((int) My.Settings.Default.CheckForUpdatesFrequencyDays == 31)
{
cboUpdateCheckFrequency.SelectedIndex = nMonthly;
}
else
{
int nCustom = cboUpdateCheckFrequency.Items.Add(string.Format(Language.strUpdateFrequencyCustom, My.Settings.Default.CheckForUpdatesFrequencyDays));
cboUpdateCheckFrequency.SelectedIndex = nCustom;
}
chkUseProxyForAutomaticUpdates.Checked = System.Convert.ToBoolean(My.Settings.Default.UpdateUseProxy);
pnlProxyBasic.Enabled = System.Convert.ToBoolean(My.Settings.Default.UpdateUseProxy);
txtProxyAddress.Text = System.Convert.ToString(My.Settings.Default.UpdateProxyAddress);
numProxyPort.Value = System.Convert.ToDecimal(My.Settings.Default.UpdateProxyPort);
chkUseProxyAuthentication.Checked = System.Convert.ToBoolean(My.Settings.Default.UpdateProxyUseAuthentication);
pnlProxyAuthentication.Enabled = System.Convert.ToBoolean(My.Settings.Default.UpdateProxyUseAuthentication);
txtProxyUsername.Text = System.Convert.ToString(My.Settings.Default.UpdateProxyAuthUser);
txtProxyPassword.Text = Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.UpdateProxyAuthPass), App.Info.General.EncryptionKey);
btnTestProxy.Enabled = System.Convert.ToBoolean(My.Settings.Default.UpdateUseProxy);
#if PORTABLE
foreach (Control Control in Controls)
{
if (Control != lblUpdatesExplanation)
{
Control.Visible = false;
}
}
#endif
}
public override void SaveSettings()
{
base.SaveSettings();
My.Settings.Default.CheckForUpdatesOnStartup = chkCheckForUpdatesOnStartup.Checked;
if (cboUpdateCheckFrequency.SelectedItem.ToString() == Language.strUpdateFrequencyDaily)
{
My.Settings.Default.CheckForUpdatesFrequencyDays = 1;
}
else if (cboUpdateCheckFrequency.SelectedItem.ToString() == Language.strUpdateFrequencyWeekly)
{
My.Settings.Default.CheckForUpdatesFrequencyDays = 7;
}
else if (cboUpdateCheckFrequency.SelectedItem.ToString() == Language.strUpdateFrequencyMonthly)
{
My.Settings.Default.CheckForUpdatesFrequencyDays = 31;
}
My.Settings.Default.UpdateUseProxy = chkUseProxyForAutomaticUpdates.Checked;
My.Settings.Default.UpdateProxyAddress = txtProxyAddress.Text;
My.Settings.Default.UpdateProxyPort = numProxyPort.Value;
My.Settings.Default.UpdateProxyUseAuthentication = chkUseProxyAuthentication.Checked;
My.Settings.Default.UpdateProxyAuthUser = txtProxyUsername.Text;
My.Settings.Default.UpdateProxyAuthPass = Crypt.Encrypt(txtProxyPassword.Text, App.Info.General.EncryptionKey);
}
#endregion
#region Private Fields
private App.Update _appUpdate;
#endregion
#region Private Methods
#region Event Handlers
public void chkCheckForUpdatesOnStartup_CheckedChanged(object sender, EventArgs e)
{
cboUpdateCheckFrequency.Enabled = chkCheckForUpdatesOnStartup.Checked;
}
public void btnUpdateCheckNow_Click(object sender, EventArgs e)
{
Runtime.Windows.Show(Type.Update);
}
public void chkUseProxyForAutomaticUpdates_CheckedChanged(object sender, EventArgs e)
{
pnlProxyBasic.Enabled = chkUseProxyForAutomaticUpdates.Checked;
btnTestProxy.Enabled = chkUseProxyForAutomaticUpdates.Checked;
if (chkUseProxyForAutomaticUpdates.Checked)
{
chkUseProxyAuthentication.Enabled = true;
if (chkUseProxyAuthentication.Checked)
{
pnlProxyAuthentication.Enabled = true;
}
}
else
{
chkUseProxyAuthentication.Enabled = false;
pnlProxyAuthentication.Enabled = false;
}
}
public void btnTestProxy_Click(object sender, EventArgs e)
{
if (_appUpdate != null)
{
if (_appUpdate.IsGetUpdateInfoRunning)
{
return ;
}
}
_appUpdate = new App.Update();
_appUpdate.Load += _appUpdate.Update_Load;
_appUpdate.SetProxySettings(chkUseProxyForAutomaticUpdates.Checked, txtProxyAddress.Text, (int) numProxyPort.Value, chkUseProxyAuthentication.Checked, txtProxyUsername.Text, txtProxyPassword.Text);
btnTestProxy.Enabled = false;
btnTestProxy.Text = Language.strOptionsProxyTesting;
_appUpdate.GetUpdateInfoCompletedEvent += GetUpdateInfoCompleted;
_appUpdate.GetUpdateInfoAsync();
}
public void chkUseProxyAuthentication_CheckedChanged(object sender, EventArgs e)
{
if (chkUseProxyForAutomaticUpdates.Checked)
{
if (chkUseProxyAuthentication.Checked)
{
pnlProxyAuthentication.Enabled = true;
}
else
{
pnlProxyAuthentication.Enabled = false;
}
}
}
#endregion
private void GetUpdateInfoCompleted(object sender, AsyncCompletedEventArgs e)
{
if (InvokeRequired)
{
AsyncCompletedEventHandler myDelegate = new AsyncCompletedEventHandler(GetUpdateInfoCompleted);
Invoke(myDelegate, new object[] {sender, e});
return ;
}
try
{
_appUpdate.GetUpdateInfoCompletedEvent -= GetUpdateInfoCompleted;
btnTestProxy.Enabled = true;
btnTestProxy.Text = Language.strButtonTestProxy;
if (e.Cancelled)
{
return ;
}
if (e.Error != null)
{
throw (e.Error);
}
cTaskDialog.ShowCommandBox(this, System.Convert.ToString(Application.Info.ProductName), Language.strProxyTestSucceeded, "", Language.strButtonOK, false);
}
catch (Exception ex)
{
cTaskDialog.ShowCommandBox(this, System.Convert.ToString(Application.Info.ProductName), Language.strProxyTestFailed, Misc.GetExceptionMessageRecursive(ex), "", "", "", Language.strButtonOK, false, eSysIcons.Error, (PSTaskDialog.eSysIcons) 0);
}
}
#endregion
}
}

View File

@@ -1,183 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Forms
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
partial class PasswordForm : System.Windows.Forms.Form
{
//Form overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.Container components = null;
//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()
{
this.lblPassword = new System.Windows.Forms.Label();
this.Load += new System.EventHandler(frmPassword_Load);
this.lblVerify = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
this.btnCancel = new System.Windows.Forms.Button();
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
this.lblStatus = new System.Windows.Forms.Label();
this.pbLock = new System.Windows.Forms.PictureBox();
this.txtVerify = new mRemoteNG.Controls.TextBox();
this.txtVerify.TextChanged += new System.EventHandler(this.txtPassword_TextChanged);
this.txtPassword = new mRemoteNG.Controls.TextBox();
this.txtPassword.TextChanged += new System.EventHandler(this.txtPassword_TextChanged);
((System.ComponentModel.ISupportInitialize) this.pbLock).BeginInit();
this.SuspendLayout();
//
//lblPassword
//
this.lblPassword.AutoSize = true;
this.lblPassword.Location = new System.Drawing.Point(82, 12);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(56, 13);
this.lblPassword.TabIndex = 1;
this.lblPassword.Text = "Password:";
//
//lblVerify
//
this.lblVerify.AutoSize = true;
this.lblVerify.Location = new System.Drawing.Point(82, 51);
this.lblVerify.Name = "lblVerify";
this.lblVerify.Size = new System.Drawing.Size(36, 13);
this.lblVerify.TabIndex = 3;
this.lblVerify.Text = "Verify:";
//
//btnOK
//
this.btnOK.Anchor = (System.Windows.Forms.AnchorStyles) (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
this.btnOK.Location = new System.Drawing.Point(291, 119);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 7;
this.btnOK.Text = global::mRemoteNG.My.Language.strButtonOK;
this.btnOK.UseVisualStyleBackColor = true;
//
//btnCancel
//
this.btnCancel.Anchor = (System.Windows.Forms.AnchorStyles) (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(210, 119);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = global::mRemoteNG.My.Language.strButtonCancel;
this.btnCancel.UseVisualStyleBackColor = true;
//
//lblStatus
//
this.lblStatus.Anchor = (System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.lblStatus.ForeColor = System.Drawing.Color.Red;
this.lblStatus.Location = new System.Drawing.Point(85, 90);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(281, 13);
this.lblStatus.TabIndex = 5;
this.lblStatus.Text = "Status";
this.lblStatus.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.lblStatus.Visible = false;
//
//pbLock
//
this.pbLock.Image = global::My.Resources.Resources.Lock;
this.pbLock.Location = new System.Drawing.Point(12, 12);
this.pbLock.Name = "pbLock";
this.pbLock.Size = new System.Drawing.Size(64, 64);
this.pbLock.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pbLock.TabIndex = 7;
this.pbLock.TabStop = false;
//
//txtVerify
//
this.txtVerify.Anchor = (System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.txtVerify.Location = new System.Drawing.Point(85, 67);
this.txtVerify.Name = "txtVerify";
this.txtVerify.SelectAllOnFocus = true;
this.txtVerify.Size = new System.Drawing.Size(281, 20);
this.txtVerify.TabIndex = 4;
this.txtVerify.UseSystemPasswordChar = true;
//
//txtPassword
//
this.txtPassword.Anchor = (System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.txtPassword.Location = new System.Drawing.Point(85, 28);
this.txtPassword.Name = "txtPassword";
this.txtPassword.SelectAllOnFocus = true;
this.txtPassword.Size = new System.Drawing.Size(281, 20);
this.txtPassword.TabIndex = 2;
this.txtPassword.UseSystemPasswordChar = true;
//
//frmPassword
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(378, 154);
this.ControlBox = false;
this.Controls.Add(this.pbLock);
this.Controls.Add(this.txtVerify);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.lblStatus);
this.Controls.Add(this.lblVerify);
this.Controls.Add(this.lblPassword);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "PasswordForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Password";
((System.ComponentModel.ISupportInitialize) this.pbLock).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
private Controls.TextBox txtPassword;
private Controls.TextBox txtVerify;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.Label lblVerify;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Label lblStatus;
private System.Windows.Forms.PictureBox pbLock;
}
}

View File

@@ -1,159 +0,0 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.My;
namespace mRemoteNG.Forms
{
public partial class PasswordForm
{
#region Public Properties
private bool _Verify = true;
public bool Verify
{
get
{
return _Verify;
}
set
{
_Verify = value;
}
}
public string Password
{
get
{
if (Verify)
{
return txtVerify.Text;
}
else
{
return txtPassword.Text;
}
}
}
#endregion
#region Constructors
public PasswordForm(string passwordName = null, bool verify = true)
{
// This call is required by the designer.
InitializeComponent();
// Add any initialization after the InitializeComponent() call.
_passwordName = passwordName;
this.Verify = verify;
}
#endregion
#region Event Handlers
public void frmPassword_Load(object sender, EventArgs e)
{
ApplyLanguage();
if (!Verify)
{
Height = Height - (txtVerify.Top - txtPassword.Top);
lblVerify.Visible = false;
txtVerify.Visible = false;
}
}
public void btnCancel_Click(System.Object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
public void btnOK_Click(System.Object sender, EventArgs e)
{
if (Verify)
{
if (VerifyPassword())
{
DialogResult = DialogResult.OK;
}
}
else
{
DialogResult = DialogResult.OK;
}
}
public void txtPassword_TextChanged(System.Object sender, EventArgs e)
{
HideStatus();
}
#endregion
#region Private Fields
private string _passwordName;
#endregion
#region Private Methods
private void ApplyLanguage()
{
if (string.IsNullOrEmpty(_passwordName))
{
Text = Language.strTitlePassword;
}
else
{
Text = string.Format(Language.strTitlePasswordWithName, _passwordName);
}
lblPassword.Text = Language.strLabelPassword;
lblVerify.Text = Language.strLabelVerify;
btnCancel.Text = Language.strButtonCancel;
btnOK.Text = Language.strButtonOK;
}
private bool VerifyPassword()
{
if (txtPassword.Text.Length >= 3)
{
if (txtPassword.Text == txtVerify.Text)
{
return true;
}
else
{
ShowStatus(Language.strPasswordStatusMustMatch);
return false;
}
}
else
{
ShowStatus(Language.strPasswordStatusTooShort);
return false;
}
}
private void ShowStatus(string status)
{
lblStatus.Visible = true;
lblStatus.Text = status;
}
private void HideStatus()
{
lblStatus.Visible = false;
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,7 +8,7 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.My;
@@ -17,28 +16,28 @@ namespace mRemoteNG.Messages
{
public class Collector
{
#region Constructors
#region Constructors
public Collector(UI.Window.ErrorsAndInfos MessageCollectorForm)
{
this._MCForm = MessageCollectorForm;
CreateTimer();
}
#endregion
#endregion
#region Private Properties
#region Private Properties
private Timer ECTimer;
private UI.Window.ErrorsAndInfos _MCForm;
#endregion
#endregion
#region Public Properties
#region Public Properties
public UI.Window.ErrorsAndInfos MCForm
{
get { return this._MCForm; }
set { this._MCForm = value; }
}
#endregion
#endregion
#region Public Methods
#region Public Methods
public void AddMessage(Messages.MessageClass MsgClass, string MsgText, bool OnlyLog = false)
{
Messages.Message nMsg = new Messages.Message();
@@ -46,10 +45,10 @@ namespace mRemoteNG.Messages
nMsg.MsgText = MsgText;
nMsg.MsgDate = DateTime.Now;
if (My.Settings.Default.SwitchToMCOnInformation && nMsg.MsgClass == Messages.MessageClass.InformationMsg)
if (Settings.Default.SwitchToMCOnInformation && nMsg.MsgClass == Messages.MessageClass.InformationMsg)
{
Debug.Print("Info: " + nMsg.MsgText);
if (My.Settings.Default.WriteLogFile)
if (Settings.Default.WriteLogFile)
{
App.Runtime.Log.Info(nMsg.MsgText);
}
@@ -59,7 +58,7 @@ namespace mRemoteNG.Messages
return;
}
if (My.Settings.Default.ShowNoMessageBoxes)
if (Settings.Default.ShowNoMessageBoxes)
{
ECTimer.Enabled = true;
}
@@ -69,10 +68,10 @@ namespace mRemoteNG.Messages
}
}
if (My.Settings.Default.SwitchToMCOnWarning && nMsg.MsgClass == Messages.MessageClass.WarningMsg)
if (Settings.Default.SwitchToMCOnWarning && nMsg.MsgClass == Messages.MessageClass.WarningMsg)
{
Debug.Print("Warning: " + nMsg.MsgText);
if (My.Settings.Default.WriteLogFile)
if (Settings.Default.WriteLogFile)
{
App.Runtime.Log.Warn(nMsg.MsgText);
}
@@ -82,7 +81,7 @@ namespace mRemoteNG.Messages
return;
}
if (My.Settings.Default.ShowNoMessageBoxes)
if (Settings.Default.ShowNoMessageBoxes)
{
ECTimer.Enabled = true;
}
@@ -92,7 +91,7 @@ namespace mRemoteNG.Messages
}
}
if (My.Settings.Default.SwitchToMCOnError && nMsg.MsgClass == Messages.MessageClass.ErrorMsg)
if (Settings.Default.SwitchToMCOnError && nMsg.MsgClass == Messages.MessageClass.ErrorMsg)
{
Debug.Print("Error: " + nMsg.MsgText);
@@ -104,7 +103,7 @@ namespace mRemoteNG.Messages
return;
}
if (My.Settings.Default.ShowNoMessageBoxes)
if (Settings.Default.ShowNoMessageBoxes)
{
ECTimer.Enabled = true;
}
@@ -118,7 +117,7 @@ namespace mRemoteNG.Messages
{
Debug.Print("Report: " + nMsg.MsgText);
if (My.Settings.Default.WriteLogFile)
if (Settings.Default.WriteLogFile)
{
App.Runtime.Log.Info(nMsg.MsgText);
}
@@ -140,7 +139,7 @@ namespace mRemoteNG.Messages
}
#endregion
#region Private Methods
#region Private Methods
private void CreateTimer()
{
ECTimer = new Timer();
@@ -157,7 +156,7 @@ namespace mRemoteNG.Messages
private void SwitchToMessage()
{
this._MCForm.PreviousActiveForm = frmMain.Default.pnlDock.ActiveContent;
this._MCForm.PreviousActiveForm = (WeifenLuo.WinFormsUI.Docking.DockContent)frmMain.Default.pnlDock.ActiveContent;
this.ShowMCForm();
this._MCForm.lvErrorCollector.Focus();
this._MCForm.lvErrorCollector.SelectedItems.Clear();
@@ -180,9 +179,9 @@ namespace mRemoteNG.Messages
break;
}
}
#endregion
#endregion
#region Delegates
#region Delegates
private delegate void ShowMCFormCB();
private void ShowMCForm()
{
@@ -210,6 +209,6 @@ namespace mRemoteNG.Messages
this._MCForm.lvErrorCollector.Items.Insert(0, lvItem);
}
}
#endregion
#endregion
}
}

View File

@@ -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.Messages
@@ -23,44 +21,44 @@ namespace mRemoteNG.Messages
}
public class Message
{
private MessageClass _MsgClass;
public MessageClass MsgClass
{
private MessageClass _MsgClass;
public MessageClass MsgClass
get
{
get
{
return _MsgClass;
}
set
{
_MsgClass = value;
}
return _MsgClass;
}
private string _MsgText;
public string MsgText
set
{
get
{
return _MsgText;
}
set
{
_MsgText = value;
}
}
private DateTime _MsgDate;
public DateTime MsgDate
{
get
{
return _MsgDate;
}
set
{
_MsgDate = value;
}
_MsgClass = value;
}
}
private string _MsgText;
public string MsgText
{
get
{
return _MsgText;
}
set
{
_MsgText = value;
}
}
private DateTime _MsgDate;
public DateTime MsgDate
{
get
{
return _MsgDate;
}
set
{
_MsgDate = value;
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="Settings" UseMySettingsClassName="true">
<Profiles />
<Settings>
<Setting Name="MainFormLocation" Provider="mRemoteNG.Config.Settings.Providers.ChooseProvider" Type="System.Drawing.Point" Scope="User">

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,11 +8,8 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.My;
using mRemoteNG.Tools;
//using mRemoteNG.Tools.LocalizedAttributes;
namespace mRemoteNG.Root.PuttySessions
@@ -25,7 +21,6 @@ namespace mRemoteNG.Root.PuttySessions
// VBConversions Note: Non-static class variable initialization is below. Class variables cannot be initially assigned non-static values in C#.
_name = Language.strPuttySavedSessionsRootName;
_panel = My.Language.strGeneral;
}
private string _name; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
@@ -47,7 +42,7 @@ namespace mRemoteNG.Root.PuttySessions
{
TreeNode.Text = value;
}
Settings.PuttySavedSessionsName = value;
My.Settings.Default.PuttySavedSessionsName = value;
}
}
@@ -68,7 +63,7 @@ namespace mRemoteNG.Root.PuttySessions
return ;
}
_panel = value;
Settings.PuttySavedSessionsPanel = value;
My.Settings.Default.PuttySavedSessionsPanel = value;
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,17 +8,16 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using mRemoteNG.Tools;
using System.ComponentModel;
//using mRemoteNG.Tools.LocalizedAttributes;
namespace mRemoteNG.Root
{
[DefaultProperty("Name")]public class Info
[DefaultProperty("Name")]
public class Info
{
#region Constructors
#region Constructors
public Info(RootType rootType)
{
// VBConversions Note: Non-static class variable initialization is below. Class variables cannot be initially assigned non-static values in C#.
@@ -27,9 +25,9 @@ namespace mRemoteNG.Root
Type = rootType;
}
#endregion
#endregion
#region Public Properties
#region Public Properties
private string _name; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1),
Browsable(true),
@@ -63,20 +61,23 @@ namespace mRemoteNG.Root
TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]
public bool Password { get; set; }
[Browsable(false)]public string PasswordString {get; set;}
[Browsable(false)]
public string PasswordString {get; set;}
[Browsable(false)]public RootType Type {get; set;}
[Browsable(false)]
public RootType Type {get; set;}
[Browsable(false)]public TreeNode TreeNode {get; set;}
#endregion
[Browsable(false)]
public TreeNode TreeNode {get; set;}
#endregion
#region Public Enumerations
#region Public Enumerations
public enum RootType
{
Connection,
Credential,
PuttySessions
}
#endregion
#endregion
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,74 +8,72 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
namespace mRemoteNG.Security
{
public class Save
{
public Save(bool DisableEverything = false)
{
public Save(bool DisableEverything = false)
if (DisableEverything == false)
{
if (DisableEverything == false)
{
_Username = true;
_Password = true;
_Domain = true;
_Inheritance = true;
}
}
private bool _Username;
public bool Username
{
get
{
return _Username;
}
set
{
_Username = value;
}
}
private bool _Password;
public bool Password
{
get
{
return _Password;
}
set
{
_Password = value;
}
}
private bool _Domain;
public bool Domain
{
get
{
return _Domain;
}
set
{
_Domain = value;
}
}
private bool _Inheritance;
public bool Inheritance
{
get
{
return _Inheritance;
}
set
{
_Inheritance = value;
}
_Username = true;
_Password = true;
_Domain = true;
_Inheritance = true;
}
}
private bool _Username;
public bool Username
{
get
{
return _Username;
}
set
{
_Username = value;
}
}
private bool _Password;
public bool Password
{
get
{
return _Password;
}
set
{
_Password = value;
}
}
private bool _Domain;
public bool Domain
{
get
{
return _Domain;
}
set
{
_Domain = value;
}
}
private bool _Inheritance;
public bool Inheritance
{
get
{
return _Inheritance;
}
set
{
_Inheritance = value;
}
}
}
}

28
mRemoteV1/CS/Settings.cs Normal file
View File

@@ -0,0 +1,28 @@
namespace mRemoteNG.My {
// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {
public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,10 +8,7 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.ComponentModel;
//using mRemoteNG.Tools.LocalizedAttributes;
using mRemoteNG.My;
using mRemoteNG.Tools;
@@ -21,7 +17,7 @@ namespace mRemoteNG.Themes
{
public class ThemeInfo : ICloneable, INotifyPropertyChanged
{
#region Public Methods
#region Public Methods
public ThemeInfo(string themeName = null)
{
// VBConversions Note: Non-static class variable initialization is below. Class variables cannot be initially assigned non-static values in C#.
@@ -66,9 +62,9 @@ namespace mRemoteNG.Themes
return true;
}
#endregion
#endregion
#region Events
#region Events
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(string propertyName)
{
@@ -76,9 +72,9 @@ namespace mRemoteNG.Themes
(PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
#endregion
#region Properties
#region Properties
private string _name; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
[Browsable(false)]
public string Name
@@ -98,7 +94,7 @@ namespace mRemoteNG.Themes
}
}
#region General
#region General
private Color _windowBackgroundColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
[LocalizedAttributes.LocalizedCategory("strThemeCategoryGeneral", 1),
LocalizedAttributes.LocalizedDisplayName("strThemeNameWindowBackgroundColor"),
@@ -204,9 +200,9 @@ namespace mRemoteNG.Themes
NotifyPropertyChanged("ToolbarTextColor");
}
}
#endregion
#endregion
#region Connections Panel
#region Connections Panel
private Color _connectionsPanelBackgroundColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
[LocalizedAttributes.LocalizedCategory("strThemeCategoryConnectionsPanel", 2),
LocalizedAttributes.LocalizedDisplayName("strThemeNameConnectionsPanelBackgroundColor"),
@@ -332,9 +328,9 @@ namespace mRemoteNG.Themes
NotifyPropertyChanged("SearchBoxTextColor");
}
}
#endregion
#endregion
#region Config Panel
#region Config Panel
private Color _configPanelBackgroundColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
[LocalizedAttributes.LocalizedCategory("strThemeCategoryConfigPanel", 3),
LocalizedAttributes.LocalizedDisplayName("strThemeNameConfigPanelBackgroundColor"),
@@ -460,7 +456,7 @@ namespace mRemoteNG.Themes
NotifyPropertyChanged("ConfigPanelGridLineColor");
}
}
#endregion
#endregion
#endregion
#endregion
}
}
}

View File

@@ -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.IO;
using System.ComponentModel;
using mRemoteNG.My;
@@ -19,145 +16,145 @@ using mRemoteNG.My;
namespace mRemoteNG.Themes
{
public class ThemeManager
{
#region Public Methods
public static ThemeInfo LoadTheme(string themeName, bool setActive = true)
{
#region Public Methods
public static ThemeInfo LoadTheme(string themeName, bool setActive = true)
{
ThemeInfo loadedTheme = DefaultTheme;
ThemeInfo loadedTheme = DefaultTheme;
if (!string.IsNullOrEmpty(themeName))
if (!string.IsNullOrEmpty(themeName))
{
foreach (ThemeInfo theme in LoadThemes())
{
foreach (ThemeInfo theme in LoadThemes())
if (theme.Name == themeName)
{
if (theme.Name == themeName)
{
loadedTheme = theme;
break;
}
loadedTheme = theme;
break;
}
}
}
if (setActive)
{
ActiveTheme = loadedTheme;
}
return loadedTheme;
}
public static List<ThemeInfo> LoadThemes()
if (setActive)
{
List<ThemeInfo> themes = new List<ThemeInfo>();
themes.Add(DefaultTheme);
try
{
themes.AddRange(ThemeSerializer.LoadFromXmlFile(Path.Combine(App.Info.Settings.SettingsPath, App.Info.Settings.ThemesFileName)));
}
catch (FileNotFoundException)
{
}
return themes;
ActiveTheme = loadedTheme;
}
public static void SaveThemes(List<ThemeInfo> themes)
{
themes.Remove(DefaultTheme);
ThemeSerializer.SaveToXmlFile(themes, Path.Combine(App.Info.Settings.SettingsPath, App.Info.Settings.ThemesFileName));
}
public static void SaveThemes(ThemeInfo[] themes)
{
SaveThemes(new List<ThemeInfo>(themes));
}
public static void SaveThemes(BindingList<ThemeInfo> themes)
{
ThemeInfo[] themesArray = new ThemeInfo[themes.Count - 1 + 1];
themes.CopyTo(themesArray, 0);
SaveThemes(themesArray);
}
#endregion
#region Events
public delegate void ThemeChangedEventHandler();
private static ThemeChangedEventHandler ThemeChangedEvent;
public static event ThemeChangedEventHandler ThemeChanged
{
add
{
ThemeChangedEvent = (ThemeChangedEventHandler) System.Delegate.Combine(ThemeChangedEvent, value);
}
remove
{
ThemeChangedEvent = (ThemeChangedEventHandler) System.Delegate.Remove(ThemeChangedEvent, value);
}
}
protected static void NotifyThemeChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "Name")
{
return ;
}
if (ThemeChangedEvent != null)
ThemeChangedEvent();
}
#endregion
#region Properties
// ReSharper disable InconsistentNaming
private static readonly ThemeInfo _defaultTheme = new ThemeInfo(Language.strDefaultTheme);
// ReSharper restore InconsistentNaming
public static ThemeInfo DefaultTheme
{
get
{
return _defaultTheme;
}
}
private static ThemeInfo _activeTheme;
private static bool _activeThemeHandlerSet = false;
public static ThemeInfo ActiveTheme
{
get
{
if (_activeTheme == null)
{
return DefaultTheme;
}
return _activeTheme;
}
set
{
// We need to set ActiveTheme to the new theme to make sure it references the right object.
// However, if both themes have the same properties, we don't need to raise a notification event.
bool needNotify = true;
if (_activeTheme != null)
{
if (_activeTheme.Equals(value))
{
needNotify = false;
}
}
if (_activeThemeHandlerSet)
{
_activeTheme.PropertyChanged -= NotifyThemeChanged;
}
_activeTheme = value;
_activeTheme.PropertyChanged += NotifyThemeChanged;
_activeThemeHandlerSet = true;
if (needNotify)
{
NotifyThemeChanged(_activeTheme, new PropertyChangedEventArgs(""));
}
}
}
#endregion
return loadedTheme;
}
public static List<ThemeInfo> LoadThemes()
{
List<ThemeInfo> themes = new List<ThemeInfo>();
themes.Add(DefaultTheme);
try
{
themes.AddRange(ThemeSerializer.LoadFromXmlFile(Path.Combine(App.Info.Settings.SettingsPath, App.Info.Settings.ThemesFileName)));
}
catch (FileNotFoundException)
{
}
return themes;
}
public static void SaveThemes(List<ThemeInfo> themes)
{
themes.Remove(DefaultTheme);
ThemeSerializer.SaveToXmlFile(themes, Path.Combine(App.Info.Settings.SettingsPath, App.Info.Settings.ThemesFileName));
}
public static void SaveThemes(ThemeInfo[] themes)
{
SaveThemes(new List<ThemeInfo>(themes));
}
public static void SaveThemes(BindingList<ThemeInfo> themes)
{
ThemeInfo[] themesArray = new ThemeInfo[themes.Count - 1 + 1];
themes.CopyTo(themesArray, 0);
SaveThemes(themesArray);
}
#endregion
#region Events
public delegate void ThemeChangedEventHandler();
private static ThemeChangedEventHandler ThemeChangedEvent;
public static event ThemeChangedEventHandler ThemeChanged
{
add
{
ThemeChangedEvent = (ThemeChangedEventHandler) System.Delegate.Combine(ThemeChangedEvent, value);
}
remove
{
ThemeChangedEvent = (ThemeChangedEventHandler) System.Delegate.Remove(ThemeChangedEvent, value);
}
}
protected static void NotifyThemeChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "Name")
{
return ;
}
if (ThemeChangedEvent != null)
ThemeChangedEvent();
}
#endregion
#region Properties
// ReSharper disable InconsistentNaming
private static readonly ThemeInfo _defaultTheme = new ThemeInfo(Language.strDefaultTheme);
// ReSharper restore InconsistentNaming
public static ThemeInfo DefaultTheme
{
get
{
return _defaultTheme;
}
}
private static ThemeInfo _activeTheme;
private static bool _activeThemeHandlerSet = false;
public static ThemeInfo ActiveTheme
{
get
{
if (_activeTheme == null)
{
return DefaultTheme;
}
return _activeTheme;
}
set
{
// We need to set ActiveTheme to the new theme to make sure it references the right object.
// However, if both themes have the same properties, we don't need to raise a notification event.
bool needNotify = true;
if (_activeTheme != null)
{
if (_activeTheme.Equals(value))
{
needNotify = false;
}
}
if (_activeThemeHandlerSet)
{
_activeTheme.PropertyChanged -= NotifyThemeChanged;
}
_activeTheme = value;
_activeTheme.PropertyChanged += NotifyThemeChanged;
_activeThemeHandlerSet = true;
if (needNotify)
{
NotifyThemeChanged(_activeTheme, new PropertyChangedEventArgs(""));
}
}
}
#endregion
}
}

View File

@@ -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.IO;
using System.Xml;
using System.Reflection;
@@ -19,141 +16,141 @@ using System.Reflection;
namespace mRemoteNG.Themes
{
public class ThemeSerializer
{
public static void SaveToXmlFile(ThemeInfo themeInfo, string filename)
{
public static void SaveToXmlFile(ThemeInfo themeInfo, string filename)
{
List<ThemeInfo> themeList = new List<ThemeInfo>();
themeList.Add(themeInfo);
SaveToXmlFile(themeList, filename);
}
List<ThemeInfo> themeList = new List<ThemeInfo>();
themeList.Add(themeInfo);
SaveToXmlFile(themeList, filename);
}
public static void SaveToXmlFile(List<ThemeInfo> themes, string filename)
public static void SaveToXmlFile(List<ThemeInfo> themes, string filename)
{
string tempFileName = Path.GetTempFileName();
XmlTextWriter xmlTextWriter = new XmlTextWriter(tempFileName, System.Text.Encoding.UTF8);
xmlTextWriter.Formatting = Formatting.Indented;
xmlTextWriter.Indentation = 4;
xmlTextWriter.WriteStartDocument();
xmlTextWriter.WriteStartElement("mRemoteNG");
xmlTextWriter.WriteStartElement("FileInfo");
xmlTextWriter.WriteAttributeString("Version", "1.0");
xmlTextWriter.WriteElementString("FileType", "Theme");
xmlTextWriter.WriteElementString("FileTypeVersion", "1.0");
xmlTextWriter.WriteEndElement(); // FileInfo
Type themeType = (new ThemeInfo()).GetType();
Type colorType = (new Color()).GetType();
Color color = new Color();
foreach (ThemeInfo themeInfo in themes)
{
string tempFileName = Path.GetTempFileName();
XmlTextWriter xmlTextWriter = new XmlTextWriter(tempFileName, System.Text.Encoding.UTF8);
xmlTextWriter.Formatting = Formatting.Indented;
xmlTextWriter.Indentation = 4;
xmlTextWriter.WriteStartDocument();
xmlTextWriter.WriteStartElement("mRemoteNG");
xmlTextWriter.WriteStartElement("FileInfo");
xmlTextWriter.WriteAttributeString("Version", "1.0");
xmlTextWriter.WriteElementString("FileType", "Theme");
xmlTextWriter.WriteElementString("FileTypeVersion", "1.0");
xmlTextWriter.WriteEndElement(); // FileInfo
Type themeType = (new ThemeInfo()).GetType();
Type colorType = (new Color()).GetType();
Color color = new Color();
foreach (ThemeInfo themeInfo in themes)
{
xmlTextWriter.WriteStartElement("Theme");
xmlTextWriter.WriteAttributeString("Name", themeInfo.Name);
xmlTextWriter.WriteStartElement("Theme");
xmlTextWriter.WriteAttributeString("Name", themeInfo.Name);
foreach (PropertyInfo propertyInfo in themeType.GetProperties())
foreach (PropertyInfo propertyInfo in themeType.GetProperties())
{
if (!(propertyInfo.PropertyType == colorType))
{
if (!(propertyInfo.PropertyType == colorType))
{
continue;
}
color = propertyInfo.GetValue(themeInfo, null);
xmlTextWriter.WriteStartElement("Color");
xmlTextWriter.WriteAttributeString("Name", propertyInfo.Name);
xmlTextWriter.WriteAttributeString("Value", EncodeColorName(color));
xmlTextWriter.WriteEndElement(); // Color
continue;
}
color = (Color)propertyInfo.GetValue(themeInfo, null);
xmlTextWriter.WriteStartElement("Color");
xmlTextWriter.WriteAttributeString("Name", propertyInfo.Name);
xmlTextWriter.WriteAttributeString("Value", EncodeColorName(color));
xmlTextWriter.WriteEndElement(); // Color
}
xmlTextWriter.WriteEndElement(); // Theme
}
xmlTextWriter.WriteEndElement(); // mRemoteNG
xmlTextWriter.Close();
File.Delete(filename);
File.Move(tempFileName, filename);
xmlTextWriter.WriteEndElement(); // Theme
}
xmlTextWriter.WriteEndElement(); // mRemoteNG
xmlTextWriter.Close();
File.Delete(filename);
File.Move(tempFileName, filename);
}
public static List<ThemeInfo> LoadFromXmlFile(string filename)
public static List<ThemeInfo> LoadFromXmlFile(string filename)
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(filename);
XmlNode fileInfoNode = xmlDocument.SelectSingleNode("/mRemoteNG/FileInfo");
Version fileInfoVersion = new Version(fileInfoNode.Attributes["Version"].Value);
if (fileInfoVersion > new Version(1, 0))
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(filename);
throw (new FileFormatException(string.Format("Unsupported FileInfo version ({0}).", fileInfoVersion)));
}
XmlNode fileInfoNode = xmlDocument.SelectSingleNode("/mRemoteNG/FileInfo");
Version fileInfoVersion = new Version(fileInfoNode.Attributes["Version"].Value);
if (fileInfoVersion > new Version(1, 0))
{
throw (new FileFormatException(string.Format("Unsupported FileInfo version ({0}).", fileInfoVersion)));
}
XmlNode fileTypeNode = fileInfoNode.SelectSingleNode("./FileType");
string fileType = fileTypeNode.InnerText;
if (!(fileType == "Theme"))
{
throw (new FileFormatException(string.Format("Incorrect FileType ({0}). Expected \"Theme\".", fileType)));
}
XmlNode fileTypeNode = fileInfoNode.SelectSingleNode("./FileType");
string fileType = fileTypeNode.InnerText;
if (!(fileType == "Theme"))
{
throw (new FileFormatException(string.Format("Incorrect FileType ({0}). Expected \"Theme\".", fileType)));
}
Version fileTypeVersion = new Version(fileInfoNode.SelectSingleNode("./FileTypeVersion").InnerText);
if (fileTypeVersion > new Version(1, 0))
{
throw (new FileFormatException(string.Format("Unsupported FileTypeVersion ({0}).", fileTypeVersion)));
}
Version fileTypeVersion = new Version(fileInfoNode.SelectSingleNode("./FileTypeVersion").InnerText);
if (fileTypeVersion > new Version(1, 0))
XmlNodeList themeNodes = xmlDocument.SelectNodes("/mRemoteNG/Theme");
List<ThemeInfo> themes = new List<ThemeInfo>();
ThemeInfo themeInfo = default(ThemeInfo);
Type themeType = (new ThemeInfo()).GetType();
Type colorType = (new Color()).GetType();
string colorName = "";
string colorValue = "";
PropertyInfo propertyInfo = default(PropertyInfo);
foreach (XmlNode themeNode in themeNodes)
{
themeInfo = new ThemeInfo();
themeInfo.Name = themeNode.Attributes["Name"].Value;
foreach (XmlNode colorNode in themeNode.SelectNodes("./Color"))
{
throw (new FileFormatException(string.Format("Unsupported FileTypeVersion ({0}).", fileTypeVersion)));
}
XmlNodeList themeNodes = xmlDocument.SelectNodes("/mRemoteNG/Theme");
List<ThemeInfo> themes = new List<ThemeInfo>();
ThemeInfo themeInfo = default(ThemeInfo);
Type themeType = (new ThemeInfo()).GetType();
Type colorType = (new Color()).GetType();
string colorName = "";
string colorValue = "";
PropertyInfo propertyInfo = default(PropertyInfo);
foreach (XmlNode themeNode in themeNodes)
{
themeInfo = new ThemeInfo();
themeInfo.Name = themeNode.Attributes["Name"].Value;
foreach (XmlNode colorNode in themeNode.SelectNodes("./Color"))
colorName = colorNode.Attributes["Name"].Value;
colorValue = colorNode.Attributes["Value"].Value;
propertyInfo = themeType.GetProperty(colorName);
if (propertyInfo == null || !(propertyInfo.PropertyType == colorType))
{
colorName = colorNode.Attributes["Name"].Value;
colorValue = colorNode.Attributes["Value"].Value;
propertyInfo = themeType.GetProperty(colorName);
if (propertyInfo == null || !(propertyInfo.PropertyType == colorType))
{
continue;
}
propertyInfo.SetValue(themeInfo, DecodeColorName(colorValue), null);
continue;
}
themes.Add(themeInfo);
propertyInfo.SetValue(themeInfo, DecodeColorName(colorValue), null);
}
themes.Add(themeInfo);
}
return themes;
}
return themes;
}
private static string EncodeColorName(Color color)
private static string EncodeColorName(Color color)
{
if (color.IsNamedColor)
{
if (color.IsNamedColor)
{
return color.Name;
}
else
{
return Conversion.Hex(color.ToArgb()).PadLeft(8, '0');
}
return color.Name;
}
private static Color DecodeColorName(string name)
else
{
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("^[0-9a-fA-F]{8}$");
if (regex.Match(name).Success)
{
return Color.FromArgb(Convert.ToInt32(name, 16));
}
else
{
return Color.FromName(name);
}
return Conversion.Hex(color.ToArgb()).PadLeft(8, '0');
}
}
private static Color DecodeColorName(string name)
{
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("^[0-9a-fA-F]{8}$");
if (regex.Match(name).Success)
{
return Color.FromArgb(Convert.ToInt32(name, 16));
}
else
{
return Color.FromName(name);
}
}
}
}

View File

@@ -68,13 +68,13 @@ namespace mRemoteNG.Tools
Marshal.StructureToPtr(trustFileInfo, trustFileInfoPointer, false);
Win32.WINTRUST_DATA trustData = new Win32.WINTRUST_DATA();
trustData.dwUIChoice = Display;
trustData.dwUIChoice = (uint)Display;
trustData.fdwRevocationChecks = Win32.WTD_REVOKE_WHOLECHAIN;
trustData.dwUnionChoice = Win32.WTD_CHOICE_FILE;
trustData.pFile = trustFileInfoPointer;
trustData.dwStateAction = Win32.WTD_STATEACTION_IGNORE;
trustData.dwProvFlags = Win32.WTD_DISABLE_MD2_MD4;
trustData.dwUIContext = DisplayContext;
trustData.dwUIContext = (uint)DisplayContext;
trustDataPointer = Marshal.AllocCoTaskMem(Marshal.SizeOf(trustData));
Marshal.StructureToPtr(trustData, trustDataPointer, false);

View File

@@ -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.Text.RegularExpressions;
@@ -18,141 +15,141 @@ namespace mRemoteNG.Tools
{
// Adapted from http://qntm.org/cmd
public class CommandLineArguments
{
#region Protected Fields
protected List<Argument> Arguments = new List<Argument>();
#endregion
#region Public Properties
public bool EscapeForShell {get; set;}
#endregion
#region Public Methods
public void Add(string argument, bool forceQuotes = false)
{
#region Protected Fields
protected List<Argument> Arguments = new List<Argument>();
#endregion
Arguments.Add(new Argument(argument, false, forceQuotes));
}
#region Public Properties
public bool EscapeForShell {get; set;}
#endregion
#region Public Methods
public void Add(string argument, bool forceQuotes = false)
public void Add(params string[] argumentArray)
{
foreach (string argument in argumentArray)
{
Arguments.Add(new argument(argument, false, forceQuotes));
Add(argument);
}
}
public void Add(params string[] argumentArray)
public void AddFileName(string fileName, bool forceQuotes = false)
{
Arguments.Add(new Argument(fileName, true, forceQuotes));
}
public override string ToString()
{
List<string> processedArguments = new List<string>();
foreach (Argument argument in Arguments)
{
foreach (string argument in argumentArray)
{
Add(argument);
}
processedArguments.Add(ProcessArgument(argument, EscapeForShell));
}
return string.Join(" ", processedArguments.ToArray());
}
public void AddFileName(string fileName, bool forceQuotes = false)
public static string PrefixFileName(string argument)
{
if (string.IsNullOrEmpty(argument))
{
Arguments.Add(new Argument(fileName, true, forceQuotes));
}
public override string ToString()
{
List<string> processedArguments = new List<string>();
foreach (Argument argument in Arguments)
{
processedArguments.Add(ProcessArgument(argument, EscapeForShell));
}
return string.Join(" ", processedArguments.ToArray());
}
public static string PrefixFileName(string argument)
{
if (string.IsNullOrEmpty(argument))
{
return argument;
}
if (argument.StartsWith("-"))
{
argument = ".\\" + argument;
}
return argument;
}
public static string EscapeBackslashes(string argument)
if (argument.StartsWith("-"))
{
if (string.IsNullOrEmpty(argument))
{
return argument;
}
// Sequence of backslashes followed by a double quote:
// double up all the backslashes and escape the double quote
return Regex.Replace(argument, "(\\\\*)\"", "$1$1\\\"");
argument = ".\\" + argument;
}
public static string EscapeBackslashesForTrailingQuote(string argument)
{
if (string.IsNullOrEmpty(argument))
{
return argument;
}
// Sequence of backslashes followed by the end of the string
// (which will become a double quote):
// double up all the backslashes
return Regex.Replace(argument, "(\\\\*)$", "$1$1");
}
public static string QuoteArgument(string argument, bool forceQuotes = false)
{
if (!forceQuotes && !string.IsNullOrEmpty(argument) && !argument.Contains(" "))
{
return argument;
}
return "\"" + EscapeBackslashesForTrailingQuote(argument) + "\"";
}
public static string EscapeShellMetacharacters(string argument)
{
if (string.IsNullOrEmpty(argument))
{
return argument;
}
return Regex.Replace(argument, "([()%!^\"<>&|])", "^$1");
}
#endregion
#region Protected Methods
protected static string ProcessArgument(Argument argument, bool escapeForShell = false)
{
string text = argument.Text;
if (argument.IsFileName)
{
text = PrefixFileName(text);
}
text = EscapeBackslashes(text);
text = QuoteArgument(text, argument.ForceQuotes);
if (escapeForShell)
{
text = EscapeShellMetacharacters(text);
}
return text;
}
#endregion
#region Protected Classes
protected class Argument
{
public Argument(string text, bool isFileName = false, bool forceQuotes = false)
{
this.Text = text;
this.IsFileName = isFileName;
this.ForceQuotes = forceQuotes;
}
public string Text {get; set;}
public bool IsFileName {get; set;}
public bool ForceQuotes {get; set;}
}
#endregion
return argument;
}
public static string EscapeBackslashes(string argument)
{
if (string.IsNullOrEmpty(argument))
{
return argument;
}
// Sequence of backslashes followed by a double quote:
// double up all the backslashes and escape the double quote
return Regex.Replace(argument, "(\\\\*)\"", "$1$1\\\"");
}
public static string EscapeBackslashesForTrailingQuote(string argument)
{
if (string.IsNullOrEmpty(argument))
{
return argument;
}
// Sequence of backslashes followed by the end of the string
// (which will become a double quote):
// double up all the backslashes
return Regex.Replace(argument, "(\\\\*)$", "$1$1");
}
public static string QuoteArgument(string argument, bool forceQuotes = false)
{
if (!forceQuotes && !string.IsNullOrEmpty(argument) && !argument.Contains(" "))
{
return argument;
}
return "\"" + EscapeBackslashesForTrailingQuote(argument) + "\"";
}
public static string EscapeShellMetacharacters(string argument)
{
if (string.IsNullOrEmpty(argument))
{
return argument;
}
return Regex.Replace(argument, "([()%!^\"<>&|])", "^$1");
}
#endregion
#region Protected Methods
protected static string ProcessArgument(Argument argument, bool escapeForShell = false)
{
string text = argument.Text;
if (argument.IsFileName)
{
text = PrefixFileName(text);
}
text = EscapeBackslashes(text);
text = QuoteArgument(text, argument.ForceQuotes);
if (escapeForShell)
{
text = EscapeShellMetacharacters(text);
}
return text;
}
#endregion
#region Protected Classes
protected class Argument
{
public Argument(string text, bool isFileName = false, bool forceQuotes = false)
{
this.Text = text;
this.IsFileName = isFileName;
this.ForceQuotes = forceQuotes;
}
public string Text {get; set;}
public bool IsFileName {get; set;}
public bool ForceQuotes {get; set;}
}
#endregion
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,55 +8,53 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.Runtime.InteropServices;
namespace mRemoteNG.Tools
{
public class EnumWindows
{
public static List<IntPtr> EnumWindows_Renamed()
{
public static List<IntPtr> EnumWindows_Renamed()
{
List<IntPtr> handleList = new List<IntPtr>();
List<IntPtr> handleList = new List<IntPtr>();
HandleLists.Add(handleList);
int handleIndex = HandleLists.IndexOf(handleList);
Win32.EnumWindows(EnumCallback, handleIndex);
HandleLists.Remove(handleList);
HandleLists.Add(handleList);
int handleIndex = HandleLists.IndexOf(handleList);
Win32.EnumWindows(EnumCallback, handleIndex);
HandleLists.Remove(handleList);
return handleList;
}
public static List<IntPtr> EnumChildWindows(IntPtr hWndParent)
{
List<IntPtr> handleList = new List<IntPtr>();
HandleLists.Add(handleList);
int handleIndex = HandleLists.IndexOf(handleList);
Win32.EnumChildWindows(hWndParent, EnumCallback, handleIndex);
HandleLists.Remove(handleList);
return handleList;
}
private static readonly List<List<IntPtr>> HandleLists = new List<List<IntPtr>>();
private static bool EnumCallback(int hwnd, int lParam)
{
HandleLists[lParam].Add(hwnd);
return true;
}
// ReSharper disable ClassNeverInstantiated.Local
private class Win32
{
// ReSharper restore ClassNeverInstantiated.Local
public delegate bool EnumWindowsProc(int hwnd, int lParam);
[DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, int lParam);
[DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
public static extern bool EnumChildWindows(IntPtr hWndParent, EnumWindowsProc lpEnumFunc, int lParam);
}
return handleList;
}
public static List<IntPtr> EnumChildWindows(IntPtr hWndParent)
{
List<IntPtr> handleList = new List<IntPtr>();
HandleLists.Add(handleList);
int handleIndex = HandleLists.IndexOf(handleList);
Win32.EnumChildWindows(hWndParent, EnumCallback, handleIndex);
HandleLists.Remove(handleList);
return handleList;
}
private static readonly List<List<IntPtr>> HandleLists = new List<List<IntPtr>>();
private static bool EnumCallback(int hwnd, int lParam)
{
HandleLists[lParam].Add((IntPtr)hwnd);
return true;
}
// ReSharper disable ClassNeverInstantiated.Local
private class Win32
{
// ReSharper restore ClassNeverInstantiated.Local
public delegate bool EnumWindowsProc(int hwnd, int lParam);
[DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, int lParam);
[DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
public static extern bool EnumChildWindows(IntPtr hWndParent, EnumWindowsProc lpEnumFunc, int lParam);
}
}
}

View File

@@ -1,4 +1,3 @@
// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using AxWFICALib;
@@ -9,62 +8,62 @@ using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
// End of VB project level imports
using System.Runtime.InteropServices;
namespace mRemoteNG.Tools
{
public class EnvironmentInfo
{
public static bool IsWow64
{
public static bool IsWow64
get
{
get
Win32.IsWow64ProcessDelegate isWow64ProcessDelegate = GetIsWow64ProcessDelegate();
if (isWow64ProcessDelegate == null)
{
Win32.IsWow64ProcessDelegate isWow64ProcessDelegate = GetIsWow64ProcessDelegate();
if (isWow64ProcessDelegate == null)
{
return false;
}
return false;
}
bool isWow64Process = false;
bool result = System.Convert.ToBoolean(isWow64ProcessDelegate.Invoke(Process.GetCurrentProcess().Handle, isWow64Process));
if (!result)
{
return false;
}
bool isWow64Process = false;
bool result = System.Convert.ToBoolean(isWow64ProcessDelegate.Invoke(Process.GetCurrentProcess().Handle, ref isWow64Process));
if (!result)
{
return false;
}
return isWow64Process;
}
}
private static Win32.IsWow64ProcessDelegate GetIsWow64ProcessDelegate()
{
IntPtr moduleHandle = Win32.LoadLibrary("kernel32");
if (moduleHandle == IntPtr.Zero)
{
return null;
}
IntPtr functionPointer = Win32.GetProcAddress(moduleHandle, "IsWow64Process");
if (functionPointer == IntPtr.Zero)
{
return null;
}
return Marshal.GetDelegateForFunctionPointer(functionPointer, typeof(Win32.IsWow64ProcessDelegate));
}
protected class Win32
{
// ReSharper disable InconsistentNaming
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]public static extern IntPtr LoadLibrary([In(), MarshalAs(UnmanagedType.LPTStr)]string lpFileName);
[DllImport("kernel32", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]public static extern IntPtr GetProcAddress([In()]IntPtr hModule, [In(), MarshalAs(UnmanagedType.LPStr)]string lpProcName);
public delegate bool IsWow64ProcessDelegate([In()]IntPtr hProcess, ref bool Wow64Process);
// ReSharper restore InconsistentNaming
return isWow64Process;
}
}
private static Win32.IsWow64ProcessDelegate GetIsWow64ProcessDelegate()
{
IntPtr moduleHandle = Win32.LoadLibrary("kernel32");
if (moduleHandle == IntPtr.Zero)
{
return null;
}
IntPtr functionPointer = Win32.GetProcAddress(moduleHandle, "IsWow64Process");
if (functionPointer == IntPtr.Zero)
{
return null;
}
return (Win32.IsWow64ProcessDelegate)Marshal.GetDelegateForFunctionPointer(functionPointer, typeof(Win32.IsWow64ProcessDelegate));
}
protected class Win32
{
// ReSharper disable InconsistentNaming
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr LoadLibrary([In(), MarshalAs(UnmanagedType.LPTStr)]string lpFileName);
[DllImport("kernel32", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr GetProcAddress([In()]IntPtr hModule, [In(), MarshalAs(UnmanagedType.LPStr)]string lpProcName);
public delegate bool IsWow64ProcessDelegate([In()]IntPtr hProcess, ref bool Wow64Process);
// ReSharper restore InconsistentNaming
}
}
}

View File

@@ -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;
using System.Text;
using mRemoteNG.My;
@@ -19,249 +16,247 @@ using mRemoteNG.My;
namespace mRemoteNG.Tools
{
public class ProcessController
{
#region Public Methods
public bool Start(string fileName, CommandLineArguments arguments = null)
{
#region Public Methods
public bool Start(string fileName, CommandLineArguments arguments = null)
Process.StartInfo.UseShellExecute = false;
Process.StartInfo.FileName = fileName;
if (arguments != null)
{
Process.StartInfo.UseShellExecute = false;
Process.StartInfo.FileName = fileName;
if (arguments != null)
{
Process.StartInfo.Arguments = arguments.ToString();
}
if (!Process.Start())
{
return false;
}
GetMainWindowHandle();
return true;
Process.StartInfo.Arguments = arguments.ToString();
}
if (!Process.Start())
{
return false;
}
GetMainWindowHandle();
return true;
}
public bool SetControlVisible(string className, string text, bool visible = true)
public bool SetControlVisible(string className, string text, bool visible = true)
{
if (Process == null || Process.HasExited)
{
if (Process == null || Process.HasExited)
{
return false;
}
if (Handle == IntPtr.Zero)
{
return false;
}
IntPtr controlHandle = GetControlHandle(className, text);
if (controlHandle == IntPtr.Zero)
{
return false;
}
int nCmdShow = 0;
if (visible)
{
nCmdShow = Win32.SW_SHOW;
}
else
{
nCmdShow = Win32.SW_HIDE;
}
Win32.ShowWindow(controlHandle, nCmdShow);
return true;
return false;
}
if (Handle == IntPtr.Zero)
{
return false;
}
IntPtr controlHandle = GetControlHandle(className, text);
if (controlHandle == IntPtr.Zero)
{
return false;
}
int nCmdShow = 0;
if (visible)
{
nCmdShow = Win32.SW_SHOW;
}
else
{
nCmdShow = Win32.SW_HIDE;
}
Win32.ShowWindow(controlHandle, nCmdShow);
return true;
}
public bool SetControlText(string className, string oldText, string newText)
public bool SetControlText(string className, string oldText, string newText)
{
if (Process == null || Process.HasExited)
{
if (Process == null || Process.HasExited)
{
return false;
}
if (Handle == IntPtr.Zero)
{
return false;
}
IntPtr controlHandle = GetControlHandle(className, oldText);
if (controlHandle == IntPtr.Zero)
{
return false;
}
IntPtr result = Win32.SendMessage(controlHandle, Win32.WM_SETTEXT, 0, new StringBuilder(newText));
if (!(result.ToInt32() == Win32.TRUE))
{
return false;
}
return true;
return false;
}
if (Handle == IntPtr.Zero)
{
return false;
}
IntPtr controlHandle = GetControlHandle(className, oldText);
if (controlHandle == IntPtr.Zero)
{
return false;
}
IntPtr result = Win32.SendMessage(controlHandle, Win32.WM_SETTEXT, (IntPtr)0, new StringBuilder(newText));
if (!(result.ToInt32() == Win32.TRUE))
{
return false;
}
return true;
}
public bool SelectListBoxItem(string itemText)
public bool SelectListBoxItem(string itemText)
{
if (Process == null || Process.HasExited)
{
if (Process == null || Process.HasExited)
{
return false;
}
if (Handle == IntPtr.Zero)
{
return false;
}
IntPtr listBoxHandle = GetControlHandle("ListBox");
if (listBoxHandle == IntPtr.Zero)
{
return false;
}
IntPtr result = Win32.SendMessage(listBoxHandle, Win32.LB_SELECTSTRING, -1, new StringBuilder(itemText));
if (result.ToInt32() == Win32.LB_ERR)
{
return false;
}
return true;
return false;
}
if (Handle == IntPtr.Zero)
{
return false;
}
IntPtr listBoxHandle = GetControlHandle("ListBox");
if (listBoxHandle == IntPtr.Zero)
{
return false;
}
IntPtr result = Win32.SendMessage(listBoxHandle, Win32.LB_SELECTSTRING, (IntPtr)(-1), new StringBuilder(itemText));
if (result.ToInt32() == Win32.LB_ERR)
{
return false;
}
return true;
}
public bool ClickButton(string text)
public bool ClickButton(string text)
{
if (Process == null || Process.HasExited)
{
if (Process == null || Process.HasExited)
{
return false;
}
if (Handle == IntPtr.Zero)
{
return false;
}
IntPtr buttonHandle = GetControlHandle("Button", text);
if (buttonHandle == IntPtr.Zero)
{
return false;
}
int buttonControlId = Win32.GetDlgCtrlID(buttonHandle);
Win32.SendMessage(Handle, Win32.WM_COMMAND, buttonControlId, buttonHandle);
return true;
return false;
}
if (Handle == IntPtr.Zero)
{
return false;
}
IntPtr buttonHandle = GetControlHandle("Button", text);
if (buttonHandle == IntPtr.Zero)
{
return false;
}
int buttonControlId = Win32.GetDlgCtrlID(buttonHandle.ToInt32());
Win32.SendMessage(Handle, Win32.WM_COMMAND, (IntPtr)buttonControlId, buttonHandle);
return true;
}
public void WaitForExit()
public void WaitForExit()
{
if (Process == null || Process.HasExited)
{
if (Process == null || Process.HasExited)
{
return ;
}
Process.WaitForExit();
return ;
}
Process.WaitForExit();
}
#endregion
#region Protected Fields
protected Process Process = new Process();
protected IntPtr Handle = IntPtr.Zero;
protected List<IntPtr> Controls = new List<IntPtr>();
protected Process Process = new Process();
protected IntPtr Handle = IntPtr.Zero;
protected List<IntPtr> Controls = new List<IntPtr>();
#endregion
#region Protected Methods
protected IntPtr GetMainWindowHandle()
protected IntPtr GetMainWindowHandle()
{
if (Process == null || Process.HasExited)
{
if (Process == null || Process.HasExited)
{
return IntPtr.Zero;
}
Process.WaitForInputIdle(Settings.MaxPuttyWaitTime * 1000);
Handle = IntPtr.Zero;
int startTicks = Environment.TickCount;
while (Handle == IntPtr.Zero && Environment.TickCount < startTicks + (Settings.MaxPuttyWaitTime * 1000))
{
Process.Refresh();
Handle = Process.MainWindowHandle;
if (Handle == IntPtr.Zero)
{
System.Threading.Thread.Sleep(0);
}
}
return Handle;
return IntPtr.Zero;
}
protected IntPtr GetControlHandle(string className, string text = "")
Process.WaitForInputIdle(My.Settings.Default.MaxPuttyWaitTime * 1000);
Handle = IntPtr.Zero;
int startTicks = Environment.TickCount;
while (Handle == IntPtr.Zero && Environment.TickCount < startTicks + (My.Settings.Default.MaxPuttyWaitTime * 1000))
{
if (Process == null || Process.HasExited)
{
return IntPtr.Zero;
}
Process.Refresh();
Handle = Process.MainWindowHandle;
if (Handle == IntPtr.Zero)
{
return IntPtr.Zero;
System.Threading.Thread.Sleep(0);
}
}
if (Controls.Count == 0)
{
Controls = EnumWindows.EnumChildWindows(Handle);
}
return Handle;
}
protected IntPtr GetControlHandle(string className, string text = "")
{
if (Process == null || Process.HasExited)
{
return IntPtr.Zero;
}
if (Handle == IntPtr.Zero)
{
return IntPtr.Zero;
}
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
IntPtr controlHandle = IntPtr.Zero;
foreach (IntPtr control in Controls)
if (Controls.Count == 0)
{
Controls = EnumWindows.EnumChildWindows(Handle);
}
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
IntPtr controlHandle = IntPtr.Zero;
foreach (IntPtr control in Controls)
{
Win32.GetClassName(control, stringBuilder, stringBuilder.Capacity);
if (stringBuilder.ToString() == className)
{
Win32.GetClassName(control, stringBuilder, stringBuilder.Capacity);
if (stringBuilder.ToString() == className)
if (string.IsNullOrEmpty(text))
{
if (string.IsNullOrEmpty(text))
controlHandle = control;
break;
}
else
{
Win32.SendMessage(control, Win32.WM_GETTEXT, new IntPtr(stringBuilder.Capacity), stringBuilder);
if (stringBuilder.ToString() == text)
{
controlHandle = control;
break;
}
else
{
Win32.SendMessage(control, Win32.WM_GETTEXT, stringBuilder.Capacity, stringBuilder);
if (stringBuilder.ToString() == text)
{
controlHandle = control;
break;
}
}
}
}
return controlHandle;
}
return controlHandle;
}
#endregion
#region Win32
// ReSharper disable ClassNeverInstantiated.Local
private class Win32
{
// ReSharper restore ClassNeverInstantiated.Local
// ReSharper disable InconsistentNaming
// ReSharper disable UnusedMethodReturnValue.Local
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern void GetClassName(IntPtr hWnd, System.Text.StringBuilder lpClassName, int nMaxCount);
// ReSharper disable ClassNeverInstantiated.Local
private class Win32
{
// ReSharper restore ClassNeverInstantiated.Local
// ReSharper disable InconsistentNaming
// ReSharper disable UnusedMethodReturnValue.Local
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern void GetClassName(IntPtr hWnd, System.Text.StringBuilder lpClassName, int nMaxCount);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, System.Text.StringBuilder lParam);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, System.Text.StringBuilder lParam);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern int GetDlgCtrlID(int hwndCtl);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern int GetDlgCtrlID(int hwndCtl);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public const int LB_ERR = -1;
public const int LB_SELECTSTRING = 0x18C;
public const int LB_ERR = -1;
public const int LB_SELECTSTRING = 0x18C;
public const int WM_SETTEXT = 0xC;
public const int WM_GETTEXT = 0xD;
public const int WM_COMMAND = 0x111;
public const int WM_SETTEXT = 0xC;
public const int WM_GETTEXT = 0xD;
public const int WM_COMMAND = 0x111;
public const int SW_HIDE = 0;
public const int SW_SHOW = 5;
public const int SW_HIDE = 0;
public const int SW_SHOW = 5;
public const int TRUE = 1;
// ReSharper restore UnusedMethodReturnValue.Local
// ReSharper restore InconsistentNaming
}
#endregion
public const int TRUE = 1;
// ReSharper restore UnusedMethodReturnValue.Local
// ReSharper restore InconsistentNaming
}
#endregion
}
}

View File

@@ -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.ComponentModel;
using System.ComponentModel.Design;
using System.Reflection;
@@ -20,14 +17,13 @@ namespace mRemoteNG.Tools
{
public class PropertyGridCommandSite : IMenuCommandService, ISite
{
protected object TheObject;
public PropertyGridCommandSite(object @object)
{
TheObject = @object;
}
public DesignerVerbCollection Verbs
public DesignerVerbCollection Verbs
{
get
{
@@ -121,7 +117,7 @@ public DesignerVerbCollection Verbs
}
}
public System.ComponentModel.IComponent Component
public System.ComponentModel.IComponent Component
{
get
{
@@ -129,7 +125,7 @@ public System.ComponentModel.IComponent Component
}
}
public System.ComponentModel.IContainer Container
public System.ComponentModel.IContainer Container
{
get
{
@@ -137,7 +133,7 @@ public System.ComponentModel.IContainer Container
}
}
public bool DesignMode
public bool DesignMode
{
get
{
@@ -145,7 +141,7 @@ public bool DesignMode
}
}
public string Name
public string Name
{
get
{
@@ -195,22 +191,22 @@ public string Name
}
public class CommandAttribute : Attribute
{
private bool _Command = false;
public bool Command
{
private bool _Command = false;
public bool Command
get
{
get
{
return _Command;
}
set
{
_Command = value;
}
return _Command;
}
public CommandAttribute(bool isCommand = true)
set
{
Command = isCommand;
_Command = value;
}
}
public CommandAttribute(bool isCommand = true)
{
Command = isCommand;
}
}
}

View File

@@ -110,7 +110,7 @@ namespace mRemoteNG
//
//pbServerStatus
//
this.pbServerStatus.Image = global::My.Resources.Resources.HostStatus_Check;
this.pbServerStatus.Image = My.Resources.HostStatus_Check;
this.pbServerStatus.Location = new System.Drawing.Point(99, 23);
this.pbServerStatus.Name = "pbServerStatus";
this.pbServerStatus.Size = new System.Drawing.Size(16, 16);

View File

@@ -29,11 +29,11 @@ namespace mRemoteNG
{
if (value == true)
{
SetStatusImage(global::My.Resources.HostStatus_On);
SetStatusImage(My.Resources.HostStatus_On);
}
else
{
SetStatusImage(global::My.Resources.HostStatus_Off);
SetStatusImage(My.Resources.HostStatus_Off);
}
_ServerReady = value;

View File

@@ -86,7 +86,7 @@ namespace mRemoteNG.Tools
{
this._cMenCons = new ToolStripMenuItem();
this._cMenCons.Text = My.Language.strConnections;
this._cMenCons.Image = global::My.Resources.Root;
this._cMenCons.Image = My.Resources.Root;
this._cMenSep1 = new ToolStripSeparator();
@@ -102,7 +102,7 @@ namespace mRemoteNG.Tools
this._nI = new NotifyIcon();
this._nI.Text = "mRemote";
this._nI.BalloonTipText = "mRemote";
this._nI.Icon = global::My.Resources.mRemote_Icon;
this._nI.Icon = My.Resources.mRemote_Icon;
this._nI.ContextMenuStrip = this._cMen;
this._nI.Visible = true;
@@ -155,7 +155,7 @@ namespace mRemoteNG.Tools
if (Tree.Node.GetNodeType(tNode) == Tree.Node.Type.Container)
{
tMenItem.Image = global::My.Resources.Folder;
tMenItem.Image = My.Resources.Folder;
tMenItem.Tag = tNode.Tag;
menToolStrip.DropDownItems.Add(tMenItem);

View File

@@ -32,22 +32,13 @@ namespace mRemoteNG.Tree
private static TreeView _TreeView;
public static TreeView TreeView
{
get
{
return _TreeView;
}
set
{
_TreeView = value;
}
get { return _TreeView; }
set { _TreeView = value; }
}
public static TreeNode SelectedNode
{
get
{
return _TreeView.SelectedNode;
}
get { return _TreeView.SelectedNode; }
set
{
treeNodeToBeSelected = value;
@@ -72,7 +63,6 @@ namespace mRemoteNG.Tree
}
}
public static string GetConstantID(TreeNode node)
{
if (GetNodeType(node) == Type.Connection)
@@ -525,7 +515,7 @@ namespace mRemoteNG.Tree
if (newName.Length > 0)
{
SelectedNode.Tag.Name = newName;
((Connection.Info)SelectedNode.Tag).Name = newName;
if (My.Settings.Default.SetHostnameLikeDisplayName)
{

View File

@@ -207,7 +207,7 @@ namespace mRemoteNG.Controls
break;
}
if (RightToLeft)
if (RightToLeft.ToString() != null)
{
format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags | StringFormatFlags.DirectionRightToLeft);
}

View File

@@ -17,7 +17,6 @@ namespace mRemoteNG.Controls
{
public class QuickConnectComboBox : ToolStripComboBox
{
private ComboBox _comboBox;
private bool _ignoreEnter = false;
@@ -97,7 +96,7 @@ namespace mRemoteNG.Controls
if (drawItem is HistoryItem)
{
HistoryItem historyItem = (HistoryItem) drawItem;
drawString = historyItem.ToString[true];
drawString = historyItem.ToString(true);
}
else
{
@@ -188,7 +187,7 @@ namespace mRemoteNG.Controls
}
}
#region Events
#region Events
public class ConnectRequestedEventArgs : EventArgs
{
@@ -199,7 +198,7 @@ namespace mRemoteNG.Controls
private string _connectionString;
public string ConnectionString
public string ConnectionString
{
get
{

View File

@@ -0,0 +1,74 @@
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
using System.ComponentModel;
// Adapted from http://stackoverflow.com/a/3678888/2101395
namespace mRemoteNG.Controls
{
public class TextBox : System.Windows.Forms.TextBox
{
#region Public Properties
[Category("Behavior"),
DefaultValue(false)]private bool _SelectAllOnFocus = false;
public bool SelectAllOnFocus
{
get
{
return _SelectAllOnFocus;
}
set
{
_SelectAllOnFocus = value;
}
}
#endregion
#region Protected Methods
protected override void OnEnter(EventArgs e)
{
base.OnEnter(e);
if (MouseButtons == MouseButtons.None)
{
SelectAll();
_focusHandled = true;
}
}
protected override void OnLeave(EventArgs e)
{
base.OnLeave(e);
_focusHandled = false;
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
if (!_focusHandled)
{
if (SelectionLength == 0)
{
SelectAll();
}
_focusHandled = true;
}
}
#endregion
#region Private Fields
private bool _focusHandled = false;
#endregion
}
}

View File

@@ -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
@@ -19,7 +17,7 @@ namespace mRemoteNG
public class ToolStripSplitButton : System.Windows.Forms.ToolStripSplitButton
{
public ToolStripDropDown DropDown
public ToolStripDropDown DropDown
{
get
{
@@ -30,7 +28,7 @@ public ToolStripDropDown DropDown
if (base.DropDown != value)
{
base.DropDown = value;
base.DropDown.Closing += new System.EventHandler(DropDown_Closing);
base.DropDown.Closing += DropDown_Closing;
}
}
}

View File

@@ -0,0 +1,313 @@
using System.Collections.Generic;
using System;
using AxWFICALib;
using System.Drawing;
using System.Diagnostics;
using System.Data;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
namespace mRemoteNG.Forms
{
public partial class ExportForm : Form
{
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.btnCancel = new System.Windows.Forms.Button();
this.Load += new System.EventHandler(ExportForm_Load);
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
this.btnOK = new System.Windows.Forms.Button();
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
this.lblUncheckProperties = new System.Windows.Forms.Label();
this.chkUsername = new System.Windows.Forms.CheckBox();
this.chkPassword = new System.Windows.Forms.CheckBox();
this.chkDomain = new System.Windows.Forms.CheckBox();
this.chkInheritance = new System.Windows.Forms.CheckBox();
this.txtFileName = new System.Windows.Forms.TextBox();
this.txtFileName.TextChanged += new System.EventHandler(this.txtFileName_TextChanged);
this.btnBrowse = new System.Windows.Forms.Button();
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
this.grpProperties = new System.Windows.Forms.GroupBox();
this.grpFile = new System.Windows.Forms.GroupBox();
this.lblFileFormat = new System.Windows.Forms.Label();
this.lblFileName = new System.Windows.Forms.Label();
this.cboFileFormat = new System.Windows.Forms.ComboBox();
this.grpItems = new System.Windows.Forms.GroupBox();
this.lblSelectedConnection = new System.Windows.Forms.Label();
this.lblSelectedFolder = new System.Windows.Forms.Label();
this.rdoExportSelectedConnection = new System.Windows.Forms.RadioButton();
this.rdoExportSelectedFolder = new System.Windows.Forms.RadioButton();
this.rdoExportEverything = new System.Windows.Forms.RadioButton();
this.grpProperties.SuspendLayout();
this.grpFile.SuspendLayout();
this.grpItems.SuspendLayout();
this.SuspendLayout();
//
//btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(447, 473);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "&Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
//btnOK
//
this.btnOK.Location = new System.Drawing.Point(366, 473);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 2;
this.btnOK.Text = "&OK";
this.btnOK.UseVisualStyleBackColor = true;
//
//lblUncheckProperties
//
this.lblUncheckProperties.AutoSize = true;
this.lblUncheckProperties.Location = new System.Drawing.Point(12, 134);
this.lblUncheckProperties.Name = "lblUncheckProperties";
this.lblUncheckProperties.Size = new System.Drawing.Size(244, 13);
this.lblUncheckProperties.TabIndex = 4;
this.lblUncheckProperties.Text = "Uncheck the properties you want not to be saved!";
//
//chkUsername
//
this.chkUsername.AutoSize = true;
this.chkUsername.Checked = true;
this.chkUsername.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkUsername.Location = new System.Drawing.Point(15, 32);
this.chkUsername.Name = "chkUsername";
this.chkUsername.Size = new System.Drawing.Size(74, 17);
this.chkUsername.TabIndex = 0;
this.chkUsername.Text = "Username";
this.chkUsername.UseVisualStyleBackColor = true;
//
//chkPassword
//
this.chkPassword.AutoSize = true;
this.chkPassword.Checked = true;
this.chkPassword.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkPassword.Location = new System.Drawing.Point(15, 55);
this.chkPassword.Name = "chkPassword";
this.chkPassword.Size = new System.Drawing.Size(72, 17);
this.chkPassword.TabIndex = 1;
this.chkPassword.Text = "Password";
this.chkPassword.UseVisualStyleBackColor = true;
//
//chkDomain
//
this.chkDomain.AutoSize = true;
this.chkDomain.Checked = true;
this.chkDomain.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkDomain.Location = new System.Drawing.Point(15, 78);
this.chkDomain.Name = "chkDomain";
this.chkDomain.Size = new System.Drawing.Size(62, 17);
this.chkDomain.TabIndex = 2;
this.chkDomain.Text = "Domain";
this.chkDomain.UseVisualStyleBackColor = true;
//
//chkInheritance
//
this.chkInheritance.AutoSize = true;
this.chkInheritance.Checked = true;
this.chkInheritance.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkInheritance.Location = new System.Drawing.Point(15, 101);
this.chkInheritance.Name = "chkInheritance";
this.chkInheritance.Size = new System.Drawing.Size(79, 17);
this.chkInheritance.TabIndex = 3;
this.chkInheritance.Text = "Inheritance";
this.chkInheritance.UseVisualStyleBackColor = true;
//
//txtFileName
//
this.txtFileName.Location = new System.Drawing.Point(15, 48);
this.txtFileName.Name = "txtFileName";
this.txtFileName.Size = new System.Drawing.Size(396, 20);
this.txtFileName.TabIndex = 1;
//
//btnBrowse
//
this.btnBrowse.Location = new System.Drawing.Point(417, 46);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(75, 23);
this.btnBrowse.TabIndex = 2;
this.btnBrowse.Text = "&Browse";
this.btnBrowse.UseVisualStyleBackColor = true;
//
//grpProperties
//
this.grpProperties.Controls.Add(this.lblUncheckProperties);
this.grpProperties.Controls.Add(this.chkInheritance);
this.grpProperties.Controls.Add(this.chkUsername);
this.grpProperties.Controls.Add(this.chkDomain);
this.grpProperties.Controls.Add(this.chkPassword);
this.grpProperties.Location = new System.Drawing.Point(12, 304);
this.grpProperties.Name = "grpProperties";
this.grpProperties.Size = new System.Drawing.Size(510, 163);
this.grpProperties.TabIndex = 1;
this.grpProperties.TabStop = false;
this.grpProperties.Text = "Export Properties";
//
//grpFile
//
this.grpFile.Controls.Add(this.lblFileFormat);
this.grpFile.Controls.Add(this.lblFileName);
this.grpFile.Controls.Add(this.cboFileFormat);
this.grpFile.Controls.Add(this.txtFileName);
this.grpFile.Controls.Add(this.btnBrowse);
this.grpFile.Location = new System.Drawing.Point(12, 12);
this.grpFile.Name = "grpFile";
this.grpFile.Size = new System.Drawing.Size(510, 140);
this.grpFile.TabIndex = 0;
this.grpFile.TabStop = false;
this.grpFile.Text = "Export File";
//
//lblFileFormat
//
this.lblFileFormat.AutoSize = true;
this.lblFileFormat.Location = new System.Drawing.Point(12, 84);
this.lblFileFormat.Name = "lblFileFormat";
this.lblFileFormat.Size = new System.Drawing.Size(61, 13);
this.lblFileFormat.TabIndex = 3;
this.lblFileFormat.Text = "File &Format:";
//
//lblFileName
//
this.lblFileName.AutoSize = true;
this.lblFileName.Location = new System.Drawing.Point(12, 32);
this.lblFileName.Name = "lblFileName";
this.lblFileName.Size = new System.Drawing.Size(52, 13);
this.lblFileName.TabIndex = 0;
this.lblFileName.Text = "Filename:";
//
//cboFileFormat
//
this.cboFileFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboFileFormat.FormattingEnabled = true;
this.cboFileFormat.Location = new System.Drawing.Point(15, 100);
this.cboFileFormat.Name = "cboFileFormat";
this.cboFileFormat.Size = new System.Drawing.Size(294, 21);
this.cboFileFormat.TabIndex = 4;
//
//grpItems
//
this.grpItems.Controls.Add(this.lblSelectedConnection);
this.grpItems.Controls.Add(this.lblSelectedFolder);
this.grpItems.Controls.Add(this.rdoExportSelectedConnection);
this.grpItems.Controls.Add(this.rdoExportSelectedFolder);
this.grpItems.Controls.Add(this.rdoExportEverything);
this.grpItems.Location = new System.Drawing.Point(12, 158);
this.grpItems.Name = "grpItems";
this.grpItems.Size = new System.Drawing.Size(510, 140);
this.grpItems.TabIndex = 4;
this.grpItems.TabStop = false;
this.grpItems.Text = "Export Items";
//
//lblSelectedConnection
//
this.lblSelectedConnection.AutoSize = true;
this.lblSelectedConnection.Location = new System.Drawing.Point(48, 111);
this.lblSelectedConnection.Name = "lblSelectedConnection";
this.lblSelectedConnection.Size = new System.Drawing.Size(92, 13);
this.lblSelectedConnection.TabIndex = 4;
this.lblSelectedConnection.Text = "Connection Name";
//
//lblSelectedFolder
//
this.lblSelectedFolder.AutoSize = true;
this.lblSelectedFolder.Location = new System.Drawing.Point(48, 75);
this.lblSelectedFolder.Name = "lblSelectedFolder";
this.lblSelectedFolder.Size = new System.Drawing.Size(67, 13);
this.lblSelectedFolder.TabIndex = 3;
this.lblSelectedFolder.Text = "Folder Name";
//
//rdoExportSelectedConnection
//
this.rdoExportSelectedConnection.AutoSize = true;
this.rdoExportSelectedConnection.Location = new System.Drawing.Point(15, 91);
this.rdoExportSelectedConnection.Name = "rdoExportSelectedConnection";
this.rdoExportSelectedConnection.Size = new System.Drawing.Size(215, 17);
this.rdoExportSelectedConnection.TabIndex = 2;
this.rdoExportSelectedConnection.TabStop = true;
this.rdoExportSelectedConnection.Text = "Export the currently selected connection";
this.rdoExportSelectedConnection.UseVisualStyleBackColor = true;
//
//rdoExportSelectedFolder
//
this.rdoExportSelectedFolder.AutoSize = true;
this.rdoExportSelectedFolder.Location = new System.Drawing.Point(15, 55);
this.rdoExportSelectedFolder.Name = "rdoExportSelectedFolder";
this.rdoExportSelectedFolder.Size = new System.Drawing.Size(188, 17);
this.rdoExportSelectedFolder.TabIndex = 1;
this.rdoExportSelectedFolder.TabStop = true;
this.rdoExportSelectedFolder.Text = "Export the currently selected folder";
this.rdoExportSelectedFolder.UseVisualStyleBackColor = true;
//
//rdoExportEverything
//
this.rdoExportEverything.AutoSize = true;
this.rdoExportEverything.Checked = true;
this.rdoExportEverything.Location = new System.Drawing.Point(15, 32);
this.rdoExportEverything.Name = "rdoExportEverything";
this.rdoExportEverything.Size = new System.Drawing.Size(107, 17);
this.rdoExportEverything.TabIndex = 0;
this.rdoExportEverything.TabStop = true;
this.rdoExportEverything.Text = "Export everything";
this.rdoExportEverything.UseVisualStyleBackColor = true;
//
//ExportForm
//
this.AcceptButton = this.btnOK;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(534, 508);
this.Controls.Add(this.grpItems);
this.Controls.Add(this.grpFile);
this.Controls.Add(this.grpProperties);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = My.Resources.Connections_SaveAs_Icon;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ExportForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Export Connections";
this.grpProperties.ResumeLayout(false);
this.grpProperties.PerformLayout();
this.grpFile.ResumeLayout(false);
this.grpFile.PerformLayout();
this.grpItems.ResumeLayout(false);
this.grpItems.PerformLayout();
this.ResumeLayout(false);
}
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Label lblUncheckProperties;
private System.Windows.Forms.CheckBox chkUsername;
private System.Windows.Forms.CheckBox chkPassword;
private System.Windows.Forms.CheckBox chkDomain;
private System.Windows.Forms.CheckBox chkInheritance;
private System.Windows.Forms.TextBox txtFileName;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.GroupBox grpProperties;
private System.Windows.Forms.GroupBox grpFile;
private System.Windows.Forms.Label lblFileFormat;
private System.Windows.Forms.Label lblFileName;
private System.Windows.Forms.ComboBox cboFileFormat;
private System.Windows.Forms.GroupBox grpItems;
private System.Windows.Forms.Label lblSelectedConnection;
private System.Windows.Forms.Label lblSelectedFolder;
private System.Windows.Forms.RadioButton rdoExportSelectedConnection;
private System.Windows.Forms.RadioButton rdoExportSelectedFolder;
private System.Windows.Forms.RadioButton rdoExportEverything;
#endregion
}
}

Some files were not shown because too many files have changed in this diff Show More