Merge branch 'develop' into MR-975_Replace_TreeView_with_TreeListview

# Conflicts:
#	mRemoteV1/Config/SqlDatabaseConnector.cs
#	mRemoteV1/Tree/Root/RootPuttySessionsNodeInfo.cs
This commit is contained in:
David Sparer
2016-09-12 08:40:43 -06:00
58 changed files with 423 additions and 722 deletions

View File

@@ -1,32 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using mRemoteNG.Controls;
using NUnit.Framework;
using NUnit.Extensions.Forms;
using System.Windows.Forms;
using NUnit.Framework;
using ListView = mRemoteNG.UI.Controls.ListView;
namespace mRemoteNGTests.UI.Controls
{
public class CustomListViewTests
{
mRemoteNG.Controls.ListView _listView;
ListView _listView;
[SetUp]
public void Setup()
{
_listView = new mRemoteNG.Controls.ListView();
_listView.Name = "myTestListView";
_listView.View = System.Windows.Forms.View.Tile;
_listView = new ListView
{
Name = "myTestListView",
View = System.Windows.Forms.View.Tile
};
}
[TearDown]
public void Teardown()
{
_listView.Dispose();
while (_listView.Disposing) ;
while (_listView.Disposing)
{
}
_listView = null;
}
}

View File

@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using NUnit.Framework;
using NUnit.Extensions.Forms;
using System.Threading.Tasks;
using mRemoteNG.Forms;
using mRemoteNG.UI.Forms;
namespace mRemoteNGTests.UI.Forms
@@ -26,7 +20,9 @@ namespace mRemoteNGTests.UI.Forms
public void Teardown()
{
_passwordForm.Dispose();
while (_passwordForm.Disposing) ;
while (_passwordForm.Disposing)
{
}
_passwordForm = null;
}

View File

@@ -6,7 +6,6 @@ using System.Threading;
using mRemoteNG.Tools;
using System.Reflection;
using mRemoteNG.App.Info;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace mRemoteNG.App.Update
{

View File

@@ -1,11 +1,6 @@
using mRemoteNG.App;
using mRemoteNG.Messages;
using mRemoteNG.Tools;
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
using mRemoteNG.My;
namespace mRemoteNG.Config.Connections
{

View File

@@ -1,9 +1,6 @@
using mRemoteNG.App;
using mRemoteNG.Messages;
using System;
using System.Data;
using System.Data.SqlClient;
using System;
using System.Timers;
using mRemoteNG.App;
namespace mRemoteNG.Config.Connections
{
@@ -67,8 +64,9 @@ namespace mRemoteNG.Config.Connections
_sqlUpdateTimer.Stop();
_sqlUpdateTimer.Close();
}
catch (Exception)
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace("SqlUpdateTimer StopTimer Exception", ex);
}
}

View File

@@ -8,7 +8,6 @@ using System.Globalization;
using mRemoteNG.Themes;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.App.Info;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.UI.Forms;

View File

@@ -1,7 +1,7 @@
using System.Data;
using mRemoteNG.App.Info;
using System.Data.SqlClient;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Security.SymmetricEncryption;
namespace mRemoteNG.Config

View File

@@ -7,7 +7,6 @@ using System.Threading;
using mRemoteNG.App.Info;
using mRemoteNG.Tools;
using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.UI.Forms;
@@ -39,24 +38,26 @@ namespace mRemoteNG.Connection.Protocol.ICA
defaultInstance = value;
}
}
static void defaultInstance_FormClosed(object sender, FormClosedEventArgs e)
#if false
private static void defaultInstance_FormClosed(object sender, FormClosedEventArgs e)
{
defaultInstance = null;
}
#endregion
#endif
#endregion
#region Private Properties
#region Private Properties
private AxICAClient _ICAClient;
private ConnectionInfo _Info;
#endregion
#endregion
#region Public Methods
#region Public Methods
public ProtocolICA()
{
try
{
this.Control = new AxICAClient();
Control = new AxICAClient();
}
catch (Exception ex)
{
@@ -70,21 +71,21 @@ namespace mRemoteNG.Connection.Protocol.ICA
try
{
_ICAClient = (AxICAClient)this.Control;
_Info = this.InterfaceControl.Info;
_ICAClient = (AxICAClient)Control;
_Info = InterfaceControl.Info;
_ICAClient.CreateControl();
while (!this._ICAClient.Created)
while (!_ICAClient.Created)
{
Thread.Sleep(10);
System.Windows.Forms.Application.DoEvents();
Application.DoEvents();
}
_ICAClient.Address = _Info.Hostname;
this.SetCredentials();
this.SetResolution();
this.SetColors();
this.SetSecurity();
SetCredentials();
SetResolution();
SetColors();
SetSecurity();
//Disable hotkeys for international users
_ICAClient.Hotkey1Shift = null;
@@ -123,7 +124,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
public override bool Connect()
{
this.SetEventHandlers();
SetEventHandlers();
try
{
@@ -137,31 +138,31 @@ namespace mRemoteNG.Connection.Protocol.ICA
return false;
}
}
#endregion
#endregion
#region Private Methods
#region Private Methods
private void SetCredentials()
{
try
{
if (((int)Force & (int)Connection.ConnectionInfo.Force.NoCredentials) == (int)Connection.ConnectionInfo.Force.NoCredentials)
if (((int)Force & (int)ConnectionInfo.Force.NoCredentials) == (int)ConnectionInfo.Force.NoCredentials)
{
return ;
}
string _user = this._Info.Username;
string _pass = this._Info.Password;
string _dom = this._Info.Domain;
string _user = _Info.Username;
string _pass = _Info.Password;
string _dom = _Info.Domain;
if (string.IsNullOrEmpty(_user))
{
if ((string) mRemoteNG.Settings.Default.EmptyCredentials == "windows")
if (Settings.Default.EmptyCredentials == "windows")
{
_ICAClient.Username = Environment.UserName;
}
else if ((string) mRemoteNG.Settings.Default.EmptyCredentials == "custom")
else if (Settings.Default.EmptyCredentials == "custom")
{
_ICAClient.Username = mRemoteNG.Settings.Default.DefaultUsername;
_ICAClient.Username = Settings.Default.DefaultUsername;
}
}
else
@@ -171,9 +172,9 @@ namespace mRemoteNG.Connection.Protocol.ICA
if (string.IsNullOrEmpty(_pass))
{
if ((string) mRemoteNG.Settings.Default.EmptyCredentials == "custom")
if (Settings.Default.EmptyCredentials == "custom")
{
if (mRemoteNG.Settings.Default.DefaultPassword != "")
if (Settings.Default.DefaultPassword != "")
{
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
_ICAClient.SetProp("ClearPassword", cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, GeneralAppInfo.EncryptionKey));
@@ -187,13 +188,13 @@ namespace mRemoteNG.Connection.Protocol.ICA
if (string.IsNullOrEmpty(_dom))
{
if ((string) mRemoteNG.Settings.Default.EmptyCredentials == "windows")
if (Settings.Default.EmptyCredentials == "windows")
{
_ICAClient.Domain = Environment.UserDomainName;
}
else if ((string) mRemoteNG.Settings.Default.EmptyCredentials == "custom")
else if (Settings.Default.EmptyCredentials == "custom")
{
_ICAClient.Domain = mRemoteNG.Settings.Default.DefaultDomain;
_ICAClient.Domain = Settings.Default.DefaultDomain;
}
}
else
@@ -211,7 +212,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
{
try
{
if ((this.Force & Connection.ConnectionInfo.Force.Fullscreen) == Connection.ConnectionInfo.Force.Fullscreen)
if ((Force & ConnectionInfo.Force.Fullscreen) == ConnectionInfo.Force.Fullscreen)
{
_ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0);
_ICAClient.FullScreenWindow();
@@ -219,15 +220,15 @@ namespace mRemoteNG.Connection.Protocol.ICA
return;
}
if (this.InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.FitToWindow)
if (InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.FitToWindow)
{
_ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0);
_ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0);
}
else if (this.InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.SmartSize)
else if (InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.SmartSize)
{
_ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0);
_ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width, InterfaceControl.Size.Height, 0);
}
else if (this.InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.Fullscreen)
else if (InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.Fullscreen)
{
_ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0);
_ICAClient.FullScreenWindow();
@@ -290,39 +291,39 @@ namespace mRemoteNG.Connection.Protocol.ICA
{
try
{
_ICAClient.OnConnecting += new System.EventHandler(ICAEvent_OnConnecting);
_ICAClient.OnConnect += new System.EventHandler(ICAEvent_OnConnected);
_ICAClient.OnConnectFailed += new System.EventHandler(ICAEvent_OnConnectFailed);
_ICAClient.OnDisconnect += new System.EventHandler(ICAEvent_OnDisconnect);
_ICAClient.OnConnecting += new EventHandler(ICAEvent_OnConnecting);
_ICAClient.OnConnect += new EventHandler(ICAEvent_OnConnected);
_ICAClient.OnConnectFailed += new EventHandler(ICAEvent_OnConnectFailed);
_ICAClient.OnDisconnect += new EventHandler(ICAEvent_OnDisconnect);
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strIcaSetEventHandlersFailed + Environment.NewLine + ex.Message, true);
}
}
#endregion
#endregion
#region Private Events & Handlers
private void ICAEvent_OnConnecting(object sender, System.EventArgs e)
#region Private Events & Handlers
private void ICAEvent_OnConnecting(object sender, EventArgs e)
{
base.Event_Connecting(this);
Event_Connecting(this);
}
private void ICAEvent_OnConnected(object sender, System.EventArgs e)
private void ICAEvent_OnConnected(object sender, EventArgs e)
{
base.Event_Connected(this);
Event_Connected(this);
}
private void ICAEvent_OnConnectFailed(object sender, System.EventArgs e)
private void ICAEvent_OnConnectFailed(object sender, EventArgs e)
{
base.Event_ErrorOccured(this, e.ToString());
Event_ErrorOccured(this, e.ToString());
}
private void ICAEvent_OnDisconnect(object sender, System.EventArgs e)
private void ICAEvent_OnDisconnect(object sender, EventArgs e)
{
base.Event_Disconnected(this, e.ToString());
Event_Disconnected(this, e.ToString());
if (mRemoteNG.Settings.Default.ReconnectOnDisconnect)
if (Settings.Default.ReconnectOnDisconnect)
{
ReconnectGroup = new ReconnectGroup();
//this.Load += ReconnectGroup_Load;
@@ -334,12 +335,12 @@ namespace mRemoteNG.Connection.Protocol.ICA
}
else
{
base.Close();
Close();
}
}
#endregion
#endregion
#region Reconnect Stuff
#region Reconnect Stuff
public void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
bool srvReady = Scanner.IsPortOpen(_Info.Hostname, Convert.ToString(_Info.Port));
@@ -353,9 +354,9 @@ namespace mRemoteNG.Connection.Protocol.ICA
_ICAClient.Connect();
}
}
#endregion
#endregion
#region Enums
#region Enums
public enum Defaults
{
Port = 1494,
@@ -375,6 +376,6 @@ namespace mRemoteNG.Connection.Protocol.ICA
[LocalizedAttributes.LocalizedDescription("strEnc128Bit")]
Encr128Bit = 128
}
#endregion
#endregion
}
}

View File

@@ -5,7 +5,6 @@ using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.My;
namespace mRemoteNG.Connection.Protocol

View File

@@ -2,6 +2,7 @@ using System;
using System.Windows.Forms;
using System.Threading;
using mRemoteNG.App;
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol
@@ -54,12 +55,22 @@ namespace mRemoteNG.Connection.Protocol
public readonly System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
protected ReconnectGroup ReconnectGroup;
protected ProtocolBase(string name)
{
Name = name;
}
public ProtocolBase()
{
}
#endregion
#region Methods
//public abstract int GetDefaultPort();
public virtual void Focus()
public virtual void Focus()
{
try
{

View File

@@ -7,19 +7,11 @@ using mRemoteNG.Connection.Protocol.SSH;
using mRemoteNG.Connection.Protocol.Telnet;
using mRemoteNG.Connection.Protocol.VNC;
using System;
using System.Collections.Generic;
using System.Text;
using mRemoteNG.My;
namespace mRemoteNG.Connection.Protocol
{
public class ProtocolFactory
{
public ProtocolFactory()
{
}
public ProtocolBase CreateProtocol(ConnectionInfo connectionInfo)
{
ProtocolBase newProtocol = default(ProtocolBase);

View File

@@ -7,7 +7,6 @@ using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.App.Info;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
@@ -40,7 +39,7 @@ namespace mRemoteNG.Connection.Protocol
}
#endregion
public PuttyBase()
public PuttyBase() : base()
{
}

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.ComponentModel;
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol.VNC

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace mRemoteNG.Messages
namespace mRemoteNG.Messages
{
public enum MessageClass
{

View File

@@ -36,25 +36,50 @@ namespace mRemoteNG.Messages
return;
}
if (Settings.Default.SwitchToMCOnInformation && nMsg.MsgClass == MessageClass.InformationMsg)
var EnableTimer = true; // used to control if we SWITCH to the notifiation panel. Message will still be added regardless.
if (nMsg.MsgClass == MessageClass.InformationMsg)
{
AddInfoMessage(nMsg);
if (Settings.Default.SwitchToMCOnWarning && nMsg.MsgClass == MessageClass.WarningMsg)
if (!Settings.Default.SwitchToMCOnInformation)
EnableTimer = false;
}
if (nMsg.MsgClass == MessageClass.WarningMsg)
{
AddWarningMessage(nMsg);
if (Settings.Default.SwitchToMCOnError && nMsg.MsgClass == MessageClass.ErrorMsg)
if (!Settings.Default.SwitchToMCOnWarning)
EnableTimer = false;
}
if (nMsg.MsgClass == MessageClass.ErrorMsg)
{
AddErrorMessage(nMsg);
if (!OnlyLog)
{
if (Settings.Default.ShowNoMessageBoxes)
_ECTimer.Enabled = true;
else
ShowMessageBox(nMsg);
ListViewItem lvItem = BuildListViewItem(nMsg);
AddToList(lvItem);
if (!Settings.Default.SwitchToMCOnError)
EnableTimer = false;
}
if (OnlyLog)
return;
if (Settings.Default.ShowNoMessageBoxes)
{
/* These if statements need to be split so we can:
* control that no messages boxes will be dispalyed
* add items to the notifications panel
* NOT switch to the notification panel if configured that way
*/
if(EnableTimer)
_ECTimer.Enabled = true;
}
else
ShowMessageBox(nMsg);
ListViewItem lvItem = BuildListViewItem(nMsg);
AddToList(lvItem);
}
private void AddInfoMessage(Message nMsg)
@@ -100,9 +125,9 @@ namespace mRemoteNG.Messages
AddMessage(msgClass, message + Environment.NewLine + Tools.MiscTools.GetExceptionMessageRecursive(ex), logOnly);
}
public void AddExceptionStackTrace(string message, Exception ex, MessageClass msgClass = MessageClass.ErrorMsg, bool logOnly = false)
public void AddExceptionStackTrace(string message, Exception ex, MessageClass msgClass = MessageClass.ErrorMsg)
{
AddMessage(msgClass, message + Environment.NewLine + ex.StackTrace, logOnly);
AddMessage(msgClass, message + Environment.NewLine + ex.StackTrace, true);
}
#endregion

View File

@@ -1,4 +1,3 @@
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;

View File

@@ -1,4 +1,3 @@
using mRemoteNG.My;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
@@ -9,9 +8,9 @@ namespace mRemoteNG.Themes
public class ThemeManager
{
#region Private Variables
private static readonly ThemeInfo _defaultTheme = new ThemeInfo(Language.strDefaultTheme);
private static ThemeInfo _activeTheme;
private static bool _activeThemeHandlerSet = false;
private static bool _activeThemeHandlerSet;
#endregion
#region Public Methods
@@ -93,11 +92,8 @@ namespace mRemoteNG.Themes
#endregion
#region Properties
public static ThemeInfo DefaultTheme
{
get { return _defaultTheme; }
}
public static ThemeInfo DefaultTheme { get; } = new ThemeInfo(Language.strDefaultTheme);
public static ThemeInfo ActiveTheme
{
get
@@ -123,7 +119,7 @@ namespace mRemoteNG.Themes
if (_activeThemeHandlerSet)
{
_activeTheme.PropertyChanged -= NotifyThemeChanged;
if (_activeTheme != null) _activeTheme.PropertyChanged -= NotifyThemeChanged;
}
_activeTheme = value;

View File

@@ -1,8 +1,6 @@
using mRemoteNG.App;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
namespace mRemoteNG.Tools
@@ -22,21 +20,14 @@ namespace mRemoteNG.Tools
private StringDictionary Parameters;
// Retrieve a parameter value if it exists
public string this[string Param]
{
get
{
return (Parameters[Param]);
}
}
public string this[string Param] => (Parameters[Param]);
public CmdArgumentsInterpreter(string[] Args)
{
Parameters = new StringDictionary();
Regex Spliter = new Regex("^-{1,2}|^/|=|:", (RegexOptions)(RegexOptions.IgnoreCase | RegexOptions.Compiled));
Regex Remover = new Regex("^[\'\"]?(.*?)[\'\"]?$", (RegexOptions)(RegexOptions.IgnoreCase | RegexOptions.Compiled));
Regex Spliter = new Regex("^-{1,2}|^/|=|:", RegexOptions.IgnoreCase | RegexOptions.Compiled);
Regex Remover = new Regex("^[\'\"]?(.*?)[\'\"]?$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
string Parameter = null;
string[] Parts = null;
// Valid parameters forms:
// {-,/,--}param{ ,=,:}((",')value(",'))
@@ -47,7 +38,7 @@ namespace mRemoteNG.Tools
foreach (string Txt in Args)
{
// Look for new parameters (-,/ or --) and a possible enclosed value (=,:)
Parts = Spliter.Split(Txt, 3);
var Parts = Spliter.Split(Txt, 3);
switch (Parts.Length)
{
case 1:

View File

@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace mRemoteNG.Tools
{

View File

@@ -7,9 +7,9 @@ using System.Reflection;
using System.Security;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Forms;
using mRemoteNG.Messages;
using mRemoteNG.Security;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.Window;
using static System.String;

View File

@@ -1,4 +1,4 @@
namespace mRemoteNG
namespace mRemoteNG.Tools
{
public partial class ReconnectGroup : System.Windows.Forms.UserControl
{

View File

@@ -1,8 +1,6 @@
using System.Drawing;
using mRemoteNG.My;
namespace mRemoteNG
namespace mRemoteNG.Tools
{
public partial class ReconnectGroup
{
@@ -19,16 +17,9 @@ namespace mRemoteNG
}
set
{
if (value == true)
{
SetStatusImage(Resources.HostStatus_On);
}
else
{
SetStatusImage(Resources.HostStatus_Off);
}
_ServerReady = value;
SetStatusImage(value ? Resources.HostStatus_On : Resources.HostStatus_Off);
_ServerReady = value;
}
}
@@ -37,8 +28,8 @@ namespace mRemoteNG
{
if (pbServerStatus.InvokeRequired)
{
SetStatusImageCB d = new SetStatusImageCB(SetStatusImage);
ParentForm.Invoke(d, new object[] {Img});
SetStatusImageCB d = new SetStatusImageCB(SetStatusImage);
ParentForm?.Invoke(d, new object[] {Img});
}
else
{
@@ -70,8 +61,8 @@ namespace mRemoteNG
{
if (chkReconnectWhenReady.InvokeRequired)
{
SetCheckboxCB d = new SetCheckboxCB(SetCheckbox);
ParentForm.Invoke(d, new object[] {Val});
SetCheckboxCB d = new SetCheckboxCB(SetCheckbox);
ParentForm?.Invoke(d, new object[] {Val});
}
else
{
@@ -125,8 +116,8 @@ namespace mRemoteNG
{
if (this.InvokeRequired)
{
DisposeReconnectGroupCB d = new DisposeReconnectGroupCB(DisposeReconnectGroup);
ParentForm.Invoke(d);
DisposeReconnectGroupCB d = new DisposeReconnectGroupCB(DisposeReconnectGroup);
ParentForm?.Invoke(d);
}
else
{

View File

@@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace mRemoteNG.Tools.Sorting
{
public interface Sortable
{
void Sort();
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Windows.Forms;
namespace mRemoteNG.Tools.Sorting
@@ -20,9 +21,9 @@ namespace mRemoteNG.Tools.Sorting
switch (Sorting)
{
case SortOrder.Ascending:
return string.Compare(tx.Text, ty.Text);
return String.CompareOrdinal(tx.Text, ty.Text);
case SortOrder.Descending:
return string.Compare(ty.Text, tx.Text);
return String.CompareOrdinal(ty.Text, tx.Text);
default:
return 0;
}

View File

@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
using mRemoteNG.My;
namespace mRemoteNG.Tools
@@ -15,20 +14,13 @@ namespace mRemoteNG.Tools
public LocalizedCategoryAttribute(string value, int Order = 1) : base(value)
{
if (Order > LocalizedCategoryAttribute.MaxOrder)
{
this.Order = LocalizedCategoryAttribute.MaxOrder;
}
else
{
this.Order = Order;
}
this.Order = Order > MaxOrder ? MaxOrder : Order;
}
protected override string GetLocalizedString(string value)
{
string OrderPrefix = "";
for (int x = 0; x <= LocalizedCategoryAttribute.MaxOrder - this.Order; x++)
for (int x = 0; x <= MaxOrder - Order; x++)
{
OrderPrefix += Convert.ToString("\t");
}
@@ -45,17 +37,17 @@ namespace mRemoteNG.Tools
public LocalizedDisplayNameAttribute(string value) : base(value)
{
this.Localized = false;
Localized = false;
}
public override string DisplayName
{
get
{
if (!this.Localized)
if (!Localized)
{
this.Localized = true;
this.DisplayNameValue = Language.ResourceManager.GetString(this.DisplayNameValue);
Localized = true;
DisplayNameValue = Language.ResourceManager.GetString(DisplayNameValue);
}
return base.DisplayName;
@@ -69,17 +61,17 @@ namespace mRemoteNG.Tools
private bool Localized;
public LocalizedDescriptionAttribute(string value) : base(value)
{
this.Localized = false;
Localized = false;
}
public override string Description
{
get
{
if (!this.Localized)
if (!Localized)
{
this.Localized = true;
this.DescriptionValue = Language.ResourceManager.GetString(this.DescriptionValue);
Localized = true;
DescriptionValue = Language.ResourceManager.GetString(DescriptionValue);
}
return base.Description;
@@ -96,13 +88,7 @@ namespace mRemoteNG.Tools
// This allows localized attributes in a derived class to override a matching
// non-localized attribute inherited from its base class
public override object TypeId
{
get
{
return typeof(DefaultValueAttribute);
}
}
public override object TypeId => typeof(DefaultValueAttribute);
}
#region Special localization - with String.Format
@@ -113,17 +99,17 @@ namespace mRemoteNG.Tools
public LocalizedDisplayNameInheritAttribute(string value) : base(value)
{
this.Localized = false;
Localized = false;
}
public override string DisplayName
{
get
{
if (!this.Localized)
if (!Localized)
{
this.Localized = true;
this.DisplayNameValue = string.Format(Language.strFormatInherit, Language.ResourceManager.GetString(this.DisplayNameValue));
Localized = true;
DisplayNameValue = string.Format(Language.strFormatInherit, Language.ResourceManager.GetString(DisplayNameValue));
}
return base.DisplayName;
@@ -138,17 +124,17 @@ namespace mRemoteNG.Tools
public LocalizedDescriptionInheritAttribute(string value) : base(value)
{
this.Localized = false;
Localized = false;
}
public override string Description
{
get
{
if (!this.Localized)
if (!Localized)
{
this.Localized = true;
this.DescriptionValue = string.Format(Language.strFormatInheritDescription, Language.ResourceManager.GetString(this.DescriptionValue));
Localized = true;
DescriptionValue = string.Format(Language.strFormatInheritDescription, Language.ResourceManager.GetString(DescriptionValue));
}
return base.Description;

View File

@@ -18,7 +18,7 @@ namespace mRemoteNG.Tree.Root
}
#region Public Properties
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1),
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay"),
Browsable(true),
LocalizedAttributes.LocalizedDefaultValue("strConnections"),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameName"),
@@ -41,7 +41,7 @@ namespace mRemoteNG.Tree.Root
}
}
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1),
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay"),
Browsable(true),
LocalizedAttributes.LocalizedDisplayName("strPasswordProtect"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]

View File

@@ -1,7 +1,5 @@
using mRemoteNG.My;
using mRemoteNG.Tools;
using mRemoteNG.Tree.Root;
using System.Windows.Forms;
using mRemoteNG.Tree;
@@ -35,14 +33,14 @@ namespace mRemoteNG.Root.PuttySessions
{
TreeNode.Text = value;
}
mRemoteNG.Settings.Default.PuttySavedSessionsName = value;
Settings.Default.PuttySavedSessionsName = value;
}
}
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1),
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay"),
LocalizedAttributes.LocalizedDisplayName("strPropertyNamePanel"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPanel")]
public string Panel
public override string Panel
{
get { return _panel; }
set
@@ -52,7 +50,7 @@ namespace mRemoteNG.Root.PuttySessions
return ;
}
_panel = value;
mRemoteNG.Settings.Default.PuttySavedSessionsPanel = value;
Settings.Default.PuttySavedSessionsPanel = value;
}
}

View File

@@ -17,12 +17,12 @@ namespace mRemoteNG.UI.Controls
public class IPTextBox: UserControl
{
private Panel panel1;
public TextBox Octet1;
private Label label1;
public TextBox Octet2;
public TextBox Octet3;
public TextBox Octet4;
private Label label2;
public System.Windows.Forms.TextBox Octet1;
public System.Windows.Forms.TextBox Octet2;
public System.Windows.Forms.TextBox Octet3;
public System.Windows.Forms.TextBox Octet4;
private Label label1;
private Label label2;
private Label label3;
private ToolTip toolTip1;
private System.ComponentModel.IContainer components;
@@ -49,13 +49,13 @@ namespace mRemoteNG.UI.Controls
{
get
{
return Octet1.Text + "." + Octet2.Text + "." + Octet3.Text + "." + Octet4.Text;
return Octet1.Text + @"." + Octet2.Text + @"." + Octet3.Text + @"." + Octet4.Text;
}
set
{
if (!string.IsNullOrEmpty(value))
{
var pieces = value.Split(".".ToCharArray(),4);
var pieces = value.Split(@".".ToCharArray(),4);
Octet1.Text = pieces[0];
Octet2.Text = pieces[1];
Octet3.Text = pieces[2];
@@ -225,7 +225,7 @@ namespace mRemoteNG.UI.Controls
* \return True if the string is between 0 and 255 inclusively, false otherwise
* \endif
* */
private bool IsValid(string inString)
private static bool IsValid(string inString)
{
try
{
@@ -249,7 +249,7 @@ namespace mRemoteNG.UI.Controls
private void Box1_KeyPress(object sender, KeyPressEventArgs e)
{
//Only Accept a '.', a numeral, or backspace
if(e.KeyChar.ToString() == "." || Char.IsDigit(e.KeyChar) || e.KeyChar == 8)
if(e.KeyChar.ToString() == "." || char.IsDigit(e.KeyChar) || e.KeyChar == 8)
{
//If the key pressed is a '.'
if(e.KeyChar.ToString() == ".")
@@ -272,9 +272,7 @@ namespace mRemoteNG.UI.Controls
// ip octet then move on to next box
if(Octet1.Text.Length == 2)
{
if(e.KeyChar == 8)
Octet1.Text.Remove(Octet1.Text.Length-1,1);
else if(!IsValid(Octet1.Text + e.KeyChar.ToString()))
if(!IsValid(Octet1.Text + e.KeyChar))
{
Octet1.SelectAll();
e.Handled = true;
@@ -299,7 +297,7 @@ namespace mRemoteNG.UI.Controls
{
//Similar to Box1_KeyPress but in special case for backspace moves cursor
//to the previouse box (Box1)
if(e.KeyChar.ToString() == "." || Char.IsDigit(e.KeyChar) || e.KeyChar == 8)
if(e.KeyChar.ToString() == "." || char.IsDigit(e.KeyChar) || e.KeyChar == 8)
{
if(e.KeyChar.ToString() == ".")
{
@@ -316,11 +314,7 @@ namespace mRemoteNG.UI.Controls
{
if(Octet2.Text.Length == 2)
{
if(e.KeyChar == 8)
{
Octet2.Text.Remove(Octet2.Text.Length-1,1);
}
else if(!IsValid(Octet2.Text + e.KeyChar.ToString()))
if(!IsValid(Octet2.Text + e.KeyChar))
{
Octet2.SelectAll();
e.Handled = true;
@@ -350,7 +344,7 @@ namespace mRemoteNG.UI.Controls
{
//Identical to Box2_KeyPress except that previous box is Box2 and
//next box is Box3
if(e.KeyChar.ToString() == "." || Char.IsDigit(e.KeyChar) || e.KeyChar == 8)
if(e.KeyChar.ToString() == "." || char.IsDigit(e.KeyChar) || e.KeyChar == 8)
{
if(e.KeyChar.ToString() == ".")
{
@@ -367,11 +361,7 @@ namespace mRemoteNG.UI.Controls
{
if(Octet3.Text.Length == 2)
{
if(e.KeyChar == 8)
{
Octet3.Text.Remove(Octet3.Text.Length-1,1);
}
else if(!IsValid(Octet3.Text + e.KeyChar.ToString()))
if(!IsValid(Octet3.Text + e.KeyChar))
{
Octet3.SelectAll();
e.Handled = true;
@@ -400,17 +390,13 @@ namespace mRemoteNG.UI.Controls
{
//Similar to Box3 but ignores the '.' character and does not advance
//to the next box. Also Box3 is previous box for backspace case.
if(Char.IsDigit(e.KeyChar) || e.KeyChar == 8)
if(char.IsDigit(e.KeyChar) || e.KeyChar == 8)
{
if(Octet4.SelectionLength != Octet4.Text.Length)
{
if(Octet4.Text.Length == 2)
{
if(e.KeyChar == 8)
{
Octet4.Text.Remove(Octet4.Text.Length-1,1);
}
else if(!IsValid(Octet4.Text + e.KeyChar.ToString()))
if(!IsValid(Octet4.Text + e.KeyChar))
{
Octet4.SelectAll();
e.Handled = true;
@@ -441,11 +427,8 @@ namespace mRemoteNG.UI.Controls
/// \endif
private void label_EnabledChanged(object sender, EventArgs e)
{
var lbl = (Label) sender;
if(lbl.Enabled)
lbl.BackColor = SystemColors.Window;
else
lbl.BackColor = SystemColors.Control;
var lbl = (Label) sender;
lbl.BackColor = lbl.Enabled ? SystemColors.Window : SystemColors.Control;
}
/// \ifnot hide_events
@@ -453,11 +436,8 @@ namespace mRemoteNG.UI.Controls
/// \endif
private void panel1_EnabledChanged(object sender, EventArgs e)
{
var pan = (Panel) sender;
if(pan.Enabled)
pan.BackColor = SystemColors.Window;
else
pan.BackColor = SystemColors.Control;
var pan = (Panel) sender;
pan.BackColor = pan.Enabled ? SystemColors.Window : SystemColors.Control;
}
}
}

View File

@@ -1,15 +1,14 @@
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
namespace mRemoteNG.Controls
namespace mRemoteNG.UI.Controls
{
public class ListView : System.Windows.Forms.ListView
{
Brush foreColorBrush = null;
Brush backColorBrush = null;
Pen borderPen = null;
Brush foreColorBrush;
Brush backColorBrush;
Pen borderPen;
#region Public Properties
[Category("Appearance"), DefaultValue(typeof(Color), "HighlightText")]
@@ -172,12 +171,9 @@ namespace mRemoteNG.Controls
private void DisposeBrushesAndPens()
{
if (foreColorBrush != null)
foreColorBrush.Dispose();
if (backColorBrush != null)
backColorBrush.Dispose();
if (borderPen != null)
borderPen.Dispose();
foreColorBrush?.Dispose();
backColorBrush?.Dispose();
borderPen?.Dispose();
}
#endregion
@@ -210,14 +206,14 @@ namespace mRemoteNG.Controls
format.Alignment = StringAlignment.Far;
break;
}
if (RightToLeft.ToString() != null)
format.FormatFlags = (StringFormatFlags) (format.FormatFlags | StringFormatFlags.DirectionRightToLeft);
if (RightToLeftLayout)
format.FormatFlags = format.FormatFlags | StringFormatFlags.DirectionRightToLeft;
if (LabelWrap)
format.FormatFlags = (StringFormatFlags) (format.FormatFlags & ~StringFormatFlags.NoWrap);
format.FormatFlags = format.FormatFlags & ~StringFormatFlags.NoWrap;
else
format.FormatFlags = (StringFormatFlags) (format.FormatFlags | StringFormatFlags.NoWrap);
format.FormatFlags = format.FormatFlags | StringFormatFlags.NoWrap;
return format;
}
@@ -258,7 +254,7 @@ namespace mRemoteNG.Controls
public override string ToString()
{
return string.Format("{0}, {1}", Vertical, Horizontal);
return $"{Vertical}, {Horizontal}";
}
}

View File

@@ -1,8 +1,7 @@
using System.Drawing;
using System.Windows.Forms;
namespace mRemoteNG.Controls
namespace mRemoteNG.UI.Controls
{
public class ToolStripSplitButton : System.Windows.Forms.ToolStripSplitButton
{
@@ -21,7 +20,7 @@ namespace mRemoteNG.Controls
private void DropDown_Closing(object sender, ToolStripDropDownClosingEventArgs e)
{
if (!(e.CloseReason == ToolStripDropDownCloseReason.AppClicked))
if (e.CloseReason != ToolStripDropDownCloseReason.AppClicked)
{
return ;
}
@@ -54,6 +53,6 @@ namespace mRemoteNG.Controls
}
}
private bool _dropDownVisibleOnMouseDown = false;
private bool _dropDownVisibleOnMouseDown;
}
}

View File

@@ -8,7 +8,7 @@ using System.Drawing;
namespace mRemoteNG.UI.Forms.Input
{
internal class input
internal static class input
{
public static DialogResult InputBox(string title, string promptText, ref string value)
{

View File

@@ -95,19 +95,19 @@ namespace mRemoteNG.UI.Forms.OptionsPages
#region Event Handlers
public void chkUseCustomPuttyPath_CheckedChanged(object sender, EventArgs e)
private void chkUseCustomPuttyPath_CheckedChanged(object sender, EventArgs e)
{
txtCustomPuttyPath.Enabled = chkUseCustomPuttyPath.Checked;
btnBrowseCustomPuttyPath.Enabled = chkUseCustomPuttyPath.Checked;
SetPuttyLaunchButtonEnabled();
}
public void txtCustomPuttyPath_TextChanged(object sender, EventArgs e)
private void txtCustomPuttyPath_TextChanged(object sender, EventArgs e)
{
SetPuttyLaunchButtonEnabled();
}
public void btnBrowseCustomPuttyPath_Click(object sender, EventArgs e)
private void btnBrowseCustomPuttyPath_Click(object sender, EventArgs e)
{
using (var openFileDialog = new OpenFileDialog())
{
@@ -124,7 +124,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
}
}
public void btnLaunchPutty_Click(object sender, EventArgs e)
private void btnLaunchPutty_Click(object sender, EventArgs e)
{
try
{

View File

@@ -1,7 +1,6 @@
using System;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.My;
namespace mRemoteNG.UI.Forms.OptionsPages
{
@@ -41,20 +40,20 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
cboLanguage.Items.Add(nativeName);
}
if (!string.IsNullOrEmpty(mRemoteNG.Settings.Default.OverrideUICulture) &&
SupportedCultures.IsNameSupported(mRemoteNG.Settings.Default.OverrideUICulture))
if (!string.IsNullOrEmpty(Settings.Default.OverrideUICulture) &&
SupportedCultures.IsNameSupported(Settings.Default.OverrideUICulture))
{
cboLanguage.SelectedItem = SupportedCultures.get_CultureNativeName(mRemoteNG.Settings.Default.OverrideUICulture);
cboLanguage.SelectedItem = SupportedCultures.get_CultureNativeName(Settings.Default.OverrideUICulture);
}
if (cboLanguage.SelectedIndex == -1)
{
cboLanguage.SelectedIndex = 0;
}
chkShowDescriptionTooltipsInTree.Checked = mRemoteNG.Settings.Default.ShowDescriptionTooltipsInTree;
chkShowFullConnectionsFilePathInTitle.Checked = mRemoteNG.Settings.Default.ShowCompleteConsPathInTitle;
chkShowSystemTrayIcon.Checked = mRemoteNG.Settings.Default.ShowSystemTrayIcon;
chkMinimizeToSystemTray.Checked = mRemoteNG.Settings.Default.MinimizeToTray;
chkShowDescriptionTooltipsInTree.Checked = Settings.Default.ShowDescriptionTooltipsInTree;
chkShowFullConnectionsFilePathInTitle.Checked = Settings.Default.ShowCompleteConsPathInTitle;
chkShowSystemTrayIcon.Checked = Settings.Default.ShowSystemTrayIcon;
chkMinimizeToSystemTray.Checked = Settings.Default.MinimizeToTray;
}
public override void SaveSettings()
@@ -63,20 +62,20 @@ namespace mRemoteNG.UI.Forms.OptionsPages
if (cboLanguage.SelectedIndex > 0 &&
SupportedCultures.IsNativeNameSupported(Convert.ToString(cboLanguage.SelectedItem)))
{
mRemoteNG.Settings.Default.OverrideUICulture =
Settings.Default.OverrideUICulture =
SupportedCultures.get_CultureName(Convert.ToString(cboLanguage.SelectedItem));
}
else
{
mRemoteNG.Settings.Default.OverrideUICulture = string.Empty;
Settings.Default.OverrideUICulture = string.Empty;
}
mRemoteNG.Settings.Default.ShowDescriptionTooltipsInTree = chkShowDescriptionTooltipsInTree.Checked;
mRemoteNG.Settings.Default.ShowCompleteConsPathInTitle = chkShowFullConnectionsFilePathInTitle.Checked;
Settings.Default.ShowDescriptionTooltipsInTree = chkShowDescriptionTooltipsInTree.Checked;
Settings.Default.ShowCompleteConsPathInTitle = chkShowFullConnectionsFilePathInTitle.Checked;
frmMain.Default.ShowFullPathInTitle = chkShowFullConnectionsFilePathInTitle.Checked;
mRemoteNG.Settings.Default.ShowSystemTrayIcon = chkShowSystemTrayIcon.Checked;
if (mRemoteNG.Settings.Default.ShowSystemTrayIcon)
Settings.Default.ShowSystemTrayIcon = chkShowSystemTrayIcon.Checked;
if (Settings.Default.ShowSystemTrayIcon)
{
if (Runtime.NotificationAreaIcon == null)
{
@@ -92,7 +91,9 @@ namespace mRemoteNG.UI.Forms.OptionsPages
}
}
mRemoteNG.Settings.Default.MinimizeToTray = chkMinimizeToSystemTray.Checked;
Settings.Default.MinimizeToTray = chkMinimizeToSystemTray.Checked;
Settings.Default.Save();
}
}
}

View File

@@ -53,45 +53,45 @@ namespace mRemoteNG.UI.Forms.OptionsPages
base.SaveSettings();
chkSingleClickOnConnectionOpensIt.Checked =
Convert.ToBoolean(mRemoteNG.Settings.Default.SingleClickOnConnectionOpensIt);
Convert.ToBoolean(Settings.Default.SingleClickOnConnectionOpensIt);
chkSingleClickOnOpenedConnectionSwitchesToIt.Checked =
Convert.ToBoolean(mRemoteNG.Settings.Default.SingleClickSwitchesToOpenConnection);
chkHostnameLikeDisplayName.Checked = Convert.ToBoolean(mRemoteNG.Settings.Default.SetHostnameLikeDisplayName);
Convert.ToBoolean(Settings.Default.SingleClickSwitchesToOpenConnection);
chkHostnameLikeDisplayName.Checked = Convert.ToBoolean(Settings.Default.SetHostnameLikeDisplayName);
numRdpReconnectionCount.Value = Convert.ToDecimal(mRemoteNG.Settings.Default.RdpReconnectionCount);
numRdpReconnectionCount.Value = Convert.ToDecimal(Settings.Default.RdpReconnectionCount);
numRDPConTimeout.Value = Convert.ToDecimal(mRemoteNG.Settings.Default.ConRDPOverallConnectionTimeout);
numRDPConTimeout.Value = Convert.ToDecimal(Settings.Default.ConRDPOverallConnectionTimeout);
numAutoSave.Value = Convert.ToDecimal(mRemoteNG.Settings.Default.AutoSaveEveryMinutes);
numAutoSave.Value = Convert.ToDecimal(Settings.Default.AutoSaveEveryMinutes);
// ReSharper disable once StringLiteralTypo
if (mRemoteNG.Settings.Default.EmptyCredentials == "noinfo")
if (Settings.Default.EmptyCredentials == "noinfo")
{
radCredentialsNoInfo.Checked = true;
}
else if (mRemoteNG.Settings.Default.EmptyCredentials == "windows")
else if (Settings.Default.EmptyCredentials == "windows")
{
radCredentialsWindows.Checked = true;
}
else if (mRemoteNG.Settings.Default.EmptyCredentials == "custom")
else if (Settings.Default.EmptyCredentials == "custom")
{
radCredentialsCustom.Checked = true;
}
txtCredentialsUsername.Text = Convert.ToString(mRemoteNG.Settings.Default.DefaultUsername);
txtCredentialsUsername.Text = Convert.ToString(Settings.Default.DefaultUsername);
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
txtCredentialsPassword.Text = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), GeneralAppInfo.EncryptionKey);
txtCredentialsDomain.Text = Convert.ToString(mRemoteNG.Settings.Default.DefaultDomain);
txtCredentialsDomain.Text = Convert.ToString(Settings.Default.DefaultDomain);
if (mRemoteNG.Settings.Default.ConfirmCloseConnection == (int) ConfirmCloseEnum.Never)
if (Settings.Default.ConfirmCloseConnection == (int) ConfirmCloseEnum.Never)
{
radCloseWarnNever.Checked = true;
}
else if (mRemoteNG.Settings.Default.ConfirmCloseConnection == (int) ConfirmCloseEnum.Exit)
else if (Settings.Default.ConfirmCloseConnection == (int) ConfirmCloseEnum.Exit)
{
radCloseWarnExit.Checked = true;
}
else if (mRemoteNG.Settings.Default.ConfirmCloseConnection == (int) ConfirmCloseEnum.Multiple)
else if (Settings.Default.ConfirmCloseConnection == (int) ConfirmCloseEnum.Multiple)
{
radCloseWarnMultiple.Checked = true;
}
@@ -103,18 +103,18 @@ namespace mRemoteNG.UI.Forms.OptionsPages
public override void SaveSettings()
{
mRemoteNG.Settings.Default.SingleClickOnConnectionOpensIt = chkSingleClickOnConnectionOpensIt.Checked;
mRemoteNG.Settings.Default.SingleClickSwitchesToOpenConnection = chkSingleClickOnOpenedConnectionSwitchesToIt.Checked;
mRemoteNG.Settings.Default.SetHostnameLikeDisplayName = chkHostnameLikeDisplayName.Checked;
Settings.Default.SingleClickOnConnectionOpensIt = chkSingleClickOnConnectionOpensIt.Checked;
Settings.Default.SingleClickSwitchesToOpenConnection = chkSingleClickOnOpenedConnectionSwitchesToIt.Checked;
Settings.Default.SetHostnameLikeDisplayName = chkHostnameLikeDisplayName.Checked;
mRemoteNG.Settings.Default.RdpReconnectionCount = (int) numRdpReconnectionCount.Value;
Settings.Default.RdpReconnectionCount = (int) numRdpReconnectionCount.Value;
mRemoteNG.Settings.Default.ConRDPOverallConnectionTimeout = (int) numRDPConTimeout.Value;
Settings.Default.ConRDPOverallConnectionTimeout = (int) numRDPConTimeout.Value;
mRemoteNG.Settings.Default.AutoSaveEveryMinutes = (int) numAutoSave.Value;
if (mRemoteNG.Settings.Default.AutoSaveEveryMinutes > 0)
Settings.Default.AutoSaveEveryMinutes = (int) numAutoSave.Value;
if (Settings.Default.AutoSaveEveryMinutes > 0)
{
frmMain.Default.tmrAutoSave.Interval = Convert.ToInt32(mRemoteNG.Settings.Default.AutoSaveEveryMinutes*60000);
frmMain.Default.tmrAutoSave.Interval = Convert.ToInt32(Settings.Default.AutoSaveEveryMinutes*60000);
frmMain.Default.tmrAutoSave.Enabled = true;
}
else
@@ -125,41 +125,43 @@ namespace mRemoteNG.UI.Forms.OptionsPages
if (radCredentialsNoInfo.Checked)
{
// ReSharper disable once StringLiteralTypo
mRemoteNG.Settings.Default.EmptyCredentials = "noinfo";
Settings.Default.EmptyCredentials = "noinfo";
}
else if (radCredentialsWindows.Checked)
{
mRemoteNG.Settings.Default.EmptyCredentials = "windows";
Settings.Default.EmptyCredentials = "windows";
}
else if (radCredentialsCustom.Checked)
{
mRemoteNG.Settings.Default.EmptyCredentials = "custom";
Settings.Default.EmptyCredentials = "custom";
}
mRemoteNG.Settings.Default.DefaultUsername = txtCredentialsUsername.Text;
Settings.Default.DefaultUsername = txtCredentialsUsername.Text;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
mRemoteNG.Settings.Default.DefaultPassword = cryptographyProvider.Encrypt(txtCredentialsPassword.Text, GeneralAppInfo.EncryptionKey);
mRemoteNG.Settings.Default.DefaultDomain = txtCredentialsDomain.Text;
Settings.Default.DefaultPassword = cryptographyProvider.Encrypt(txtCredentialsPassword.Text, GeneralAppInfo.EncryptionKey);
Settings.Default.DefaultDomain = txtCredentialsDomain.Text;
if (radCloseWarnAll.Checked)
{
mRemoteNG.Settings.Default.ConfirmCloseConnection = (int) ConfirmCloseEnum.All;
Settings.Default.ConfirmCloseConnection = (int) ConfirmCloseEnum.All;
}
if (radCloseWarnMultiple.Checked)
{
mRemoteNG.Settings.Default.ConfirmCloseConnection = (int) ConfirmCloseEnum.Multiple;
Settings.Default.ConfirmCloseConnection = (int) ConfirmCloseEnum.Multiple;
}
if (radCloseWarnExit.Checked)
{
mRemoteNG.Settings.Default.ConfirmCloseConnection = (int) ConfirmCloseEnum.Exit;
Settings.Default.ConfirmCloseConnection = (int) ConfirmCloseEnum.Exit;
}
if (radCloseWarnNever.Checked)
{
mRemoteNG.Settings.Default.ConfirmCloseConnection = (int) ConfirmCloseEnum.Never;
Settings.Default.ConfirmCloseConnection = (int) ConfirmCloseEnum.Never;
}
Settings.Default.Save();
}
public void radCredentialsCustom_CheckedChanged(object sender, EventArgs e)
private void radCredentialsCustom_CheckedChanged(object sender, EventArgs e)
{
lblCredentialsUsername.Enabled = radCredentialsCustom.Checked;
lblCredentialsPassword.Enabled = radCredentialsCustom.Checked;

View File

@@ -6,7 +6,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
public class OptionsPage : UserControl
{
public OptionsPage()
protected OptionsPage()
{
//InitializeComponent();
}

View File

@@ -2,8 +2,6 @@ using System;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Config.Connections;
using mRemoteNG.My;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
namespace mRemoteNG.UI.Forms.OptionsPages
@@ -39,10 +37,10 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
base.SaveSettings();
chkUseSQLServer.Checked = mRemoteNG.Settings.Default.UseSQLServer;
txtSQLServer.Text = mRemoteNG.Settings.Default.SQLHost;
txtSQLDatabaseName.Text = mRemoteNG.Settings.Default.SQLDatabaseName;
txtSQLUsername.Text = mRemoteNG.Settings.Default.SQLUser;
chkUseSQLServer.Checked = Settings.Default.UseSQLServer;
txtSQLServer.Text = Settings.Default.SQLHost;
txtSQLDatabaseName.Text = Settings.Default.SQLDatabaseName;
txtSQLUsername.Text = Settings.Default.SQLUser;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
txtSQLPassword.Text = cryptographyProvider.Decrypt(Settings.Default.SQLPass, GeneralAppInfo.EncryptionKey);
}
@@ -51,13 +49,15 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
base.SaveSettings();
mRemoteNG.Settings.Default.UseSQLServer = chkUseSQLServer.Checked;
mRemoteNG.Settings.Default.SQLHost = txtSQLServer.Text;
mRemoteNG.Settings.Default.SQLDatabaseName = txtSQLDatabaseName.Text;
mRemoteNG.Settings.Default.SQLUser = txtSQLUsername.Text;
Settings.Default.UseSQLServer = chkUseSQLServer.Checked;
Settings.Default.SQLHost = txtSQLServer.Text;
Settings.Default.SQLDatabaseName = txtSQLDatabaseName.Text;
Settings.Default.SQLUser = txtSQLUsername.Text;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
mRemoteNG.Settings.Default.SQLPass = cryptographyProvider.Encrypt(txtSQLPassword.Text, GeneralAppInfo.EncryptionKey);
Settings.Default.SQLPass = cryptographyProvider.Encrypt(txtSQLPassword.Text, GeneralAppInfo.EncryptionKey);
ReinitializeSqlUpdater();
Settings.Default.Save();
}
private static void ReinitializeSqlUpdater()
@@ -65,8 +65,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
if (Runtime.SQLConnProvider != null)
{
Runtime.SQLConnProvider.Dispose();
frmMain.Default.AreWeUsingSqlServerForSavingConnections = mRemoteNG.Settings.Default.UseSQLServer;
if (mRemoteNG.Settings.Default.UseSQLServer)
frmMain.Default.AreWeUsingSqlServerForSavingConnections = Settings.Default.UseSQLServer;
if (Settings.Default.UseSQLServer)
{
Runtime.SQLConnProvider = new SqlConnectionsProvider();
Runtime.SQLConnProvider.Enable();
@@ -74,7 +74,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
}
}
public void chkUseSQLServer_CheckedChanged(object sender, EventArgs e)
private void chkUseSQLServer_CheckedChanged(object sender, EventArgs e)
{
lblSQLServer.Enabled = chkUseSQLServer.Checked;
lblSQLDatabaseName.Enabled = chkUseSQLServer.Checked;

View File

@@ -1,5 +1,4 @@
using System;
using mRemoteNG.My;
namespace mRemoteNG.UI.Forms.OptionsPages
{
@@ -30,18 +29,20 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
base.SaveSettings();
mRemoteNG.Settings.Default.SaveConsOnExit = chkSaveConsOnExit.Checked;
mRemoteNG.Settings.Default.OpenConsFromLastSession = chkReconnectOnStart.Checked;
mRemoteNG.Settings.Default.SingleInstance = chkSingleInstance.Checked;
mRemoteNG.Settings.Default.StartupComponentsCheck = chkProperInstallationOfComponentsAtStartup.Checked;
Settings.Default.SaveConsOnExit = chkSaveConsOnExit.Checked;
Settings.Default.OpenConsFromLastSession = chkReconnectOnStart.Checked;
Settings.Default.SingleInstance = chkSingleInstance.Checked;
Settings.Default.StartupComponentsCheck = chkProperInstallationOfComponentsAtStartup.Checked;
Settings.Default.Save();
}
public void StartupExitPage_Load(object sender, EventArgs e)
private void StartupExitPage_Load(object sender, EventArgs e)
{
chkSaveConsOnExit.Checked = mRemoteNG.Settings.Default.SaveConsOnExit;
chkReconnectOnStart.Checked = mRemoteNG.Settings.Default.OpenConsFromLastSession;
chkSingleInstance.Checked = mRemoteNG.Settings.Default.SingleInstance;
chkProperInstallationOfComponentsAtStartup.Checked = mRemoteNG.Settings.Default.StartupComponentsCheck;
chkSaveConsOnExit.Checked = Settings.Default.SaveConsOnExit;
chkReconnectOnStart.Checked = Settings.Default.OpenConsFromLastSession;
chkSingleInstance.Checked = Settings.Default.SingleInstance;
chkProperInstallationOfComponentsAtStartup.Checked = Settings.Default.StartupComponentsCheck;
}
}
}

View File

@@ -1,5 +1,4 @@
using System;
using mRemoteNG.My;
namespace mRemoteNG.UI.Forms.OptionsPages
{
@@ -39,41 +38,43 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
base.SaveSettings();
chkAlwaysShowPanelTabs.Checked = mRemoteNG.Settings.Default.AlwaysShowPanelTabs;
chkOpenNewTabRightOfSelected.Checked = mRemoteNG.Settings.Default.OpenTabsRightOfSelected;
chkShowLogonInfoOnTabs.Checked = mRemoteNG.Settings.Default.ShowLogonInfoOnTabs;
chkShowProtocolOnTabs.Checked = mRemoteNG.Settings.Default.ShowProtocolOnTabs;
chkIdentifyQuickConnectTabs.Checked = mRemoteNG.Settings.Default.IdentifyQuickConnectTabs;
chkDoubleClickClosesTab.Checked = mRemoteNG.Settings.Default.DoubleClickOnTabClosesIt;
chkAlwaysShowPanelSelectionDlg.Checked = mRemoteNG.Settings.Default.AlwaysShowPanelSelectionDlg;
chkAlwaysShowPanelTabs.Checked = Settings.Default.AlwaysShowPanelTabs;
chkOpenNewTabRightOfSelected.Checked = Settings.Default.OpenTabsRightOfSelected;
chkShowLogonInfoOnTabs.Checked = Settings.Default.ShowLogonInfoOnTabs;
chkShowProtocolOnTabs.Checked = Settings.Default.ShowProtocolOnTabs;
chkIdentifyQuickConnectTabs.Checked = Settings.Default.IdentifyQuickConnectTabs;
chkDoubleClickClosesTab.Checked = Settings.Default.DoubleClickOnTabClosesIt;
chkAlwaysShowPanelSelectionDlg.Checked = Settings.Default.AlwaysShowPanelSelectionDlg;
chkUseOnlyErrorsAndInfosPanel.Checked = mRemoteNG.Settings.Default.ShowNoMessageBoxes;
chkMCInformation.Checked = mRemoteNG.Settings.Default.SwitchToMCOnInformation;
chkMCWarnings.Checked = mRemoteNG.Settings.Default.SwitchToMCOnWarning;
chkMCErrors.Checked = mRemoteNG.Settings.Default.SwitchToMCOnError;
chkUseOnlyErrorsAndInfosPanel.Checked = Settings.Default.ShowNoMessageBoxes;
chkMCInformation.Checked = Settings.Default.SwitchToMCOnInformation;
chkMCWarnings.Checked = Settings.Default.SwitchToMCOnWarning;
chkMCErrors.Checked = Settings.Default.SwitchToMCOnError;
}
public override void SaveSettings()
{
base.SaveSettings();
mRemoteNG.Settings.Default.AlwaysShowPanelTabs = chkAlwaysShowPanelTabs.Checked;
Settings.Default.AlwaysShowPanelTabs = chkAlwaysShowPanelTabs.Checked;
frmMain.Default.ShowHidePanelTabs();
mRemoteNG.Settings.Default.OpenTabsRightOfSelected = chkOpenNewTabRightOfSelected.Checked;
mRemoteNG.Settings.Default.ShowLogonInfoOnTabs = chkShowLogonInfoOnTabs.Checked;
mRemoteNG.Settings.Default.ShowProtocolOnTabs = chkShowProtocolOnTabs.Checked;
mRemoteNG.Settings.Default.IdentifyQuickConnectTabs = chkIdentifyQuickConnectTabs.Checked;
mRemoteNG.Settings.Default.DoubleClickOnTabClosesIt = chkDoubleClickClosesTab.Checked;
mRemoteNG.Settings.Default.AlwaysShowPanelSelectionDlg = chkAlwaysShowPanelSelectionDlg.Checked;
Settings.Default.OpenTabsRightOfSelected = chkOpenNewTabRightOfSelected.Checked;
Settings.Default.ShowLogonInfoOnTabs = chkShowLogonInfoOnTabs.Checked;
Settings.Default.ShowProtocolOnTabs = chkShowProtocolOnTabs.Checked;
Settings.Default.IdentifyQuickConnectTabs = chkIdentifyQuickConnectTabs.Checked;
Settings.Default.DoubleClickOnTabClosesIt = chkDoubleClickClosesTab.Checked;
Settings.Default.AlwaysShowPanelSelectionDlg = chkAlwaysShowPanelSelectionDlg.Checked;
mRemoteNG.Settings.Default.ShowNoMessageBoxes = chkUseOnlyErrorsAndInfosPanel.Checked;
mRemoteNG.Settings.Default.SwitchToMCOnInformation = chkMCInformation.Checked;
mRemoteNG.Settings.Default.SwitchToMCOnWarning = chkMCWarnings.Checked;
mRemoteNG.Settings.Default.SwitchToMCOnError = chkMCErrors.Checked;
Settings.Default.ShowNoMessageBoxes = chkUseOnlyErrorsAndInfosPanel.Checked;
Settings.Default.SwitchToMCOnInformation = chkMCInformation.Checked;
Settings.Default.SwitchToMCOnWarning = chkMCWarnings.Checked;
Settings.Default.SwitchToMCOnError = chkMCErrors.Checked;
Settings.Default.Save();
}
public void chkUseOnlyErrorsAndInfosPanel_CheckedChanged(object sender, EventArgs e)
private void chkUseOnlyErrorsAndInfosPanel_CheckedChanged(object sender, EventArgs e)
{
chkMCInformation.Enabled = chkUseOnlyErrorsAndInfosPanel.Checked;
chkMCWarnings.Enabled = chkUseOnlyErrorsAndInfosPanel.Checked;

View File

@@ -1,7 +1,6 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using mRemoteNG.My;
using mRemoteNG.Themes;
namespace mRemoteNG.UI.Forms.OptionsPages
@@ -46,7 +45,9 @@ namespace mRemoteNG.UI.Forms.OptionsPages
base.SaveSettings();
ThemeManager.SaveThemes(_themeList);
mRemoteNG.Settings.Default.ThemeName = ThemeManager.ActiveTheme.Name;
Settings.Default.ThemeName = ThemeManager.ActiveTheme.Name;
Settings.Default.Save();
}
public override void RevertSettings()
@@ -65,23 +66,23 @@ namespace mRemoteNG.UI.Forms.OptionsPages
#region Event Handlers
public void cboTheme_DropDown(object sender, EventArgs e)
private void cboTheme_DropDown(object sender, EventArgs e)
{
if (ThemeManager.ActiveTheme == ThemeManager.DefaultTheme)
if (Equals(ThemeManager.ActiveTheme, ThemeManager.DefaultTheme))
{
return;
}
ThemeManager.ActiveTheme.Name = cboTheme.Text;
}
public void cboTheme_SelectionChangeCommitted(object sender, EventArgs e)
private void cboTheme_SelectionChangeCommitted(object sender, EventArgs e)
{
if (cboTheme.SelectedItem == null)
{
cboTheme.SelectedItem = ThemeManager.DefaultTheme;
}
if (cboTheme.SelectedItem == ThemeManager.DefaultTheme)
if (Equals(cboTheme.SelectedItem, ThemeManager.DefaultTheme))
{
cboTheme.DropDownStyle = ComboBoxStyle.DropDownList;
btnThemeDelete.Enabled = false;
@@ -99,7 +100,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
ThemePropertyGrid.Refresh();
}
public void btnThemeNew_Click(object sender, EventArgs e)
private void btnThemeNew_Click(object sender, EventArgs e)
{
var newTheme = (ThemeInfo) ThemeManager.ActiveTheme.Clone();
newTheme.Name = Language.strUnnamedTheme;
@@ -112,7 +113,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
cboTheme.Focus();
}
public void btnThemeDelete_Click(object sender, EventArgs e)
private void btnThemeDelete_Click(object sender, EventArgs e)
{
var theme = (ThemeInfo) cboTheme.SelectedItem;
if (theme == null)

View File

@@ -4,8 +4,6 @@ using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.App.Update;
using mRemoteNG.My;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.UI.TaskDialog;
@@ -143,6 +141,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
Settings.Default.UpdateProxyAuthUser = txtProxyUsername.Text;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
Settings.Default.UpdateProxyAuthPass = cryptographyProvider.Encrypt(txtProxyPassword.Text, GeneralAppInfo.EncryptionKey);
Settings.Default.Save();
}
#endregion
@@ -151,17 +151,17 @@ namespace mRemoteNG.UI.Forms.OptionsPages
#region Event Handlers
public void chkCheckForUpdatesOnStartup_CheckedChanged(object sender, EventArgs e)
private void chkCheckForUpdatesOnStartup_CheckedChanged(object sender, EventArgs e)
{
cboUpdateCheckFrequency.Enabled = chkCheckForUpdatesOnStartup.Checked;
}
public void btnUpdateCheckNow_Click(object sender, EventArgs e)
private void btnUpdateCheckNow_Click(object sender, EventArgs e)
{
Windows.Show(WindowType.Update);
}
public void chkUseProxyForAutomaticUpdates_CheckedChanged(object sender, EventArgs e)
private void chkUseProxyForAutomaticUpdates_CheckedChanged(object sender, EventArgs e)
{
pnlProxyBasic.Enabled = chkUseProxyForAutomaticUpdates.Checked;
btnTestProxy.Enabled = chkUseProxyForAutomaticUpdates.Checked;
@@ -182,7 +182,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
}
}
public void btnTestProxy_Click(object sender, EventArgs e)
private void btnTestProxy_Click(object sender, EventArgs e)
{
if (_appUpdate != null)
{
@@ -206,7 +206,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
_appUpdate.GetUpdateInfoAsync();
}
public void chkUseProxyAuthentication_CheckedChanged(object sender, EventArgs e)
private void chkUseProxyAuthentication_CheckedChanged(object sender, EventArgs e)
{
if (chkUseProxyForAutomaticUpdates.Checked)
{

View File

@@ -1,8 +1,6 @@
using TextBox = mRemoteNG.UI.Forms.TextBox;
using mRemoteNG.My;
namespace mRemoteNG.Forms
namespace mRemoteNG.UI.Forms
{
public
partial class PasswordForm : System.Windows.Forms.Form
@@ -40,8 +38,8 @@ namespace mRemoteNG.Forms
this.btnCancel = new System.Windows.Forms.Button();
this.lblStatus = new System.Windows.Forms.Label();
this.pbLock = new System.Windows.Forms.PictureBox();
this.txtVerify = new mRemoteNG.Controls.TextBox();
this.txtPassword = new mRemoteNG.Controls.TextBox();
this.txtVerify = new TextBox();
this.txtPassword = new TextBox();
((System.ComponentModel.ISupportInitialize)(this.pbLock)).BeginInit();
this.SuspendLayout();
//
@@ -163,8 +161,8 @@ namespace mRemoteNG.Forms
this.PerformLayout();
}
private Controls.TextBox txtPassword;
private Controls.TextBox txtVerify;
private TextBox txtPassword;
private TextBox txtVerify;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.Label lblVerify;
private System.Windows.Forms.Button btnOK;

View File

@@ -1,9 +1,8 @@
using System;
using System.Windows.Forms;
using mRemoteNG.My;
using mRemoteNG.UI.Controls;
namespace mRemoteNG.Forms
namespace mRemoteNG.UI.Forms
{
public partial class PasswordForm
{
@@ -37,12 +36,13 @@ namespace mRemoteNG.Forms
// Add any initialization after the InitializeComponent() call.
_passwordName = passwordName;
this.Verify = verify;
Verify = verify;
}
#endregion
#region Event Handlers
public void frmPassword_Load(object sender, EventArgs e)
private void frmPassword_Load(object sender, EventArgs e)
{
ApplyLanguage();
@@ -53,14 +53,14 @@ namespace mRemoteNG.Forms
txtVerify.Visible = false;
}
}
public void btnCancel_Click(System.Object sender, EventArgs e)
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
public void btnOK_Click(System.Object sender, EventArgs e)
private void btnOK_Click(object sender, EventArgs e)
{
if (Verify)
{
@@ -72,8 +72,8 @@ namespace mRemoteNG.Forms
DialogResult = DialogResult.OK;
}
}
public void txtPassword_TextChanged(System.Object sender, EventArgs e)
private void txtPassword_TextChanged(object sender, EventArgs e)
{
HideStatus();
}

View File

@@ -1,61 +0,0 @@
using mRemoteNG.My;
namespace mRemoteNG.UI.Forms
{
partial class SplashPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// SplashPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = Resources.Logo;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.ClientSize = new System.Drawing.Size(492, 128);
this.ControlBox = false;
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(492, 128);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(492, 128);
this.Name = "SplashPage";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SplashPage";
this.TopMost = true;
this.ResumeLayout(false);
}
#endregion
}
}

View File

@@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace mRemoteNG.UI.Forms
{
public partial class SplashPage : Form
{
BackgroundWorker splashPageWorker;
public SplashPage()
{
InitializeComponent();
InitializeBackgroundWorker();
}
public void InitializeBackgroundWorker()
{
splashPageWorker = new BackgroundWorker();
}
}
}

View File

@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<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>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1,17 +1,16 @@
using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.Windows.Forms;
// Adapted from http://stackoverflow.com/a/3678888/2101395
namespace mRemoteNG.Controls
namespace mRemoteNG.UI.Forms
{
public class TextBox : System.Windows.Forms.TextBox
{
#region Public Properties
[Category("Behavior"),
DefaultValue(false)]private bool _SelectAllOnFocus = false;
DefaultValue(false)]private bool _SelectAllOnFocus;
public bool SelectAllOnFocus
{
get
@@ -60,7 +59,7 @@ namespace mRemoteNG.Controls
#endregion
#region Private Fields
private bool _focusHandled = false;
private bool _focusHandled;
#endregion
}
}

View File

@@ -1,8 +1,6 @@
using mRemoteNG.My;
namespace mRemoteNG
namespace mRemoteNG.UI.Forms
{
public partial class frmChoosePanel : System.Windows.Forms.Form

View File

@@ -2,7 +2,7 @@ using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.UI.Forms.Input;
namespace mRemoteNG
namespace mRemoteNG.UI.Forms
{
public partial class frmChoosePanel
{
@@ -21,8 +21,8 @@ namespace mRemoteNG
cbPanels.SelectedItem = value;
}
}
public void frmChoosePanel_Load(object sender, System.EventArgs e)
private void frmChoosePanel_Load(object sender, System.EventArgs e)
{
ApplyLanguage();
@@ -59,8 +59,8 @@ namespace mRemoteNG
btnOK.Enabled = false;
}
}
public void btnNew_Click(object sender, System.EventArgs e)
private void btnNew_Click(object sender, System.EventArgs e)
{
string pnlName = Language.strNewPanel;
@@ -72,13 +72,13 @@ namespace mRemoteNG
cbPanels.Focus();
}
}
public void btnOK_Click(object sender, System.EventArgs e)
private void btnOK_Click(object sender, System.EventArgs e)
{
DialogResult = DialogResult.OK;
}
public void btnCancel_Click(object sender, System.EventArgs e)
private void btnCancel_Click(object sender, System.EventArgs e)
{
DialogResult = DialogResult.Cancel;
}

View File

@@ -1,4 +1,3 @@
using mRemoteNG.Controls;
using mRemoteNG.UI.Controls;
namespace mRemoteNG.UI.Forms
@@ -98,7 +97,7 @@ namespace mRemoteNG.UI.Forms
this.cmbQuickConnect = new mRemoteNG.UI.Controls.QuickConnectComboBox();
this.tsContainer = new System.Windows.Forms.ToolStripContainer();
this.tsQuickConnect = new System.Windows.Forms.ToolStrip();
this.btnQuickConnect = new mRemoteNG.Controls.ToolStripSplitButton();
this.btnQuickConnect = new ToolStripSplitButton();
this.mnuQuickConnectProtocol = new System.Windows.Forms.ContextMenuStrip(this.components);
this.btnConnections = new System.Windows.Forms.ToolStripDropDownButton();
this.mnuConnections = new System.Windows.Forms.ContextMenuStrip(this.components);

View File

@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
namespace mRemoteNG.UI.TaskDialog
@@ -14,8 +11,8 @@ namespace mRemoteNG.UI.TaskDialog
//--------------------------------------------------------------------------------
#region PRIVATE MEMBERS
//--------------------------------------------------------------------------------
Image imgArrow1 = null;
Image imgArrow2 = null;
Image imgArrow1;
Image imgArrow2;
const int LEFT_MARGIN = 10;
const int TOP_MARGIN = 10;
@@ -37,8 +34,8 @@ namespace mRemoteNG.UI.TaskDialog
{
base.Text = value;
if (m_autoHeight)
this.Height = GetBestHeight();
this.Invalidate();
Height = GetBestHeight();
Invalidate();
}
}
@@ -51,7 +48,7 @@ namespace mRemoteNG.UI.TaskDialog
[Browsable(true)]
[Category("Behavior")]
[DefaultValue(true)]
public bool AutoHeight { get { return m_autoHeight; } set { m_autoHeight = value; if (m_autoHeight) this.Invalidate(); } }
public bool AutoHeight { get { return m_autoHeight; } set { m_autoHeight = value; if (m_autoHeight) Invalidate(); } }
#endregion
@@ -61,8 +58,8 @@ namespace mRemoteNG.UI.TaskDialog
public CommandButton()
{
InitializeComponent();
base.Font = new Font("Segoe UI", 11.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)0);
m_smallFont = new Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)0);
Font = new Font("Segoe UI", 11.75F, FontStyle.Regular, GraphicsUnit.Point, 0);
m_smallFont = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point, 0);
}
#endregion
@@ -81,16 +78,16 @@ namespace mRemoteNG.UI.TaskDialog
//--------------------------------------------------------------------------------
string GetLargeText()
{
string[] lines = this.Text.Split(new char[] { '\n' });
string[] lines = Text.Split(new char[] { '\n' });
return lines[0];
}
string GetSmallText()
{
if (this.Text.IndexOf('\n') < 0)
if (Text.IndexOf('\n') < 0)
return "";
string s = this.Text;
string s = Text;
string[] lines = s.Split(new char[] { '\n' });
s = "";
for (int i = 1; i < lines.Length; i++)
@@ -101,9 +98,9 @@ namespace mRemoteNG.UI.TaskDialog
SizeF GetLargeTextSizeF()
{
int x = LEFT_MARGIN + ARROW_WIDTH + 5;
SizeF mzSize = new SizeF(this.Width - x - LEFT_MARGIN, 5000.0F); // presume RIGHT_MARGIN = LEFT_MARGIN
Graphics g = Graphics.FromHwnd(this.Handle);
SizeF textSize = g.MeasureString(GetLargeText(), base.Font, mzSize);
SizeF mzSize = new SizeF(Width - x - LEFT_MARGIN, 5000.0F); // presume RIGHT_MARGIN = LEFT_MARGIN
Graphics g = Graphics.FromHwnd(Handle);
SizeF textSize = g.MeasureString(GetLargeText(), Font, mzSize);
return textSize;
}
@@ -112,8 +109,8 @@ namespace mRemoteNG.UI.TaskDialog
string s = GetSmallText();
if (s == "") return new SizeF(0, 0);
int x = LEFT_MARGIN + ARROW_WIDTH + 8; // <- indent small text slightly more
SizeF mzSize = new SizeF(this.Width - x - LEFT_MARGIN, 5000.0F); // presume RIGHT_MARGIN = LEFT_MARGIN
Graphics g = Graphics.FromHwnd(this.Handle);
SizeF mzSize = new SizeF(Width - x - LEFT_MARGIN, 5000.0F); // presume RIGHT_MARGIN = LEFT_MARGIN
Graphics g = Graphics.FromHwnd(Handle);
SizeF textSize = g.MeasureString(s, m_smallFont, mzSize);
return textSize;
}
@@ -149,7 +146,7 @@ namespace mRemoteNG.UI.TaskDialog
{
case eButtonState.Normal:
e.Graphics.FillRectangle(Brushes.White, newRect);
if (base.Focused)
if (Focused)
e.Graphics.DrawRectangle(new Pen(Color.SkyBlue, 1), newRect);
else
e.Graphics.DrawRectangle(new Pen(Color.White, 1), newRect);
@@ -180,12 +177,12 @@ namespace mRemoteNG.UI.TaskDialog
text_color = Color.DarkBlue;
}
string largetext = this.GetLargeText();
string smalltext = this.GetSmallText();
string largetext = GetLargeText();
string smalltext = GetSmallText();
SizeF szL = GetLargeTextSizeF();
//e.Graphics.DrawString(largetext, base.Font, new SolidBrush(text_color), new RectangleF(new PointF(LEFT_MARGIN + imgArrow1.Width + 5, TOP_MARGIN), szL));
TextRenderer.DrawText(e.Graphics, largetext, base.Font, new Rectangle(LEFT_MARGIN + imgArrow1.Width + 5, TOP_MARGIN, (int)szL.Width, (int)szL.Height), text_color, TextFormatFlags.Default);
TextRenderer.DrawText(e.Graphics, largetext, Font, new Rectangle(LEFT_MARGIN + imgArrow1.Width + 5, TOP_MARGIN, (int)szL.Width, (int)szL.Height), text_color, TextFormatFlags.Default);
if (smalltext != "")
{
@@ -193,38 +190,38 @@ namespace mRemoteNG.UI.TaskDialog
e.Graphics.DrawString(smalltext, m_smallFont, new SolidBrush(text_color), new RectangleF(new PointF(LEFT_MARGIN + imgArrow1.Width + 8, TOP_MARGIN + (int)szL.Height), szS));
}
e.Graphics.DrawImage(img, new Point(LEFT_MARGIN, TOP_MARGIN + (int)(szL.Height / 2) - (int)(img.Height / 2)));
e.Graphics.DrawImage(img, new Point(LEFT_MARGIN, TOP_MARGIN + (int)(szL.Height / 2) - img.Height / 2));
}
//--------------------------------------------------------------------------------
protected override void OnMouseLeave(System.EventArgs e)
protected override void OnMouseLeave(EventArgs e)
{
m_State = eButtonState.Normal;
this.Invalidate();
Invalidate();
base.OnMouseLeave(e);
}
//--------------------------------------------------------------------------------
protected override void OnMouseEnter(System.EventArgs e)
protected override void OnMouseEnter(EventArgs e)
{
m_State = eButtonState.MouseOver;
this.Invalidate();
Invalidate();
base.OnMouseEnter(e);
}
//--------------------------------------------------------------------------------
protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
protected override void OnMouseUp(MouseEventArgs e)
{
m_State = eButtonState.MouseOver;
this.Invalidate();
Invalidate();
base.OnMouseUp(e);
}
//--------------------------------------------------------------------------------
protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
protected override void OnMouseDown(MouseEventArgs e)
{
m_State = eButtonState.Down;
this.Invalidate();
Invalidate();
base.OnMouseDown(e);
}
@@ -234,9 +231,9 @@ namespace mRemoteNG.UI.TaskDialog
if (m_autoHeight)
{
int h = GetBestHeight();
if (this.Height != h)
if (Height != h)
{
this.Height = h;
Height = h;
return;
}
}

View File

@@ -2,12 +2,11 @@ using System;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using mRemoteNG.App;
using mRemoteNG.My;
namespace mRemoteNG.UI.Window
{
public partial class ActiveDirectoryImportWindow : BaseWindow
public partial class ActiveDirectoryImportWindow
{
#region Constructors
public ActiveDirectoryImportWindow(DockContent panel)

View File

@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
using mRemoteNG.My;
using WeifenLuo.WinFormsUI.Docking;
using mRemoteNG.App;
using mRemoteNG.App.Update;

View File

@@ -1,7 +1,6 @@
using System;
using System.Windows.Forms;
using mRemoteNG.App.Info;
using mRemoteNG.My;
using WeifenLuo.WinFormsUI.Docking;
@@ -13,7 +12,7 @@ namespace mRemoteNG.UI.Window
#region Form Init
internal TreeView tvIndex;
internal ImageList imgListHelp;
private System.ComponentModel.Container components = null;
private System.ComponentModel.Container components;
internal SplitContainer pnlSplitter;
internal Label lblDocName;
internal WebBrowser wbHelp;

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System;
using System.Drawing;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using mRemoteNG.App;

View File

@@ -6,6 +6,7 @@ using System.Windows.Forms;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using WeifenLuo.WinFormsUI.Docking;
using TextBox = System.Windows.Forms.TextBox;
namespace mRemoteNG.UI.Window
{

View File

@@ -3,7 +3,6 @@ using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.ComponentModel;
using mRemoteNG.My;
using WeifenLuo.WinFormsUI.Docking;
using System.IO;
using mRemoteNG.App;
@@ -39,22 +38,22 @@ namespace mRemoteNG.UI.Window
btnDownload.Text = Language.strDownloadAndInstall;
lblChangeLogLabel.Text = Language.strLabelChangeLog;
lblInstalledVersion.Text = Language.strVersion;
lblInstalledVersionLabel.Text = string.Format("{0}:", Language.strCurrentVersion);
lblInstalledVersionLabel.Text = $"{Language.strCurrentVersion}:";
lblLatestVersion.Text = Language.strVersion;
lblLatestVersionLabel.Text = string.Format("{0}:", Language.strAvailableVersion);
lblLatestVersionLabel.Text = $"{Language.strAvailableVersion}:";
}
public void btnCheckForUpdate_Click(System.Object sender, EventArgs e)
public void btnCheckForUpdate_Click(Object sender, EventArgs e)
{
CheckForUpdate();
}
public void btnDownload_Click(System.Object sender, EventArgs e)
public void btnDownload_Click(Object sender, EventArgs e)
{
DownloadUpdate();
}
public void pbUpdateImage_Click(System.Object sender, EventArgs e)
public void pbUpdateImage_Click(Object sender, EventArgs e)
{
Uri linkUri = pbUpdateImage.Tag as Uri;
if (linkUri == null || linkUri.IsFile || linkUri.IsUnc || linkUri.IsLoopback)
@@ -67,7 +66,7 @@ namespace mRemoteNG.UI.Window
#region Private Fields
private AppUpdater _appUpdate;
private bool _isUpdateDownloadHandlerDeclared = false;
private bool _isUpdateDownloadHandlerDeclared;
#endregion
#region Private Methods
@@ -177,7 +176,7 @@ namespace mRemoteNG.UI.Window
}
}
private void GetChangeLogCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
private void GetChangeLogCompleted(object sender, AsyncCompletedEventArgs e)
{
if (InvokeRequired)
{
@@ -237,7 +236,7 @@ namespace mRemoteNG.UI.Window
prgbDownload.Value = e.ProgressPercentage;
}
private void DownloadUpdateCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
private void DownloadUpdateCompleted(object sender, AsyncCompletedEventArgs e)
{
try
{
@@ -253,10 +252,9 @@ namespace mRemoteNG.UI.Window
throw (e.Error);
}
if (MessageBox.Show(Language.strUpdateDownloadComplete, Language.strMenuCheckForUpdates, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK)
if (MessageBox.Show(Language.strUpdateDownloadComplete, Language.strMenuCheckForUpdates, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
{
Shutdown.Quit(_appUpdate.CurrentUpdateInfo.UpdateFilePath);
return ;
}
else
{

View File

@@ -192,7 +192,6 @@
<Compile Include="Tools\ExternalToolsTypeConverter.cs" />
<Compile Include="Tools\SecureTransfer.cs" />
<Compile Include="Tools\Sorting\TreeNodeSorter.cs" />
<Compile Include="Tools\Sorting\Sortable.cs" />
<Compile Include="Tree\ConnectionTree.cs" />
<Compile Include="Tree\ConnectionTreeDragAndDropHandler.cs" />
<Compile Include="Tree\ConnectionTreeModel.cs" />
@@ -216,9 +215,6 @@
<Compile Include="UI\Controls\QuickConnectComboBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\TextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\ToolStripSplitButton.cs">
<SubType>Component</SubType>
</Compile>
@@ -384,11 +380,8 @@
<Compile Include="Tools\Tools.SystemMenu.cs" />
<Compile Include="Tools\Tools.WindowPlacement.cs" />
<Compile Include="Tree\ConnectionTreeNode.cs" />
<Compile Include="UI\Forms\SplashPage.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Forms\SplashPage.Designer.cs">
<DependentUpon>SplashPage.cs</DependentUpon>
<Compile Include="UI\Forms\TextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\TaskDialog\CommandButton.cs">
<SubType>Component</SubType>
@@ -587,9 +580,6 @@
<DependentUpon>ReconnectGroup.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="UI\Forms\SplashPage.resx">
<DependentUpon>SplashPage.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\TaskDialog\frmTaskDialog.resx">
<DependentUpon>frmTaskDialog.cs</DependentUpon>
</EmbeddedResource>