mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
feature/alternate_shell - alternate shell implemented as Start Program
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Security;
|
||||
using System.Xml.Linq;
|
||||
using mRemoteNG.Connection;
|
||||
@@ -112,6 +112,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
|
||||
element.Add(new XAttribute("MacAddress", connectionInfo.MacAddress));
|
||||
element.Add(new XAttribute("UserField", connectionInfo.UserField));
|
||||
element.Add(new XAttribute("ExtApp", connectionInfo.ExtApp));
|
||||
element.Add(new XAttribute("StartProgram", connectionInfo.StartProgram));
|
||||
element.Add(new XAttribute("VNCCompression", connectionInfo.VNCCompression));
|
||||
element.Add(new XAttribute("VNCEncoding", connectionInfo.VNCEncoding));
|
||||
element.Add(new XAttribute("VNCAuthMode", connectionInfo.VNCAuthMode));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Security;
|
||||
using System.Xml.Linq;
|
||||
using mRemoteNG.App;
|
||||
@@ -130,6 +130,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
|
||||
element.Add(new XAttribute("UserField", connectionInfo.UserField));
|
||||
element.Add(new XAttribute("Favorite", connectionInfo.Favorite));
|
||||
element.Add(new XAttribute("ExtApp", connectionInfo.ExtApp));
|
||||
element.Add(new XAttribute("StartProgram", connectionInfo.StartProgram));
|
||||
element.Add(new XAttribute("VNCCompression", connectionInfo.VNCCompression));
|
||||
element.Add(new XAttribute("VNCEncoding", connectionInfo.VNCEncoding));
|
||||
element.Add(new XAttribute("VNCAuthMode", connectionInfo.VNCAuthMode));
|
||||
|
||||
@@ -151,6 +151,9 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
|
||||
case "gatewayhostname":
|
||||
connectionInfo.RDGatewayHostname = value;
|
||||
break;
|
||||
case "alternate shell":
|
||||
connectionInfo.StartProgram = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
@@ -183,7 +183,7 @@ namespace mRemoteNG.Config.Serializers.MiscSerializers
|
||||
{
|
||||
if (bool.TryParse(connectionSettingsNode.SelectSingleNode("./connectToConsole")?.InnerText, out var useConsole))
|
||||
connectionInfo.UseConsoleSession = useConsole;
|
||||
// ./startProgram
|
||||
connectionInfo.StartProgram = connectionSettingsNode.SelectSingleNode("./startProgram")?.InnerText;
|
||||
// ./workingDir
|
||||
if (int.TryParse(connectionSettingsNode.SelectSingleNode("./port")?.InnerText, out var port))
|
||||
connectionInfo.Port = port;
|
||||
|
||||
@@ -78,6 +78,7 @@ namespace mRemoteNG.Connection
|
||||
private string _postExtApp;
|
||||
private string _macAddress;
|
||||
private string _userField;
|
||||
private string _startProgram;
|
||||
private bool _favorite;
|
||||
|
||||
private ProtocolVNC.Compression _vncCompression;
|
||||
@@ -729,6 +730,16 @@ namespace mRemoteNG.Connection
|
||||
get => GetPropertyValue("Favorite", _favorite);
|
||||
set => SetField(ref _favorite, value, "Favorite");
|
||||
}
|
||||
|
||||
[LocalizedAttributes.LocalizedCategory(nameof(Language.Miscellaneous), 7),
|
||||
LocalizedAttributes.LocalizedDisplayName(nameof(Language.StartProgram)),
|
||||
LocalizedAttributes.LocalizedDescription(nameof(Language.PropertyDescriptionStartProgram))]
|
||||
public virtual string StartProgram
|
||||
{
|
||||
get => GetPropertyValue("StartProgram", _startProgram);
|
||||
set => SetField(ref _startProgram, value, "StartProgram");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region VNC
|
||||
|
||||
@@ -356,6 +356,7 @@ namespace mRemoteNG.Connection
|
||||
MacAddress = Settings.Default.ConDefaultMacAddress;
|
||||
UserField = Settings.Default.ConDefaultUserField;
|
||||
Favorite = Settings.Default.ConDefaultFavorite;
|
||||
StartProgram = Settings.Default.ConDefaultStartProgram;
|
||||
}
|
||||
|
||||
private void SetVncDefaults()
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace mRemoteNG.Connection.Protocol
|
||||
return new IntegratedProgram();
|
||||
}
|
||||
|
||||
return default;
|
||||
return default(ProtocolBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,10 @@ namespace mRemoteNG.Connection.Protocol.RDP
|
||||
public class RdpProtocol6 : ProtocolBase, ISupportsViewOnly
|
||||
{
|
||||
/* RDP v8 requires Windows 7 with:
|
||||
* https://support.microsoft.com/en-us/kb/2592687
|
||||
* https://support.microsoft.com/en-us/kb/2592687
|
||||
* OR
|
||||
* https://support.microsoft.com/en-us/kb/2923545
|
||||
*
|
||||
*
|
||||
* Windows 8+ support RDP v8 out of the box.
|
||||
*/
|
||||
private MsRdpClient6NotSafeForScripting _rdpClient;
|
||||
@@ -303,6 +303,8 @@ namespace mRemoteNG.Connection.Protocol.RDP
|
||||
|
||||
_rdpClient.AdvancedSettings2.overallConnectionTimeout = Settings.Default.ConRDPOverallConnectionTimeout;
|
||||
|
||||
_rdpClient.SecuredSettings2.StartProgram = connectionInfo.StartProgram;
|
||||
|
||||
_rdpClient.AdvancedSettings2.BitmapPeristence = Convert.ToInt32(connectionInfo.CacheBitmaps);
|
||||
if (_rdpVersion >= Versions.RDC61)
|
||||
{
|
||||
@@ -606,28 +608,28 @@ namespace mRemoteNG.Connection.Protocol.RDP
|
||||
var pFlags = 0;
|
||||
if (connectionInfo.DisplayThemes == false)
|
||||
pFlags += (int)RDPPerformanceFlags.DisableThemes;
|
||||
|
||||
|
||||
if (connectionInfo.DisplayWallpaper == false)
|
||||
pFlags += (int)RDPPerformanceFlags.DisableWallpaper;
|
||||
|
||||
|
||||
if (connectionInfo.EnableFontSmoothing)
|
||||
pFlags += (int)RDPPerformanceFlags.EnableFontSmoothing;
|
||||
|
||||
if (connectionInfo.EnableDesktopComposition)
|
||||
pFlags += (int)RDPPerformanceFlags.EnableDesktopComposition;
|
||||
|
||||
|
||||
if (connectionInfo.DisableFullWindowDrag)
|
||||
pFlags += (int)RDPPerformanceFlags.DisableFullWindowDrag;
|
||||
|
||||
|
||||
if (connectionInfo.DisableMenuAnimations)
|
||||
pFlags += (int)RDPPerformanceFlags.DisableMenuAnimations;
|
||||
|
||||
|
||||
if (connectionInfo.DisableCursorShadow)
|
||||
pFlags += (int)RDPPerformanceFlags.DisableCursorShadow;
|
||||
|
||||
|
||||
if (connectionInfo.DisableCursorBlinking)
|
||||
pFlags += (int)RDPPerformanceFlags.DisableCursorBlinking;
|
||||
|
||||
|
||||
_rdpClient.AdvancedSettings2.PerformanceFlags = pFlags;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
12
mRemoteNG/Properties/Settings.Designer.cs
generated
12
mRemoteNG/Properties/Settings.Designer.cs
generated
@@ -3094,5 +3094,17 @@ namespace mRemoteNG.Properties {
|
||||
this["ConDefaultDisableCursorBlinking"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string ConDefaultStartProgram {
|
||||
get {
|
||||
return ((string)(this["ConDefaultStartProgram"]));
|
||||
}
|
||||
set {
|
||||
this["ConDefaultStartProgram"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,5 +770,8 @@
|
||||
<Setting Name="ConDefaultDisableCursorBlinking" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="ConDefaultStartProgram" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
18
mRemoteNG/Resources/Language/Language.Designer.cs
generated
18
mRemoteNG/Resources/Language/Language.Designer.cs
generated
@@ -4218,6 +4218,15 @@ namespace mRemoteNG.Resources.Language {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Start Program.
|
||||
/// </summary>
|
||||
internal static string PropertyDescriptionStartProgram {
|
||||
get {
|
||||
return ResourceManager.GetString("PropertyDescriptionStartProgram", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Connect to the console session of the remote host..
|
||||
/// </summary>
|
||||
@@ -5616,6 +5625,15 @@ namespace mRemoteNG.Resources.Language {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Start Program.
|
||||
/// </summary>
|
||||
internal static string StartProgram {
|
||||
get {
|
||||
return ResourceManager.GetString("StartProgram", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Socks 5.
|
||||
/// </summary>
|
||||
|
||||
@@ -2273,4 +2273,10 @@ Development Channel includes Alphas, Betas & Release Candidates.</value>
|
||||
<data name="ShowHideMenu" xml:space="preserve">
|
||||
<value>Show/Hide Menu Strip</value>
|
||||
</data>
|
||||
<data name="PropertyDescriptionStartProgram" xml:space="preserve">
|
||||
<value>Start Program/alternate shell</value>
|
||||
</data>
|
||||
<data name="StartProgram" xml:space="preserve">
|
||||
<value>Start Program</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -32,7 +32,7 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
private const bool ExpectedPortRedirection = true;
|
||||
private const bool ExpectedPrinterRedirection = true;
|
||||
private const RDPSounds ExpectedSoundRedirection = RDPSounds.BringToThisComputer;
|
||||
|
||||
private const string ExpectedStartProgram = "alternate shell";
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void OnetimeSetup()
|
||||
@@ -175,6 +175,13 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
Assert.That(connectionInfo.LoadBalanceInfo, Is.EqualTo(ExpectedLoadBalanceInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StartProgramImportedCorrectly()
|
||||
{
|
||||
var connectionInfo = _connectionTreeModel.RootNodes.First().Children.First();
|
||||
Assert.That(connectionInfo.StartProgram, Is.EqualTo(ExpectedStartProgram));
|
||||
}
|
||||
|
||||
//[Test]
|
||||
//public void GatewayHostnameImportedCorrectly()
|
||||
//{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
private const bool ExpectedPortRedirection = true;
|
||||
private const bool ExpectedPrinterRedirection = true;
|
||||
private const AuthenticationLevel ExpectedAuthLevel = AuthenticationLevel.WarnOnFailedAuth;
|
||||
|
||||
private const string ExpectedStartProgram = "alternate shell";
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void OnetimeSetup()
|
||||
@@ -165,6 +165,7 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectPrinters), ExpectedPrinterRedirection).SetName(nameof(ConnectionInfo.RedirectPrinters)),
|
||||
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectPorts), ExpectedPortRedirection).SetName(nameof(ConnectionInfo.RedirectPorts)),
|
||||
new TestCaseData((Func<ConnectionInfo,object>)(con => con.RedirectDiskDrives), ExpectedDriveRedirection).SetName(nameof(ConnectionInfo.RedirectDiskDrives)),
|
||||
new TestCaseData((Func<ConnectionInfo,object>)(con => con.StartProgram), ExpectedStartProgram).SetName(nameof(ConnectionInfo.StartProgram)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
private const bool ExpectedPortRedirection = true;
|
||||
private const bool ExpectedPrinterRedirection = true;
|
||||
private const AuthenticationLevel ExpectedAuthLevel = AuthenticationLevel.AuthRequired;
|
||||
|
||||
private const string ExpectedStartProgram = "alternate shell";
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void OnetimeSetup()
|
||||
@@ -323,5 +323,15 @@ namespace mRemoteNGTests.Config.Serializers.MiscSerializers
|
||||
var badFileContents = Resources.test_rdcman_noversion;
|
||||
Assert.That(() => _deserializer.Deserialize(badFileContents), Throws.TypeOf<FileFormatException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StartProgramImported()
|
||||
{
|
||||
var rootNode = _connectionTreeModel.RootNodes.First();
|
||||
var importedRdcmanRootNode = rootNode.Children.OfType<ContainerInfo>().First();
|
||||
var group1 = importedRdcmanRootNode.Children.OfType<ContainerInfo>().First(node => node.Name == "Group1");
|
||||
var connection = group1.Children.First();
|
||||
Assert.That(connection.StartProgram, Is.EqualTo(ExpectedStartProgram));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@
|
||||
</logonCredentials>
|
||||
<connectionSettings inherit="None">
|
||||
<connectToConsole>True</connectToConsole>
|
||||
<startProgram />
|
||||
<startProgram>alternate shell</startProgram>
|
||||
<workingDir />
|
||||
<port>9933</port>
|
||||
</connectionSettings>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</logonCredentials>
|
||||
<connectionSettings inherit="None">
|
||||
<connectToConsole>True</connectToConsole>
|
||||
<startProgram />
|
||||
<startProgram>alternate shell</startProgram>
|
||||
<workingDir />
|
||||
<port>9933</port>
|
||||
<loadBalanceInfo />
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user