Merging Japanese translation

This commit is contained in:
hiriumi
2016-05-31 09:32:36 -07:00
44 changed files with 1210 additions and 1132 deletions

View File

@@ -1,4 +1,10 @@
1.73 Beta 2 ():
1.74 (2016-05-31):
Converted source from Visual Basic to C Sharp
Lots of code refactoring
Removed Keyboard shortcut functionality (introduced in 1.73 beta, caused stability issues, may be re-added in a future release)
Updated PuTTY to 0.67
1.73 Beta 2 (NEVER RELEASED):
Fixed issue MR-619 - Keyboard shortcuts stop working after locking the screen with Win+L
Added support for importing files from PuTTY Connection Manager.
Improved the import and export functionality.

View File

@@ -27,5 +27,34 @@ namespace CustomActions
session.Log("End IsKBInstalled");
return ActionResult.Success;
}
[CustomAction]
public static ActionResult IsLegacyVersionInstalled(Session session)
{
session.Log("Begin IsLegacyVersionInstalled");
UninstallNSISVersions uninstaller = new UninstallNSISVersions();
if (uninstaller.IsLegacymRemoteNGInstalled())
{
session["LEGACYVERSIONINSTALLED"] = "1";
}
else
{
session["LEGACYVERSIONINSTALLED"] = "0";
}
session.Log("End IsLegacyVersionInstalled");
return ActionResult.Success;
}
[CustomAction]
public static ActionResult UninstallLegacyVersion(Session session)
{
session.Log("Begin UninstallLegacyVersion");
UninstallNSISVersions uninstaller = new UninstallNSISVersions();
string uninstallString = uninstaller.GetLegacyUninstallString();
uninstaller.UninstallLegacyVersion(true);
session.Log("End UninstallLegacyVersion");
return ActionResult.Success;
}
}
}

View File

@@ -33,7 +33,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
<StartupObject>
</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -46,6 +47,7 @@
<Compile Include="CustomActions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="InstalledWindowsUpdateGatherer.cs" />
<Compile Include="UninstallNSISVersions.cs" />
<Content Include="CustomAction.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
using System.Diagnostics;
using System.IO;
namespace CustomActions
{
public class UninstallNSISVersions
{
private const string REGISTRY_PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
private const string REGISTRY_PATH_Wow6432 = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
private RegistryKey _activeRegistryPath;
public UninstallNSISVersions()
{
GetLegacymRemoteNGRegistryKeyPath();
}
public void UninstallLegacyVersion(bool Silent = false)
{
if (!IsLegacymRemoteNGInstalled())
return;
string uninstallString = GetLegacyUninstallString();
string forceNonTempUninstaller = string.Format("_?={0}", uninstallString.Replace("Uninstall.exe", "").Replace(@"""", ""));
string silentUninstall = "";
if (Silent)
{
silentUninstall = "/S";
}
ProcessStartInfo processStartInfo = new ProcessStartInfo(uninstallString);
processStartInfo.UseShellExecute = true;
processStartInfo.Arguments = string.Format("{0} {1}", forceNonTempUninstaller, silentUninstall);
Process uninstallProcess = Process.Start(processStartInfo);
while (uninstallProcess.HasExited == false)
{
Debug.WriteLine("Waiting for uninstaller to exit");
}
}
public bool IsLegacymRemoteNGInstalled()
{
return (_activeRegistryPath != null);
}
public string GetLegacyUninstallString()
{
if (IsLegacymRemoteNGInstalled())
return _activeRegistryPath.GetValue("UninstallString").ToString();
return "";
}
private void GetLegacymRemoteNGRegistryKeyPath()
{
GetUninstallKeyPath();
GetUninstallKeyPath6432();
}
private void GetUninstallKeyPath()
{
try
{
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(REGISTRY_PATH);
}
catch (Exception ex)
{ }
}
private void GetUninstallKeyPath6432()
{
try
{
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(REGISTRY_PATH_Wow6432);
}
catch (Exception ex)
{ }
}
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include $(sys.CURRENTDIR)Includes\Config.wxi?>
<Fragment>
<CustomAction Id="CheckIfLegacyVersionInstalled" Return="check" Execute="immediate" BinaryKey="CustomActions.CA.dll" DllEntry="IsLegacyVersionInstalled" />
</Fragment>
<Fragment>
<CustomAction Id="UninstallLegacyVersion" Return="check" Execute="immediate" BinaryKey="CustomActions.CA.dll" DllEntry="UninstallLegacyVersion" />
</Fragment>
</Wix>

View File

@@ -27,6 +27,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="CustomActions\CheckForInstalledWindowsUpdates.wxs" />
<Compile Include="CustomActions\UninstallLegacyVersions.wxs" />
<Compile Include="Fragments\FilesFragment.wxs" />
<Compile Include="Fragments\DirectoriesFragment.wxs" />
<Compile Include="Fragments\MainExeFragment.wxs" />

View File

@@ -17,13 +17,17 @@
<RegistrySearch Id='mRemoteNGRegistry' Type='raw' Root='HKLM' Key='Software\mRemoteNG' Name='InstallDir' />
</Property>
<Property Id='REQUIREDDOTNETFRAMEWORKVERSION' Value='$(var.RequiredDotNetFrameworkVersion)' />
<Property Id='LEGACYVERSIONINSTALLED' Value='0' />
<PropertyRef Id="NETFRAMEWORK40FULL" />
<PropertyRef Id="WIX_IS_NETFRAMEWORK_40_OR_LATER_INSTALLED" />
<Icon Id="mRemoteNG.ico" SourceFile="Resources\mRemoteNG.ico" />
<InstallUISequence>
<Custom Action="SetRDP80KBValue" After="AppSearch" />
<Custom Action="CheckIfRDP80Installed" After="SetRDP80KBValue">NOT Installed AND (VersionNT = 601 OR VersionNT64 = 601)</Custom>
<Custom Action="CheckIfRDP80Installed" After="SetRDP80KBValue">(NOT Installed) AND (VersionNT = 601 OR VersionNT64 = 601)</Custom>
<LaunchConditions After="SetWIX_IS_NETFRAMEWORK_40_OR_LATER_INSTALLED" />
<Custom Action="CheckIfLegacyVersionInstalled" After="LaunchConditions" />
<Custom Action="UninstallLegacyVersion" After="CheckIfLegacyVersionInstalled">(NOT Installed) AND (LEGACYVERSIONINSTALLED = 1)</Custom>
</InstallUISequence>

View File

@@ -3,6 +3,7 @@ using System;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
using static System.Environment;
@@ -14,7 +15,10 @@ namespace mRemoteNG.App.Info
public static readonly string UrlDonate = "http://donate.mremoteng.org/";
public static readonly string UrlForum = "http://forum.mremoteng.org/";
public static readonly string UrlBugs = "http://bugs.mremoteng.org/";
public static readonly string HomePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
public static readonly string version = Application.ProductVersion;
public static readonly string ProdName = Application.ProductName;
public static readonly string copyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute), false)).Copyright;
public static readonly string HomePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
public static readonly string EncryptionKey = "mR3m";
public static string ReportingFilePath = "";
public static readonly string PuttyPath = HomePath + "\\PuTTYNG.exe";
@@ -33,8 +37,15 @@ namespace mRemoteNG.App.Info
details.Add($".NET CLR {Environment.Version}");
string detailsString = string.Join("; ", details.ToArray());
return $"Mozilla/5.0 ({detailsString}) {System.Windows.Forms.Application.ProductName}/{System.Windows.Forms.Application.ProductVersion}";
return $"Mozilla/5.0 ({detailsString}) {ProdName}/{version}";
}
}
public static Version getVer()
{
System.Version v = new Version();
System.Version.TryParse(version, out v);
return v;
}
}
}

View File

@@ -1,4 +1,3 @@
using log4net;
using Microsoft.VisualBasic;
using mRemoteNG.App.Info;
using mRemoteNG.Config.Connections;
@@ -555,7 +554,9 @@ namespace mRemoteNG.App
}
else
{
Interaction.MsgBox(string.Format(Language.strErrorStartupConnectionFileLoad, Environment.NewLine, Application.ProductName, GetStartupConnectionFileName(), MiscTools.GetExceptionMessageRecursive(ex)), (int)MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, null);
MessageBox.Show(frmMain.Default,
string.Format(Language.strErrorStartupConnectionFileLoad, Environment.NewLine, Application.ProductName, GetStartupConnectionFileName(), MiscTools.GetExceptionMessageRecursive(ex)),
"Could not load startup file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
return;
}

View File

@@ -78,7 +78,7 @@ namespace mRemoteNG.App
if (isFipsPolicyEnabled)
{
MessageBox.Show(frmMain.Default, string.Format(Language.strErrorFipsPolicyIncompatible, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName), (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(frmMain.Default, string.Format(Language.strErrorFipsPolicyIncompatible, GeneralAppInfo.ProdName, GeneralAppInfo.ProdName, MessageBoxButtons.OK, MessageBoxIcon.Error));
Environment.Exit(1);
}
}

View File

@@ -1,4 +1,3 @@
using System.Collections.Generic;
using System;
using System.IO;
using System.Net;
@@ -6,6 +5,7 @@ using System.ComponentModel;
using System.Threading;
using mRemoteNG.Tools;
using System.Reflection;
using mRemoteNG.App.Info;
namespace mRemoteNG.App.Update
@@ -107,7 +107,7 @@ namespace mRemoteNG.App.Update
public void SetProxySettings()
{
SetProxySettings(Convert.ToBoolean(mRemoteNG.Settings.Default.UpdateUseProxy), Convert.ToString(mRemoteNG.Settings.Default.UpdateProxyAddress), Convert.ToInt32(mRemoteNG.Settings.Default.UpdateProxyPort), Convert.ToBoolean(mRemoteNG.Settings.Default.UpdateProxyUseAuthentication), Convert.ToString(mRemoteNG.Settings.Default.UpdateProxyAuthUser), Security.Crypt.Decrypt(Convert.ToString(mRemoteNG.Settings.Default.UpdateProxyAuthPass), Info.GeneralAppInfo.EncryptionKey));
SetProxySettings(Convert.ToBoolean(Settings.Default.UpdateUseProxy), Convert.ToString(Settings.Default.UpdateProxyAddress), Convert.ToInt32(Settings.Default.UpdateProxyPort), Convert.ToBoolean(Settings.Default.UpdateProxyUseAuthentication), Convert.ToString(Settings.Default.UpdateProxyAuthUser), Security.Crypt.Decrypt(Convert.ToString(Settings.Default.UpdateProxyAuthPass), GeneralAppInfo.EncryptionKey));
}
public void SetProxySettings(bool useProxy, string address, int port, bool useAuthentication, string username, string password)
@@ -145,7 +145,7 @@ namespace mRemoteNG.App.Update
return false;
}
return _currentUpdateInfo.Version > (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.Version;
return _currentUpdateInfo.Version > GeneralAppInfo.getVer();
}
public bool IsAnnouncementAvailable()
@@ -155,7 +155,7 @@ namespace mRemoteNG.App.Update
return false;
}
return !(_currentAnnouncementInfo.Name == mRemoteNG.Settings.Default.LastAnnouncement);
return (_currentAnnouncementInfo.Name != Settings.Default.LastAnnouncement);
}
public void GetUpdateInfoAsync()
@@ -165,7 +165,7 @@ namespace mRemoteNG.App.Update
_getUpdateInfoThread.Abort();
}
_getUpdateInfoThread = new Thread(new System.Threading.ThreadStart(GetUpdateInfo));
_getUpdateInfoThread = new Thread(new ThreadStart(GetUpdateInfo));
_getUpdateInfoThread.SetApartmentState(ApartmentState.STA);
_getUpdateInfoThread.IsBackground = true;
_getUpdateInfoThread.Start();
@@ -183,7 +183,7 @@ namespace mRemoteNG.App.Update
_getChangeLogThread.Abort();
}
_getChangeLogThread = new Thread(new System.Threading.ThreadStart(GetChangeLog));
_getChangeLogThread = new Thread(new ThreadStart(GetChangeLog));
_getChangeLogThread.SetApartmentState(ApartmentState.STA);
_getChangeLogThread.IsBackground = true;
_getChangeLogThread.Start();
@@ -196,7 +196,7 @@ namespace mRemoteNG.App.Update
_getAnnouncementInfoThread.Abort();
}
_getAnnouncementInfoThread = new Thread(new System.Threading.ThreadStart(GetAnnouncementInfo));
_getAnnouncementInfoThread = new Thread(new ThreadStart(GetAnnouncementInfo));
_getAnnouncementInfoThread.SetApartmentState(ApartmentState.STA);
_getAnnouncementInfoThread.IsBackground = true;
_getAnnouncementInfoThread.Start();
@@ -244,7 +244,7 @@ namespace mRemoteNG.App.Update
private WebClient CreateWebClient()
{
WebClient webClient = new WebClient();
webClient.Headers.Add("user-agent", Info.GeneralAppInfo.UserAgent);
webClient.Headers.Add("user-agent", GeneralAppInfo.UserAgent);
webClient.Proxy = _webProxy;
return webClient;
}
@@ -285,17 +285,17 @@ namespace mRemoteNG.App.Update
private void GetUpdateInfo()
{
Uri updateFileUri = new Uri(new Uri(Convert.ToString(mRemoteNG.Settings.Default.UpdateAddress)), new Uri(Info.UpdateChannelInfo.FileName, UriKind.Relative));
Uri updateFileUri = new Uri(new Uri(Convert.ToString(Settings.Default.UpdateAddress)), new Uri(UpdateChannelInfo.FileName, UriKind.Relative));
DownloadStringCompletedEventArgs e = DownloadString(updateFileUri);
if (!e.Cancelled && e.Error == null)
{
_currentUpdateInfo = UpdateInfo.FromString(e.Result);
mRemoteNG.Settings.Default.CheckForUpdatesLastCheck = DateTime.UtcNow;
if (!mRemoteNG.Settings.Default.UpdatePending)
Settings.Default.CheckForUpdatesLastCheck = DateTime.UtcNow;
if (!Settings.Default.UpdatePending)
{
mRemoteNG.Settings.Default.UpdatePending = IsUpdateAvailable();
Settings.Default.UpdatePending = IsUpdateAvailable();
}
}
@@ -318,7 +318,7 @@ namespace mRemoteNG.App.Update
private void GetAnnouncementInfo()
{
Uri announcementFileUri = new Uri(Convert.ToString(mRemoteNG.Settings.Default.AnnouncementAddress));
Uri announcementFileUri = new Uri(Convert.ToString(Settings.Default.AnnouncementAddress));
DownloadStringCompletedEventArgs e = DownloadString(announcementFileUri);
if (!e.Cancelled && e.Error == null)
@@ -327,7 +327,7 @@ namespace mRemoteNG.App.Update
if (!string.IsNullOrEmpty(_currentAnnouncementInfo.Name))
{
mRemoteNG.Settings.Default.LastAnnouncement = _currentAnnouncementInfo.Name;
Settings.Default.LastAnnouncement = _currentAnnouncementInfo.Name;
}
}
@@ -341,7 +341,7 @@ namespace mRemoteNG.App.Update
DownloadUpdateProgressChangedEventEvent(sender, e);
}
private void DownloadUpdateCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
private void DownloadUpdateCompleted(object sender, AsyncCompletedEventArgs e)
{
AsyncCompletedEventArgs raiseEventArgs = e;
@@ -353,7 +353,7 @@ namespace mRemoteNG.App.Update
updateAuthenticode.RequireThumbprintMatch = true;
updateAuthenticode.ThumbprintToMatch = _currentUpdateInfo.CertificateThumbprint;
if (!(updateAuthenticode.Verify() == Authenticode.StatusValue.Verified))
if (updateAuthenticode.Verify() != Authenticode.StatusValue.Verified)
{
if (updateAuthenticode.Status == Authenticode.StatusValue.UnhandledException)
{
@@ -390,11 +390,11 @@ namespace mRemoteNG.App.Update
{
add
{
GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(GetUpdateInfoCompletedEventEvent, value);
GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Combine(GetUpdateInfoCompletedEventEvent, value);
}
remove
{
GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(GetUpdateInfoCompletedEventEvent, value);
GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Remove(GetUpdateInfoCompletedEventEvent, value);
}
}
@@ -403,11 +403,11 @@ namespace mRemoteNG.App.Update
{
add
{
GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(GetChangeLogCompletedEventEvent, value);
GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Combine(GetChangeLogCompletedEventEvent, value);
}
remove
{
GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(GetChangeLogCompletedEventEvent, value);
GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Remove(GetChangeLogCompletedEventEvent, value);
}
}
@@ -416,11 +416,11 @@ namespace mRemoteNG.App.Update
{
add
{
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(GetAnnouncementInfoCompletedEventEvent, value);
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Combine(GetAnnouncementInfoCompletedEventEvent, value);
}
remove
{
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(GetAnnouncementInfoCompletedEventEvent, value);
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Remove(GetAnnouncementInfoCompletedEventEvent, value);
}
}
@@ -429,11 +429,11 @@ namespace mRemoteNG.App.Update
{
add
{
DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)System.Delegate.Combine(DownloadUpdateProgressChangedEventEvent, value);
DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)Delegate.Combine(DownloadUpdateProgressChangedEventEvent, value);
}
remove
{
DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)System.Delegate.Remove(DownloadUpdateProgressChangedEventEvent, value);
DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)Delegate.Remove(DownloadUpdateProgressChangedEventEvent, value);
}
}
@@ -442,11 +442,11 @@ namespace mRemoteNG.App.Update
{
add
{
DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(DownloadUpdateCompletedEventEvent, value);
DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Combine(DownloadUpdateCompletedEventEvent, value);
}
remove
{
DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(DownloadUpdateCompletedEventEvent, value);
DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Remove(DownloadUpdateCompletedEventEvent, value);
}
}
#endregion

View File

@@ -1,19 +1,23 @@
using mRemoteNG.App;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Container;
using mRemoteNG.Tools;
using mRemoteNG.Tree;
using System;
using System.Data.SqlClient;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using mRemoteNG.My;
using mRemoteNG.UI.Forms;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Container;
using mRemoteNG.Messages;
using mRemoteNG.Security;
using mRemoteNG.Tools;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Forms;
namespace mRemoteNG.Config.Connections
{
@@ -38,7 +42,7 @@ namespace mRemoteNG.Config.Connections
private SqlConnection _sqlConnection;
private SqlCommand _sqlQuery;
private int _currentNodeIndex = 0;
private int _currentNodeIndex;
private string _parentConstantId = Convert.ToString(0);
#endregion
@@ -52,7 +56,7 @@ namespace mRemoteNG.Config.Connections
public TreeNode RootTreeNode {get; set;}
public bool Export {get; set;}
public Format SaveFormat {get; set;}
public Security.Save SaveSecurity {get; set;}
public Save SaveSecurity {get; set;}
public ConnectionList ConnectionList {get; set;}
public ContainerList ContainerList {get; set;}
#endregion
@@ -95,7 +99,7 @@ namespace mRemoteNG.Config.Connections
{
bool isVerified = false;
SqlDataReader sqlDataReader = null;
System.Version databaseVersion = null;
Version databaseVersion = null;
try
{
SqlCommand sqlCommand = new SqlCommand("SELECT * FROM tblRoot", sqlConnection);
@@ -110,17 +114,17 @@ namespace mRemoteNG.Config.Connections
sqlDataReader.Close();
if (databaseVersion.CompareTo(new System.Version(2, 2)) == 0) // 2.2
if (databaseVersion.CompareTo(new Version(2, 2)) == 0) // 2.2
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format("Upgrading database from version {0} to version {1}.", databaseVersion.ToString(), "2.3"));
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format("Upgrading database from version {0} to version {1}.", databaseVersion, "2.3"));
sqlCommand = new SqlCommand("ALTER TABLE tblCons ADD EnableFontSmoothing bit NOT NULL DEFAULT 0, EnableDesktopComposition bit NOT NULL DEFAULT 0, InheritEnableFontSmoothing bit NOT NULL DEFAULT 0, InheritEnableDesktopComposition bit NOT NULL DEFAULT 0;", sqlConnection);
sqlCommand.ExecuteNonQuery();
databaseVersion = new System.Version(2, 3);
databaseVersion = new Version(2, 3);
}
if (databaseVersion.CompareTo(new System.Version(2, 3)) == 0) // 2.3
if (databaseVersion.CompareTo(new Version(2, 3)) == 0) // 2.3
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format("Upgrading database from version {0} to version {1}.", databaseVersion.ToString(), "2.4"));
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format("Upgrading database from version {0} to version {1}.", databaseVersion, "2.4"));
sqlCommand = new SqlCommand("ALTER TABLE tblCons ADD UseCredSsp bit NOT NULL DEFAULT 1, InheritUseCredSsp bit NOT NULL DEFAULT 0;", sqlConnection);
sqlCommand.ExecuteNonQuery();
databaseVersion = new Version(2, 4);
@@ -128,7 +132,7 @@ namespace mRemoteNG.Config.Connections
if (databaseVersion.CompareTo(new Version(2, 4)) == 0) // 2.4
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format("Upgrading database from version {0} to version {1}.", databaseVersion.ToString(), "2.5"));
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format("Upgrading database from version {0} to version {1}.", databaseVersion, "2.5"));
sqlCommand = new SqlCommand("ALTER TABLE tblCons ADD LoadBalanceInfo varchar (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, AutomaticResize bit NOT NULL DEFAULT 1, InheritLoadBalanceInfo bit NOT NULL DEFAULT 0, InheritAutomaticResize bit NOT NULL DEFAULT 0;", sqlConnection);
sqlCommand.ExecuteNonQuery();
databaseVersion = new Version(2, 5);
@@ -141,12 +145,12 @@ namespace mRemoteNG.Config.Connections
if (isVerified == false)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, string.Format(Language.strErrorBadDatabaseVersion, databaseVersion.ToString(), (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName));
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, string.Format(Language.strErrorBadDatabaseVersion, databaseVersion, GeneralAppInfo.ProdName));
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, string.Format(Language.strErrorVerifyDatabaseVersionFailed, ex.Message));
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, string.Format(Language.strErrorVerifyDatabaseVersionFailed, ex.Message));
}
finally
{
@@ -176,48 +180,46 @@ namespace mRemoteNG.Config.Connections
if (!VerifyDatabaseVersion(_sqlConnection))
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strErrorConnectionListSaveFailed);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strErrorConnectionListSaveFailed);
return ;
}
var tN = (TreeNode)RootTreeNode.Clone();
TreeNode tN = default(TreeNode);
tN = (TreeNode)RootTreeNode.Clone();
string strProtected = "";
string strProtected;
if (tN.Tag != null)
{
if ((tN.Tag as RootNodeInfo).Password == true)
if (((RootNodeInfo) tN.Tag).Password)
{
_password = Convert.ToString((tN.Tag as RootNodeInfo).PasswordString);
strProtected = Security.Crypt.Encrypt("ThisIsProtected", _password);
_password = Convert.ToString(((RootNodeInfo) tN.Tag).PasswordString);
strProtected = Crypt.Encrypt("ThisIsProtected", _password);
}
else
{
strProtected = Security.Crypt.Encrypt("ThisIsNotProtected", _password);
strProtected = Crypt.Encrypt("ThisIsNotProtected", _password);
}
}
else
{
strProtected = Security.Crypt.Encrypt("ThisIsNotProtected", _password);
strProtected = Crypt.Encrypt("ThisIsNotProtected", _password);
}
_sqlQuery = new SqlCommand("DELETE FROM tblRoot", _sqlConnection);
_sqlQuery.ExecuteNonQuery();
_sqlQuery = new SqlCommand("INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" + MiscTools.PrepareValueForDB(tN.Text) + "\', 0, \'" + strProtected + "\'," + App.Info.ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")", _sqlConnection);
_sqlQuery = new SqlCommand("INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" + MiscTools.PrepareValueForDB(tN.Text) + "\', 0, \'" + strProtected + "\'," + ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")", _sqlConnection);
_sqlQuery.ExecuteNonQuery();
_sqlQuery = new SqlCommand("DELETE FROM tblCons", _sqlConnection);
_sqlQuery.ExecuteNonQuery();
TreeNodeCollection tNC = default(TreeNodeCollection);
tNC = tN.Nodes;
TreeNodeCollection tNC = tN.Nodes;
SaveNodesSQL(tNC);
_sqlQuery = new SqlCommand("DELETE FROM tblUpdate", _sqlConnection);
_sqlQuery.ExecuteNonQuery();
_sqlQuery = new SqlCommand("INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + Tools.MiscTools.DBDate(DateTime.Now) + "\')", _sqlConnection);
_sqlQuery = new SqlCommand("INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + MiscTools.DBDate(DateTime.Now) + "\')", _sqlConnection);
_sqlQuery.ExecuteNonQuery();
_sqlConnection.Close();
@@ -234,33 +236,33 @@ namespace mRemoteNG.Config.Connections
+ "InheritUseCredSsp, " + "PositionID, ParentID, ConstantID, LastChange)" + "VALUES (", _sqlConnection
);
if (Tree.ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection | Tree.ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container)
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection | ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container)
{
//_xmlTextWriter.WriteStartElement("Node")
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(node.Text) + "\',"; //Name
_sqlQuery.CommandText += "\'" + Tree.ConnectionTreeNode.GetNodeType(node).ToString() + "\',"; //Type
_sqlQuery.CommandText += "\'" + ConnectionTreeNode.GetNodeType(node) + "\',"; //Type
}
if (Tree.ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container) //container
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container) //container
{
_sqlQuery.CommandText += "\'" + this.ContainerList[node.Tag].IsExpanded + "\',"; //Expanded
curConI = this.ContainerList[node.Tag].ConnectionInfo;
_sqlQuery.CommandText += "\'" + ContainerList[node.Tag].IsExpanded + "\',"; //Expanded
curConI = ContainerList[node.Tag].ConnectionInfo;
SaveConnectionFieldsSQL(curConI);
_sqlQuery.CommandText = Tools.MiscTools.PrepareForDB(_sqlQuery.CommandText);
_sqlQuery.CommandText = MiscTools.PrepareForDB(_sqlQuery.CommandText);
_sqlQuery.ExecuteNonQuery();
//_parentConstantId = _currentNodeIndex
SaveNodesSQL(node.Nodes);
//_xmlTextWriter.WriteEndElement()
}
if (Tree.ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection)
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection)
{
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
curConI = this.ConnectionList[node.Tag];
curConI = ConnectionList[node.Tag];
SaveConnectionFieldsSQL(curConI);
//_xmlTextWriter.WriteEndElement()
_sqlQuery.CommandText = Tools.MiscTools.PrepareForDB(_sqlQuery.CommandText);
_sqlQuery.CommandText = MiscTools.PrepareForDB(_sqlQuery.CommandText);
_sqlQuery.ExecuteNonQuery();
}
@@ -275,7 +277,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Icon) + "\',";
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Panel) + "\',";
if (this.SaveSecurity.Username == true)
if (SaveSecurity.Username)
{
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Username) + "\',";
}
@@ -284,7 +286,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + "" + "\',";
}
if (this.SaveSecurity.Domain == true)
if (SaveSecurity.Domain)
{
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Domain) + "\',";
}
@@ -293,9 +295,9 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + "" + "\',";
}
if (this.SaveSecurity.Password == true)
if (SaveSecurity.Password)
{
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(Security.Crypt.Encrypt(with_1.Password, _password)) + "\',";
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(Crypt.Encrypt(with_1.Password, _password)) + "\',";
}
else
{
@@ -303,16 +305,16 @@ namespace mRemoteNG.Config.Connections
}
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Hostname) + "\',";
_sqlQuery.CommandText += "\'" + with_1.Protocol.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.Protocol + "\',";
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.PuttySession) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Port) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.UseConsoleSession) + "\',";
_sqlQuery.CommandText += "\'" + with_1.RenderingEngine.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.ICAEncryption.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.RDPAuthenticationLevel.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.RenderingEngine + "\',";
_sqlQuery.CommandText += "\'" + with_1.ICAEncryption + "\',";
_sqlQuery.CommandText += "\'" + with_1.RDPAuthenticationLevel + "\',";
_sqlQuery.CommandText += "\'" + with_1.LoadBalanceInfo + "\',";
_sqlQuery.CommandText += "\'" + with_1.Colors.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.Resolution.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.Colors + "\',";
_sqlQuery.CommandText += "\'" + with_1.Resolution + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.AutomaticResize) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.DisplayWallpaper) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.DisplayThemes) + "\',";
@@ -323,7 +325,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectPorts) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectPrinters) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectSmartCards) + "\',";
_sqlQuery.CommandText += "\'" + with_1.RedirectSound.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.RedirectSound + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectKeys) + "\',";
if (curConI.OpenConnections.Count > 0)
@@ -341,23 +343,23 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + with_1.UserField + "\',";
_sqlQuery.CommandText += "\'" + with_1.ExtApp + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCCompression.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCEncoding.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCAuthMode.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCProxyType.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCCompression + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCEncoding + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCAuthMode + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCProxyType + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCProxyIP + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCProxyPort) + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCProxyUsername + "\',";
_sqlQuery.CommandText += "\'" + Security.Crypt.Encrypt(with_1.VNCProxyPassword, _password) + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCColors.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCSmartSizeMode.ToString() + "\',";
_sqlQuery.CommandText += "\'" + Crypt.Encrypt(with_1.VNCProxyPassword, _password) + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCColors + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCSmartSizeMode + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCViewOnly) + "\',";
_sqlQuery.CommandText += "\'" + with_1.RDGatewayUsageMethod.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.RDGatewayUsageMethod + "\',";
_sqlQuery.CommandText += "\'" + with_1.RDGatewayHostname + "\',";
_sqlQuery.CommandText += "\'" + with_1.RDGatewayUseConnectionCredentials.ToString() + "\',";
_sqlQuery.CommandText += "\'" + with_1.RDGatewayUseConnectionCredentials + "\',";
if (this.SaveSecurity.Username == true)
if (SaveSecurity.Username)
{
_sqlQuery.CommandText += "\'" + with_1.RDGatewayUsername + "\',";
}
@@ -366,16 +368,16 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + "" + "\',";
}
if (this.SaveSecurity.Password == true)
if (SaveSecurity.Password)
{
_sqlQuery.CommandText += "\'" + Security.Crypt.Encrypt(with_1.RDGatewayPassword, _password) + "\',";
_sqlQuery.CommandText += "\'" + Crypt.Encrypt(with_1.RDGatewayPassword, _password) + "\',";
}
else
{
_sqlQuery.CommandText += "\'" + "" + "\',";
}
if (this.SaveSecurity.Domain == true)
if (SaveSecurity.Domain)
{
_sqlQuery.CommandText += "\'" + with_1.RDGatewayDomain + "\',";
}
@@ -386,7 +388,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.UseCredSsp) + "\',";
if (this.SaveSecurity.Inheritance == true)
if (SaveSecurity.Inheritance)
{
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.CacheBitmaps) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.Colors) + "\',";
@@ -507,7 +509,7 @@ namespace mRemoteNG.Config.Connections
{
if (with_1.Parent != null)
{
_parentConstantId = Convert.ToString((with_1.Parent as ContainerInfo).ConnectionInfo.ConstantID);
_parentConstantId = Convert.ToString(with_1.Parent.ConnectionInfo.ConstantID);
}
else
{
@@ -516,9 +518,9 @@ namespace mRemoteNG.Config.Connections
}
else
{
if ((with_1.Parent as ContainerInfo).Parent != null)
if (with_1.Parent.Parent != null)
{
_parentConstantId = Convert.ToString(((with_1.Parent as ContainerInfo).Parent as ContainerInfo).ConnectionInfo.ConstantID);
_parentConstantId = Convert.ToString(with_1.Parent.Parent.ConnectionInfo.ConstantID);
}
else
{
@@ -526,7 +528,7 @@ namespace mRemoteNG.Config.Connections
}
}
_sqlQuery.CommandText += _currentNodeIndex + ",\'" + _parentConstantId + "\',\'" + with_1.ConstantID + "\',\'" + Tools.MiscTools.DBDate(DateTime.Now) + "\')";
_sqlQuery.CommandText += _currentNodeIndex + ",\'" + _parentConstantId + "\',\'" + with_1.ConstantID + "\',\'" + MiscTools.DBDate(DateTime.Now) + "\')";
}
#endregion
@@ -535,14 +537,14 @@ namespace mRemoteNG.Config.Connections
{
StreamReader streamReader = new StreamReader(ConnectionFileName);
string fileContents = "";
string fileContents;
fileContents = streamReader.ReadToEnd();
streamReader.Close();
if (!string.IsNullOrEmpty(fileContents))
{
StreamWriter streamWriter = new StreamWriter(ConnectionFileName);
streamWriter.Write(Security.Crypt.Encrypt(fileContents, _password));
streamWriter.Write(Crypt.Encrypt(fileContents, _password));
streamWriter.Close();
}
}
@@ -558,18 +560,18 @@ namespace mRemoteNG.Config.Connections
TreeNode treeNode = default(TreeNode);
if (Tree.ConnectionTreeNode.GetNodeType(RootTreeNode) == Tree.TreeNodeType.Root)
if (ConnectionTreeNode.GetNodeType(RootTreeNode) == TreeNodeType.Root)
{
treeNode = (TreeNode)RootTreeNode.Clone();
}
else
{
treeNode = new TreeNode("mR|Export (" + Tools.MiscTools.DBDate(DateTime.Now) + ")");
treeNode = new TreeNode("mR|Export (" + MiscTools.DBDate(DateTime.Now) + ")");
treeNode.Nodes.Add(Convert.ToString(RootTreeNode.Clone()));
}
string tempFileName = Path.GetTempFileName();
_xmlTextWriter = new XmlTextWriter(tempFileName, System.Text.Encoding.UTF8);
_xmlTextWriter = new XmlTextWriter(tempFileName, Encoding.UTF8);
_xmlTextWriter.Formatting = Formatting.Indented;
_xmlTextWriter.Indentation = 4;
@@ -582,22 +584,22 @@ namespace mRemoteNG.Config.Connections
if (Export)
{
_xmlTextWriter.WriteAttributeString("Protected", "", Security.Crypt.Encrypt("ThisIsNotProtected", _password));
_xmlTextWriter.WriteAttributeString("Protected", "", Crypt.Encrypt("ThisIsNotProtected", _password));
}
else
{
if ((treeNode.Tag as RootNodeInfo).Password == true)
if (((RootNodeInfo) treeNode.Tag).Password)
{
_password = Convert.ToString((treeNode.Tag as RootNodeInfo).PasswordString);
_xmlTextWriter.WriteAttributeString("Protected", "", Security.Crypt.Encrypt("ThisIsProtected", _password));
_password = Convert.ToString(((RootNodeInfo) treeNode.Tag).PasswordString);
_xmlTextWriter.WriteAttributeString("Protected", "", Crypt.Encrypt("ThisIsProtected", _password));
}
else
{
_xmlTextWriter.WriteAttributeString("Protected", "", Security.Crypt.Encrypt("ThisIsNotProtected", _password));
_xmlTextWriter.WriteAttributeString("Protected", "", Crypt.Encrypt("ThisIsNotProtected", _password));
}
}
_xmlTextWriter.WriteAttributeString("ConfVersion", "", App.Info.ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture));
_xmlTextWriter.WriteAttributeString("ConfVersion", "", ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture));
TreeNodeCollection treeNodeCollection = default(TreeNodeCollection);
treeNodeCollection = treeNode.Nodes;
@@ -624,7 +626,7 @@ namespace mRemoteNG.Config.Connections
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SaveToXml failed" + Environment.NewLine + ex.Message, false);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SaveToXml failed" + Environment.NewLine + ex.Message, false);
}
}
@@ -636,25 +638,25 @@ namespace mRemoteNG.Config.Connections
{
ConnectionInfo curConI = default(ConnectionInfo);
if (Tree.ConnectionTreeNode.GetNodeType(node) == Tree.TreeNodeType.Connection | Tree.ConnectionTreeNode.GetNodeType(node) == Tree.TreeNodeType.Container)
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection | ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container)
{
_xmlTextWriter.WriteStartElement("Node");
_xmlTextWriter.WriteAttributeString("Name", "", node.Text);
_xmlTextWriter.WriteAttributeString("Type", "", Tree.ConnectionTreeNode.GetNodeType(node).ToString());
_xmlTextWriter.WriteAttributeString("Type", "", ConnectionTreeNode.GetNodeType(node).ToString());
}
if (Tree.ConnectionTreeNode.GetNodeType(node) == Tree.TreeNodeType.Container) //container
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container) //container
{
_xmlTextWriter.WriteAttributeString("Expanded", "", Convert.ToString(this.ContainerList[node.Tag].TreeNode.IsExpanded));
curConI = this.ContainerList[node.Tag].ConnectionInfo;
_xmlTextWriter.WriteAttributeString("Expanded", "", Convert.ToString(ContainerList[node.Tag].TreeNode.IsExpanded));
curConI = ContainerList[node.Tag].ConnectionInfo;
SaveConnectionFields(curConI);
SaveNode(node.Nodes);
_xmlTextWriter.WriteEndElement();
}
if (Tree.ConnectionTreeNode.GetNodeType(node) == Tree.TreeNodeType.Connection)
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection)
{
curConI = this.ConnectionList[node.Tag];
curConI = ConnectionList[node.Tag];
SaveConnectionFields(curConI);
_xmlTextWriter.WriteEndElement();
}
@@ -662,7 +664,7 @@ namespace mRemoteNG.Config.Connections
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SaveNode failed" + Environment.NewLine + ex.Message, true);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SaveNode failed" + Environment.NewLine + ex.Message, true);
}
}
@@ -676,7 +678,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("Panel", "", curConI.Panel);
if (this.SaveSecurity.Username == true)
if (SaveSecurity.Username)
{
_xmlTextWriter.WriteAttributeString("Username", "", curConI.Username);
}
@@ -685,7 +687,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("Username", "", "");
}
if (this.SaveSecurity.Domain == true)
if (SaveSecurity.Domain)
{
_xmlTextWriter.WriteAttributeString("Domain", "", curConI.Domain);
}
@@ -694,9 +696,9 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("Domain", "", "");
}
if (this.SaveSecurity.Password == true)
if (SaveSecurity.Password)
{
_xmlTextWriter.WriteAttributeString("Password", "", Security.Crypt.Encrypt(curConI.Password, _password));
_xmlTextWriter.WriteAttributeString("Password", "", Crypt.Encrypt(curConI.Password, _password));
}
else
{
@@ -773,7 +775,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("VNCProxyIP", "", curConI.VNCProxyIP);
_xmlTextWriter.WriteAttributeString("VNCProxyPort", "", Convert.ToString(curConI.VNCProxyPort));
_xmlTextWriter.WriteAttributeString("VNCProxyUsername", "", curConI.VNCProxyUsername);
_xmlTextWriter.WriteAttributeString("VNCProxyPassword", "", Security.Crypt.Encrypt(curConI.VNCProxyPassword, _password));
_xmlTextWriter.WriteAttributeString("VNCProxyPassword", "", Crypt.Encrypt(curConI.VNCProxyPassword, _password));
_xmlTextWriter.WriteAttributeString("VNCColors", "", curConI.VNCColors.ToString());
_xmlTextWriter.WriteAttributeString("VNCSmartSizeMode", "", curConI.VNCSmartSizeMode.ToString());
_xmlTextWriter.WriteAttributeString("VNCViewOnly", "", Convert.ToString(curConI.VNCViewOnly));
@@ -783,7 +785,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("RDGatewayUseConnectionCredentials", "", curConI.RDGatewayUseConnectionCredentials.ToString());
if (this.SaveSecurity.Username == true)
if (SaveSecurity.Username)
{
_xmlTextWriter.WriteAttributeString("RDGatewayUsername", "", curConI.RDGatewayUsername);
}
@@ -792,16 +794,16 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("RDGatewayUsername", "", "");
}
if (this.SaveSecurity.Password == true)
if (SaveSecurity.Password)
{
_xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", Security.Crypt.Encrypt(curConI.RDGatewayPassword, _password));
_xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", Crypt.Encrypt(curConI.RDGatewayPassword, _password));
}
else
{
_xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", "");
}
if (this.SaveSecurity.Domain == true)
if (SaveSecurity.Domain)
{
_xmlTextWriter.WriteAttributeString("RDGatewayDomain", "", curConI.RDGatewayDomain);
}
@@ -810,7 +812,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("RDGatewayDomain", "", "");
}
if (this.SaveSecurity.Inheritance == true)
if (SaveSecurity.Inheritance)
{
_xmlTextWriter.WriteAttributeString("InheritCacheBitmaps", "", Convert.ToString(curConI.Inheritance.CacheBitmaps));
_xmlTextWriter.WriteAttributeString("InheritColors", "", Convert.ToString(curConI.Inheritance.Colors));
@@ -920,7 +922,7 @@ namespace mRemoteNG.Config.Connections
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SaveConnectionFields failed" + Environment.NewLine + ex.Message, true);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SaveConnectionFields failed" + Environment.NewLine + ex.Message, true);
}
}
#endregion
@@ -930,7 +932,7 @@ namespace mRemoteNG.Config.Connections
private void SaveTomRCSV()
{
if (App.Runtime.IsConnectionsFileLoaded == false)
if (Runtime.IsConnectionsFileLoaded == false)
{
return;
}
@@ -981,13 +983,13 @@ namespace mRemoteNG.Config.Connections
{
foreach (TreeNode node in tNC)
{
if (Tree.ConnectionTreeNode.GetNodeType(node) == Tree.TreeNodeType.Connection)
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection)
{
ConnectionInfo curConI = (ConnectionInfo)node.Tag;
WritemRCSVLine(curConI);
}
else if (Tree.ConnectionTreeNode.GetNodeType(node) == Tree.TreeNodeType.Container)
else if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container)
{
SaveNodemRCSV(node.Nodes);
}
@@ -1030,7 +1032,7 @@ namespace mRemoteNG.Config.Connections
csvLn += con.Domain + ";";
}
csvLn += con.Hostname + ";" + con.Protocol.ToString() + ";" + con.PuttySession + ";" + Convert.ToString(con.Port) + ";" + Convert.ToString(con.UseConsoleSession) + ";" + Convert.ToString(con.UseCredSsp) + ";" + con.RenderingEngine.ToString() + ";" + con.ICAEncryption.ToString() + ";" + con.RDPAuthenticationLevel.ToString() + ";" + con.LoadBalanceInfo + ";" + con.Colors.ToString() + ";" + con.Resolution.ToString() + ";" + Convert.ToString(con.AutomaticResize) + ";" + Convert.ToString(con.DisplayWallpaper) + ";" + Convert.ToString(con.DisplayThemes) + ";" + Convert.ToString(con.EnableFontSmoothing) + ";" + Convert.ToString(con.EnableDesktopComposition) + ";" + Convert.ToString(con.CacheBitmaps) + ";" + Convert.ToString(con.RedirectDiskDrives) + ";" + Convert.ToString(con.RedirectPorts) + ";" + Convert.ToString(con.RedirectPrinters) + ";" + Convert.ToString(con.RedirectSmartCards) + ";" + con.RedirectSound.ToString() + ";" + Convert.ToString(con.RedirectKeys) + ";" + con.PreExtApp + ";" + con.PostExtApp + ";" + con.MacAddress + ";" + con.UserField + ";" + con.ExtApp + ";" + con.VNCCompression.ToString() + ";" + con.VNCEncoding.ToString() + ";" + con.VNCAuthMode.ToString() + ";" + con.VNCProxyType.ToString() + ";" + con.VNCProxyIP + ";" + Convert.ToString(con.VNCProxyPort) + ";" + con.VNCProxyUsername + ";" + con.VNCProxyPassword + ";" + con.VNCColors.ToString() + ";" + con.VNCSmartSizeMode.ToString() + ";" + Convert.ToString(con.VNCViewOnly) + ";";
csvLn += con.Hostname + ";" + con.Protocol + ";" + con.PuttySession + ";" + Convert.ToString(con.Port) + ";" + Convert.ToString(con.UseConsoleSession) + ";" + Convert.ToString(con.UseCredSsp) + ";" + con.RenderingEngine + ";" + con.ICAEncryption + ";" + con.RDPAuthenticationLevel + ";" + con.LoadBalanceInfo + ";" + con.Colors + ";" + con.Resolution + ";" + Convert.ToString(con.AutomaticResize) + ";" + Convert.ToString(con.DisplayWallpaper) + ";" + Convert.ToString(con.DisplayThemes) + ";" + Convert.ToString(con.EnableFontSmoothing) + ";" + Convert.ToString(con.EnableDesktopComposition) + ";" + Convert.ToString(con.CacheBitmaps) + ";" + Convert.ToString(con.RedirectDiskDrives) + ";" + Convert.ToString(con.RedirectPorts) + ";" + Convert.ToString(con.RedirectPrinters) + ";" + Convert.ToString(con.RedirectSmartCards) + ";" + con.RedirectSound + ";" + Convert.ToString(con.RedirectKeys) + ";" + con.PreExtApp + ";" + con.PostExtApp + ";" + con.MacAddress + ";" + con.UserField + ";" + con.ExtApp + ";" + con.VNCCompression + ";" + con.VNCEncoding + ";" + con.VNCAuthMode + ";" + con.VNCProxyType + ";" + con.VNCProxyIP + ";" + Convert.ToString(con.VNCProxyPort) + ";" + con.VNCProxyUsername + ";" + con.VNCProxyPassword + ";" + con.VNCColors + ";" + con.VNCSmartSizeMode + ";" + Convert.ToString(con.VNCViewOnly) + ";";
if (SaveSecurity.Inheritance)
{
@@ -1045,7 +1047,7 @@ namespace mRemoteNG.Config.Connections
#region vRD CSV
private void SaveTovRDCSV()
{
if (App.Runtime.IsConnectionsFileLoaded == false)
if (Runtime.IsConnectionsFileLoaded == false)
{
return;
}
@@ -1067,16 +1069,16 @@ namespace mRemoteNG.Config.Connections
{
foreach (TreeNode node in tNC)
{
if (Tree.ConnectionTreeNode.GetNodeType(node) == Tree.TreeNodeType.Connection)
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection)
{
ConnectionInfo curConI = (ConnectionInfo)node.Tag;
if (curConI.Protocol == Connection.Protocol.ProtocolType.RDP)
if (curConI.Protocol == ProtocolType.RDP)
{
WritevRDCSVLine(curConI);
}
}
else if (Tree.ConnectionTreeNode.GetNodeType(node) == Tree.TreeNodeType.Container)
else if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container)
{
SaveNodevRDCSV(node.Nodes);
}
@@ -1107,7 +1109,7 @@ namespace mRemoteNG.Config.Connections
#region vRD VRE
private void SaveToVRE()
{
if (App.Runtime.IsConnectionsFileLoaded == false)
if (Runtime.IsConnectionsFileLoaded == false)
{
return;
}
@@ -1118,7 +1120,7 @@ namespace mRemoteNG.Config.Connections
TreeNodeCollection tNC = default(TreeNodeCollection);
tNC = tN.Nodes;
_xmlTextWriter = new XmlTextWriter(ConnectionFileName, System.Text.Encoding.UTF8);
_xmlTextWriter = new XmlTextWriter(ConnectionFileName, Encoding.UTF8);
_xmlTextWriter.Formatting = Formatting.Indented;
_xmlTextWriter.Indentation = 4;
@@ -1140,11 +1142,11 @@ namespace mRemoteNG.Config.Connections
{
foreach (TreeNode node in tNC)
{
if (Tree.ConnectionTreeNode.GetNodeType(node) == Tree.TreeNodeType.Connection)
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection)
{
ConnectionInfo curConI = (ConnectionInfo)node.Tag;
if (curConI.Protocol == Connection.Protocol.ProtocolType.RDP)
if (curConI.Protocol == ProtocolType.RDP)
{
_xmlTextWriter.WriteStartElement("Connection");
_xmlTextWriter.WriteAttributeString("Id", "", "");

View File

@@ -1,17 +1,8 @@
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.DirectoryServices;
using mRemoteNG.App;
using System.Text.RegularExpressions;
using mRemoteNG.My;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Tree;
@@ -24,14 +15,14 @@ namespace mRemoteNG.Config.Import
{
try
{
TreeNode treeNode = Tree.ConnectionTreeNode.AddNode(TreeNodeType.Container);
var treeNode = ConnectionTreeNode.AddNode(TreeNodeType.Container);
ContainerInfo containerInfo = new ContainerInfo();
var containerInfo = new ContainerInfo();
containerInfo.TreeNode = treeNode;
containerInfo.ConnectionInfo = new ConnectionInfo(containerInfo);
string name = "";
Match match = Regex.Match(ldapPath, "ou=([^,]*)", RegexOptions.IgnoreCase);
var name = "";
var match = Regex.Match(ldapPath, "ou=([^,]*)", RegexOptions.IgnoreCase);
if (match.Success)
{
name = match.Groups[1].Captures[0].Value;
@@ -64,7 +55,7 @@ namespace mRemoteNG.Config.Import
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(message: "Config.Import.ActiveDirectory.Import() failed.", ex: ex, logOnly: true);
Runtime.MessageCollector.AddExceptionMessage("Config.Import.ActiveDirectory.Import() failed.", ex, logOnly: true);
}
}
@@ -72,15 +63,11 @@ namespace mRemoteNG.Config.Import
{
try
{
string strDisplayName = "";
string strDescription = "";
string strHostName = "";
const string ldapFilter = "(objectClass=computer)";
const string ldapFilter = "(objectClass=computer)";
DirectorySearcher ldapSearcher = new DirectorySearcher();
SearchResultCollection ldapResults = default(SearchResultCollection);
SearchResult ldapResult = default(SearchResult);
var ldapSearcher = new DirectorySearcher();
var ldapResults = default(SearchResultCollection);
var ldapResult = default(SearchResult);
ldapSearcher.SearchRoot = new DirectoryEntry(ldapPath);
ldapSearcher.PropertiesToLoad.AddRange(new[] {"securityEquals", "cn"});
@@ -92,26 +79,26 @@ namespace mRemoteNG.Config.Import
foreach (SearchResult tempLoopVar_ldapResult in ldapResults)
{
ldapResult = tempLoopVar_ldapResult;
System.DirectoryServices.DirectoryEntry with_2 = ldapResult.GetDirectoryEntry();
strDisplayName = Convert.ToString(with_2.Properties["cn"].Value);
strDescription = Convert.ToString(with_2.Properties["Description"].Value);
strHostName = Convert.ToString(with_2.Properties["dNSHostName"].Value);
var with_2 = ldapResult.GetDirectoryEntry();
var displayName = Convert.ToString(with_2.Properties["cn"].Value);
var description = Convert.ToString(with_2.Properties["Description"].Value);
var hostName = Convert.ToString(with_2.Properties["dNSHostName"].Value);
TreeNode treeNode = Tree.ConnectionTreeNode.AddNode(TreeNodeType.Connection, strDisplayName);
var treeNode = ConnectionTreeNode.AddNode(TreeNodeType.Connection, displayName);
ConnectionInfo connectionInfo = new ConnectionInfo();
ConnectionInfoInheritance inheritanceInfo = new ConnectionInfoInheritance(connectionInfo, true);
var connectionInfo = new ConnectionInfo();
var inheritanceInfo = new ConnectionInfoInheritance(connectionInfo, true);
inheritanceInfo.Description = false;
if (parentTreeNode.Tag is ContainerInfo)
{
connectionInfo.Parent = (ContainerInfo)parentTreeNode.Tag;
}
connectionInfo.Inheritance = inheritanceInfo;
connectionInfo.Name = strDisplayName;
connectionInfo.Hostname = strHostName;
connectionInfo.Description = strDescription;
connectionInfo.Name = displayName;
connectionInfo.Hostname = hostName;
connectionInfo.Description = description;
connectionInfo.TreeNode = treeNode;
treeNode.Name = strDisplayName;
treeNode.Name = displayName;
treeNode.Tag = connectionInfo; //set the nodes tag to the conI
//add connection to connections
Runtime.ConnectionList.Add(connectionInfo);
@@ -121,7 +108,7 @@ namespace mRemoteNG.Config.Import
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(message: "Config.Import.ActiveDirectory.ImportComputers() failed.", ex: ex, logOnly: true);
Runtime.MessageCollector.AddExceptionMessage("Config.Import.ActiveDirectory.ImportComputers() failed.", ex, logOnly: true);
}
}
}

View File

@@ -1,11 +1,3 @@
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 mRemoteNG.App;
@@ -22,12 +14,12 @@ namespace mRemoteNG.Config.Import
{
foreach (Tools.PortScan.ScanHost host in hosts)
{
ProtocolType finalProtocol = default(ProtocolType);
bool protocolValid = false;
var finalProtocol = default(ProtocolType);
var protocolValid = false;
TreeNode treeNode = Tree.ConnectionTreeNode.AddNode(Tree.TreeNodeType.Connection, host.HostNameWithoutDomain);
var treeNode = Tree.ConnectionTreeNode.AddNode(Tree.TreeNodeType.Connection, host.HostNameWithoutDomain);
ConnectionInfo connectionInfo = new ConnectionInfo();
var connectionInfo = new ConnectionInfo();
connectionInfo.Inheritance = new ConnectionInfoInheritance(connectionInfo);
connectionInfo.Name = host.HostNameWithoutDomain;

View File

@@ -1,12 +1,4 @@
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.Xml;
using System.IO;

View File

@@ -1,12 +1,4 @@
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.IO;
using mRemoteNG.App;

View File

@@ -1,12 +1,3 @@
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.IO;
using mRemoteNG.App;
@@ -23,11 +14,11 @@ namespace mRemoteNG.Config.Import
{
public static void Import(string fileName, TreeNode parentTreeNode)
{
string name = Path.GetFileNameWithoutExtension(fileName);
TreeNode treeNode = new TreeNode(name);
var name = Path.GetFileNameWithoutExtension(fileName);
var treeNode = new TreeNode(name);
parentTreeNode.Nodes.Add(treeNode);
ContainerInfo containerInfo = new ContainerInfo
var containerInfo = new ContainerInfo
{
TreeNode = treeNode,
Name = name
@@ -51,14 +42,16 @@ namespace mRemoteNG.Config.Import
treeNode.Tag = containerInfo;
treeNode.ImageIndex = (int)TreeImageType.Container;
treeNode.SelectedImageIndex = (int)TreeImageType.Container;
ConnectionsLoader connectionsLoad = new ConnectionsLoader();
connectionsLoad.ConnectionFileName = fileName;
connectionsLoad.RootTreeNode = treeNode;
connectionsLoad.ConnectionList = Runtime.ConnectionList;
connectionsLoad.ContainerList = Runtime.ContainerList;
connectionsLoad.LoadConnections(true);
var connectionsLoad = new ConnectionsLoader
{
ConnectionFileName = fileName,
RootTreeNode = treeNode,
ConnectionList = Runtime.ConnectionList,
ContainerList = Runtime.ContainerList
};
connectionsLoad.LoadConnections(true);
Runtime.ContainerList.Add(containerInfo);
}

View File

@@ -19,7 +19,7 @@ namespace mRemoteNG.Config.Settings
public void LoadExternalAppsFromXML()
{
string oldPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + SettingsFileInfo.ExtAppsFilesName;
string oldPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\" + GeneralAppInfo.ProdName + "\\" + SettingsFileInfo.ExtAppsFilesName;
string newPath = SettingsFileInfo.SettingsPath + "\\" + SettingsFileInfo.ExtAppsFilesName;
XmlDocument xDom = new XmlDocument();
if (File.Exists(newPath))

View File

@@ -34,7 +34,7 @@ namespace mRemoteNG.Config.Settings
CreatePanels();
#if !PORTABLE
string oldPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + SettingsFileInfo.LayoutFileName;
string oldPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\" + GeneralAppInfo.ProdName + "\\" + SettingsFileInfo.LayoutFileName;
#endif
string newPath = SettingsFileInfo.SettingsPath + "\\" + SettingsFileInfo.LayoutFileName;
if (File.Exists(newPath))

View File

@@ -9,14 +9,14 @@ namespace mRemoteNG.Connection
{
public class ConnectionIcon : StringConverter
{
public static string[] Icons = new string[] {};
public static string[] Icons = {};
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context)
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(Icons);
}
public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context)
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
@@ -26,21 +26,22 @@ namespace mRemoteNG.Connection
return true;
}
public static System.Drawing.Icon FromString(string IconName)
public static System.Drawing.Icon FromString(string iconName)
{
try
{
string IconPath = GeneralAppInfo.HomePath + "\\Icons\\" + IconName +".ico";
var iconPath = $"{GeneralAppInfo.HomePath}\\Icons\\{iconName}.ico";
if (System.IO.File.Exists(IconPath))
if (System.IO.File.Exists(iconPath))
{
System.Drawing.Icon nI = new System.Drawing.Icon(IconPath);
var nI = new System.Drawing.Icon(iconPath);
return nI;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t get Icon from String" + Environment.NewLine + ex.Message);
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
$"Couldn\'t get Icon from String" + Environment.NewLine + ex.Message);
}
return null;
}

View File

@@ -2,7 +2,6 @@ using System;
using System.Drawing;
using System.Diagnostics;
using AxMSTSCLib;
using Microsoft.VisualBasic;
using System.Collections;
using System.Windows.Forms;
using System.Threading;
@@ -153,7 +152,7 @@ namespace mRemoteNG.Connection.Protocol.RDP
SetLoadBalanceInfo();
SetRdGateway();
_rdpClient.ColorDepth = Convert.ToInt32(Conversion.Int(_connectionInfo.Colors));
_rdpClient.ColorDepth = (int)_connectionInfo.Colors;
SetPerformanceFlags();
@@ -537,7 +536,7 @@ namespace mRemoteNG.Connection.Protocol.RDP
_rdpClient.AdvancedSettings2.RedirectPorts = _connectionInfo.RedirectPorts;
_rdpClient.AdvancedSettings2.RedirectPrinters = _connectionInfo.RedirectPrinters;
_rdpClient.AdvancedSettings2.RedirectSmartCards = _connectionInfo.RedirectSmartCards;
_rdpClient.SecuredSettings2.AudioRedirectionMode = Convert.ToInt32(Conversion.Int(_connectionInfo.RedirectSound));
_rdpClient.SecuredSettings2.AudioRedirectionMode = (int)_connectionInfo.RedirectSound;
}
catch (Exception ex)
{
@@ -552,22 +551,22 @@ namespace mRemoteNG.Connection.Protocol.RDP
int pFlags = 0;
if (_connectionInfo.DisplayThemes == false)
{
pFlags += Convert.ToInt32(Conversion.Int(RDPPerformanceFlags.DisableThemes));
pFlags += Convert.ToInt32(RDPPerformanceFlags.DisableThemes);
}
if (_connectionInfo.DisplayWallpaper == false)
{
pFlags += Convert.ToInt32(Conversion.Int(RDPPerformanceFlags.DisableWallpaper));
pFlags += Convert.ToInt32(RDPPerformanceFlags.DisableWallpaper);
}
if (_connectionInfo.EnableFontSmoothing)
{
pFlags += Convert.ToInt32(Conversion.Int(RDPPerformanceFlags.EnableFontSmoothing));
pFlags += Convert.ToInt32(RDPPerformanceFlags.EnableFontSmoothing);
}
if (_connectionInfo.EnableDesktopComposition)
{
pFlags += Convert.ToInt32(Conversion.Int(RDPPerformanceFlags.EnableDesktopComposition));
pFlags += Convert.ToInt32(RDPPerformanceFlags.EnableDesktopComposition);
}
_rdpClient.AdvancedSettings2.PerformanceFlags = pFlags;

File diff suppressed because it is too large Load Diff

View File

@@ -1112,7 +1112,7 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for
<value>mRemoteNGヘルプ</value>
</data>
<data name="strMenuJumpTo" xml:space="preserve">
<value>Jump To</value>
<value>移動先</value>
</data>
<data name="strMenuLaunchExternalTool" xml:space="preserve">
<value>外部ツールの立ち上げ</value>
@@ -1124,7 +1124,7 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for
<value>新規外部ツール</value>
</data>
<data name="strMenuNotifications" xml:space="preserve">
<value>Notifications</value>
<value>通知</value>
</data>
<data name="strMenuNotificationsCopyAll" xml:space="preserve">
<value>全てコピー</value>
@@ -1172,10 +1172,10 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for
<value>バグを報告する</value>
</data>
<data name="strMenuResetLayout" xml:space="preserve">
<value>Reset layout</value>
<value>レイアウトを初期化</value>
</data>
<data name="strMenuSaveConnectionFile" xml:space="preserve">
<value>Save Connection File</value>
<value>接続ファイルの保存</value>
</data>
<data name="strMenuSaveConnectionFileAs" xml:space="preserve">
<value>Save Connection File As...</value>
@@ -1277,7 +1277,7 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for
<value>No Ext. App specified.</value>
</data>
<data name="strNoInformation" xml:space="preserve">
<value>なし</value>
<value>情報がありません</value>
</data>
<data name="strNone" xml:space="preserve">
<value>なし</value>
@@ -1347,13 +1347,13 @@ If you run into such an error, please create a new connection file!</comment>
<value>新規(&amp;N)</value>
</data>
<data name="strPanelName" xml:space="preserve">
<value>Panel Name</value>
<value>パネル名</value>
</data>
<data name="strPasswordProtect" xml:space="preserve">
<value>Password protect</value>
<value>パスワードの保護</value>
</data>
<data name="strPasswordStatusMustMatch" xml:space="preserve">
<value>Both passwords must match.</value>
<value>同じパスワードを入力してください</value>
</data>
<data name="strPasswordStatusTooShort" xml:space="preserve">
<value>The password must be at least 3 characters long.</value>
@@ -1506,7 +1506,7 @@ If you run into such an error, please create a new connection file!</comment>
<value>Feel free to enter any information you need here.</value>
</data>
<data name="strPropertyDescriptionUsername" xml:space="preserve">
<value>Enter your username.</value>
<value>ユーザー名を入力してください</value>
</data>
<data name="strPropertyDescriptionViewOnly" xml:space="preserve">
<value>If you want to establish a view only connection to the host select yes.</value>
@@ -1530,7 +1530,7 @@ If you run into such an error, please create a new connection file!</comment>
<value>Hostname/IP</value>
</data>
<data name="strPropertyNameAll" xml:space="preserve">
<value>All</value>
<value>全て</value>
</data>
<data name="strPropertyNameAuthenticationLevel" xml:space="preserve">
<value>Server Authentication</value>
@@ -1545,7 +1545,7 @@ If you run into such an error, please create a new connection file!</comment>
<value>Cache Bitmaps</value>
</data>
<data name="strPropertyNameColors" xml:space="preserve">
<value>Colours</value>
<value></value>
</data>
<data name="strPropertyNameCompression" xml:space="preserve">
<value>Compression</value>
@@ -1584,31 +1584,31 @@ If you run into such an error, please create a new connection file!</comment>
<value>External Tool Before</value>
</data>
<data name="strPropertyNameIcon" xml:space="preserve">
<value>Icon</value>
<value>アイコン</value>
</data>
<data name="strPropertyNameLoadBalanceInfo" xml:space="preserve">
<value>Load Balance Info</value>
</data>
<data name="strPropertyNameMACAddress" xml:space="preserve">
<value>MAC Address</value>
<value>MACアドレス</value>
</data>
<data name="strPropertyNameName" xml:space="preserve">
<value>Name</value>
<value>名前</value>
</data>
<data name="strPropertyNamePanel" xml:space="preserve">
<value>Panel</value>
<value>パネル</value>
</data>
<data name="strPropertyNamePassword" xml:space="preserve">
<value>Password</value>
<value>パスワード</value>
</data>
<data name="strPropertyNamePort" xml:space="preserve">
<value>Port</value>
<value>ポート</value>
</data>
<data name="strPropertyNameProtocol" xml:space="preserve">
<value>Protocol</value>
<value>プロトコル</value>
</data>
<data name="strPropertyNamePuttySession" xml:space="preserve">
<value>PuTTY Session</value>
<value>PuTTYのセッション</value>
</data>
<data name="strPropertyNameRDGatewayDomain" xml:space="preserve">
<value>Gateway Domain</value>
@@ -1635,16 +1635,16 @@ If you run into such an error, please create a new connection file!</comment>
<value>Key Combinations</value>
</data>
<data name="strPropertyNameRedirectPorts" xml:space="preserve">
<value>Ports</value>
<value>ポート</value>
</data>
<data name="strPropertyNameRedirectPrinters" xml:space="preserve">
<value>Printers</value>
<value>プリンター</value>
</data>
<data name="strPropertyNameRedirectSmartCards" xml:space="preserve">
<value>Smart Cards</value>
<value>スマートカード</value>
</data>
<data name="strPropertyNameRedirectSounds" xml:space="preserve">
<value>Sounds</value>
<value>サウンド</value>
</data>
<data name="strPropertyNameRenderingEngine" xml:space="preserve">
<value>Rendering Engine</value>
@@ -1956,7 +1956,7 @@ Message:
<value>遠隔ファイル</value>
</data>
<data name="strRemoveAll" xml:space="preserve">
<value>すべて削除</value>
<value>て削除</value>
</data>
<data name="strRename" xml:space="preserve">
<value>名前の変更</value>
@@ -1968,7 +1968,7 @@ Message:
<value>保存</value>
</data>
<data name="strSaveAll" xml:space="preserve">
<value>すべて保存</value>
<value>て保存</value>
</data>
<data name="strSaveConnectionsFileBeforeOpeningAnother" xml:space="preserve">
<value>Do you want to save the current connections file before loading another?</value>
@@ -2040,13 +2040,13 @@ Message:
<value>Socks 5</value>
</data>
<data name="strSort" xml:space="preserve">
<value>Sort</value>
<value>並び替え</value>
</data>
<data name="strSortAsc" xml:space="preserve">
<value>Ascending (A-Z)</value>
<value>昇順</value>
</data>
<data name="strSortDesc" xml:space="preserve">
<value>Descending (Z-A)</value>
<value>降順</value>
</data>
<data name="strSpecialKeys" xml:space="preserve">
<value>Special Keys</value>
@@ -2061,34 +2061,34 @@ Message:
<value>SQL Update check finished and there is an update available! Going to refresh connections.</value>
</data>
<data name="strSsh1" xml:space="preserve">
<value>SSH version 1</value>
<value>SSHバージョン1</value>
</data>
<data name="strSsh2" xml:space="preserve">
<value>SSH version 2</value>
<value>SSHバージョン2</value>
</data>
<data name="strSSHStartTransferBG" xml:space="preserve">
<value>SSH background transfer failed!</value>
</data>
<data name="strSSHTranferSuccessful" xml:space="preserve">
<value>Transfer successful!</value>
<value>転送に成功しました</value>
</data>
<data name="strSSHTransferEndFailed" xml:space="preserve">
<value>SSH Transfer End (UI.Window.SSHTransfer) failed!</value>
</data>
<data name="strSSHTransferFailed" xml:space="preserve">
<value>SSH transfer failed.</value>
<value>SSH経由の転送に失敗しました</value>
</data>
<data name="strStartIP" xml:space="preserve">
<value>Start IP</value>
<value>開始IP</value>
</data>
<data name="strStartPort" xml:space="preserve">
<value>Start Port</value>
<value>開始のポート</value>
</data>
<data name="strStartupExit" xml:space="preserve">
<value>Startup/Exit</value>
</data>
<data name="strStatus" xml:space="preserve">
<value>Status</value>
<value>ステータス</value>
</data>
<data name="strSwitchToErrorsAndInfos" xml:space="preserve">
<value>Switch to Notifications panel on:</value>
@@ -2115,7 +2115,7 @@ Message:
<value>設定パネル</value>
</data>
<data name="strThemeCategoryConnectionsPanel" xml:space="preserve">
<value>Connections Panel</value>
<value>接続パネル</value>
</data>
<data name="strThemeCategoryGeneral" xml:space="preserve">
<value>General</value>
@@ -2220,10 +2220,10 @@ Message:
<value>Toolbar Text Colour</value>
</data>
<data name="strThemeNameWindowBackgroundColor" xml:space="preserve">
<value>Window Background Colour</value>
<value>ウィンドウの背景色</value>
</data>
<data name="strTitleError" xml:space="preserve">
<value>Error ({0})</value>
<value>エラー({0})</value>
</data>
<data name="strTitleInformation" xml:space="preserve">
<value>Information ({0})</value>
@@ -2235,22 +2235,22 @@ Message:
<value>Password for {0}</value>
</data>
<data name="strTitleSelectPanel" xml:space="preserve">
<value>Select Panel</value>
<value>パネルを選択</value>
</data>
<data name="strTitleWarning" xml:space="preserve">
<value>Warning ({0})</value>
</data>
<data name="strTransfer" xml:space="preserve">
<value>Transfer</value>
<value>転送</value>
</data>
<data name="strTransferFailed" xml:space="preserve">
<value>Transfer failed!</value>
<value>転送中にエラーが発生しました</value>
</data>
<data name="strTryIntegrate" xml:space="preserve">
<value>Try to integrate</value>
</data>
<data name="strType" xml:space="preserve">
<value>Type</value>
<value>種類</value>
</data>
<data name="strUltraVncRepeater" xml:space="preserve">
<value>Ultra VNC Repeater</value>
@@ -2262,7 +2262,7 @@ Message:
<value>Uncheck the properties you want not to be saved!</value>
</data>
<data name="strUnnamedTheme" xml:space="preserve">
<value>Unnamed Theme</value>
<value>無名のテーマ</value>
</data>
<data name="strUpdateAvailable" xml:space="preserve">
<value>mRemoteNG requires an update</value>
@@ -2274,17 +2274,17 @@ Message:
<value>The update information could not be downloaded.</value>
</data>
<data name="strUpdateCheckFailedLabel" xml:space="preserve">
<value>Check failed</value>
<value>確認に失敗しました</value>
</data>
<data name="strUpdateCheckingLabel" xml:space="preserve">
<value>Checking for updates...</value>
<value>更新を確認しています…</value>
</data>
<data name="strUpdateCheckPortableEdition" xml:space="preserve">
<value>mRemoteNG Portable Edition does not currently support automatic updates.</value>
</data>
<data name="strUpdateDownloadComplete" xml:space="preserve">
<value>Download complete!
mRemoteNG will now quit and begin with the installation.</value>
<value>ダウンロードが終了しました
mRemoteNGを終了してインストールを開始します</value>
</data>
<data name="strUpdateDownloadCompleteFailed" xml:space="preserve">
<value>The update could not be downloaded.</value>
@@ -2293,16 +2293,16 @@ mRemoteNG will now quit and begin with the installation.</value>
<value>The update download could not be initiated.</value>
</data>
<data name="strUpdateFrequencyCustom" xml:space="preserve">
<value>Every {0} days</value>
<value>{0}日毎</value>
</data>
<data name="strUpdateFrequencyDaily" xml:space="preserve">
<value>Daily</value>
<value>毎日</value>
</data>
<data name="strUpdateFrequencyMonthly" xml:space="preserve">
<value>Monthly</value>
<value>毎月</value>
</data>
<data name="strUpdateFrequencyWeekly" xml:space="preserve">
<value>Weekly</value>
<value>毎週</value>
</data>
<data name="strUpdateGetAnnouncementInfoFailed" xml:space="preserve">
<value>The announcement information could not be downloaded.</value>
@@ -2317,7 +2317,7 @@ mRemoteNG will now quit and begin with the installation.</value>
<value>Use only Notifications panel (no messagebox popups)</value>
</data>
<data name="strUser" xml:space="preserve">
<value>User</value>
<value>ユーザー</value>
</data>
<data name="strUseSameUsernameAndPassword" xml:space="preserve">
<value>Use the same username and password</value>
@@ -2368,7 +2368,7 @@ mRemoteNG will now quit and begin with the installation.</value>
<value>Warn me if authentication fails</value>
</data>
<data name="strWarnings" xml:space="preserve">
<value>Warnings</value>
<value>警告</value>
</data>
<data name="strWeifenLuoAttribution" xml:space="preserve">
<value>Uses the DockPanel Suite by [Weifen Luo]</value>
@@ -2377,12 +2377,12 @@ mRemoteNG will now quit and begin with the installation.</value>
<value>http://sourceforge.net/projects/dockpanelsuite/</value>
</data>
<data name="strWriteLogFile" xml:space="preserve">
<value>Write log file (mRemoteNG.log)</value>
<value>ログファイルを書き出す(mRemoteNG.log)</value>
</data>
<data name="strXULrunnerPath" xml:space="preserve">
<value>XULrunner path:</value>
<value>XULRunnerのパス:</value>
</data>
<data name="strYes" xml:space="preserve">
<value>Yes</value>
<value>はい</value>
</data>
</root>

View File

@@ -1,8 +1,8 @@
using System;
using Microsoft.VisualBasic;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using mRemoteNG.App;
@@ -39,21 +39,23 @@ namespace mRemoteNG.Security
private string GetErrorMessage(int errorCode)
{
int messageSize = 255;
string lpMsgBuf = "";
int dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
string lpMsgBuf = "";
int dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
IntPtr ptrlpSource = IntPtr.Zero;
IntPtr prtArguments = IntPtr.Zero;
int retVal = FormatMessage(dwFlags, ref ptrlpSource, errorCode, 0, ref lpMsgBuf, messageSize, ref prtArguments);
return lpMsgBuf.Trim(new char[] {char.Parse(Constants.vbCr), char.Parse(Constants.vbLf)});
lpMsgBuf = Regex.Replace(lpMsgBuf, @"\r\n|\n|\r", " ");
return lpMsgBuf;
}
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]public void StartImpersonation(string DomainName, string UserName, string Password)
{
try
{
if (!(impersonatedUser == null))
if (impersonatedUser != null)
{
throw (new Exception("Already impersonating a user."));
}

View File

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

View File

@@ -1,10 +1,5 @@
using mRemoteNG.My;
namespace mRemoteNG
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class ReconnectGroup : System.Windows.Forms.UserControl
{
//UserControl overrides dispose to clean up the component list.

View File

@@ -1,17 +1,16 @@
using Microsoft.VisualBasic;
using mRemoteNG.App;
using mRemoteNG.App;
using mRemoteNG.Connection;
using mRemoteNG.Messages;
using mRemoteNG.Tools.Sorting;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using mRemoteNG.My;
namespace mRemoteNG.Tree
{
public class ConnectionTree
{
private static TreeNode SetNodeToolTip_old_node = null;
private static TreeNode SetNodeToolTip_old_node;
private static TreeNode treeNodeToBeSelected;
private static TreeView _TreeView;
@@ -38,101 +37,122 @@ namespace mRemoteNG.Tree
{
try
{
if (SelectedNode == null)
{
if (!SelectedNodeIsAValidDeletionTarget())
return;
}
if (Tree.ConnectionTreeNode.GetNodeType(SelectedNode) == TreeNodeType.Root)
if (ConnectionTreeNode.GetNodeType(SelectedNode) == TreeNodeType.Container)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "The root item cannot be deleted!");
}
else if (Tree.ConnectionTreeNode.GetNodeType(SelectedNode) == TreeNodeType.Container)
{
if (Tree.ConnectionTreeNode.IsEmpty(SelectedNode) == false)
if (ConnectionTreeNode.IsEmpty(SelectedNode))
{
if (Interaction.MsgBox(string.Format(Language.strConfirmDeleteNodeFolder, SelectedNode.Text), (Microsoft.VisualBasic.MsgBoxStyle)(MsgBoxStyle.YesNo | MsgBoxStyle.Question), null) == MsgBoxResult.Yes)
{
if (UserConfirmsEmptyFolderDeletion())
SelectedNode.Remove();
}
}
else
{
if (Interaction.MsgBox(string.Format(Language.strConfirmDeleteNodeFolderNotEmpty, SelectedNode.Text), (Microsoft.VisualBasic.MsgBoxStyle)(MsgBoxStyle.YesNo | MsgBoxStyle.Question), null) == MsgBoxResult.Yes)
if (UserConfirmsNonEmptyFolderDeletion())
{
foreach (TreeNode tNode in SelectedNode.Nodes)
{
tNode.Remove();
}
TreeView.BeginUpdate();
SelectedNode.Nodes.Clear();
SelectedNode.Remove();
TreeView.EndUpdate();
}
}
}
else if (Tree.ConnectionTreeNode.GetNodeType(SelectedNode) == TreeNodeType.Connection)
else if (ConnectionTreeNode.GetNodeType(SelectedNode) == TreeNodeType.Connection)
{
if (Interaction.MsgBox(string.Format(Language.strConfirmDeleteNodeConnection, SelectedNode.Text), (Microsoft.VisualBasic.MsgBoxStyle)(MsgBoxStyle.YesNo | MsgBoxStyle.Question), null) == MsgBoxResult.Yes)
{
if (UserConfirmsConnectionDeletion())
SelectedNode.Remove();
}
}
else
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "Tree item type is unknown so it cannot be deleted!");
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "Tree item type is unknown so it cannot be deleted!");
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Deleting selected node failed" + Environment.NewLine + ex.Message, true);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Deleting selected node failed" + Environment.NewLine + ex.Message, true);
}
}
private static bool SelectedNodeIsAValidDeletionTarget()
{
bool validDeletionTarget = true;
if (SelectedNode == null)
validDeletionTarget = false;
else if (ConnectionTreeNode.GetNodeType(SelectedNode) == TreeNodeType.Root)
{
validDeletionTarget = false;
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "The root item cannot be deleted!");
}
return validDeletionTarget;
}
private static bool UserConfirmsEmptyFolderDeletion()
{
string messagePrompt = string.Format(Language.strConfirmDeleteNodeFolder, SelectedNode.Text);
return PromptUser(messagePrompt);
}
private static bool UserConfirmsNonEmptyFolderDeletion()
{
string messagePrompt = string.Format(Language.strConfirmDeleteNodeFolderNotEmpty, SelectedNode.Text);
return PromptUser(messagePrompt);
}
private static bool UserConfirmsConnectionDeletion()
{
string messagePrompt = string.Format(Language.strConfirmDeleteNodeConnection, SelectedNode.Text);
return PromptUser(messagePrompt);
}
private static bool PromptUser(string PromptMessage)
{
DialogResult msgBoxResponse = MessageBox.Show(PromptMessage, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
return (msgBoxResponse == DialogResult.Yes);
}
public static void StartRenameSelectedNode()
{
if (SelectedNode != null)
{
SelectedNode.BeginEdit();
}
SelectedNode?.BeginEdit();
}
public static void FinishRenameSelectedNode(string newName)
{
ConnectionInfo connectionInfo = SelectedNode.Tag as ConnectionInfo;
if (connectionInfo != null)
Tree.ConnectionTreeNode.RenameNode(connectionInfo, newName);
ConnectionTreeNode.RenameNode(connectionInfo, newName);
}
public static void SetNodeToolTip(MouseEventArgs e, ToolTip tTip)
{
try
{
if (mRemoteNG.Settings.Default.ShowDescriptionTooltipsInTree)
if (!Settings.Default.ShowDescriptionTooltipsInTree) return;
//Find the node under the mouse.
TreeNode new_node = _TreeView.GetNodeAt(e.X, e.Y);
if (new_node == null || new_node.Equals(SetNodeToolTip_old_node))
{
//Find the node under the mouse.
TreeNode new_node = _TreeView.GetNodeAt(e.X, e.Y);
if (new_node.Equals(SetNodeToolTip_old_node))
{
return;
}
SetNodeToolTip_old_node = new_node;
return;
}
SetNodeToolTip_old_node = new_node;
//See if we have a node.
if (SetNodeToolTip_old_node == null)
//See if we have a node.
if (SetNodeToolTip_old_node == null)
{
tTip.SetToolTip(_TreeView, "");
}
else
{
//Get this node's object data.
if (ConnectionTreeNode.GetNodeType(SetNodeToolTip_old_node) == TreeNodeType.Connection)
{
tTip.SetToolTip(_TreeView, "");
}
else
{
//Get this node's object data.
if (Tree.ConnectionTreeNode.GetNodeType(SetNodeToolTip_old_node) == TreeNodeType.Connection)
{
tTip.SetToolTip(_TreeView, (SetNodeToolTip_old_node.Tag as ConnectionInfo).Description);
}
tTip.SetToolTip(_TreeView, ((ConnectionInfo) SetNodeToolTip_old_node.Tag).Description);
}
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SetNodeToolTip failed" + Environment.NewLine + ex.Message, true);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SetNodeToolTip failed" + Environment.NewLine + ex.Message, true);
}
}
@@ -157,25 +177,20 @@ namespace mRemoteNG.Tree
{
try
{
if (SelectedNode != null)
{
if (!(SelectedNode.NextNode == null))
{
TreeView.BeginUpdate();
TreeView.Sorted = false;
if (SelectedNode?.NextNode == null) return;
TreeView.BeginUpdate();
TreeView.Sorted = false;
TreeNode newNode = (TreeNode)SelectedNode.Clone();
SelectedNode.Parent.Nodes.Insert(SelectedNode.Index + 2, newNode);
SelectedNode.Remove();
SelectedNode = newNode;
TreeNode newNode = (TreeNode)SelectedNode.Clone();
SelectedNode.Parent.Nodes.Insert(SelectedNode.Index + 2, newNode);
SelectedNode.Remove();
SelectedNode = newNode;
TreeView.EndUpdate();
}
}
TreeView.EndUpdate();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "MoveNodeDown failed" + Environment.NewLine + ex.Message, true);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "MoveNodeDown failed" + Environment.NewLine + ex.Message, true);
}
}
@@ -183,25 +198,20 @@ namespace mRemoteNG.Tree
{
try
{
if (SelectedNode != null)
{
if (!(SelectedNode.PrevNode == null))
{
TreeView.BeginUpdate();
TreeView.Sorted = false;
if (SelectedNode?.PrevNode == null) return;
TreeView.BeginUpdate();
TreeView.Sorted = false;
TreeNode newNode = (TreeNode)SelectedNode.Clone();
SelectedNode.Parent.Nodes.Insert(SelectedNode.Index - 1, newNode);
SelectedNode.Remove();
SelectedNode = newNode;
TreeNode newNode = (TreeNode)SelectedNode.Clone();
SelectedNode.Parent.Nodes.Insert(SelectedNode.Index - 1, newNode);
SelectedNode.Remove();
SelectedNode = newNode;
TreeView.EndUpdate();
}
}
TreeView.EndUpdate();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "MoveNodeUp failed" + Environment.NewLine + ex.Message, true);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "MoveNodeUp failed" + Environment.NewLine + ex.Message, true);
}
}
@@ -219,7 +229,7 @@ namespace mRemoteNG.Tree
else
return;
}
else if (Tree.ConnectionTreeNode.GetNodeType(treeNode) == TreeNodeType.Connection)
else if (ConnectionTreeNode.GetNodeType(treeNode) == TreeNodeType.Connection)
{
treeNode = treeNode.Parent;
if (treeNode == null)
@@ -251,8 +261,11 @@ namespace mRemoteNG.Tree
currentNode = childNode;
}
}
treeNode.Nodes.Remove(currentNode);
sortedNodes.Add(currentNode);
if (currentNode != null)
{
treeNode.Nodes.Remove(currentNode);
sortedNodes.Add(currentNode);
}
currentNode = null;
}
@@ -263,14 +276,13 @@ namespace mRemoteNG.Tree
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Sort nodes failed" + Environment.NewLine + ex.Message, true);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Sort nodes failed" + Environment.NewLine + ex.Message, true);
}
}
public static TreeNode Find(TreeNode treeNode, string searchFor)
{
TreeNode tmpNode = default(TreeNode);
try
{
if (IsThisTheNodeWeAreSearchingFor(treeNode, searchFor))
@@ -278,8 +290,8 @@ namespace mRemoteNG.Tree
foreach (TreeNode childNode in treeNode.Nodes)
{
tmpNode = Find(childNode, searchFor);
if (!(tmpNode == null))
TreeNode tmpNode = Find(childNode, searchFor);
if (tmpNode != null)
{
return tmpNode;
}
@@ -287,7 +299,7 @@ namespace mRemoteNG.Tree
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Find node failed" + Environment.NewLine + ex.Message, true);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Find node failed" + Environment.NewLine + ex.Message, true);
}
return null;
@@ -300,7 +312,6 @@ namespace mRemoteNG.Tree
public static TreeNode Find(TreeNode treeNode, ConnectionInfo conInfo)
{
TreeNode tmpNode = default(TreeNode);
try
{
if (treeNode.Tag == conInfo)
@@ -308,14 +319,14 @@ namespace mRemoteNG.Tree
foreach (TreeNode childNode in treeNode.Nodes)
{
tmpNode = Find(childNode, conInfo);
if (!(tmpNode == null))
TreeNode tmpNode = Find(childNode, conInfo);
if (tmpNode != null)
return tmpNode;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Find node failed" + Environment.NewLine + ex.Message, true);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Find node failed" + Environment.NewLine + ex.Message, true);
}
return null;
@@ -326,7 +337,7 @@ namespace mRemoteNG.Tree
{
if (TreeView.InvokeRequired)
{
ResetTreeDelegate resetTreeDelegate = new ResetTreeDelegate(ResetTree);
ResetTreeDelegate resetTreeDelegate = ResetTree;
Windows.treeForm.Invoke(resetTreeDelegate);
}
else
@@ -341,9 +352,9 @@ namespace mRemoteNG.Tree
private delegate void SelectNodeCB();
private static void SelectNode()
{
if (_TreeView.InvokeRequired == true)
if (_TreeView.InvokeRequired)
{
SelectNodeCB d = new SelectNodeCB(SelectNode);
SelectNodeCB d = SelectNode;
_TreeView.Invoke(d);
}
else
@@ -352,4 +363,4 @@ namespace mRemoteNG.Tree
}
}
}
}
}

View File

@@ -108,7 +108,7 @@ namespace mRemoteNG.Tree
{
try
{
if (treeNode.Nodes.Count <= 0)
if (treeNode.Nodes.Count > 0)
return false;
}
catch (Exception ex)

View File

@@ -2,7 +2,7 @@
namespace mRemoteNG.UI.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class AppearancePage : OptionsPage
{

View File

@@ -2,7 +2,7 @@
namespace mRemoteNG.UI.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class ConnectionsPage : OptionsPage
{

View File

@@ -2,7 +2,7 @@
namespace mRemoteNG.UI.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class SqlServerPage : OptionsPage
{

View File

@@ -2,7 +2,7 @@
namespace mRemoteNG.UI.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class StartupExitPage : OptionsPage
{

View File

@@ -4,7 +4,7 @@ using mRemoteNG.My;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class TabsPanelsPage : OptionsPage
{

View File

@@ -2,7 +2,7 @@
namespace mRemoteNG.UI.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class ThemePage : OptionsPage
{

View File

@@ -1,7 +1,7 @@
namespace mRemoteNG.UI.Forms.OptionsPages
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class UpdatesPage : OptionsPage
{

View File

@@ -4,7 +4,7 @@ using mRemoteNG.My;
namespace mRemoteNG.Forms
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
public
partial class PasswordForm : System.Windows.Forms.Form
{

View File

@@ -4,7 +4,7 @@ using mRemoteNG.My;
namespace mRemoteNG
{
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class frmChoosePanel : System.Windows.Forms.Form
{
//Form overrides dispose to clean up the component list.

View File

@@ -37,7 +37,7 @@ namespace mRemoteNG.UI.Forms
private bool _showFullPathInTitle;
private ConnectionInfo _selectedConnection = null;
private SystemMenu _systemMenu;
public MiscTools.Fullscreen _fullscreen;
private MiscTools.Fullscreen _fullscreen;
@@ -45,6 +45,7 @@ namespace mRemoteNG.UI.Forms
{
_showFullPathInTitle = Settings.Default.ShowCompleteConsPathInTitle;
InitializeComponent();
_fullscreen = new MiscTools.Fullscreen(this);
}
static frmMain()
@@ -286,7 +287,7 @@ namespace mRemoteNG.UI.Forms
// if (!mRemoteNG.Settings.Default.CheckForUpdatesAsked)
// {
// string[] commandButtons = new string[] {Language.strAskUpdatesCommandRecommended, Language.strAskUpdatesCommandCustom, Language.strAskUpdatesCommandAskLater};
// cTaskDialog.ShowTaskDialogBox(this, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, Language.strAskUpdatesMainInstruction, string.Format(Language.strAskUpdatesContent, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName), "", "", "", "", string.Join("|", commandButtons), eTaskDialogButtons.None, eSysIcons.Question, eSysIcons.Question);
// cTaskDialog.ShowTaskDialogBox(this, GeneralAppInfo.ProdName, Language.strAskUpdatesMainInstruction, string.Format(Language.strAskUpdatesContent, GeneralAppInfo.ProdName, "", "", "", "", string.Join("|", commandButtons), eTaskDialogButtons.None, eSysIcons.Question, eSysIcons.Question);
// if (cTaskDialog.CommandButtonResult == 0 | cTaskDialog.CommandButtonResult == 1)
// {
// mRemoteNG.Settings.Default.CheckForUpdatesAsked = true;
@@ -626,8 +627,8 @@ namespace mRemoteNG.UI.Forms
private void ConnectionPanelMenuItem_Click(object sender, EventArgs e)
{
((BaseWindow) ((Control)sender).Tag).Show(pnlDock);
((BaseWindow) ((Control)sender).Tag).Focus();
((BaseWindow) ((ToolStripMenuItem)sender).Tag).Show(pnlDock);
((BaseWindow) ((ToolStripMenuItem)sender).Tag).Focus();
}
private void mMenViewConnections_Click(object sender, EventArgs e)
@@ -955,9 +956,10 @@ namespace mRemoteNG.UI.Forms
{
if (e.Button == MouseButtons.Left)
{
if (((Control)sender).Tag is ConnectionInfo)
var tag = ((ToolStripMenuItem)sender).Tag as ConnectionInfo;
if (tag != null)
{
Runtime.OpenConnection((ConnectionInfo)((Control)sender).Tag);
Runtime.OpenConnection(tag);
}
}
}

View File

@@ -256,26 +256,25 @@ namespace mRemoteNG.UI.Window
#endif
}
private void FillLinkLabel(LinkLabel llbl, string Text, string URL)
private void FillLinkLabel(LinkLabel llbl, string txt, string URL)
{
llbl.Links.Clear();
int Open = Text.IndexOf("[");
int Close = 0;
int Open = txt.IndexOf("[");
while (Open != -1)
{
Text = Text.Remove(Open, 1);
Close = Text.IndexOf("]", Open);
txt = txt.Remove(Open, 1);
int Close = txt.IndexOf("]", Open);
if (Close == -1)
{
break;
}
Text = Text.Remove(Close, 1);
txt = txt.Remove(Close, 1);
llbl.Links.Add(Open, Close - Open, URL);
Open = Text.IndexOf("[", Open);
Open = txt.IndexOf("[", Open);
}
llbl.Text = Text;
llbl.Text = txt;
}
#endregion
@@ -287,9 +286,9 @@ namespace mRemoteNG.UI.Window
try
{
lblCopyright.Text = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.Copyright;
lblCopyright.Text = GeneralAppInfo.copyright;
lblVersion.Text = "Version " + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.Version.ToString();
lblVersion.Text = @"Version " + GeneralAppInfo.version;
if (File.Exists(GeneralAppInfo.HomePath + "\\CHANGELOG.TXT"))
{
@@ -310,8 +309,9 @@ namespace mRemoteNG.UI.Window
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Loading About failed" + Environment.NewLine + ex.Message, true);
}
}
private void llblFAMFAMFAM_LinkClicked(Object sender, LinkLabelLinkClickedEventArgs e)
#if false
private void llblFAMFAMFAM_LinkClicked(Object sender, LinkLabelLinkClickedEventArgs e)
{
Runtime.GoToURL(Language.strFAMFAMFAMAttributionURL);
}
@@ -325,6 +325,7 @@ namespace mRemoteNG.UI.Window
{
Runtime.GoToURL(Language.strWeifenLuoAttributionURL);
}
#endregion
#endif
#endregion
}
}

View File

@@ -40,31 +40,31 @@ namespace mRemoteNG.UI.Window
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
Load += new EventHandler(Config_Load);
SystemColorsChanged += new EventHandler(Config_SystemColorsChanged);
Load += Config_Load;
SystemColorsChanged += Config_SystemColorsChanged;
pGrid = new FilteredPropertyGrid();
pGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(pGrid_PropertyValueChanged);
pGrid.PropertySortChanged += new EventHandler(pGrid_PropertySortChanged);
pGrid.PropertyValueChanged += pGrid_PropertyValueChanged;
pGrid.PropertySortChanged += pGrid_PropertySortChanged;
propertyGridContextMenu = new ContextMenuStrip(components);
propertyGridContextMenu.Opening += new System.ComponentModel.CancelEventHandler(propertyGridContextMenu_Opening);
propertyGridContextMenu.Opening += propertyGridContextMenu_Opening;
propertyGridContextMenuReset = new ToolStripMenuItem();
propertyGridContextMenuReset.Click += new EventHandler(propertyGridContextMenuReset_Click);
propertyGridContextMenuReset.Click += propertyGridContextMenuReset_Click;
ToolStripSeparator1 = new ToolStripSeparator();
propertyGridContextMenuShowHelpText = new ToolStripMenuItem();
propertyGridContextMenuShowHelpText.Click += new EventHandler(propertyGridContextMenuShowHelpText_Click);
propertyGridContextMenuShowHelpText.CheckedChanged += new EventHandler(propertyGridContextMenuShowHelpText_CheckedChanged);
propertyGridContextMenuShowHelpText.Click += propertyGridContextMenuShowHelpText_Click;
propertyGridContextMenuShowHelpText.CheckedChanged += propertyGridContextMenuShowHelpText_CheckedChanged;
btnShowInheritance = new ToolStripButton();
btnShowInheritance.Click += new EventHandler(btnShowInheritance_Click);
btnShowInheritance.Click += btnShowInheritance_Click;
btnShowDefaultInheritance = new ToolStripButton();
btnShowDefaultInheritance.Click += new EventHandler(btnShowDefaultInheritance_Click);
btnShowDefaultInheritance.Click += btnShowDefaultInheritance_Click;
btnShowProperties = new ToolStripButton();
btnShowProperties.Click += new EventHandler(btnShowProperties_Click);
btnShowProperties.Click += btnShowProperties_Click;
btnShowDefaultProperties = new ToolStripButton();
btnShowDefaultProperties.Click += new EventHandler(btnShowDefaultProperties_Click);
btnShowDefaultProperties.Click += btnShowDefaultProperties_Click;
btnIcon = new ToolStripButton();
btnIcon.MouseUp += new MouseEventHandler(btnIcon_Click);
btnIcon.MouseUp += btnIcon_Click;
btnHostStatus = new ToolStripButton();
btnHostStatus.Click += new EventHandler(btnHostStatus_Click);
btnHostStatus.Click += btnHostStatus_Click;
cMenIcons = new ContextMenuStrip(components);
propertyGridContextMenu.SuspendLayout();
SuspendLayout();
@@ -192,15 +192,12 @@ namespace mRemoteNG.UI.Window
{
get
{
if (btnShowProperties.Checked)
return true;
else
return false;
return btnShowProperties.Checked;
}
set
{
btnShowProperties.Checked = value;
if (value == true)
if (value)
{
btnShowInheritance.Checked = false;
btnShowDefaultInheritance.Checked = false;
@@ -213,15 +210,12 @@ namespace mRemoteNG.UI.Window
{
get
{
if (btnShowInheritance.Checked)
return true;
else
return false;
return btnShowInheritance.Checked;
}
set
{
btnShowInheritance.Checked = value;
if (value == true)
if (value)
{
btnShowProperties.Checked = false;
btnShowDefaultInheritance.Checked = false;
@@ -234,15 +228,12 @@ namespace mRemoteNG.UI.Window
{
get
{
if (btnShowDefaultProperties.Checked)
return true;
else
return false;
return btnShowDefaultProperties.Checked;
}
set
{
btnShowDefaultProperties.Checked = value;
if (value == true)
if (value)
{
btnShowProperties.Checked = false;
btnShowDefaultInheritance.Checked = false;
@@ -253,17 +244,11 @@ namespace mRemoteNG.UI.Window
public bool DefaultInheritanceVisible
{
get
{
if (btnShowDefaultInheritance.Checked)
return true;
else
return false;
}
get { return btnShowDefaultInheritance.Checked; }
set
{
btnShowDefaultInheritance.Checked = value;
if (value == true)
if (value)
{
btnShowProperties.Checked = false;
btnShowDefaultProperties.Checked = false;
@@ -289,20 +274,20 @@ namespace mRemoteNG.UI.Window
{
if ((keyData & Keys.KeyCode) == Keys.Tab)
{
GridItem selectedItem = pGrid.SelectedGridItem;
GridItem gridRoot = selectedItem;
var selectedItem = pGrid.SelectedGridItem;
var gridRoot = selectedItem;
while (gridRoot.GridItemType != GridItemType.Root)
{
gridRoot = gridRoot.Parent;
}
List<GridItem> gridItems = new List<GridItem>();
var gridItems = new List<GridItem>();
FindChildGridItems(gridRoot, ref gridItems);
if (!ContainsGridItemProperty(gridItems))
return true;
GridItem newItem = selectedItem;
var newItem = selectedItem;
if (keyData == (Keys.Tab | Keys.Shift))
newItem = FindPreviousGridItemProperty(gridItems, selectedItem);
@@ -334,7 +319,7 @@ namespace mRemoteNG.UI.Window
private bool ContainsGridItemProperty(List<GridItem> gridItems)
{
foreach (GridItem item in gridItems)
foreach (var item in gridItems)
{
if (item.GridItemType == GridItemType.Property)
{
@@ -349,7 +334,7 @@ namespace mRemoteNG.UI.Window
if (gridItems.Count == 0 || startItem == null)
return null;
int startIndex = gridItems.IndexOf(startItem);
var startIndex = gridItems.IndexOf(startItem);
if (startItem.GridItemType == GridItemType.Property)
{
startIndex--;
@@ -359,9 +344,9 @@ namespace mRemoteNG.UI.Window
}
}
int previousIndex = 0;
bool previousIndexValid = false;
for (int index = startIndex; index >= 0; index--)
var previousIndex = 0;
var previousIndexValid = false;
for (var index = startIndex; index >= 0; index--)
{
if (gridItems[index].GridItemType == GridItemType.Property)
{
@@ -374,7 +359,7 @@ namespace mRemoteNG.UI.Window
if (previousIndexValid)
return gridItems[previousIndex];
for (int index = gridItems.Count - 1; index >= startIndex + 1; index--)
for (var index = gridItems.Count - 1; index >= startIndex + 1; index--)
{
if (gridItems[index].GridItemType == GridItemType.Property)
{
@@ -394,7 +379,7 @@ namespace mRemoteNG.UI.Window
if (gridItems.Count == 0 || startItem == null)
return null;
int startIndex = gridItems.IndexOf(startItem);
var startIndex = gridItems.IndexOf(startItem);
if (startItem.GridItemType == GridItemType.Property)
{
startIndex++;
@@ -404,9 +389,9 @@ namespace mRemoteNG.UI.Window
}
}
int nextIndex = 0;
bool nextIndexValid = false;
for (int index = startIndex; index <= gridItems.Count - 1; index++)
var nextIndex = 0;
var nextIndexValid = false;
for (var index = startIndex; index <= gridItems.Count - 1; index++)
{
if (gridItems[index].GridItemType == GridItemType.Property)
{
@@ -419,7 +404,7 @@ namespace mRemoteNG.UI.Window
if (nextIndexValid)
return gridItems[nextIndex];
for (int index = 0; index <= startIndex - 1; index++)
for (var index = 0; index <= startIndex - 1; index++)
{
if (gridItems[index].GridItemType == GridItemType.Property)
{
@@ -540,7 +525,7 @@ namespace mRemoteNG.UI.Window
PropertiesVisible = true;
}
Icon conIcon = ConnectionIcon.FromString(Convert.ToString(((ConnectionInfo)Obj).Icon));
var conIcon = ConnectionIcon.FromString(Convert.ToString(((ConnectionInfo)Obj).Icon));
if (conIcon != null)
{
btnIcon.Image = conIcon.ToBitmap();
@@ -548,7 +533,7 @@ namespace mRemoteNG.UI.Window
}
else if (Obj is RootNodeInfo) //ROOT
{
RootNodeInfo rootInfo = (RootNodeInfo) Obj;
var rootInfo = (RootNodeInfo) Obj;
switch (rootInfo.Type)
{
case RootNodeType.Connection:
@@ -590,7 +575,7 @@ namespace mRemoteNG.UI.Window
btnIcon.Enabled = true;
btnHostStatus.Enabled = !((ConnectionInfo)((ConnectionInfoInheritance)Obj).Parent).IsContainer;
InheritanceVisible = true;
Icon conIcon = ConnectionIcon.FromString(Convert.ToString(((ConnectionInfo)((ConnectionInfoInheritance)Obj).Parent).Icon));
var conIcon = ConnectionIcon.FromString(Convert.ToString(((ConnectionInfo)((ConnectionInfoInheritance)Obj).Parent).Icon));
if (conIcon != null)
{
btnIcon.Image = conIcon.ToBitmap();
@@ -655,7 +640,7 @@ namespace mRemoteNG.UI.Window
{
try
{
ToolStrip customToolStrip = new ToolStrip();
var customToolStrip = new ToolStrip();
customToolStrip.Items.Add(btnShowProperties);
customToolStrip.Items.Add(btnShowInheritance);
customToolStrip.Items.Add(btnShowDefaultProperties);
@@ -664,7 +649,7 @@ namespace mRemoteNG.UI.Window
customToolStrip.Items.Add(btnIcon);
customToolStrip.Show();
ToolStrip propertyGridToolStrip = new ToolStrip();
var propertyGridToolStrip = new ToolStrip();
ToolStrip toolStrip = null;
foreach (Control control in pGrid.Controls)
@@ -693,7 +678,7 @@ namespace mRemoteNG.UI.Window
// Hide the "Property Pages" button
propertyGridToolStrip.Items[_originalPropertyGridToolStripItemCount - 1].Visible = false;
int expectedToolStripItemCount = _originalPropertyGridToolStripItemCount + customToolStrip.Items.Count;
var expectedToolStripItemCount = _originalPropertyGridToolStripItemCount + customToolStrip.Items.Count;
if (propertyGridToolStrip.Items.Count != expectedToolStripItemCount)
{
propertyGridToolStrip.AllowMerge = true;
@@ -749,14 +734,14 @@ namespace mRemoteNG.UI.Window
Windows.treeForm.tvConnections.SelectedNode.Text = Convert.ToString(((ConnectionInfo)pGrid.SelectedObject).Name);
if (Settings.Default.SetHostnameLikeDisplayName && pGrid.SelectedObject is ConnectionInfo)
{
ConnectionInfo connectionInfo = (ConnectionInfo)pGrid.SelectedObject;
var connectionInfo = (ConnectionInfo)pGrid.SelectedObject;
if (!string.IsNullOrEmpty(connectionInfo.Name))
connectionInfo.Hostname = connectionInfo.Name;
}
}
else if (e.ChangedItem.Label == Language.strPropertyNameIcon)
{
Icon conIcon = ConnectionIcon.FromString(Convert.ToString(((ConnectionInfo)pGrid.SelectedObject).Icon));
var conIcon = ConnectionIcon.FromString(Convert.ToString(((ConnectionInfo)pGrid.SelectedObject).Icon));
if (conIcon != null)
btnIcon.Image = conIcon.ToBitmap();
}
@@ -774,19 +759,19 @@ namespace mRemoteNG.UI.Window
{
if (pGrid.SelectedObject is RootNodeInfo)
{
RootNodeInfo rootInfo = (RootNodeInfo)pGrid.SelectedObject;
var rootInfo = (RootNodeInfo)pGrid.SelectedObject;
switch (e.ChangedItem.PropertyDescriptor.Name)
{
case "Password":
if (rootInfo.Password == true)
if (rootInfo.Password)
{
string passwordName = "";
var passwordName = "";
if (Settings.Default.UseSQLServer)
passwordName = Language.strSQLServer.TrimEnd(':');
else
passwordName = Path.GetFileName(Runtime.GetStartupConnectionFileName());
string password = MiscTools.PasswordDialog(passwordName);
var password = MiscTools.PasswordDialog(passwordName);
if (string.IsNullOrEmpty(password))
rootInfo.Password = false;
else
@@ -820,11 +805,11 @@ namespace mRemoteNG.UI.Window
{
try
{
List<string> strHide = new List<string>();
var strHide = new List<string>();
if (pGrid.SelectedObject is ConnectionInfo)
{
ConnectionInfo conI = (ConnectionInfo)pGrid.SelectedObject;
var conI = (ConnectionInfo)pGrid.SelectedObject;
switch (conI.Protocol)
{
@@ -1553,7 +1538,7 @@ namespace mRemoteNG.UI.Window
}
else if (pGrid.SelectedObject is RootNodeInfo)
{
RootNodeInfo rootInfo = (RootNodeInfo) pGrid.SelectedObject;
var rootInfo = (RootNodeInfo) pGrid.SelectedObject;
if (rootInfo.Type == RootNodeType.PuttySessions)
{
strHide.Add("Password");
@@ -1653,16 +1638,16 @@ namespace mRemoteNG.UI.Window
{
cMenIcons.Items.Clear();
foreach (string iStr in ConnectionIcon.Icons)
foreach (var iStr in ConnectionIcon.Icons)
{
ToolStripMenuItem tI = new ToolStripMenuItem();
var tI = new ToolStripMenuItem();
tI.Text = iStr;
tI.Image = ConnectionIcon.FromString(iStr).ToBitmap();
tI.Click += IconMenu_Click;
cMenIcons.Items.Add(tI);
}
Point mPos = new Point(new Size(PointToScreen(new Point(e.Location.X + pGrid.Width - 100, e.Location.Y))));
var mPos = new Point(new Size(PointToScreen(new Point(e.Location.X + pGrid.Width - 100, e.Location.Y))));
cMenIcons.Show(mPos);
}
}
@@ -1676,25 +1661,25 @@ namespace mRemoteNG.UI.Window
{
try
{
ConnectionInfo connectionInfo = (ConnectionInfo)pGrid.SelectedObject;
var connectionInfo = (ConnectionInfo)pGrid.SelectedObject;
if (connectionInfo == null)
{
return ;
}
ToolStripMenuItem selectedMenuItem = (ToolStripMenuItem)sender;
var selectedMenuItem = (ToolStripMenuItem)sender;
if (selectedMenuItem == null)
{
return ;
}
string iconName = selectedMenuItem.Text;
var iconName = selectedMenuItem.Text;
if (string.IsNullOrEmpty(iconName))
{
return ;
}
Icon connectionIcon = ConnectionIcon.FromString(iconName);
var connectionIcon = ConnectionIcon.FromString(iconName);
if (connectionIcon == null)
{
return ;
@@ -1720,7 +1705,7 @@ namespace mRemoteNG.UI.Window
private void CheckHostAlive()
{
Ping pingSender = new Ping();
var pingSender = new Ping();
PingReply pReply;
try
@@ -1755,7 +1740,7 @@ namespace mRemoteNG.UI.Window
{
if (pGrid.InvokeRequired)
{
ShowStatusImageCB d = new ShowStatusImageCB(ShowStatusImage);
ShowStatusImageCB d = ShowStatusImage;
pGrid.Invoke(d, new object[] {Image});
}
else
@@ -1785,7 +1770,7 @@ namespace mRemoteNG.UI.Window
btnHostStatus.Tag = "checking";
HostName = ((ConnectionInfo)ConnectionInfo).Hostname;
pThread = new System.Threading.Thread(new System.Threading.ThreadStart(CheckHostAlive));
pThread = new System.Threading.Thread(CheckHostAlive);
pThread.SetApartmentState(System.Threading.ApartmentState.STA);
pThread.IsBackground = true;
pThread.Start();
@@ -1803,7 +1788,7 @@ namespace mRemoteNG.UI.Window
try
{
propertyGridContextMenuShowHelpText.Checked = Settings.Default.ShowConfigHelpText;
GridItem gridItem = pGrid.SelectedGridItem;
var gridItem = pGrid.SelectedGridItem;
propertyGridContextMenuReset.Enabled = Convert.ToBoolean(pGrid.SelectedObject != null && gridItem != null && gridItem.PropertyDescriptor != null && gridItem.PropertyDescriptor.CanResetValue(pGrid.SelectedObject));
}
catch (Exception ex)
@@ -1816,7 +1801,7 @@ namespace mRemoteNG.UI.Window
{
try
{
GridItem gridItem = pGrid.SelectedGridItem;
var gridItem = pGrid.SelectedGridItem;
if (pGrid.SelectedObject != null && gridItem != null && gridItem.PropertyDescriptor != null && gridItem.PropertyDescriptor.CanResetValue(pGrid.SelectedObject))
{
pGrid.ResetSelectedProperty();

View File

@@ -11,6 +11,7 @@ using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.TaskDialog;
using mRemoteNG.App.Info;
namespace mRemoteNG.UI.Window
{
@@ -421,7 +422,7 @@ namespace mRemoteNG.UI.Window
((Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.All & TabController.TabPages.Count > 0) ||
(Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.Multiple & TabController.TabPages.Count > 1)))
{
DialogResult result = CTaskDialog.MessageBox(this, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, string.Format(Language.strConfirmCloseConnectionPanelMainInstruction, Text), "", "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.YesNo, ESysIcons.Question, ESysIcons.Question);
DialogResult result = CTaskDialog.MessageBox(this, GeneralAppInfo.ProdName, string.Format(Language.strConfirmCloseConnectionPanelMainInstruction, Text), "", "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.YesNo, ESysIcons.Question, ESysIcons.Question);
if (CTaskDialog.VerificationChecked)
{
Settings.Default.ConfirmCloseConnection--;
@@ -504,7 +505,7 @@ namespace mRemoteNG.UI.Window
Crownwood.Magic.Controls.TabPage selectedTab = TabController.SelectedTab;
if (Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.All)
{
DialogResult result = CTaskDialog.MessageBox(this, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, string.Format(Language.strConfirmCloseConnectionMainInstruction, selectedTab.Title), "", "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.YesNo, ESysIcons.Question, ESysIcons.Question);
DialogResult result = CTaskDialog.MessageBox(this, GeneralAppInfo.ProdName, string.Format(Language.strConfirmCloseConnectionMainInstruction, selectedTab.Title), "", "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.YesNo, ESysIcons.Question, ESysIcons.Question);
if (CTaskDialog.VerificationChecked)
{
Settings.Default.ConfirmCloseConnection--;

View File

@@ -1,10 +1,8 @@
using System.Collections.Generic;
using System;
using Microsoft.VisualBasic;
using System.Windows.Forms;
using mRemoteNG.App;
using WeifenLuo.WinFormsUI.Docking;
using mRemoteNG.My;
using mRemoteNG.UI.Forms;
@@ -23,7 +21,7 @@ namespace mRemoteNG.UI.Window
#endregion
#region Private Fields
private Tools.ExternalTool _selectedTool = null;
private Tools.ExternalTool _selectedTool;
#endregion
#region Private Methods
@@ -34,12 +32,12 @@ namespace mRemoteNG.UI.Window
UpdateToolsListView();
}
static public void ExternalTools_FormClosed(System.Object sender, FormClosedEventArgs e)
static public void ExternalTools_FormClosed(object sender, FormClosedEventArgs e)
{
mRemoteNG.Config.Settings.SettingsSaver.SaveExternalAppsToXML();
Config.Settings.SettingsSaver.SaveExternalAppsToXML();
}
public void NewTool_Click(System.Object sender, EventArgs e)
public void NewTool_Click(object sender, EventArgs e)
{
try
{
@@ -54,11 +52,11 @@ namespace mRemoteNG.UI.Window
}
}
public void DeleteTool_Click(System.Object sender, EventArgs e)
public void DeleteTool_Click(object sender, EventArgs e)
{
try
{
string message = "";
string message;
if (ToolsListView.SelectedItems.Count == 1)
{
message = string.Format(Language.strConfirmDeleteExternalTool, ToolsListView.SelectedItems[0].Text);
@@ -71,8 +69,8 @@ namespace mRemoteNG.UI.Window
{
return ;
}
if (!(Interaction.MsgBox(message, (Microsoft.VisualBasic.MsgBoxStyle) (MsgBoxStyle.Question | MsgBoxStyle.YesNo), null) == MsgBoxResult.Yes))
if (MessageBox.Show(frmMain.Default, message, "Question?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
{
return ;
}
@@ -95,12 +93,12 @@ namespace mRemoteNG.UI.Window
}
}
public void LaunchTool_Click(System.Object sender, EventArgs e)
public void LaunchTool_Click(object sender, EventArgs e)
{
LaunchTool();
}
public void ToolsListView_SelectedIndexChanged(System.Object sender, EventArgs e)
public void ToolsListView_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
@@ -161,7 +159,7 @@ namespace mRemoteNG.UI.Window
}
}
public void BrowseButton_Click(System.Object sender, EventArgs e)
public void BrowseButton_Click(object sender, EventArgs e)
{
try
{
@@ -181,7 +179,7 @@ namespace mRemoteNG.UI.Window
}
}
public void TryToIntegrateCheckBox_CheckedChanged(System.Object sender, EventArgs e)
public void TryToIntegrateCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (TryToIntegrateCheckBox.Checked)
{

View File

@@ -1,10 +1,9 @@
using Microsoft.VisualBasic;
using mRemoteNG.App;
using System;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.My;
using mRemoteNG.UI.Forms;
using Tamir.SharpSsh;
using WeifenLuo.WinFormsUI.Docking;
@@ -14,298 +13,298 @@ namespace mRemoteNG.UI.Window
public class SSHTransferWindow : BaseWindow
{
#region Form Init
internal System.Windows.Forms.ProgressBar pbStatus;
internal System.Windows.Forms.Button btnTransfer;
internal System.Windows.Forms.TextBox txtUser;
internal System.Windows.Forms.TextBox txtPassword;
internal System.Windows.Forms.TextBox txtHost;
internal System.Windows.Forms.TextBox txtPort;
internal System.Windows.Forms.Label lblHost;
internal System.Windows.Forms.Label lblPort;
internal System.Windows.Forms.Label lblUser;
internal System.Windows.Forms.Label lblPassword;
internal System.Windows.Forms.Label lblProtocol;
internal System.Windows.Forms.RadioButton radProtSCP;
internal System.Windows.Forms.RadioButton radProtSFTP;
internal System.Windows.Forms.GroupBox grpConnection;
internal System.Windows.Forms.Button btnBrowse;
internal System.Windows.Forms.Label lblRemoteFile;
internal System.Windows.Forms.TextBox txtRemoteFile;
internal System.Windows.Forms.TextBox txtLocalFile;
internal System.Windows.Forms.Label lblLocalFile;
internal System.Windows.Forms.GroupBox grpFiles;
internal ProgressBar pbStatus;
internal Button btnTransfer;
internal TextBox txtUser;
internal TextBox txtPassword;
internal TextBox txtHost;
internal TextBox txtPort;
internal Label lblHost;
internal Label lblPort;
internal Label lblUser;
internal Label lblPassword;
internal Label lblProtocol;
internal RadioButton radProtSCP;
internal RadioButton radProtSFTP;
internal GroupBox grpConnection;
internal Button btnBrowse;
internal Label lblRemoteFile;
internal TextBox txtRemoteFile;
internal TextBox txtLocalFile;
internal Label lblLocalFile;
internal GroupBox grpFiles;
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SSHTransferWindow));
this.grpFiles = new System.Windows.Forms.GroupBox();
this.Load += new System.EventHandler(SSHTransfer_Load);
this.lblLocalFile = new System.Windows.Forms.Label();
this.txtLocalFile = new System.Windows.Forms.TextBox();
this.txtRemoteFile = new System.Windows.Forms.TextBox();
this.lblRemoteFile = new System.Windows.Forms.Label();
this.btnBrowse = new System.Windows.Forms.Button();
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
this.grpConnection = new System.Windows.Forms.GroupBox();
this.radProtSFTP = new System.Windows.Forms.RadioButton();
this.radProtSCP = new System.Windows.Forms.RadioButton();
this.lblProtocol = new System.Windows.Forms.Label();
this.lblPassword = new System.Windows.Forms.Label();
this.lblUser = new System.Windows.Forms.Label();
this.lblPort = new System.Windows.Forms.Label();
this.lblHost = new System.Windows.Forms.Label();
this.txtPort = new System.Windows.Forms.TextBox();
this.txtHost = new System.Windows.Forms.TextBox();
this.txtPassword = new System.Windows.Forms.TextBox();
this.txtUser = new System.Windows.Forms.TextBox();
this.btnTransfer = new System.Windows.Forms.Button();
this.btnTransfer.Click += new System.EventHandler(this.btnTransfer_Click);
this.pbStatus = new System.Windows.Forms.ProgressBar();
this.grpFiles.SuspendLayout();
this.grpConnection.SuspendLayout();
this.SuspendLayout();
//
//grpFiles
//
this.grpFiles.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.grpFiles.Controls.Add(this.lblLocalFile);
this.grpFiles.Controls.Add(this.txtLocalFile);
this.grpFiles.Controls.Add(this.txtRemoteFile);
this.grpFiles.Controls.Add(this.lblRemoteFile);
this.grpFiles.Controls.Add(this.btnBrowse);
this.grpFiles.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.grpFiles.Location = new System.Drawing.Point(12, 153);
this.grpFiles.Name = "grpFiles";
this.grpFiles.Size = new System.Drawing.Size(668, 194);
this.grpFiles.TabIndex = 2000;
this.grpFiles.TabStop = false;
this.grpFiles.Text = "Files";
//
//lblLocalFile
//
this.lblLocalFile.AutoSize = true;
this.lblLocalFile.Location = new System.Drawing.Point(20, 25);
this.lblLocalFile.Name = "lblLocalFile";
this.lblLocalFile.Size = new System.Drawing.Size(52, 13);
this.lblLocalFile.TabIndex = 10;
this.lblLocalFile.Text = "Local file:";
//
//txtLocalFile
//
this.txtLocalFile.Anchor = (System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.txtLocalFile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtLocalFile.Location = new System.Drawing.Point(105, 23);
this.txtLocalFile.Name = "txtLocalFile";
this.txtLocalFile.Size = new System.Drawing.Size(455, 20);
this.txtLocalFile.TabIndex = 20;
//
//txtRemoteFile
//
this.txtRemoteFile.Anchor = (System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.txtRemoteFile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtRemoteFile.Location = new System.Drawing.Point(105, 49);
this.txtRemoteFile.Name = "txtRemoteFile";
this.txtRemoteFile.Size = new System.Drawing.Size(542, 20);
this.txtRemoteFile.TabIndex = 50;
//
//lblRemoteFile
//
this.lblRemoteFile.AutoSize = true;
this.lblRemoteFile.Location = new System.Drawing.Point(20, 51);
this.lblRemoteFile.Name = "lblRemoteFile";
this.lblRemoteFile.Size = new System.Drawing.Size(63, 13);
this.lblRemoteFile.TabIndex = 40;
this.lblRemoteFile.Text = "Remote file:";
//
//btnBrowse
//
this.btnBrowse.Anchor = (System.Windows.Forms.AnchorStyles) (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
this.btnBrowse.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBrowse.Location = new System.Drawing.Point(566, 21);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(81, 23);
this.btnBrowse.TabIndex = 30;
this.btnBrowse.Text = "Browse";
this.btnBrowse.UseVisualStyleBackColor = true;
//
//grpConnection
//
this.grpConnection.Anchor = (System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.grpConnection.Controls.Add(this.radProtSFTP);
this.grpConnection.Controls.Add(this.radProtSCP);
this.grpConnection.Controls.Add(this.lblProtocol);
this.grpConnection.Controls.Add(this.lblPassword);
this.grpConnection.Controls.Add(this.lblUser);
this.grpConnection.Controls.Add(this.lblPort);
this.grpConnection.Controls.Add(this.lblHost);
this.grpConnection.Controls.Add(this.txtPort);
this.grpConnection.Controls.Add(this.txtHost);
this.grpConnection.Controls.Add(this.txtPassword);
this.grpConnection.Controls.Add(this.txtUser);
this.grpConnection.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.grpConnection.Location = new System.Drawing.Point(12, 12);
this.grpConnection.Name = "grpConnection";
this.grpConnection.Size = new System.Drawing.Size(668, 135);
this.grpConnection.TabIndex = 1000;
this.grpConnection.TabStop = false;
this.grpConnection.Text = "Connection";
//
//radProtSFTP
//
this.radProtSFTP.AutoSize = true;
this.radProtSFTP.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.radProtSFTP.Location = new System.Drawing.Point(153, 103);
this.radProtSFTP.Name = "radProtSFTP";
this.radProtSFTP.Size = new System.Drawing.Size(51, 17);
this.radProtSFTP.TabIndex = 110;
this.radProtSFTP.Text = "SFTP";
this.radProtSFTP.UseVisualStyleBackColor = true;
//
//radProtSCP
//
this.radProtSCP.AutoSize = true;
this.radProtSCP.Checked = true;
this.radProtSCP.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.radProtSCP.Location = new System.Drawing.Point(92, 103);
this.radProtSCP.Name = "radProtSCP";
this.radProtSCP.Size = new System.Drawing.Size(45, 17);
this.radProtSCP.TabIndex = 100;
this.radProtSCP.TabStop = true;
this.radProtSCP.Text = "SCP";
this.radProtSCP.UseVisualStyleBackColor = true;
//
//lblProtocol
//
this.lblProtocol.AutoSize = true;
this.lblProtocol.Location = new System.Drawing.Point(20, 105);
this.lblProtocol.Name = "lblProtocol";
this.lblProtocol.Size = new System.Drawing.Size(49, 13);
this.lblProtocol.TabIndex = 90;
this.lblProtocol.Text = "Protocol:";
//
//lblPassword
//
this.lblPassword.AutoSize = true;
this.lblPassword.Location = new System.Drawing.Point(20, 79);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(56, 13);
this.lblPassword.TabIndex = 70;
this.lblPassword.Text = "Password:";
//
//lblUser
//
this.lblUser.AutoSize = true;
this.lblUser.Location = new System.Drawing.Point(20, 53);
this.lblUser.Name = "lblUser";
this.lblUser.Size = new System.Drawing.Size(32, 13);
this.lblUser.TabIndex = 50;
this.lblUser.Text = "User:";
//
//lblPort
//
this.lblPort.Anchor = (System.Windows.Forms.AnchorStyles) (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
this.lblPort.AutoSize = true;
this.lblPort.Location = new System.Drawing.Point(582, 27);
this.lblPort.Name = "lblPort";
this.lblPort.Size = new System.Drawing.Size(29, 13);
this.lblPort.TabIndex = 30;
this.lblPort.Text = "Port:";
//
//lblHost
//
this.lblHost.AutoSize = true;
this.lblHost.Location = new System.Drawing.Point(20, 27);
this.lblHost.Name = "lblHost";
this.lblHost.Size = new System.Drawing.Size(32, 13);
this.lblHost.TabIndex = 10;
this.lblHost.Text = "Host:";
//
//txtPort
//
this.txtPort.Anchor = (System.Windows.Forms.AnchorStyles) (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
this.txtPort.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtPort.Location = new System.Drawing.Point(617, 25);
this.txtPort.Name = "txtPort";
this.txtPort.Size = new System.Drawing.Size(30, 20);
this.txtPort.TabIndex = 40;
//
//txtHost
//
this.txtHost.Anchor = (System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.txtHost.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtHost.Location = new System.Drawing.Point(105, 25);
this.txtHost.Name = "txtHost";
this.txtHost.Size = new System.Drawing.Size(471, 20);
this.txtHost.TabIndex = 20;
//
//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.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtPassword.Location = new System.Drawing.Point(105, 77);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = global::Microsoft.VisualBasic.Strings.ChrW(42);
this.txtPassword.Size = new System.Drawing.Size(471, 20);
this.txtPassword.TabIndex = 80;
//
//txtUser
//
this.txtUser.Anchor = (System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.txtUser.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtUser.Location = new System.Drawing.Point(105, 51);
this.txtUser.Name = "txtUser";
this.txtUser.Size = new System.Drawing.Size(471, 20);
this.txtUser.TabIndex = 60;
//
//btnTransfer
//
this.btnTransfer.Anchor = (System.Windows.Forms.AnchorStyles) (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
this.btnTransfer.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnTransfer.Image = Resources.SSHTransfer;
this.btnTransfer.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnTransfer.Location = new System.Drawing.Point(597, 382);
this.btnTransfer.Name = "btnTransfer";
this.btnTransfer.Size = new System.Drawing.Size(83, 29);
this.btnTransfer.TabIndex = 10000;
this.btnTransfer.Text = "Transfer";
this.btnTransfer.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnTransfer.UseVisualStyleBackColor = true;
//
//pbStatus
//
this.pbStatus.Anchor = (System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.pbStatus.Location = new System.Drawing.Point(12, 353);
this.pbStatus.Name = "pbStatus";
this.pbStatus.Size = new System.Drawing.Size(668, 23);
this.pbStatus.TabIndex = 3000;
//
//SSHTransfer
//
this.ClientSize = new System.Drawing.Size(692, 423);
this.Controls.Add(this.grpFiles);
this.Controls.Add(this.grpConnection);
this.Controls.Add(this.btnTransfer);
this.Controls.Add(this.pbStatus);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, Convert.ToByte(0));
this.Icon = (System.Drawing.Icon) (resources.GetObject("$this.Icon"));
this.Name = "SSHTransfer";
this.TabText = "SSH File Transfer";
this.Text = "SSH File Transfer";
this.grpFiles.ResumeLayout(false);
this.grpFiles.PerformLayout();
this.grpConnection.ResumeLayout(false);
this.grpConnection.PerformLayout();
this.ResumeLayout(false);
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SSHTransferWindow));
grpFiles = new GroupBox();
lblLocalFile = new Label();
txtLocalFile = new TextBox();
txtRemoteFile = new TextBox();
lblRemoteFile = new Label();
btnBrowse = new Button();
grpConnection = new GroupBox();
radProtSFTP = new RadioButton();
radProtSCP = new RadioButton();
lblProtocol = new Label();
lblPassword = new Label();
lblUser = new Label();
lblPort = new Label();
lblHost = new Label();
txtPort = new TextBox();
txtHost = new TextBox();
txtPassword = new TextBox();
txtUser = new TextBox();
btnTransfer = new Button();
pbStatus = new ProgressBar();
grpFiles.SuspendLayout();
grpConnection.SuspendLayout();
SuspendLayout();
//
// grpFiles
//
grpFiles.Anchor = (((AnchorStyles.Top | AnchorStyles.Bottom)
| AnchorStyles.Left)
| AnchorStyles.Right);
grpFiles.Controls.Add(lblLocalFile);
grpFiles.Controls.Add(txtLocalFile);
grpFiles.Controls.Add(txtRemoteFile);
grpFiles.Controls.Add(lblRemoteFile);
grpFiles.Controls.Add(btnBrowse);
grpFiles.FlatStyle = FlatStyle.Flat;
grpFiles.Location = new System.Drawing.Point(12, 153);
grpFiles.Name = "grpFiles";
grpFiles.Size = new System.Drawing.Size(668, 194);
grpFiles.TabIndex = 2000;
grpFiles.TabStop = false;
grpFiles.Text = "Files";
//
// lblLocalFile
//
lblLocalFile.AutoSize = true;
lblLocalFile.Location = new System.Drawing.Point(20, 25);
lblLocalFile.Name = "lblLocalFile";
lblLocalFile.Size = new System.Drawing.Size(55, 13);
lblLocalFile.TabIndex = 10;
lblLocalFile.Text = "Local file:";
//
// txtLocalFile
//
txtLocalFile.Anchor = ((AnchorStyles.Top | AnchorStyles.Left)
| AnchorStyles.Right);
txtLocalFile.BorderStyle = BorderStyle.FixedSingle;
txtLocalFile.Location = new System.Drawing.Point(105, 23);
txtLocalFile.Name = "txtLocalFile";
txtLocalFile.Size = new System.Drawing.Size(455, 22);
txtLocalFile.TabIndex = 20;
//
// txtRemoteFile
//
txtRemoteFile.Anchor = ((AnchorStyles.Top | AnchorStyles.Left)
| AnchorStyles.Right);
txtRemoteFile.BorderStyle = BorderStyle.FixedSingle;
txtRemoteFile.Location = new System.Drawing.Point(105, 49);
txtRemoteFile.Name = "txtRemoteFile";
txtRemoteFile.Size = new System.Drawing.Size(542, 22);
txtRemoteFile.TabIndex = 50;
//
// lblRemoteFile
//
lblRemoteFile.AutoSize = true;
lblRemoteFile.Location = new System.Drawing.Point(20, 51);
lblRemoteFile.Name = "lblRemoteFile";
lblRemoteFile.Size = new System.Drawing.Size(68, 13);
lblRemoteFile.TabIndex = 40;
lblRemoteFile.Text = "Remote file:";
//
// btnBrowse
//
btnBrowse.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
btnBrowse.FlatStyle = FlatStyle.Flat;
btnBrowse.Location = new System.Drawing.Point(566, 21);
btnBrowse.Name = "btnBrowse";
btnBrowse.Size = new System.Drawing.Size(81, 23);
btnBrowse.TabIndex = 30;
btnBrowse.Text = "Browse";
btnBrowse.UseVisualStyleBackColor = true;
btnBrowse.Click += new EventHandler(btnBrowse_Click);
//
// grpConnection
//
grpConnection.Anchor = ((AnchorStyles.Top | AnchorStyles.Left)
| AnchorStyles.Right);
grpConnection.Controls.Add(radProtSFTP);
grpConnection.Controls.Add(radProtSCP);
grpConnection.Controls.Add(lblProtocol);
grpConnection.Controls.Add(lblPassword);
grpConnection.Controls.Add(lblUser);
grpConnection.Controls.Add(lblPort);
grpConnection.Controls.Add(lblHost);
grpConnection.Controls.Add(txtPort);
grpConnection.Controls.Add(txtHost);
grpConnection.Controls.Add(txtPassword);
grpConnection.Controls.Add(txtUser);
grpConnection.FlatStyle = FlatStyle.Flat;
grpConnection.Location = new System.Drawing.Point(12, 12);
grpConnection.Name = "grpConnection";
grpConnection.Size = new System.Drawing.Size(668, 135);
grpConnection.TabIndex = 1000;
grpConnection.TabStop = false;
grpConnection.Text = "Connection";
//
// radProtSFTP
//
radProtSFTP.AutoSize = true;
radProtSFTP.FlatStyle = FlatStyle.Flat;
radProtSFTP.Location = new System.Drawing.Point(153, 103);
radProtSFTP.Name = "radProtSFTP";
radProtSFTP.Size = new System.Drawing.Size(47, 17);
radProtSFTP.TabIndex = 110;
radProtSFTP.Text = "SFTP";
radProtSFTP.UseVisualStyleBackColor = true;
//
// radProtSCP
//
radProtSCP.AutoSize = true;
radProtSCP.Checked = true;
radProtSCP.FlatStyle = FlatStyle.Flat;
radProtSCP.Location = new System.Drawing.Point(92, 103);
radProtSCP.Name = "radProtSCP";
radProtSCP.Size = new System.Drawing.Size(43, 17);
radProtSCP.TabIndex = 100;
radProtSCP.TabStop = true;
radProtSCP.Text = "SCP";
radProtSCP.UseVisualStyleBackColor = true;
//
// lblProtocol
//
lblProtocol.AutoSize = true;
lblProtocol.Location = new System.Drawing.Point(20, 105);
lblProtocol.Name = "lblProtocol";
lblProtocol.Size = new System.Drawing.Size(53, 13);
lblProtocol.TabIndex = 90;
lblProtocol.Text = "Protocol:";
//
// lblPassword
//
lblPassword.AutoSize = true;
lblPassword.Location = new System.Drawing.Point(20, 79);
lblPassword.Name = "lblPassword";
lblPassword.Size = new System.Drawing.Size(59, 13);
lblPassword.TabIndex = 70;
lblPassword.Text = "Password:";
//
// lblUser
//
lblUser.AutoSize = true;
lblUser.Location = new System.Drawing.Point(20, 53);
lblUser.Name = "lblUser";
lblUser.Size = new System.Drawing.Size(33, 13);
lblUser.TabIndex = 50;
lblUser.Text = "User:";
//
// lblPort
//
lblPort.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
lblPort.AutoSize = true;
lblPort.Location = new System.Drawing.Point(582, 27);
lblPort.Name = "lblPort";
lblPort.Size = new System.Drawing.Size(31, 13);
lblPort.TabIndex = 30;
lblPort.Text = "Port:";
//
// lblHost
//
lblHost.AutoSize = true;
lblHost.Location = new System.Drawing.Point(20, 27);
lblHost.Name = "lblHost";
lblHost.Size = new System.Drawing.Size(34, 13);
lblHost.TabIndex = 10;
lblHost.Text = "Host:";
//
// txtPort
//
txtPort.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
txtPort.BorderStyle = BorderStyle.FixedSingle;
txtPort.Location = new System.Drawing.Point(617, 25);
txtPort.Name = "txtPort";
txtPort.Size = new System.Drawing.Size(30, 22);
txtPort.TabIndex = 40;
//
// txtHost
//
txtHost.Anchor = ((AnchorStyles.Top | AnchorStyles.Left)
| AnchorStyles.Right);
txtHost.BorderStyle = BorderStyle.FixedSingle;
txtHost.Location = new System.Drawing.Point(105, 25);
txtHost.Name = "txtHost";
txtHost.Size = new System.Drawing.Size(471, 22);
txtHost.TabIndex = 20;
//
// txtPassword
//
txtPassword.Anchor = ((AnchorStyles.Top | AnchorStyles.Left)
| AnchorStyles.Right);
txtPassword.BorderStyle = BorderStyle.FixedSingle;
txtPassword.Location = new System.Drawing.Point(105, 77);
txtPassword.Name = "txtPassword";
txtPassword.Size = new System.Drawing.Size(471, 22);
txtPassword.TabIndex = 80;
txtPassword.UseSystemPasswordChar = true;
//
// txtUser
//
txtUser.Anchor = ((AnchorStyles.Top | AnchorStyles.Left)
| AnchorStyles.Right);
txtUser.BorderStyle = BorderStyle.FixedSingle;
txtUser.Location = new System.Drawing.Point(105, 51);
txtUser.Name = "txtUser";
txtUser.Size = new System.Drawing.Size(471, 22);
txtUser.TabIndex = 60;
//
// btnTransfer
//
btnTransfer.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
btnTransfer.FlatStyle = FlatStyle.Flat;
btnTransfer.Image = Resources.SSHTransfer;
btnTransfer.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
btnTransfer.Location = new System.Drawing.Point(597, 382);
btnTransfer.Name = "btnTransfer";
btnTransfer.Size = new System.Drawing.Size(83, 29);
btnTransfer.TabIndex = 10000;
btnTransfer.Text = "Transfer";
btnTransfer.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
btnTransfer.UseVisualStyleBackColor = true;
btnTransfer.Click += new EventHandler(btnTransfer_Click);
//
// pbStatus
//
pbStatus.Anchor = ((AnchorStyles.Bottom | AnchorStyles.Left)
| AnchorStyles.Right);
pbStatus.Location = new System.Drawing.Point(12, 353);
pbStatus.Name = "pbStatus";
pbStatus.Size = new System.Drawing.Size(668, 23);
pbStatus.TabIndex = 3000;
//
// SSHTransferWindow
//
ClientSize = new System.Drawing.Size(692, 423);
Controls.Add(grpFiles);
Controls.Add(grpConnection);
Controls.Add(btnTransfer);
Controls.Add(pbStatus);
Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
Name = "SSHTransferWindow";
TabText = "SSH File Transfer";
Text = "SSH File Transfer";
Load += new EventHandler(SSHTransfer_Load);
grpFiles.ResumeLayout(false);
grpFiles.PerformLayout();
grpConnection.ResumeLayout(false);
grpConnection.PerformLayout();
ResumeLayout(false);
}
#endregion
@@ -319,11 +318,11 @@ namespace mRemoteNG.UI.Window
{
get
{
return this.txtHost.Text;
return txtHost.Text;
}
set
{
this.txtHost.Text = value;
txtHost.Text = value;
}
}
@@ -331,11 +330,11 @@ namespace mRemoteNG.UI.Window
{
get
{
return this.txtPort.Text;
return txtPort.Text;
}
set
{
this.txtPort.Text = value;
txtPort.Text = value;
}
}
@@ -343,11 +342,11 @@ namespace mRemoteNG.UI.Window
{
get
{
return this.txtUser.Text;
return txtUser.Text;
}
set
{
this.txtUser.Text = value;
txtUser.Text = value;
}
}
@@ -355,17 +354,17 @@ namespace mRemoteNG.UI.Window
{
get
{
return this.txtPassword.Text;
return txtPassword.Text;
}
set
{
this.txtPassword.Text = value;
txtPassword.Text = value;
}
}
#endregion
#region Form Stuff
private void SSHTransfer_Load(object sender, System.EventArgs e)
private void SSHTransfer_Load(object sender, EventArgs e)
{
ApplyLanguage();
}
@@ -397,7 +396,7 @@ namespace mRemoteNG.UI.Window
return;
}
if (File.Exists(this.txtLocalFile.Text) == false)
if (File.Exists(txtLocalFile.Text) == false)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, Language.strLocalFileDoesNotExist);
return;
@@ -407,23 +406,23 @@ namespace mRemoteNG.UI.Window
{
if (Protocol == SSHTransferProtocol.SCP)
{
this.sshT = new Scp(txtHost.Text, txtUser.Text, txtPassword.Text);
sshT = new Scp(txtHost.Text, txtUser.Text, txtPassword.Text);
}
else if (Protocol == SSHTransferProtocol.SFTP)
{
this.sshT = new Sftp(txtHost.Text, txtUser.Text, txtPassword.Text);
sshT = new Sftp(txtHost.Text, txtUser.Text, txtPassword.Text);
}
sshT.OnTransferStart += SshTransfer_Start;
sshT.OnTransferProgress += SshTransfer_Progress;
sshT.OnTransferEnd += SshTransfer_End;
sshT.Connect(Convert.ToInt32(txtPort.Text));
this.sshT.Connect(Convert.ToInt32(this.txtPort.Text));
LocalFile = txtLocalFile.Text;
RemoteFile = txtRemoteFile.Text;
LocalFile = this.txtLocalFile.Text;
RemoteFile = this.txtRemoteFile.Text;
Thread t = new Thread(new System.Threading.ThreadStart(StartTransferBG));
Thread t = new Thread(new ThreadStart(StartTransferBG));
t.SetApartmentState(ApartmentState.STA);
t.IsBackground = true;
t.Start();
@@ -431,7 +430,7 @@ namespace mRemoteNG.UI.Window
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strSSHTransferFailed + Environment.NewLine + ex.Message);
this.sshT.Close();
sshT.Close();
}
}
@@ -443,7 +442,7 @@ namespace mRemoteNG.UI.Window
try
{
DisableButtons();
this.sshT.Put(LocalFile, RemoteFile);
sshT.Put(LocalFile, RemoteFile);
}
catch (Exception ex)
{
@@ -453,19 +452,19 @@ namespace mRemoteNG.UI.Window
private bool AllFieldsSet()
{
if (this.txtHost.Text != "" && this.txtPort.Text != "" && this.txtUser.Text != "" && this.txtLocalFile.Text != "" && this.txtRemoteFile.Text != "")
if (txtHost.Text != "" && txtPort.Text != "" && txtUser.Text != "" && txtLocalFile.Text != "" && txtRemoteFile.Text != "")
{
if (this.txtPassword.Text == "")
if (txtPassword.Text == "")
{
if (Interaction.MsgBox(Language.strEmptyPasswordContinue, (Microsoft.VisualBasic.MsgBoxStyle) (MsgBoxStyle.Question | MsgBoxStyle.YesNo), null) == MsgBoxResult.No)
if (MessageBox.Show(frmMain.Default, Language.strEmptyPasswordContinue, "Question?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return false;
}
}
if (this.txtRemoteFile.Text.EndsWith("/") || this.txtRemoteFile.Text.EndsWith("\\"))
if (txtRemoteFile.Text.EndsWith("/") || txtRemoteFile.Text.EndsWith("\\"))
{
this.txtRemoteFile.Text += this.txtLocalFile.Text.Substring(this.txtLocalFile.Text.LastIndexOf("\\") + 1);
txtRemoteFile.Text += txtLocalFile.Text.Substring(txtLocalFile.Text.LastIndexOf("\\") + 1);
}
return true;
@@ -486,7 +485,7 @@ namespace mRemoteNG.UI.Window
if (pbStatus.InvokeRequired)
{
SetStatusCB d = new SetStatusCB(SetStatus);
this.pbStatus.Invoke(d);
pbStatus.Invoke(d);
}
else
{
@@ -501,7 +500,7 @@ namespace mRemoteNG.UI.Window
if (btnTransfer.InvokeRequired)
{
EnableButtonsCB d = new EnableButtonsCB(EnableButtons);
this.btnTransfer.Invoke(d);
btnTransfer.Invoke(d);
}
else
{
@@ -515,7 +514,7 @@ namespace mRemoteNG.UI.Window
if (btnTransfer.InvokeRequired)
{
DisableButtonsCB d = new DisableButtonsCB(DisableButtons);
this.btnTransfer.Invoke(d);
btnTransfer.Invoke(d);
}
else
{
@@ -551,13 +550,13 @@ namespace mRemoteNG.UI.Window
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, Language.strSSHTransferFailed);
if (this.sshT != null)
if (sshT != null)
{
this.sshT.Close();
sshT.Close();
}
else if (this.sshT != null)
else if (sshT != null)
{
this.sshT.Close();
sshT.Close();
}
}
catch (Exception ex)
@@ -570,37 +569,37 @@ namespace mRemoteNG.UI.Window
#region Public Methods
public SSHTransferWindow(DockContent Panel)
{
this.WindowType = WindowType.SSHTransfer;
this.DockPnl = Panel;
this.InitializeComponent();
this.oDlg = new OpenFileDialog();
this.oDlg.Filter = "All Files (*.*)|*.*";
this.oDlg.CheckFileExists = true;
WindowType = WindowType.SSHTransfer;
DockPnl = Panel;
InitializeComponent();
oDlg = new OpenFileDialog();
oDlg.Filter = "All Files (*.*)|*.*";
oDlg.CheckFileExists = true;
}
#endregion
#region Form Stuff
private void btnBrowse_Click(System.Object sender, System.EventArgs e)
private void btnBrowse_Click(object sender, EventArgs e)
{
if (this.oDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (oDlg.ShowDialog() == DialogResult.OK)
{
if (this.oDlg.FileName != "")
if (oDlg.FileName != "")
{
this.txtLocalFile.Text = this.oDlg.FileName;
txtLocalFile.Text = oDlg.FileName;
}
}
}
private void btnTransfer_Click(System.Object sender, System.EventArgs e)
private void btnTransfer_Click(object sender, EventArgs e)
{
if (this.radProtSCP.Checked)
if (radProtSCP.Checked)
{
this.StartTransfer(SSHTransferProtocol.SCP);
StartTransfer(SSHTransferProtocol.SCP);
}
else if (this.radProtSFTP.Checked)
else if (radProtSFTP.Checked)
{
this.StartTransfer(SSHTransferProtocol.SFTP);
StartTransfer(SSHTransferProtocol.SFTP);
}
}
#endregion

View File

@@ -112,12 +112,12 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA