mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
merged from develop
This commit is contained in:
BIN
.github/logo.png
vendored
Normal file
BIN
.github/logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -18,7 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- #1690: Replaced GeckoFX (Firefox) with CefSharp (Chromium)
|
||||
- #1325: Language resource files cleanup
|
||||
### Fixed
|
||||
- #1773: Connection issue with mysql - Missing fields in tblCons
|
||||
- #1783: Added missing inheritance properties to SQL scripts
|
||||
- #1773: Connection issue with mysql - Missing fields in
|
||||
- #1756: Cannot type any character on MultiSSH toolbar
|
||||
- #1720: Show configuration file name in title of password prompt form
|
||||
- #1713: Sound redirection does not work if Clipboard redirection is set to No
|
||||
- #1632: 1.77.1 breaks RDP drive and sound redirection
|
||||
|
||||
64
README.MD
64
README.MD
@@ -1,29 +1,52 @@
|
||||
# Welcome to the mRemoteNG project!
|
||||
<p align="center">
|
||||
<img width="500" src="https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/develop/.github/logo.png">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
mRemoteNG is an open source, multi-protocol, remote connections manager that allows you to view all of your remote connections in a simple, yet powerful tabbed interface
|
||||
</p>
|
||||
|
||||
[](https://twitter.com/intent/follow?screen_name=mRemoteNG)
|
||||
[](https://gitter.im/mRemoteNG/PublicChat)
|
||||
[](https://www.paypal.me/DavidSparer)
|
||||
<p align="center">
|
||||
<img alt="GitHub All Releases" src="https://img.shields.io/github/downloads/mremoteng/mremoteng/total?label=Overall%20Downloads&style=for-the-badge">
|
||||
</p>
|
||||
|
||||
[](https://github.com/mRemoteNG/mRemoteNG/releases/)
|
||||
<p align="center">
|
||||
<a href="https://www.reddit.com/r/mRemoteNG/">
|
||||
<img alt="Subreddit subscribers" src="https://img.shields.io/reddit/subreddit-subscribers/mremoteng?label=Reddit&logo=Reddit&style=flat-square">
|
||||
</a>
|
||||
<a href="https://twitter.com/mremoteng">
|
||||
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/mremoteng?color=%231DA1F2&label=Twitter&logo=Twitter&style=flat-square">
|
||||
</a>
|
||||
<a href="https://gitter.im/mRemoteNG/PublicChat">
|
||||
<img alt="Gitter" src="https://img.shields.io/gitter/room/mRemoteNG/PublicChat?label=Join%20the%20Chat&logo=Gitter&style=flat-square">
|
||||
</a>
|
||||
<a href="https://www.paypal.me/DavidSparer">
|
||||
<img alt="PayPal" src="https://img.shields.io/badge/%24-PayPal-blue.svg?label=Donate&logo=PayPal&style=flat-square">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/529)
|
||||
[](https://mremoteng.readthedocs.io/en/latest/?badge=latest)
|
||||
<p align="center">
|
||||
<a href="https://github.com/mRemoteNG/mRemoteNG/blob/develop/COPYING.TXT">
|
||||
<img alt="License" src="https://img.shields.io/github/license/mremoteng/mremoteng?label=License&style=flat">
|
||||
</a>
|
||||
<a href="https://bestpractices.coreinfrastructure.org/projects/529">
|
||||
<img alt="CII Best Practices" src="https://bestpractices.coreinfrastructure.org/projects/529/badge?style=flat">
|
||||
</a>
|
||||
<a href='https://mremoteng.readthedocs.io/en/latest/?badge=latest'>
|
||||
<img src='https://readthedocs.org/projects/mremoteng/badge/?version=latest' alt='Documentation Status' />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
| Update Channel | Build Status | Downloads |
|
||||
| ---------------|--------------|-----------|
|
||||
| Stable | [](https://ci.appveyor.com/project/mremoteng/mremoteng/branch/master) | [](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.76.15) |
|
||||
| Beta | | [](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.76.15) |
|
||||
| Development | [](https://ci.appveyor.com/project/mremoteng/mremoteng/branch/develop) | [](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.77.1) |
|
||||
|
||||
mRemoteNG is the next generation of mRemote, a full-featured, multi-tab remote connections manager.
|
||||
| Prerelease | [](https://ci.appveyor.com/project/mremoteng/mremoteng/branch/develop) | [](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.77.1) |
|
||||
|
||||
## Features
|
||||
|
||||
mRemoteNG is a fork of mRemote: an open source, tabbed, multi-protocol, remote connections manager. mRemoteNG adds bug fixes and new features to mRemote.
|
||||
|
||||
It allows you to view all of your remote connections in a simple yet powerful tabbed interface.
|
||||
|
||||
mRemoteNG supports the following protocols:
|
||||
The following protocols are supported:
|
||||
|
||||
* RDP (Remote Desktop/Terminal Server)
|
||||
* VNC (Virtual Network Computing)
|
||||
@@ -37,9 +60,8 @@ For a detailed feature list and general usage support, refer to the [Documentati
|
||||
|
||||
## Installation
|
||||
|
||||
mRemoteNG is supported on Windows 7 or later. Before installing make sure you fullfill all the [minimum requirements](https://mremoteng.readthedocs.io/en/latest/installation/minimum_requirements.html).
|
||||
|
||||
mRemoteNG is available as a redistributable msi package, and can be downloaded from the following locations:
|
||||
Before installing make sure you fullfill all the [minimum requirements](https://mremoteng.readthedocs.io/en/latest/installation/minimum_requirements.html).
|
||||
We support Microsoft Windows 7 or later. mRemoteNG is available as a redistributable MSI package or as a portable ZIP package, and can be downloaded from the following locations:
|
||||
* [GitHub](https://github.com/mRemoteNG/mRemoteNG/releases)
|
||||
* [Project Website](https://mremoteng.org/download)
|
||||
|
||||
@@ -53,4 +75,6 @@ Check out the [Wiki page](https://github.com/mRemoteNG/mRemoteNG/wiki) on how to
|
||||
### Translate
|
||||
Check out the [Wiki page](https://github.com/mRemoteNG/mRemoteNG/wiki) on how to help make mRemoteNG a polyglot.
|
||||
|
||||
[](https://www.jetbrains.com/resharper/)
|
||||
<p align="center">
|
||||
<img alt="Developed with ReSharper" src="https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/develop/.github/icon_ReSharper.png">
|
||||
</p>
|
||||
|
||||
@@ -14,10 +14,20 @@ Write-Output "Building HTML-Documentation with Sphinx"
|
||||
|
||||
$path_HelpFilesDir = Join-Path -Path $TargetDir -ChildPath "Help"
|
||||
$path_SphinxSourceDir = Join-Path -Path $SolutionDir -ChildPath "mRemoteNG\Documentation"
|
||||
|
||||
# Remove stale Help files, if they exist
|
||||
if (Test-Path -Path $path_HelpFilesDir) {
|
||||
Remove-Item -Path $path_HelpFilesDir -Recurse -Force
|
||||
}
|
||||
|
||||
# Build docs
|
||||
sphinx-build $path_SphinxSourceDir $path_HelpFilesDir
|
||||
|
||||
# Place dummy html file if build failed
|
||||
if (-Not (Test-Path $path_HelpFilesDir\index.html -PathType Leaf)) {
|
||||
New-Item -Path $path_HelpFilesDir -ItemType "directory"
|
||||
New-Item $path_HelpFilesDir\index.html
|
||||
Set-Content $path_HelpFilesDir\index.html 'Welcome to mRemoteNG!'
|
||||
}
|
||||
|
||||
Write-Output ""
|
||||
@@ -21,12 +21,14 @@ namespace mRemoteNG.App
|
||||
{
|
||||
if (Settings.Default.OverrideFIPSCheck)
|
||||
{
|
||||
messageCollector.AddMessage(MessageClass.InformationMsg, "OverrideFIPSCheck is set. Will skip check...",
|
||||
true);
|
||||
messageCollector.AddMessage(MessageClass.InformationMsg, "OverrideFIPSCheck is set. Will skip check", true);
|
||||
return;
|
||||
}
|
||||
|
||||
messageCollector.AddMessage(MessageClass.InformationMsg, "Checking FIPS Policy...", true);
|
||||
messageCollector.AddMessage(MessageClass.InformationMsg, "Checking FIPS policy...", true);
|
||||
messageCollector.AddMessage(MessageClass.InformationMsg, $"FIPS2003: {FipsPolicyEnabledForServer2003()}", true);
|
||||
messageCollector.AddMessage(MessageClass.InformationMsg, $"FIPS2008+: {FipsPolicyEnabledForServer2008AndNewer()}", true);
|
||||
|
||||
if (!FipsPolicyEnabledForServer2003() && !FipsPolicyEnabledForServer2008AndNewer()) return;
|
||||
|
||||
var errorText = string.Format(Language.ErrorFipsPolicyIncompatible, GeneralAppInfo.ProductName);
|
||||
@@ -86,7 +88,14 @@ namespace mRemoteNG.App
|
||||
messageCollector.AddExceptionMessage("Error in CheckLenovoAutoScrollUtility", ex);
|
||||
}
|
||||
|
||||
if (proccesses.Length <= 0) return;
|
||||
if (proccesses.Length <= 0)
|
||||
{
|
||||
messageCollector.AddMessage(MessageClass.InformationMsg, "Lenovo AutoScroll Utility not found", true);
|
||||
return;
|
||||
}
|
||||
|
||||
messageCollector.AddMessage(MessageClass.WarningMsg, "Lenovo AutoScroll Utility found", true);
|
||||
|
||||
CTaskDialog.MessageBox(Application.ProductName, Language.CompatibilityProblemDetected,
|
||||
string.Format(Language.CompatibilityLenovoAutoScrollUtilityDetected,
|
||||
Application.ProductName), "",
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace mRemoteNG.App
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
XmlConfigurator.Configure();
|
||||
XmlConfigurator.Configure(LogManager.CreateRepository("mRemoteNG"));
|
||||
if (string.IsNullOrEmpty(Settings.Default.LogFilePath))
|
||||
Settings.Default.LogFilePath = BuildLogFilePath();
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace mRemoteNG.App
|
||||
|
||||
public void SetLogPath(string path)
|
||||
{
|
||||
var repository = LogManager.GetRepository();
|
||||
var repository = LogManager.GetRepository("mRemoteNG");
|
||||
var appenders = repository.GetAppenders();
|
||||
|
||||
foreach (var appender in appenders)
|
||||
@@ -44,7 +44,7 @@ namespace mRemoteNG.App
|
||||
fileAppender.ActivateOptions();
|
||||
}
|
||||
|
||||
Log = LogManager.GetLogger("Logger");
|
||||
Log = LogManager.GetLogger("mRemoteNG", "Logger");
|
||||
}
|
||||
|
||||
private static string BuildLogFilePath()
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
|
||||
// ReSharper disable ArrangeAccessorOwnerBody
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using mRemoteNG.Tools;
|
||||
@@ -24,7 +24,6 @@ namespace mRemoteNG.Config.Putty
|
||||
private PuttySessionsManager()
|
||||
{
|
||||
AddProvider(new PuttySessionsRegistryProvider());
|
||||
AddProvider(new PuttySessionsXmingProvider());
|
||||
}
|
||||
|
||||
|
||||
@@ -124,16 +123,7 @@ namespace mRemoteNG.Config.Putty
|
||||
private bool IsProviderEnabled(AbstractPuttySessionsProvider puttySessionsProvider)
|
||||
{
|
||||
var enabled = true;
|
||||
if (PuttyTypeDetector.GetPuttyType() == PuttyTypeDetector.PuttyType.Xming)
|
||||
{
|
||||
if (puttySessionsProvider is PuttySessionsRegistryProvider)
|
||||
enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (puttySessionsProvider is PuttySessionsXmingProvider)
|
||||
enabled = false;
|
||||
}
|
||||
if (!(puttySessionsProvider is PuttySessionsRegistryProvider)) enabled = false;
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Management;
|
||||
using System.Net;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Microsoft.Win32;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
|
||||
@@ -1,378 +0,0 @@
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Messages;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using System.Web;
|
||||
using System.Net;
|
||||
|
||||
namespace mRemoteNG.Config.Putty
|
||||
{
|
||||
public class PuttySessionsXmingProvider : AbstractPuttySessionsProvider
|
||||
{
|
||||
public override RootPuttySessionsNodeInfo RootInfo { get; } =
|
||||
new RootPuttySessionsNodeInfo {Name = "Xming Putty Sessions"};
|
||||
|
||||
private const string RegistrySessionNameFormat = "{0} [registry]";
|
||||
private const string RegistrySessionNamePattern = "(.*)\\ \\[registry\\]";
|
||||
|
||||
private static readonly PuttySessionsRegistryProvider PuttySessionsRegistryProvider =
|
||||
new PuttySessionsRegistryProvider();
|
||||
|
||||
private static FileSystemWatcher _eventWatcher;
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override string[] GetSessionNames(bool raw = false)
|
||||
{
|
||||
var sessionsFolderPath = GetSessionsFolderPath();
|
||||
if (!Directory.Exists(sessionsFolderPath))
|
||||
{
|
||||
return new string[] { };
|
||||
}
|
||||
|
||||
var sessionNames = new List<string>();
|
||||
foreach (var sessionName in Directory.GetFiles(sessionsFolderPath))
|
||||
{
|
||||
var sessionFileName = Path.GetFileName(sessionName);
|
||||
// ReSharper disable once ConstantConditionalAccessQualifier
|
||||
sessionNames.Add(raw ? sessionFileName
|
||||
: WebUtility.UrlDecode(sessionFileName?.Replace("+", "%2B")));
|
||||
}
|
||||
|
||||
if (raw)
|
||||
{
|
||||
if (!sessionNames.Contains("Default%20Settings")) // Do not localize
|
||||
sessionNames.Insert(0, "Default%20Settings");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sessionNames.Contains("Default Settings"))
|
||||
sessionNames.Insert(0, "Default Settings");
|
||||
}
|
||||
|
||||
var registrySessionNames =
|
||||
PuttySessionsRegistryProvider.GetSessionNames(raw).Select(sessionName => string.Format(RegistrySessionNameFormat, sessionName)).ToList();
|
||||
|
||||
sessionNames.AddRange(registrySessionNames);
|
||||
sessionNames.Sort();
|
||||
|
||||
return sessionNames.ToArray();
|
||||
}
|
||||
|
||||
public override PuttySessionInfo GetSession(string sessionName)
|
||||
{
|
||||
var registrySessionName = GetRegistrySessionName(sessionName);
|
||||
if (!string.IsNullOrEmpty(registrySessionName))
|
||||
{
|
||||
return ModifyRegistrySessionInfo(PuttySessionsRegistryProvider.GetSession(registrySessionName));
|
||||
}
|
||||
|
||||
var sessionsFolderPath = GetSessionsFolderPath();
|
||||
if (!Directory.Exists(sessionsFolderPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var sessionFile = Path.Combine(sessionsFolderPath, sessionName);
|
||||
if (!File.Exists(sessionFile))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
sessionName = WebUtility.UrlDecode(sessionName.Replace("+", "%2B"));
|
||||
|
||||
var sessionFileReader = new SessionFileReader(sessionFile);
|
||||
var sessionInfo = new PuttySessionInfo
|
||||
{
|
||||
PuttySession = sessionName,
|
||||
Name = sessionName,
|
||||
Hostname = sessionFileReader.GetValue("HostName"),
|
||||
Username = sessionFileReader.GetValue("UserName")
|
||||
};
|
||||
var protocol = sessionFileReader.GetValue("Protocol") ?? "ssh";
|
||||
switch (protocol.ToLowerInvariant())
|
||||
{
|
||||
case "raw":
|
||||
sessionInfo.Protocol = ProtocolType.RAW;
|
||||
break;
|
||||
case "rlogin":
|
||||
sessionInfo.Protocol = ProtocolType.Rlogin;
|
||||
break;
|
||||
case "serial":
|
||||
return null;
|
||||
case "ssh":
|
||||
object sshVersionObject = sessionFileReader.GetValue("SshProt");
|
||||
if (sshVersionObject != null)
|
||||
{
|
||||
var sshVersion = Convert.ToInt32(sshVersionObject);
|
||||
sessionInfo.Protocol = sshVersion >= 2 ? ProtocolType.SSH2 : ProtocolType.SSH1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sessionInfo.Protocol = ProtocolType.SSH2;
|
||||
}
|
||||
|
||||
break;
|
||||
case "telnet":
|
||||
sessionInfo.Protocol = ProtocolType.Telnet;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
sessionInfo.Port = Convert.ToInt32(sessionFileReader.GetValue("PortNumber"));
|
||||
|
||||
return sessionInfo;
|
||||
}
|
||||
|
||||
public override void StartWatcher()
|
||||
{
|
||||
if (_eventWatcher != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var sessionsFolderPath = GetSessionsFolderPath();
|
||||
|
||||
if (!Directory.Exists(sessionsFolderPath))
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
|
||||
$"XmingPortablePuttySessions.Watcher.StartWatching() failed: '{sessionsFolderPath}' does not exist.",
|
||||
true);
|
||||
return;
|
||||
}
|
||||
|
||||
_eventWatcher = new FileSystemWatcher(sessionsFolderPath)
|
||||
{
|
||||
NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite
|
||||
};
|
||||
_eventWatcher.Changed += OnFileSystemEventArrived;
|
||||
_eventWatcher.Created += OnFileSystemEventArrived;
|
||||
_eventWatcher.Deleted += OnFileSystemEventArrived;
|
||||
_eventWatcher.Renamed += OnFileSystemEventArrived;
|
||||
_eventWatcher.EnableRaisingEvents = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionMessage(
|
||||
"XmingPortablePuttySessions.Watcher.StartWatching() failed.",
|
||||
ex, MessageClass.WarningMsg);
|
||||
}
|
||||
}
|
||||
|
||||
public override void StopWatcher()
|
||||
{
|
||||
PuttySessionsRegistryProvider.StopWatcher();
|
||||
PuttySessionsRegistryProvider.PuttySessionChanged -= OnRegistrySessionChanged;
|
||||
|
||||
if (_eventWatcher == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_eventWatcher.EnableRaisingEvents = false;
|
||||
_eventWatcher.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static string GetPuttyConfPath()
|
||||
{
|
||||
var puttyPath = mRemoteNG.Settings.Default.UseCustomPuttyPath
|
||||
? mRemoteNG.Settings.Default.CustomPuttyPath
|
||||
: App.Info.GeneralAppInfo.PuttyPath;
|
||||
puttyPath = Path.GetDirectoryName(puttyPath);
|
||||
return string.IsNullOrEmpty(puttyPath) ? null : Path.Combine(puttyPath, "putty.conf");
|
||||
}
|
||||
|
||||
private static string GetSessionsFolderPath()
|
||||
{
|
||||
var puttyConfPath = GetPuttyConfPath();
|
||||
var sessionFileReader = new PuttyConfFileReader(puttyConfPath);
|
||||
var basePath = Environment.ExpandEnvironmentVariables(sessionFileReader.GetValue("sshk&sess"));
|
||||
return Path.Combine(basePath, "sessions");
|
||||
}
|
||||
|
||||
private static string GetRegistrySessionName(string sessionName)
|
||||
{
|
||||
var regex = new Regex(RegistrySessionNamePattern);
|
||||
|
||||
var matches = regex.Matches(sessionName);
|
||||
if (matches.Count < 1)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var groups = matches[0].Groups;
|
||||
return groups.Count < 1 ? string.Empty : groups[1].Value;
|
||||
}
|
||||
|
||||
private static PuttySessionInfo ModifyRegistrySessionInfo(PuttySessionInfo sessionInfo)
|
||||
{
|
||||
if (sessionInfo == null)
|
||||
return null;
|
||||
|
||||
sessionInfo.Name = string.Format(RegistrySessionNameFormat, sessionInfo.Name);
|
||||
sessionInfo.PuttySession = string.Format(RegistrySessionNameFormat, sessionInfo.PuttySession);
|
||||
return sessionInfo;
|
||||
}
|
||||
|
||||
private void OnFileSystemEventArrived(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
RaiseSessionChangedEvent(new PuttySessionChangedEventArgs());
|
||||
}
|
||||
|
||||
private void OnRegistrySessionChanged(object sender, PuttySessionChangedEventArgs e)
|
||||
{
|
||||
RaiseSessionChangedEvent(new PuttySessionChangedEventArgs());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Classes
|
||||
|
||||
private class PuttyConfFileReader
|
||||
{
|
||||
public PuttyConfFileReader(string puttyConfFile)
|
||||
{
|
||||
_puttyConfFile = puttyConfFile;
|
||||
}
|
||||
|
||||
private string _puttyConfFile;
|
||||
private bool _configurationLoaded;
|
||||
private Dictionary<string, string> _configuration = new Dictionary<string, string>();
|
||||
|
||||
private void LoadConfiguration()
|
||||
{
|
||||
_configurationLoaded = true;
|
||||
try
|
||||
{
|
||||
if (!File.Exists(_puttyConfFile))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
using (var streamReader = new StreamReader(_puttyConfFile))
|
||||
{
|
||||
do
|
||||
{
|
||||
var line = streamReader.ReadLine();
|
||||
if (line == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
line = line.Trim();
|
||||
if (line == string.Empty)
|
||||
{
|
||||
continue; // Blank line
|
||||
}
|
||||
|
||||
if (line.Substring(0, 1) == ";")
|
||||
{
|
||||
continue; // Comment
|
||||
}
|
||||
|
||||
var parts = line.Split(new[] {'='}, 2);
|
||||
if (parts.Length < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_configuration.ContainsKey(parts[0]))
|
||||
{
|
||||
continue; // As per http://www.straightrunning.com/XmingNotes/portableputty.php only first entry is used
|
||||
}
|
||||
|
||||
_configuration.Add(parts[0], parts[1]);
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionMessage("PuttyConfFileReader.LoadConfiguration() failed.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetValue(string setting)
|
||||
{
|
||||
if (!_configurationLoaded)
|
||||
{
|
||||
LoadConfiguration();
|
||||
}
|
||||
|
||||
return !_configuration.ContainsKey(setting) ? string.Empty : _configuration[setting];
|
||||
}
|
||||
}
|
||||
|
||||
private class SessionFileReader
|
||||
{
|
||||
public SessionFileReader(string sessionFile)
|
||||
{
|
||||
_sessionFile = sessionFile;
|
||||
}
|
||||
|
||||
private string _sessionFile;
|
||||
private bool _sessionInfoLoaded;
|
||||
private Dictionary<string, string> _sessionInfo = new Dictionary<string, string>();
|
||||
|
||||
private void LoadSessionInfo()
|
||||
{
|
||||
_sessionInfoLoaded = true;
|
||||
try
|
||||
{
|
||||
if (!File.Exists(_sessionFile))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
using (var streamReader = new StreamReader(_sessionFile))
|
||||
{
|
||||
do
|
||||
{
|
||||
var line = streamReader.ReadLine();
|
||||
if (line == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
var parts = line.Split('\\');
|
||||
if (parts.Length < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_sessionInfo.Add(parts[0], parts[1]);
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionMessage("SessionFileReader.LoadSessionInfo() failed.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetValue(string setting)
|
||||
{
|
||||
if (!_sessionInfoLoaded)
|
||||
{
|
||||
LoadSessionInfo();
|
||||
}
|
||||
|
||||
return !_sessionInfo.ContainsKey(setting) ? string.Empty : _sessionInfo[setting];
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace mRemoteNG.Config.Serializers.MsSql
|
||||
connectionInfo.Icon = (string)dataRow["Icon"];
|
||||
connectionInfo.Panel = (string)dataRow["Panel"];
|
||||
connectionInfo.Username = (string)dataRow["Username"];
|
||||
connectionInfo.Domain = (string)dataRow["DomainName"];
|
||||
connectionInfo.Domain = (string)dataRow["Domain"];
|
||||
connectionInfo.Password = DecryptValue((string)dataRow["Password"]);
|
||||
connectionInfo.Hostname = (string)dataRow["Hostname"];
|
||||
connectionInfo.VmId = (string)dataRow["VmId"];
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace mRemoteNG.Config.Serializers.MsSql
|
||||
dataTable.Columns.Add("Icon", typeof(string));
|
||||
dataTable.Columns.Add("Panel", typeof(string));
|
||||
dataTable.Columns.Add("Username", typeof(string));
|
||||
dataTable.Columns.Add("DomainName", typeof(string));
|
||||
dataTable.Columns.Add("Domain", typeof(string));
|
||||
dataTable.Columns.Add("Password", typeof(string));
|
||||
dataTable.Columns.Add("Hostname", typeof(string));
|
||||
dataTable.Columns.Add("Port", typeof(int));
|
||||
@@ -264,7 +264,7 @@ namespace mRemoteNG.Config.Serializers.MsSql
|
||||
dataRow["Icon"].Equals(connectionInfo.Icon) &&
|
||||
dataRow["Panel"].Equals(connectionInfo.Panel) &&
|
||||
dataRow["Username"].Equals(_saveFilter.SaveUsername ? connectionInfo.Username : "") &&
|
||||
dataRow["DomainName"].Equals(_saveFilter.SaveDomain ? connectionInfo.Domain : "");
|
||||
dataRow["Domain"].Equals(_saveFilter.SaveDomain ? connectionInfo.Domain : "");
|
||||
|
||||
isFieldNotChange = isFieldNotChange && dataRow["Hostname"].Equals(connectionInfo.Hostname);
|
||||
isFieldNotChange = isFieldNotChange && dataRow["VmId"].Equals(connectionInfo.VmId);
|
||||
@@ -508,7 +508,7 @@ namespace mRemoteNG.Config.Serializers.MsSql
|
||||
dataRow["Icon"] = connectionInfo.Icon;
|
||||
dataRow["Panel"] = connectionInfo.Panel;
|
||||
dataRow["Username"] = _saveFilter.SaveUsername ? connectionInfo.Username : "";
|
||||
dataRow["DomainName"] = _saveFilter.SaveDomain ? connectionInfo.Domain : "";
|
||||
dataRow["Domain"] = _saveFilter.SaveDomain ? connectionInfo.Domain : "";
|
||||
dataRow["Password"] = _saveFilter.SavePassword
|
||||
? _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)
|
||||
: "";
|
||||
|
||||
@@ -22,135 +22,143 @@ CREATE TABLE [dbo].[tblCons] (
|
||||
Name varchar(128) NOT NULL,
|
||||
[Type] varchar(32) NOT NULL,
|
||||
Expanded bit NOT NULL,
|
||||
Description varchar(1024),
|
||||
Icon varchar(128) NOT NULL,
|
||||
Panel varchar(128) NOT NULL,
|
||||
Username varchar(512),
|
||||
DomainName varchar(512),
|
||||
Password varchar(1024),
|
||||
Hostname varchar(512),
|
||||
Protocol varchar(32) NOT NULL,
|
||||
PuttySession varchar(128),
|
||||
Port int NOT NULL,
|
||||
ConnectToConsole bit NOT NULL,
|
||||
UseCredSsp bit NOT NULL,
|
||||
RenderingEngine varchar(10),
|
||||
ICAEncryptionStrength varchar(32) NOT NULL,
|
||||
RDPAuthenticationLevel varchar(32) NOT NULL,
|
||||
RDPMinutesToIdleTimeout int NOT NULL,
|
||||
RDPAlertIdleTimeout bit NOT NULL,
|
||||
AutomaticResize bit DEFAULT ((1)) NOT NULL,
|
||||
CacheBitmaps bit NOT NULL,
|
||||
Colors varchar(32) NOT NULL,
|
||||
Resolution varchar(32) NOT NULL,
|
||||
DisplayWallpaper bit NOT NULL,
|
||||
DisplayThemes bit NOT NULL,
|
||||
EnableFontSmoothing bit NOT NULL,
|
||||
EnableDesktopComposition bit NOT NULL,
|
||||
|
||||
|
||||
ConnectToConsole bit NOT NULL,
|
||||
Connected bit NOT NULL,
|
||||
Description varchar(1024),
|
||||
DisableCursorBlinking bit NOT NULL,
|
||||
DisableCursorShadow bit NOT NULL,
|
||||
DisableFullWindowDrag bit NOT NULL,
|
||||
DisableMenuAnimations bit NOT NULL,
|
||||
DisableCursorShadow bit NOT NULL,
|
||||
DisableCursorBlinking bit NOT NULL,
|
||||
|
||||
CacheBitmaps bit NOT NULL,
|
||||
DisplayThemes bit NOT NULL,
|
||||
DisplayWallpaper bit NOT NULL,
|
||||
Domain varchar(512),
|
||||
EnableDesktopComposition bit NOT NULL,
|
||||
EnableFontSmoothing bit NOT NULL,
|
||||
ExtApp varchar(256),
|
||||
Favorite tinyint(1) NOT NULL,
|
||||
Hostname varchar(512),
|
||||
ICAEncryptionStrength varchar(32) NOT NULL,
|
||||
Icon varchar(128) NOT NULL,
|
||||
LoadBalanceInfo varchar(1024),
|
||||
MacAddress varchar(32),
|
||||
Panel varchar(128) NOT NULL,
|
||||
Password varchar(1024),
|
||||
Port int NOT NULL,
|
||||
PostExtApp varchar(256),
|
||||
PreExtApp varchar(256),
|
||||
Protocol varchar(32) NOT NULL,
|
||||
PuttySession varchar(128),
|
||||
RDGatewayDomain varchar(512),
|
||||
RDGatewayHostname varchar(512),
|
||||
RDGatewayPassword varchar(1024),
|
||||
RDGatewayUsageMethod varchar(32) NOT NULL,
|
||||
RDGatewayUseConnectionCredentials varchar(32) NOT NULL,
|
||||
RDGatewayUsername varchar(512),
|
||||
RDPAlertIdleTimeout bit NOT NULL,
|
||||
RDPAuthenticationLevel varchar(32) NOT NULL,
|
||||
RDPMinutesToIdleTimeout int NOT NULL,
|
||||
RdpVersion varchar(10),
|
||||
RedirectAudioCapture bit NOT NULL,
|
||||
RedirectClipboard bit DEFAULT ((0)) NOT NULL,
|
||||
RedirectClipboard bit NOT NULL,
|
||||
RedirectDiskDrives bit NOT NULL,
|
||||
RedirectKeys bit NOT NULL,
|
||||
RedirectPorts bit NOT NULL,
|
||||
RedirectPrinters bit NOT NULL,
|
||||
RedirectSmartCards bit NOT NULL,
|
||||
RedirectSound varchar(64) NOT NULL,
|
||||
RenderingEngine varchar(10),
|
||||
Resolution varchar(32) NOT NULL,
|
||||
SSHOptions varchar(1024) NOT NULL,
|
||||
SSHTunnelConnectionName varchar(128) NOT NULL,
|
||||
SoundQuality varchar(20) NOT NULL,
|
||||
RedirectAudioCapture bit NOT NULL,
|
||||
RedirectKeys bit NOT NULL,
|
||||
Connected bit NOT NULL,
|
||||
PreExtApp varchar(256),
|
||||
PostExtApp varchar(256),
|
||||
MacAddress varchar(32),
|
||||
UseCredSsp bit NOT NULL,
|
||||
UseEnhancedMode bit DEFAULT ((0)),
|
||||
UseVmId bit,
|
||||
UserField varchar(256),
|
||||
ExtApp varchar(256),
|
||||
Username varchar(512),
|
||||
VNCAuthMode varchar(10),
|
||||
VNCColors varchar(10),
|
||||
VNCCompression varchar(10),
|
||||
VNCEncoding varchar(20),
|
||||
VNCAuthMode varchar(10),
|
||||
VNCProxyType varchar(20),
|
||||
VNCProxyIP varchar(128),
|
||||
VNCProxyPort int,
|
||||
VNCProxyUsername varchar(512),
|
||||
VNCProxyPassword varchar(1024),
|
||||
VNCColors varchar(10),
|
||||
VNCProxyPort int,
|
||||
VNCProxyType varchar(20),
|
||||
VNCProxyUsername varchar(512),
|
||||
VNCSmartSizeMode varchar(20),
|
||||
VNCViewOnly bit NOT NULL,
|
||||
RDGatewayUsageMethod varchar(32) NOT NULL,
|
||||
RDGatewayHostname varchar(512),
|
||||
RDGatewayUseConnectionCredentials varchar(32) NOT NULL,
|
||||
RDGatewayUsername varchar(512),
|
||||
RDGatewayPassword varchar(1024),
|
||||
RDGatewayDomain varchar(512),
|
||||
VmId varchar(100),
|
||||
InheritAutomaticResize bit DEFAULT ((0)) NOT NULL,
|
||||
InheritCacheBitmaps bit NOT NULL,
|
||||
InheritColors bit NOT NULL,
|
||||
InheritDescription bit NOT NULL,
|
||||
InheritDisableCursorBlinking bit NOT NULL,
|
||||
InheritDisableCursorShadow bit NOT NULL,
|
||||
InheritDisableFullWindowDrag bit NOT NULL,
|
||||
InheritDisableMenuAnimations bit NOT NULL,
|
||||
InheritDisplayThemes bit NOT NULL,
|
||||
InheritDisplayWallpaper bit NOT NULL,
|
||||
InheritEnableFontSmoothing bit NOT NULL,
|
||||
InheritEnableDesktopComposition bit NOT NULL,
|
||||
InheritDomain bit NOT NULL,
|
||||
InheritEnableDesktopComposition bit NOT NULL,
|
||||
InheritEnableFontSmoothing bit NOT NULL,
|
||||
InheritExtApp bit NOT NULL,
|
||||
InheritFavorite bit NOT NULL,
|
||||
InheritICAEncryptionStrength bit NOT NULL,
|
||||
InheritIcon bit NOT NULL,
|
||||
InheritLoadBalanceInfo bit DEFAULT ((0)) NOT NULL,
|
||||
InheritMacAddress bit NOT NULL,
|
||||
InheritPanel bit NOT NULL,
|
||||
InheritPassword bit NOT NULL,
|
||||
InheritPort bit NOT NULL,
|
||||
InheritPostExtApp bit NOT NULL,
|
||||
InheritPreExtApp bit NOT NULL,
|
||||
InheritProtocol bit NOT NULL,
|
||||
InheritPuttySession bit NOT NULL,
|
||||
InheritRDGatewayDomain bit NOT NULL,
|
||||
InheritRDGatewayHostname bit NOT NULL,
|
||||
InheritRDGatewayPassword bit NOT NULL,
|
||||
InheritRDGatewayUsageMethod bit NOT NULL,
|
||||
InheritRDGatewayUseConnectionCredentials bit NOT NULL,
|
||||
InheritRDGatewayUsername bit NOT NULL,
|
||||
InheritRDPAlertIdleTimeout bit NOT NULL,
|
||||
InheritRDPAuthenticationLevel bit NOT NULL,
|
||||
InheritRDPMinutesToIdleTimeout bit NOT NULL,
|
||||
InheritRdpVersion bit DEFAULT ((0)) NOT NULL,
|
||||
InheritRedirectAudioCapture bit NOT NULL,
|
||||
InheritRedirectClipboard bit DEFAULT ((0)) NOT NULL,
|
||||
InheritRedirectDiskDrives bit NOT NULL,
|
||||
InheritRedirectKeys bit NOT NULL,
|
||||
InheritRedirectPorts bit NOT NULL,
|
||||
InheritRedirectPrinters bit NOT NULL,
|
||||
InheritRedirectSmartCards bit NOT NULL,
|
||||
InheritRedirectSound bit NOT NULL,
|
||||
InheritSoundQuality bit NOT NULL,
|
||||
InheritRedirectAudioCapture bit NOT NULL,
|
||||
InheritRenderingEngine bit NOT NULL,
|
||||
InheritResolution bit NOT NULL,
|
||||
InheritSSHOptions bit NOT NULL,
|
||||
InheritSSHTunnelConnectionName bit NOT NULL,
|
||||
InheritSoundQuality bit NOT NULL,
|
||||
InheritUseConsoleSession bit NOT NULL,
|
||||
InheritUseCredSsp bit NOT NULL,
|
||||
InheritRenderingEngine bit NOT NULL,
|
||||
InheritICAEncryptionStrength bit NOT NULL,
|
||||
InheritRDPAuthenticationLevel bit NOT NULL,
|
||||
InheritRDPMinutesToIdleTimeout bit NOT NULL,
|
||||
InheritRDPAlertIdleTimeout bit NOT NULL,
|
||||
InheritUsername bit NOT NULL,
|
||||
InheritPreExtApp bit NOT NULL,
|
||||
InheritPostExtApp bit NOT NULL,
|
||||
InheritMacAddress bit NOT NULL,
|
||||
InheritUseEnhancedMode bit DEFAULT ((0)),
|
||||
InheritUseVmId bit,
|
||||
InheritUserField bit NOT NULL,
|
||||
InheritExtApp bit NOT NULL,
|
||||
InheritUsername bit NOT NULL,
|
||||
InheritVNCAuthMode bit NOT NULL,
|
||||
InheritVNCColors bit NOT NULL,
|
||||
InheritVNCCompression bit NOT NULL,
|
||||
InheritVNCEncoding bit NOT NULL,
|
||||
InheritVNCAuthMode bit NOT NULL,
|
||||
InheritVNCProxyType bit NOT NULL,
|
||||
InheritVNCProxyIP bit NOT NULL,
|
||||
InheritVNCProxyPort bit NOT NULL,
|
||||
InheritVNCProxyUsername bit NOT NULL,
|
||||
InheritVNCProxyPassword bit NOT NULL,
|
||||
InheritVNCColors bit NOT NULL,
|
||||
InheritVNCProxyPort bit NOT NULL,
|
||||
InheritVNCProxyType bit NOT NULL,
|
||||
InheritVNCProxyUsername bit NOT NULL,
|
||||
InheritVNCSmartSizeMode bit NOT NULL,
|
||||
InheritVNCViewOnly bit NOT NULL,
|
||||
InheritRDGatewayUsageMethod bit NOT NULL,
|
||||
InheritRDGatewayHostname bit NOT NULL,
|
||||
InheritRDGatewayUseConnectionCredentials bit NOT NULL,
|
||||
InheritRDGatewayUsername bit NOT NULL,
|
||||
InheritRDGatewayPassword bit NOT NULL,
|
||||
InheritRDGatewayDomain bit NOT NULL,
|
||||
LoadBalanceInfo varchar(1024),
|
||||
AutomaticResize bit DEFAULT ((1)) NOT NULL,
|
||||
InheritLoadBalanceInfo bit DEFAULT ((0)) NOT NULL,
|
||||
InheritAutomaticResize bit DEFAULT ((0)) NOT NULL,
|
||||
RedirectClipboard bit DEFAULT ((0)) NOT NULL,
|
||||
InheritRedirectClipboard bit DEFAULT ((0)) NOT NULL,
|
||||
RdpVersion varchar(10),
|
||||
InheritRdpVersion bit DEFAULT ((0)) NOT NULL,
|
||||
VmId varchar(100),
|
||||
UseVmId bit,
|
||||
UseEnhancedMode bit DEFAULT ((0)),
|
||||
InheritVmId bit ,
|
||||
InheritUseVmId bit,
|
||||
InheritUseEnhancedMode bit DEFAULT ((0))
|
||||
InheritVmId bit
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
@@ -25,136 +25,143 @@ CREATE TABLE `tblCons` (
|
||||
`Name` varchar(128) NOT NULL,
|
||||
`Type` varchar(32) NOT NULL,
|
||||
`Expanded` tinyint(1) NOT NULL,
|
||||
`Description` varchar(1024) DEFAULT NULL,
|
||||
`Icon` varchar(128) NOT NULL,
|
||||
`Panel` varchar(128) NOT NULL,
|
||||
`Username` varchar(512) DEFAULT NULL,
|
||||
`DomainName` varchar(512) DEFAULT NULL,
|
||||
`Password` varchar(1024) DEFAULT NULL,
|
||||
`SSHTunnelConnectionName` varchar(128) NOT NULL,
|
||||
`SSHOptions` varchar(1024) NOT NULL,
|
||||
`Hostname` varchar(512) DEFAULT NULL,
|
||||
`Protocol` varchar(32) NOT NULL,
|
||||
`PuttySession` varchar(128) DEFAULT NULL,
|
||||
`Port` int(11) NOT NULL,
|
||||
`ConnectToConsole` tinyint(1) NOT NULL,
|
||||
`UseCredSsp` tinyint(1) NOT NULL,
|
||||
`RenderingEngine` varchar(10) DEFAULT NULL,
|
||||
`ICAEncryptionStrength` varchar(32) NOT NULL,
|
||||
`RDPAuthenticationLevel` varchar(32) NOT NULL,
|
||||
`RDPMinutesToIdleTimeout` int(11) NOT NULL,
|
||||
`RDPAlertIdleTimeout` tinyint(1) NOT NULL,
|
||||
`Colors` varchar(32) NOT NULL,
|
||||
`Resolution` varchar(32) NOT NULL,
|
||||
`DisplayWallpaper` tinyint(1) NOT NULL,
|
||||
`DisplayThemes` tinyint(1) NOT NULL,
|
||||
`EnableFontSmoothing` tinyint(1) NOT NULL,
|
||||
`EnableDesktopComposition` tinyint(1) NOT NULL,
|
||||
`DisableFullWindowDrag` tinyint(1) NOT NULL,
|
||||
`DisableMenuAnimations` tinyint(1) NOT NULL,
|
||||
`DisableCursorShadow` tinyint(1) NOT NULL,
|
||||
`DisableCursorBlinking` tinyint(1) NOT NULL,
|
||||
`CacheBitmaps` tinyint(1) NOT NULL,
|
||||
`RedirectDiskDrives` tinyint(1) NOT NULL,
|
||||
`RedirectPorts` tinyint(1) NOT NULL,
|
||||
`RedirectPrinters` tinyint(1) NOT NULL,
|
||||
`RedirectSmartCards` tinyint(1) NOT NULL,
|
||||
`RedirectSound` varchar(64) NOT NULL,
|
||||
`SoundQuality` varchar(20) NOT NULL,
|
||||
`RedirectAudioCapture` tinyint(1) NOT NULL,
|
||||
`RedirectKeys` tinyint(1) NOT NULL,
|
||||
`Connected` tinyint(1) NOT NULL,
|
||||
`PreExtApp` varchar(256) DEFAULT NULL,
|
||||
`PostExtApp` varchar(256) DEFAULT NULL,
|
||||
`MacAddress` varchar(32) DEFAULT NULL,
|
||||
`UserField` varchar(256) DEFAULT NULL,
|
||||
`ExtApp` varchar(256) DEFAULT NULL,
|
||||
`VNCCompression` varchar(10) DEFAULT NULL,
|
||||
`VNCEncoding` varchar(20) DEFAULT NULL,
|
||||
`VNCAuthMode` varchar(10) DEFAULT NULL,
|
||||
`VNCProxyType` varchar(20) DEFAULT NULL,
|
||||
`VNCProxyIP` varchar(128) DEFAULT NULL,
|
||||
`VNCProxyPort` int(11) DEFAULT NULL,
|
||||
`VNCProxyUsername` varchar(512) DEFAULT NULL,
|
||||
`VNCProxyPassword` varchar(1024) DEFAULT NULL,
|
||||
`VNCColors` varchar(10) DEFAULT NULL,
|
||||
`VNCSmartSizeMode` varchar(20) DEFAULT NULL,
|
||||
`VNCViewOnly` tinyint(1) NOT NULL,
|
||||
`RDGatewayUsageMethod` varchar(32) NOT NULL,
|
||||
`RDGatewayHostname` varchar(512) DEFAULT NULL,
|
||||
`RDGatewayUseConnectionCredentials` varchar(32) NOT NULL,
|
||||
`RDGatewayUsername` varchar(512) DEFAULT NULL,
|
||||
`RDGatewayPassword` varchar(1024) DEFAULT NULL,
|
||||
`RDGatewayDomain` varchar(512) DEFAULT NULL,
|
||||
`InheritCacheBitmaps` tinyint(1) NOT NULL,
|
||||
`InheritColors` tinyint(1) NOT NULL,
|
||||
`InheritDescription` tinyint(1) NOT NULL,
|
||||
`InheritDisplayThemes` tinyint(1) NOT NULL,
|
||||
`InheritDisplayWallpaper` tinyint(1) NOT NULL,
|
||||
`InheritEnableFontSmoothing` tinyint(1) NOT NULL,
|
||||
`InheritEnableDesktopComposition` tinyint(1) NOT NULL,
|
||||
`InheritDomain` tinyint(1) NOT NULL,
|
||||
`InheritIcon` tinyint(1) NOT NULL,
|
||||
`InheritPanel` tinyint(1) NOT NULL,
|
||||
`InheritPassword` tinyint(1) NOT NULL,
|
||||
`InheritPort` tinyint(1) NOT NULL,
|
||||
`InheritProtocol` tinyint(1) NOT NULL,
|
||||
`InheritSSHTunnelConnectionName` tinyint(1) NOT NULL,
|
||||
`InheritSSHOptions` tinyint(1) NOT NULL,
|
||||
`InheritPuttySession` tinyint(1) NOT NULL,
|
||||
`InheritRedirectDiskDrives` tinyint(1) NOT NULL,
|
||||
`InheritRedirectKeys` tinyint(1) NOT NULL,
|
||||
`InheritRedirectPorts` tinyint(1) NOT NULL,
|
||||
`InheritRedirectPrinters` tinyint(1) NOT NULL,
|
||||
`InheritRedirectSmartCards` tinyint(1) NOT NULL,
|
||||
`InheritRedirectSound` tinyint(1) NOT NULL,
|
||||
`InheritSoundQuality` tinyint(1) NOT NULL,
|
||||
`InheritRedirectAudioCapture` tinyint(1) NOT NULL,
|
||||
`InheritResolution` tinyint(1) NOT NULL,
|
||||
`InheritUseConsoleSession` tinyint(1) NOT NULL,
|
||||
`InheritUseCredSsp` tinyint(1) NOT NULL,
|
||||
`InheritRenderingEngine` tinyint(1) NOT NULL,
|
||||
`InheritICAEncryptionStrength` tinyint(1) NOT NULL,
|
||||
`InheritRDPAuthenticationLevel` tinyint(1) NOT NULL,
|
||||
`InheritRDPMinutesToIdleTimeout` tinyint(1) NOT NULL,
|
||||
`InheritRDPAlertIdleTimeout` tinyint(1) NOT NULL,
|
||||
`InheritUsername` tinyint(1) NOT NULL,
|
||||
`InheritPreExtApp` tinyint(1) NOT NULL,
|
||||
`InheritPostExtApp` tinyint(1) NOT NULL,
|
||||
`InheritMacAddress` tinyint(1) NOT NULL,
|
||||
`InheritUserField` tinyint(1) NOT NULL,
|
||||
`InheritExtApp` tinyint(1) NOT NULL,
|
||||
`InheritVNCCompression` tinyint(1) NOT NULL,
|
||||
`InheritVNCEncoding` tinyint(1) NOT NULL,
|
||||
`InheritVNCAuthMode` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyType` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyIP` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyPort` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyUsername` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyPassword` tinyint(1) NOT NULL,
|
||||
`InheritVNCColors` tinyint(1) NOT NULL,
|
||||
`InheritVNCSmartSizeMode` tinyint(1) NOT NULL,
|
||||
`InheritVNCViewOnly` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayUsageMethod` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayHostname` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayUseConnectionCredentials` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayUsername` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayPassword` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayDomain` tinyint(1) NOT NULL,
|
||||
`LoadBalanceInfo` varchar(1024) DEFAULT NULL,
|
||||
`AutomaticResize` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`InheritLoadBalanceInfo` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`InheritAutomaticResize` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`RedirectClipboard` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`InheritRedirectClipboard` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`RdpVersion` varchar(10) DEFAULT NULL,
|
||||
`InheritRdpVersion` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`VmId` varchar(512) DEFAULT NULL,
|
||||
`UseVmId` tinyint(1) DEFAULT NULL,
|
||||
`AutomaticResize` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`CacheBitmaps` tinyint(1) NOT NULL,
|
||||
`Colors` varchar(32) NOT NULL,
|
||||
`ConnectToConsole` tinyint(1) NOT NULL,
|
||||
`Connected` tinyint(1) NOT NULL,
|
||||
`Description` varchar(1024) DEFAULT NULL,
|
||||
`DisableCursorBlinking` tinyint(1) NOT NULL,
|
||||
`DisableCursorShadow` tinyint(1) NOT NULL,
|
||||
`DisableFullWindowDrag` tinyint(1) NOT NULL,
|
||||
`DisableMenuAnimations` tinyint(1) NOT NULL,
|
||||
`DisplayThemes` tinyint(1) NOT NULL,
|
||||
`DisplayWallpaper` tinyint(1) NOT NULL,
|
||||
`Domain` varchar(512) DEFAULT NULL,
|
||||
`EnableDesktopComposition` tinyint(1) NOT NULL,
|
||||
`EnableFontSmoothing` tinyint(1) NOT NULL,
|
||||
`ExtApp` varchar(256) DEFAULT NULL,
|
||||
`Favorite` tinyint(1) NOT NULL,
|
||||
`Hostname` varchar(512) DEFAULT NULL,
|
||||
`LoadBalanceInfo` varchar(1024) DEFAULT NULL,
|
||||
`MacAddress` varchar(32) DEFAULT NULL,
|
||||
`Panel` varchar(128) NOT NULL,
|
||||
`Password` varchar(1024) DEFAULT NULL,
|
||||
`Port` int(11) NOT NULL,
|
||||
`PostExtApp` varchar(256) DEFAULT NULL,
|
||||
`PreExtApp` varchar(256) DEFAULT NULL,
|
||||
`Protocol` varchar(32) NOT NULL,
|
||||
`PuttySession` varchar(128) DEFAULT NULL,
|
||||
`RDGatewayDomain` varchar(512) DEFAULT NULL,
|
||||
`RDGatewayHostname` varchar(512) DEFAULT NULL,
|
||||
`RDGatewayPassword` varchar(1024) DEFAULT NULL,
|
||||
`RDGatewayUsageMethod` varchar(32) NOT NULL,
|
||||
`RDGatewayUseConnectionCredentials` varchar(32) NOT NULL,
|
||||
`RDGatewayUsername` varchar(512) DEFAULT NULL,
|
||||
`RDPAlertIdleTimeout` tinyint(1) NOT NULL,
|
||||
`RDPAuthenticationLevel` varchar(32) NOT NULL,
|
||||
`RDPMinutesToIdleTimeout` int(11) NOT NULL,
|
||||
`RdpVersion` varchar(10) DEFAULT NULL,
|
||||
`RedirectAudioCapture` tinyint(1) NOT NULL,
|
||||
`RedirectClipboard` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`RedirectClipboard` tinyint(1) NOT NULL,
|
||||
`RedirectDiskDrives` tinyint(1) NOT NULL,
|
||||
`RedirectKeys` tinyint(1) NOT NULL,
|
||||
`RedirectPorts` tinyint(1) NOT NULL,
|
||||
`RedirectPrinters` tinyint(1) NOT NULL,
|
||||
`RedirectSmartCards` tinyint(1) NOT NULL,
|
||||
`RedirectSound` varchar(64) NOT NULL,
|
||||
`RenderingEngine` varchar(10) DEFAULT NULL,
|
||||
`Resolution` varchar(32) NOT NULL,
|
||||
`SSHOptions` varchar(1024) NOT NULL,
|
||||
`SSHTunnelConnectionName` varchar(128) NOT NULL,
|
||||
`SoundQuality` varchar(20) NOT NULL,
|
||||
`UseCredSsp` tinyint(1) NOT NULL,
|
||||
`UseEnhancedMode` tinyint(1) DEFAULT NULL,
|
||||
`InheritVmId` tinyint(1) DEFAULT NULL,
|
||||
`InheritUseVmId` tinyint(1) DEFAULT NULL,
|
||||
`UseVmId` tinyint(1) DEFAULT NULL,
|
||||
`UserField` varchar(256) DEFAULT NULL,
|
||||
`Username` varchar(512) DEFAULT NULL,
|
||||
`VNCAuthMode` varchar(10) DEFAULT NULL,
|
||||
`VNCColors` varchar(10) DEFAULT NULL,
|
||||
`VNCCompression` varchar(10) DEFAULT NULL,
|
||||
`VNCEncoding` varchar(20) DEFAULT NULL,
|
||||
`VNCProxyIP` varchar(128) DEFAULT NULL,
|
||||
`VNCProxyPassword` varchar(1024) DEFAULT NULL,
|
||||
`VNCProxyPort` int(11) DEFAULT NULL,
|
||||
`VNCProxyType` varchar(20) DEFAULT NULL,
|
||||
`VNCProxyUsername` varchar(512) DEFAULT NULL,
|
||||
`VNCSmartSizeMode` varchar(20) DEFAULT NULL,
|
||||
`VNCViewOnly` tinyint(1) NOT NULL,
|
||||
`VmId` varchar(512) DEFAULT NULL,
|
||||
`ICAEncryptionStrength` varchar(32) NOT NULL,
|
||||
`Icon` varchar(128) NOT NULL,
|
||||
`InheritAutomaticResize` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`InheritCacheBitmaps` tinyint(1) NOT NULL,
|
||||
`InheritColors` tinyint(1) NOT NULL,
|
||||
`InheritDescription` tinyint(1) NOT NULL,
|
||||
`InheritDisableCursorBlinking` tinyint(1) NOT NULL,
|
||||
`InheritDisableCursorShadow` tinyint(1) NOT NULL,
|
||||
`InheritDisableFullWindowDrag` tinyint(1) NOT NULL,
|
||||
`InheritDisableMenuAnimations` tinyint(1) NOT NULL,
|
||||
`InheritDisplayThemes` tinyint(1) NOT NULL,
|
||||
`InheritDisplayWallpaper` tinyint(1) NOT NULL,
|
||||
`InheritDomain` tinyint(1) NOT NULL,
|
||||
`InheritEnableDesktopComposition` tinyint(1) NOT NULL,
|
||||
`InheritEnableFontSmoothing` tinyint(1) NOT NULL,
|
||||
`InheritExtApp` tinyint(1) NOT NULL,
|
||||
`InheritFavorite` tinyint(1) NOT NULL,
|
||||
`InheritICAEncryptionStrength` tinyint(1) NOT NULL,
|
||||
`InheritIcon` tinyint(1) NOT NULL,
|
||||
`InheritLoadBalanceInfo` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`InheritMacAddress` tinyint(1) NOT NULL,
|
||||
`InheritPanel` tinyint(1) NOT NULL,
|
||||
`InheritPassword` tinyint(1) NOT NULL,
|
||||
`InheritPort` tinyint(1) NOT NULL,
|
||||
`InheritPostExtApp` tinyint(1) NOT NULL,
|
||||
`InheritPreExtApp` tinyint(1) NOT NULL,
|
||||
`InheritProtocol` tinyint(1) NOT NULL,
|
||||
`InheritPuttySession` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayDomain` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayHostname` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayPassword` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayUsageMethod` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayUseConnectionCredentials` tinyint(1) NOT NULL,
|
||||
`InheritRDGatewayUsername` tinyint(1) NOT NULL,
|
||||
`InheritRDPAlertIdleTimeout` tinyint(1) NOT NULL,
|
||||
`InheritRDPAuthenticationLevel` tinyint(1) NOT NULL,
|
||||
`InheritRDPMinutesToIdleTimeout` tinyint(1) NOT NULL,
|
||||
`InheritRdpVersion` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`InheritRedirectAudioCapture` tinyint(1) NOT NULL,
|
||||
`InheritRedirectClipboard` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`InheritRedirectDiskDrives` tinyint(1) NOT NULL,
|
||||
`InheritRedirectKeys` tinyint(1) NOT NULL,
|
||||
`InheritRedirectPorts` tinyint(1) NOT NULL,
|
||||
`InheritRedirectPrinters` tinyint(1) NOT NULL,
|
||||
`InheritRedirectSmartCards` tinyint(1) NOT NULL,
|
||||
`InheritRedirectSound` tinyint(1) NOT NULL,
|
||||
`InheritRenderingEngine` tinyint(1) NOT NULL,
|
||||
`InheritResolution` tinyint(1) NOT NULL,
|
||||
`InheritSSHOptions` tinyint(1) NOT NULL,
|
||||
`InheritSSHTunnelConnectionName` tinyint(1) NOT NULL,
|
||||
`InheritSoundQuality` tinyint(1) NOT NULL,
|
||||
`InheritUseConsoleSession` tinyint(1) NOT NULL,
|
||||
`InheritUseCredSsp` tinyint(1) NOT NULL,
|
||||
`InheritUseEnhancedMode` tinyint(1) DEFAULT NULL,
|
||||
`InheritUseVmId` tinyint(1) DEFAULT NULL,
|
||||
`InheritUserField` tinyint(1) NOT NULL,
|
||||
`InheritUsername` tinyint(1) NOT NULL,
|
||||
`InheritVNCAuthMode` tinyint(1) NOT NULL,
|
||||
`InheritVNCColors` tinyint(1) NOT NULL,
|
||||
`InheritVNCCompression` tinyint(1) NOT NULL,
|
||||
`InheritVNCEncoding` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyIP` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyPassword` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyPort` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyType` tinyint(1) NOT NULL,
|
||||
`InheritVNCProxyUsername` tinyint(1) NOT NULL,
|
||||
`InheritVNCSmartSizeMode` tinyint(1) NOT NULL,
|
||||
`InheritVNCViewOnly` tinyint(1) NOT NULL,
|
||||
`InheritVmId` tinyint(1) DEFAULT NULL
|
||||
PRIMARY KEY (`ConstantID`),
|
||||
UNIQUE (`ID`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3324 DEFAULT CHARSET=latin1;
|
||||
|
||||
12
mRemoteNG/Properties/Settings.Designer.cs
generated
12
mRemoteNG/Properties/Settings.Designer.cs
generated
@@ -3011,6 +3011,18 @@ namespace mRemoteNG {
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool InhDefaultUseEnhancedMode {
|
||||
get {
|
||||
return ((bool)(this["InhDefaultUseEnhancedMode"]));
|
||||
}
|
||||
set {
|
||||
this["InhDefaultUseEnhancedMode"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
|
||||
@@ -749,6 +749,9 @@
|
||||
<Setting Name="ConDefaultUseEnhancedMode" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="InhDefaultUseEnhancedMode" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="CloseToTray" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
|
||||
namespace mRemoteNG.Tools
|
||||
{
|
||||
public class MultiSSHController
|
||||
{
|
||||
private readonly ArrayList processHandlers = new ArrayList();
|
||||
private readonly ArrayList quickConnectConnections = new ArrayList();
|
||||
private readonly ArrayList previousCommands = new ArrayList();
|
||||
private int previousCommandIndex;
|
||||
|
||||
private int CommandHistoryLength { get; set; } = 100;
|
||||
|
||||
public MultiSSHController(TextBox txtBox)
|
||||
{
|
||||
DecorateTextBox(txtBox);
|
||||
}
|
||||
|
||||
public MultiSSHController(ToolStripTextBox txtBox)
|
||||
{
|
||||
DecorateTextBox(txtBox.TextBox);
|
||||
}
|
||||
|
||||
public void ProcessNewQuickConnect(ConnectionInfo connection)
|
||||
{
|
||||
quickConnectConnections.Add(connection);
|
||||
}
|
||||
|
||||
private void DecorateTextBox(TextBox toBeDecorated)
|
||||
{
|
||||
toBeDecorated.Enter += refreshActiveConnections;
|
||||
toBeDecorated.KeyDown += processKeyPress;
|
||||
toBeDecorated.KeyUp += processKeyRelease;
|
||||
}
|
||||
|
||||
private ArrayList ProcessOpenConnections(ConnectionInfo connection)
|
||||
{
|
||||
var handlers = new ArrayList();
|
||||
|
||||
foreach (ProtocolBase _base in connection.OpenConnections)
|
||||
{
|
||||
if (_base.GetType().IsSubclassOf(typeof(PuttyBase)))
|
||||
{
|
||||
handlers.Add((PuttyBase)_base);
|
||||
}
|
||||
}
|
||||
|
||||
return handlers;
|
||||
}
|
||||
|
||||
private void SendAllKeystrokes(int keyType, int keyData)
|
||||
{
|
||||
if (processHandlers.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (PuttyBase proc in processHandlers)
|
||||
{
|
||||
NativeMethods.PostMessage(proc.PuttyHandle, keyType, new IntPtr(keyData), new IntPtr(0));
|
||||
}
|
||||
}
|
||||
|
||||
#region Event Processors
|
||||
|
||||
private void refreshActiveConnections(object sender, EventArgs e)
|
||||
{
|
||||
processHandlers.Clear();
|
||||
foreach (ConnectionInfo connection in quickConnectConnections)
|
||||
{
|
||||
processHandlers.AddRange(ProcessOpenConnections(connection));
|
||||
}
|
||||
|
||||
var connectionTreeConnections = Runtime.ConnectionsService.ConnectionTreeModel.GetRecursiveChildList()
|
||||
.Where(item => item.OpenConnections.Count > 0);
|
||||
|
||||
foreach (var connection in connectionTreeConnections)
|
||||
{
|
||||
processHandlers.AddRange(ProcessOpenConnections(connection));
|
||||
}
|
||||
}
|
||||
|
||||
private void processKeyPress(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (!(sender is TextBox txtMultiSSH)) return;
|
||||
|
||||
if (processHandlers.Count == 0)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Up when previousCommandIndex - 1 >= 0:
|
||||
previousCommandIndex -= 1;
|
||||
break;
|
||||
case Keys.Down when previousCommandIndex + 1 < previousCommands.Count:
|
||||
previousCommandIndex += 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
txtMultiSSH.Text = previousCommands[previousCommandIndex].ToString();
|
||||
txtMultiSSH.Select(txtMultiSSH.TextLength, 0);
|
||||
}
|
||||
|
||||
if (e.Control && e.KeyCode != Keys.V && e.Alt == false)
|
||||
{
|
||||
SendAllKeystrokes(NativeMethods.WM_KEYDOWN, e.KeyValue);
|
||||
}
|
||||
|
||||
if (e.KeyCode != Keys.Enter) return;
|
||||
var strLine = txtMultiSSH.Text;
|
||||
foreach (var chr1 in strLine)
|
||||
{
|
||||
SendAllKeystrokes(NativeMethods.WM_CHAR, Convert.ToByte(chr1));
|
||||
}
|
||||
|
||||
SendAllKeystrokes(NativeMethods.WM_KEYDOWN, 13); // Enter = char13
|
||||
}
|
||||
|
||||
private void processKeyRelease(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (!(sender is TextBox txtMultiSSH)) return;
|
||||
|
||||
if (e.KeyCode != Keys.Enter) return;
|
||||
if (txtMultiSSH.Text.Trim() != "")
|
||||
{
|
||||
previousCommands.Add(txtMultiSSH.Text.Trim());
|
||||
}
|
||||
|
||||
if (previousCommands.Count >= CommandHistoryLength)
|
||||
{
|
||||
previousCommands.RemoveAt(0);
|
||||
}
|
||||
|
||||
previousCommandIndex = previousCommands.Count - 1;
|
||||
txtMultiSSH.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,27 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.Themes;
|
||||
using mRemoteNG.Tools;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
|
||||
namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
public class MultiSshToolStrip : ToolStrip
|
||||
public partial class MultiSshToolStrip : ToolStrip
|
||||
{
|
||||
private IContainer components;
|
||||
private ToolStripLabel _lblMultiSsh;
|
||||
private ToolStripTextBox _txtMultiSsh;
|
||||
|
||||
// ReSharper disable once NotAccessedField.Local
|
||||
private MultiSSHController _multiSshController;
|
||||
private ToolStripLabel lblMultiSsh;
|
||||
private ToolStripTextBox txtMultiSsh;
|
||||
private int previousCommandIndex = 0;
|
||||
private readonly ArrayList processHandlers = new ArrayList();
|
||||
private readonly ArrayList quickConnectConnections = new ArrayList();
|
||||
private readonly ArrayList previousCommands = new ArrayList();
|
||||
private readonly ThemeManager _themeManager;
|
||||
|
||||
private int CommandHistoryLength { get; set; } = 100;
|
||||
|
||||
public MultiSshToolStrip()
|
||||
{
|
||||
@@ -22,43 +29,115 @@ namespace mRemoteNG.UI.Controls
|
||||
_themeManager = ThemeManager.getInstance();
|
||||
_themeManager.ThemeChanged += ApplyTheme;
|
||||
ApplyTheme();
|
||||
_multiSshController = new MultiSSHController(_txtMultiSsh);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
_lblMultiSsh = new ToolStripLabel();
|
||||
_txtMultiSsh = new ToolStripTextBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// lblMultiSSH
|
||||
//
|
||||
_lblMultiSsh.Name = "_lblMultiSsh";
|
||||
_lblMultiSsh.Size = new System.Drawing.Size(77, 22);
|
||||
_lblMultiSsh.Text = Language.MultiSsh;
|
||||
//
|
||||
// txtMultiSsh
|
||||
//
|
||||
_txtMultiSsh.Name = "_txtMultiSsh";
|
||||
_txtMultiSsh.Size = new System.Drawing.Size(new DisplayProperties().ScaleWidth(300), 25);
|
||||
_txtMultiSsh.ToolTipText = Language.MultiSshToolTip;
|
||||
|
||||
Items.AddRange(new ToolStripItem[]
|
||||
{
|
||||
_lblMultiSsh,
|
||||
_txtMultiSsh
|
||||
});
|
||||
ResumeLayout(true);
|
||||
}
|
||||
|
||||
private void ApplyTheme()
|
||||
{
|
||||
if (!_themeManager.ActiveAndExtended) return;
|
||||
_txtMultiSsh.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
|
||||
_txtMultiSsh.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
|
||||
txtMultiSsh.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
|
||||
txtMultiSsh.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
|
||||
}
|
||||
|
||||
private ArrayList ProcessOpenConnections(ConnectionInfo connection)
|
||||
{
|
||||
var handlers = new ArrayList();
|
||||
|
||||
foreach (ProtocolBase _base in connection.OpenConnections)
|
||||
{
|
||||
if (_base.GetType().IsSubclassOf(typeof(PuttyBase)))
|
||||
{
|
||||
handlers.Add((PuttyBase)_base);
|
||||
}
|
||||
}
|
||||
|
||||
return handlers;
|
||||
}
|
||||
|
||||
private void SendAllKeystrokes(int keyType, int keyData)
|
||||
{
|
||||
if (processHandlers.Count == 0) return;
|
||||
|
||||
foreach (PuttyBase proc in processHandlers)
|
||||
{
|
||||
NativeMethods.PostMessage(proc.PuttyHandle, keyType, new IntPtr(keyData), new IntPtr(0));
|
||||
}
|
||||
}
|
||||
|
||||
#region Key Event Handler
|
||||
|
||||
private void RefreshActiveConnections(object sender, EventArgs e)
|
||||
{
|
||||
processHandlers.Clear();
|
||||
foreach (ConnectionInfo connection in quickConnectConnections)
|
||||
{
|
||||
processHandlers.AddRange(ProcessOpenConnections(connection));
|
||||
}
|
||||
|
||||
var connectionTreeConnections = Runtime.ConnectionsService.ConnectionTreeModel.GetRecursiveChildList()
|
||||
.Where(item => item.OpenConnections.Count > 0);
|
||||
|
||||
foreach (var connection in connectionTreeConnections)
|
||||
{
|
||||
processHandlers.AddRange(ProcessOpenConnections(connection));
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessKeyPress(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
try
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Up when previousCommandIndex - 1 >= 0:
|
||||
previousCommandIndex -= 1;
|
||||
break;
|
||||
case Keys.Down when previousCommandIndex + 1 < previousCommands.Count:
|
||||
previousCommandIndex += 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
txtMultiSsh.Text = previousCommands[previousCommandIndex].ToString();
|
||||
txtMultiSsh.SelectAll();
|
||||
}
|
||||
|
||||
if (e.Control && e.KeyCode != Keys.V && e.Alt == false)
|
||||
{
|
||||
SendAllKeystrokes(NativeMethods.WM_KEYDOWN, e.KeyValue);
|
||||
}
|
||||
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
foreach (var chr1 in txtMultiSsh.Text)
|
||||
{
|
||||
SendAllKeystrokes(NativeMethods.WM_CHAR, Convert.ToByte(chr1));
|
||||
}
|
||||
|
||||
SendAllKeystrokes(NativeMethods.WM_KEYDOWN, 13); // Enter = char13
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessKeyRelease(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode != Keys.Enter) return;
|
||||
if (string.IsNullOrWhiteSpace(txtMultiSsh.Text)) return;
|
||||
|
||||
previousCommands.Add(txtMultiSsh.Text.Trim());
|
||||
|
||||
if (previousCommands.Count >= CommandHistoryLength) previousCommands.RemoveAt(0);
|
||||
|
||||
previousCommandIndex = previousCommands.Count - 1;
|
||||
txtMultiSsh.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
@@ -69,5 +148,42 @@ namespace mRemoteNG.UI.Controls
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.lblMultiSsh = new ToolStripLabel();
|
||||
this.txtMultiSsh = new ToolStripTextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblMultiSSH
|
||||
//
|
||||
this.lblMultiSsh.Name = "_lblMultiSsh";
|
||||
this.lblMultiSsh.Size = new System.Drawing.Size(77, 22);
|
||||
this.lblMultiSsh.Text = Language.MultiSsh;
|
||||
//
|
||||
// txtMultiSsh
|
||||
//
|
||||
this.txtMultiSsh.Name = "_txtMultiSsh";
|
||||
this.txtMultiSsh.Size = new System.Drawing.Size(new DisplayProperties().ScaleWidth(300), 25);
|
||||
this.txtMultiSsh.ToolTipText = Language.MultiSshToolTip;
|
||||
this.txtMultiSsh.Enter += RefreshActiveConnections;
|
||||
this.txtMultiSsh.KeyDown += ProcessKeyPress;
|
||||
this.txtMultiSsh.KeyUp += ProcessKeyRelease;
|
||||
|
||||
this.Items.AddRange(new ToolStripItem[]
|
||||
{
|
||||
lblMultiSsh,
|
||||
txtMultiSsh
|
||||
});
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
4
mRemoteNG/UI/Forms/frmMain.Designer.cs
generated
4
mRemoteNG/UI/Forms/frmMain.Designer.cs
generated
@@ -36,7 +36,7 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
|
||||
this.pnlDock = new WeifenLuo.WinFormsUI.Docking.DockPanel();
|
||||
this.msMain = new System.Windows.Forms.MenuStrip();
|
||||
this.fileMenu = new mRemoteNG.UI.Menu.MainFileMenu();
|
||||
this.fileMenu = new mRemoteNG.UI.Menu.FileMenu();
|
||||
this.viewMenu = new mRemoteNG.UI.Menu.ViewMenu();
|
||||
this.toolsMenu = new mRemoteNG.UI.Menu.ToolsMenu();
|
||||
this.helpMenu = new mRemoteNG.UI.Menu.HelpMenu();
|
||||
@@ -224,7 +224,7 @@
|
||||
internal System.Windows.Forms.Timer tmrAutoSave;
|
||||
internal System.Windows.Forms.ToolStripSeparator mMenSep3;
|
||||
private System.ComponentModel.IContainer components;
|
||||
private Menu.MainFileMenu fileMenu;
|
||||
private Menu.FileMenu fileMenu;
|
||||
private Menu.ViewMenu viewMenu;
|
||||
private Menu.ToolsMenu toolsMenu;
|
||||
private Menu.HelpMenu helpMenu;
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.Themes;
|
||||
using System.Configuration;
|
||||
|
||||
namespace mRemoteNG.UI.Forms
|
||||
{
|
||||
@@ -129,7 +130,7 @@ namespace mRemoteNG.UI.Forms
|
||||
page.SaveSettings();
|
||||
}
|
||||
|
||||
Debug.WriteLine(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
|
||||
Debug.WriteLine((ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)).FilePath);
|
||||
Settings.Default.Save();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ using mRemoteNG.UI.Window;
|
||||
|
||||
namespace mRemoteNG.UI.Menu
|
||||
{
|
||||
public class MainFileMenu : ToolStripMenuItem
|
||||
public class FileMenu : ToolStripMenuItem
|
||||
{
|
||||
private ToolStripMenuItem _mMenFileNew;
|
||||
private ToolStripMenuItem _mMenFileLoad;
|
||||
@@ -38,7 +38,7 @@ namespace mRemoteNG.UI.Menu
|
||||
public ConnectionTreeWindow TreeWindow { get; set; }
|
||||
public IConnectionInitiator ConnectionInitiator { get; set; }
|
||||
|
||||
public MainFileMenu()
|
||||
public FileMenu()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
@@ -169,7 +169,6 @@
|
||||
<Compile Include="Config\Import\RemoteDesktopConnectionImporter.cs" />
|
||||
<Compile Include="Config\Import\RemoteDesktopConnectionManagerImporter.cs" />
|
||||
<Compile Include="Config\Putty\PuttySessionsRegistryProvider.cs" />
|
||||
<Compile Include="Config\Putty\PuttySessionsXmingProvider.cs" />
|
||||
<Compile Include="Config\Putty\PuttySessionsManager.cs" />
|
||||
<Compile Include="Config\Putty\AbstractPuttySessionsProvider.cs" />
|
||||
<Compile Include="Config\DatabaseConnectors\IDatabaseConnector.cs" />
|
||||
@@ -310,7 +309,6 @@
|
||||
<Compile Include="Tools\ExternalToolsTypeConverter.cs" />
|
||||
<Compile Include="Tools\CustomCollections\INotifyCollectionUpdated.cs" />
|
||||
<Compile Include="Tools\Optional.cs" />
|
||||
<Compile Include="Tools\MultiSSHController.cs" />
|
||||
<Compile Include="Tools\MouseClickSimulator.cs" />
|
||||
<Compile Include="Tools\NotificationAreaIcon.cs" />
|
||||
<Compile Include="Tools\Attributes\AttributeUsedInProtocol.cs" />
|
||||
@@ -665,7 +663,7 @@
|
||||
<Compile Include="UI\Menu\HelpMenu.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Menu\MainFileMenu.cs">
|
||||
<Compile Include="UI\Menu\FileMenu.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Menu\AdvancedWindowMenu.cs" />
|
||||
@@ -1563,6 +1561,10 @@
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="VncSharp">
|
||||
<HintPath>References\VncSharp.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace mRemoteNGTests.Config.Serializers
|
||||
var model = CreateConnectionTreeModel();
|
||||
_saveFilter.SaveDomain = true;
|
||||
var dataTable = _dataTableSerializer.Serialize(model);
|
||||
Assert.That(dataTable.Rows[0]["DomainName"], Is.Not.EqualTo(""));
|
||||
Assert.That(dataTable.Rows[0]["Domain"], Is.Not.EqualTo(""));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -94,7 +94,7 @@ namespace mRemoteNGTests.Config.Serializers
|
||||
var model = CreateConnectionTreeModel();
|
||||
_saveFilter.SaveDomain = false;
|
||||
var dataTable = _dataTableSerializer.Serialize(model);
|
||||
Assert.That(dataTable.Rows[0]["DomainName"], Is.EqualTo(""));
|
||||
Assert.That(dataTable.Rows[0]["Domain"], Is.EqualTo(""));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user