Merge remote-tracking branch 'upstream/develop' into help-updates

This commit is contained in:
nmat
2018-11-16 00:35:57 +01:00
8 changed files with 46 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
using System.Windows.Forms;
using mRemoteNG.Connection;
using mRemoteNG.Connection;
using mRemoteNG.Tree;
using NUnit.Framework;
using System.Windows.Forms;
namespace mRemoteNGTests.Tree
@@ -30,12 +30,12 @@ namespace mRemoteNGTests.Tree
Assert.That(deletionConfirmer.Confirm(_testConnectionInfo), Is.False);
}
private DialogResult MockClickYes(string promptMessage, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
private DialogResult MockClickYes(string promptMessage)
{
return DialogResult.Yes;
}
private DialogResult MockClickNo(string promptMessage, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
private DialogResult MockClickNo(string promptMessage)
{
return DialogResult.No;
}

View File

@@ -63,7 +63,7 @@ namespace mRemoteNG.Connection
StartPreConnectionExternalApp(connectionInfo);
if ((force & ConnectionInfo.Force.DoNotJump) != ConnectionInfo.Force.DoNotJump)
if (!force.HasFlag(ConnectionInfo.Force.DoNotJump))
{
if (SwitchToOpenConnection(connectionInfo))
return;
@@ -136,7 +136,7 @@ namespace mRemoteNG.Connection
private static string SetConnectionPanel(ConnectionInfo connectionInfo, ConnectionInfo.Force force)
{
var connectionPanel = "";
if (connectionInfo.Panel == "" || (force & ConnectionInfo.Force.OverridePanel) == ConnectionInfo.Force.OverridePanel | Settings.Default.AlwaysShowPanelSelectionDlg)
if (connectionInfo.Panel == "" || force.HasFlag(ConnectionInfo.Force.OverridePanel) || Settings.Default.AlwaysShowPanelSelectionDlg)
{
var frmPnl = new frmChoosePanel();
if (frmPnl.ShowDialog() == DialogResult.OK)

View File

@@ -1,7 +1,3 @@
using System;
using System.Threading;
using System.Timers;
using System.Windows.Forms;
using AxWFICALib;
using mRemoteNG.App;
using mRemoteNG.Connection.Protocol.RDP;
@@ -9,11 +5,15 @@ using mRemoteNG.Messages;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using System;
using System.Threading;
using System.Timers;
using System.Windows.Forms;
namespace mRemoteNG.Connection.Protocol.ICA
{
public class IcaProtocol : ProtocolBase
public class IcaProtocol : ProtocolBase
{
private AxICAClient _icaClient;
private ConnectionInfo _info;
@@ -112,7 +112,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
{
try
{
if (((int)Force & (int)ConnectionInfo.Force.NoCredentials) == (int)ConnectionInfo.Force.NoCredentials)
if (Force.HasFlag(ConnectionInfo.Force.NoCredentials))
{
return;
}
@@ -179,7 +179,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
{
try
{
if ((Force & ConnectionInfo.Force.Fullscreen) == ConnectionInfo.Force.Fullscreen)
if (Force.HasFlag(ConnectionInfo.Force.Fullscreen))
{
_icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(_frmMain).Bounds.Width, Screen.FromControl(_frmMain).Bounds.Height, 0);
_icaClient.FullScreenWindow();

View File

@@ -1,20 +1,20 @@
using System;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Messages;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.Tools.Cmdline;
using mRemoteNG.UI;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Connection.Protocol
{
public class PuttyBase : ProtocolBase
public class PuttyBase : ProtocolBase
{
private const int IDM_RECONF = 0x50; // PuTTY Settings Menu ID
private bool _isPuttyNg;
@@ -108,7 +108,7 @@ namespace mRemoteNG.Connection.Protocol
arguments.Add("-" + (int)PuttySSHVersion);
if (((int)Force & (int)ConnectionInfo.Force.NoCredentials) != (int)ConnectionInfo.Force.NoCredentials)
if (!Force.HasFlag(ConnectionInfo.Force.NoCredentials))
{
if (!string.IsNullOrEmpty(username))
{

View File

@@ -1,11 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using AxMSTSCLib;
using mRemoteNG.App;
using mRemoteNG.Messages;
@@ -14,10 +6,16 @@ using mRemoteNG.Tools;
using mRemoteNG.UI;
using mRemoteNG.UI.Forms;
using MSTSCLib;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpProtocol : ProtocolBase
public class RdpProtocol : ProtocolBase
{
/* RDP v8 requires Windows 7 with:
* https://support.microsoft.com/en-us/kb/2592687
@@ -355,7 +353,7 @@ namespace mRemoteNG.Connection.Protocol.RDP
{
_rdpClient.TransportSettings.GatewayCredsSource = 1; // TSC_PROXY_CREDS_MODE_SMARTCARD
}
if (_rdpVersion >= Versions.RDC61 && (Force & ConnectionInfo.Force.NoCredentials) != ConnectionInfo.Force.NoCredentials)
if (_rdpVersion >= Versions.RDC61 && !Force.HasFlag(ConnectionInfo.Force.NoCredentials))
{
if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes)
{
@@ -389,11 +387,11 @@ namespace mRemoteNG.Connection.Protocol.RDP
{
bool value;
if ((Force & ConnectionInfo.Force.UseConsoleSession) == ConnectionInfo.Force.UseConsoleSession)
if (Force.HasFlag(ConnectionInfo.Force.UseConsoleSession))
{
value = true;
}
else if ((Force & ConnectionInfo.Force.DontUseConsoleSession) == ConnectionInfo.Force.DontUseConsoleSession)
else if (Force.HasFlag(ConnectionInfo.Force.DontUseConsoleSession))
{
value = false;
}
@@ -454,7 +452,7 @@ namespace mRemoteNG.Connection.Protocol.RDP
{
try
{
if ((Force & ConnectionInfo.Force.NoCredentials) == ConnectionInfo.Force.NoCredentials)
if (Force.HasFlag(ConnectionInfo.Force.NoCredentials))
{
return;
}
@@ -525,7 +523,7 @@ namespace mRemoteNG.Connection.Protocol.RDP
SetExtendedProperty("DesktopScaleFactor", scaleFactor);
SetExtendedProperty("DeviceScaleFactor", (uint)100);
if ((Force & ConnectionInfo.Force.Fullscreen) == ConnectionInfo.Force.Fullscreen)
if (Force.HasFlag(ConnectionInfo.Force.Fullscreen))
{
_rdpClient.FullScreen = true;
_rdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width;

View File

@@ -1,14 +1,14 @@
using System;
using System.ComponentModel;
using mRemoteNG.App;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using System;
using System.ComponentModel;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Connection.Protocol.VNC
{
public class ProtocolVNC : ProtocolBase
public class ProtocolVNC : ProtocolBase
{
#region Properties
public bool SmartSize
@@ -164,8 +164,7 @@ namespace mRemoteNG.Connection.Protocol.VNC
_VNC.ConnectComplete += VNCEvent_Connected;
_VNC.ConnectionLost += VNCEvent_Disconnected;
FrmMain.ClipboardChanged += VNCEvent_ClipboardChanged;
if (((int)Force & (int)ConnectionInfo.Force.NoCredentials) != (int)ConnectionInfo.Force.NoCredentials
&& Info?.Password?.Length > 0)
if (!Force.HasFlag(ConnectionInfo.Force.NoCredentials) && Info?.Password?.Length > 0)
{
_VNC.GetPassword = VNCEvent_Authenticate;
}

View File

@@ -1,17 +1,16 @@
using System;
using System.Windows.Forms;
using mRemoteNG.Connection;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.UI.TaskDialog;
using System;
using System.Windows.Forms;
namespace mRemoteNG.Tree
{
public class SelectedConnectionDeletionConfirmer : IConfirm<ConnectionInfo>
public class SelectedConnectionDeletionConfirmer : IConfirm<ConnectionInfo>
{
private readonly Func<string, string, MessageBoxButtons, MessageBoxIcon, DialogResult> _confirmationFunc;
private readonly Func<string, DialogResult> _confirmationFunc;
public SelectedConnectionDeletionConfirmer(Func<string, string, MessageBoxButtons, MessageBoxIcon, DialogResult> confirmationFunc)
public SelectedConnectionDeletionConfirmer(Func<string, DialogResult> confirmationFunc)
{
_confirmationFunc = confirmationFunc;
}
@@ -49,7 +48,7 @@ namespace mRemoteNG.Tree
private bool PromptUser(string promptMessage)
{
var msgBoxResponse = CTaskDialog.MessageBox(Application.ProductName, promptMessage, "", ETaskDialogButtons.YesNo, ESysIcons.Question);
var msgBoxResponse = _confirmationFunc(promptMessage);
return msgBoxResponse == DialogResult.Yes;
}
}

View File

@@ -5,6 +5,7 @@ using mRemoteNG.Themes;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Controls;
using mRemoteNG.UI.TaskDialog;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -104,7 +105,8 @@ namespace mRemoteNG.UI.Window
#region ConnectionTree
private void SetConnectionTreeEventHandlers()
{
olvConnections.NodeDeletionConfirmer = new SelectedConnectionDeletionConfirmer(MessageBox.Show);
olvConnections.NodeDeletionConfirmer = new SelectedConnectionDeletionConfirmer(prompt =>
CTaskDialog.MessageBox(Application.ProductName, prompt, "", ETaskDialogButtons.YesNo, ESysIcons.Question));
olvConnections.KeyDown += tvConnections_KeyDown;
olvConnections.KeyPress += tvConnections_KeyPress;
SetTreePostSetupActions();