use statement bodys to allow building with VS2015

This commit is contained in:
Sean Kaim
2017-04-12 13:40:36 -04:00
parent af5000b0f8
commit 53c8b3b66d
23 changed files with 190 additions and 78 deletions

View File

@@ -6,6 +6,7 @@ using System;
#endif
using System.IO;
using System.Windows.Forms;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.App
{
@@ -15,7 +16,10 @@ namespace mRemoteNG.App
public ILog Log { get; private set; }
public static string DefaultLogPath => BuildLogFilePath();
public static string DefaultLogPath
{
get { return BuildLogFilePath(); }
}
private Logger()
{

View File

@@ -5,6 +5,7 @@ using System.Windows.Forms;
using mRemoteNG.Config.Putty;
using mRemoteNG.UI.Controls;
using mRemoteNG.UI.Forms;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.App
{
@@ -12,7 +13,10 @@ namespace mRemoteNG.App
{
private static string _updateFilePath;
private static bool UpdatePending => !string.IsNullOrEmpty(_updateFilePath);
private static bool UpdatePending
{
get { return !string.IsNullOrEmpty(_updateFilePath); }
}
public static void Quit(string updateFilePath = null)
{

View File

@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.App
{
@@ -11,7 +11,10 @@ namespace mRemoteNG.App
{
private static SupportedCultures _Instance;
private static SupportedCultures SingletonInstance => _Instance ?? (_Instance = new SupportedCultures());
private static SupportedCultures SingletonInstance
{
get { return _Instance ?? (_Instance = new SupportedCultures()); }
}
private SupportedCultures()

View File

@@ -13,6 +13,7 @@ using mRemoteNG.Tools;
#else
using System.Windows.Forms;
#endif
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.App.Update
{
@@ -28,11 +29,20 @@ namespace mRemoteNG.App.Update
public string ChangeLog { get; private set; }
public bool IsGetUpdateInfoRunning => _getUpdateInfoThread != null && _getUpdateInfoThread.IsAlive;
public bool IsGetUpdateInfoRunning
{
get { return _getUpdateInfoThread != null && _getUpdateInfoThread.IsAlive; }
}
private bool IsGetChangeLogRunning => _getChangeLogThread != null && _getChangeLogThread.IsAlive;
private bool IsGetChangeLogRunning
{
get { return _getChangeLogThread != null && _getChangeLogThread.IsAlive; }
}
public bool IsDownloadUpdateRunning => _downloadUpdateWebClient != null;
public bool IsDownloadUpdateRunning
{
get { return _downloadUpdateWebClient != null; }
}
#endregion

View File

@@ -1,6 +1,7 @@
using System;
using System.Timers;
using mRemoteNG.App;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.Connections.Multiuser
{
@@ -11,7 +12,10 @@ namespace mRemoteNG.Config.Connections.Multiuser
private readonly ConnectionsLoader _connectionsLoader;
private readonly ConnectionsSaver _connectionsSaver;
public double TimerIntervalInMilliseconds => _updateTimer.Interval;
public double TimerIntervalInMilliseconds
{
get { return _updateTimer.Interval; }
}
public RemoteConnectionsSyncronizer(IConnectionsUpdateChecker updateChecker)
{
@@ -47,10 +51,25 @@ namespace mRemoteNG.Config.Connections.Multiuser
_connectionsSaver.SaveConnections();
}
public void Enable() => _updateTimer.Start();
public void Disable() => _updateTimer.Stop();
public bool IsUpdateAvailable() => _updateChecker.IsUpdateAvailable();
public void IsUpdateAvailableAsync() => _updateChecker.IsUpdateAvailableAsync();
public void Enable()
{
_updateTimer.Start();
}
public void Disable()
{
_updateTimer.Stop();
}
public bool IsUpdateAvailable()
{
return _updateChecker.IsUpdateAvailable();
}
public void IsUpdateAvailableAsync()
{
_updateChecker.IsUpdateAvailableAsync();
}
private void OnUpdateCheckStarted(object sender, EventArgs eventArgs)

View File

@@ -2,6 +2,7 @@
using System.Data.SqlClient;
using mRemoteNG.App;
using mRemoteNG.Security.SymmetricEncryption;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.DatabaseConnectors
{
@@ -14,7 +15,10 @@ namespace mRemoteNG.Config.DatabaseConnectors
private string _sqlUsername;
private string _sqlPassword;
public bool IsConnected => (SqlConnection.State == ConnectionState.Open);
public bool IsConnected
{
get { return (SqlConnection.State == ConnectionState.Open); }
}
public SqlDatabaseConnector()
{

View File

@@ -3,16 +3,19 @@ using System.Collections.Specialized;
using System.Linq;
using mRemoteNG.Connection;
using mRemoteNG.Tree.Root;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.Putty
{
public abstract class AbstractPuttySessionsProvider
{
public virtual RootPuttySessionsNodeInfo RootInfo { get; } = new RootPuttySessionsNodeInfo();
protected virtual List<PuttySessionInfo> Sessions => RootInfo.Children.OfType<PuttySessionInfo>().ToList();
protected virtual List<PuttySessionInfo> Sessions
{
get { return RootInfo.Children.OfType<PuttySessionInfo>().ToList(); }
}
#region Public Methods
#region Public Methods
public abstract string[] GetSessionNames(bool raw = false);
public abstract PuttySessionInfo GetSession(string sessionName);

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using mRemoteNG.Tree.Root;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.Putty
{
@@ -12,7 +12,11 @@ namespace mRemoteNG.Config.Putty
public static PuttySessionsManager Instance { get; } = new PuttySessionsManager();
private readonly List<AbstractPuttySessionsProvider> _providers = new List<AbstractPuttySessionsProvider>();
public IEnumerable<AbstractPuttySessionsProvider> Providers => _providers;
public IEnumerable<AbstractPuttySessionsProvider> Providers
{
get { return _providers; }
}
public List<RootPuttySessionsNodeInfo> RootPuttySessionsNodes { get; } = new List<RootPuttySessionsNodeInfo>();
private PuttySessionsManager()
@@ -122,7 +126,10 @@ namespace mRemoteNG.Config.Putty
#region Public Classes
public class SessionList : StringConverter
{
public static string[] Names => Instance.GetSessionNames();
public static string[] Names
{
get { return Instance.GetSessionNames(); }
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections;
using System.Collections.Specialized;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Connection.Protocol
{
@@ -20,10 +20,13 @@ namespace mRemoteNG.Connection.Protocol
}
}
public new int Count => List.Count;
public new int Count
{
get { return List.Count; }
}
public void Add(ProtocolBase cProt)
public void Add(ProtocolBase cProt)
{
List.Add(cProt);
RaiseCollectionChangedEvent(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, cProt));

View File

@@ -9,7 +9,7 @@ using System.Windows.Forms;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools.Cmdline;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Connection.Protocol
{
@@ -30,7 +30,10 @@ namespace mRemoteNG.Connection.Protocol
public static string PuttyPath { get; set; }
public bool Focused => NativeMethods.GetForegroundWindow() == PuttyHandle;
public bool Focused
{
get { return NativeMethods.GetForegroundWindow() == PuttyHandle; }
}
#endregion
@@ -76,14 +79,16 @@ namespace mRemoteNG.Connection.Protocol
}
else
{
if (Settings.Default.EmptyCredentials == "windows")
{
username = Environment.UserName;
}
else if (Settings.Default.EmptyCredentials == "custom")
{
username = Settings.Default.DefaultUsername;
}
// ReSharper disable once SwitchStatementMissingSomeCases
switch (Settings.Default.EmptyCredentials)
{
case "windows":
username = Environment.UserName;
break;
case "custom":
username = Settings.Default.DefaultUsername;
break;
}
}
if (!string.IsNullOrEmpty(InterfaceControl.Info.CredentialRecord?.Password.ConvertToUnsecureString()))

View File

@@ -4,6 +4,7 @@ using System.ComponentModel;
using mRemoteNG.Security;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Connection.Protocol.VNC
@@ -12,17 +13,18 @@ namespace mRemoteNG.Connection.Protocol.VNC
{
#region Properties
public bool SmartSize
{
get => _VNC.Scaled;
set => _VNC.Scaled = value;
{
get { return _VNC.Scaled; }
set { _VNC.Scaled = value; }
}
public bool ViewOnly
{
get => _VNC.ViewOnly;
set => _VNC.ViewOnly = value;
}
#endregion
public bool ViewOnly
{
get { return _VNC.ViewOnly; }
set { _VNC.ViewOnly = value; }
}
#endregion
#region Private Declarations
private VncSharp.RemoteDesktop _VNC;

View File

@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Credential
{
@@ -8,7 +8,10 @@ namespace mRemoteNG.Credential
{
private readonly List<ICredentialProvider> _credentialProviders = new List<ICredentialProvider>();
public IEnumerable<ICredentialProvider> CredentialProviders => _credentialProviders;
public IEnumerable<ICredentialProvider> CredentialProviders
{
get { return _credentialProviders; }
}
public void AddProvider(ICredentialProvider credentialProvider)

View File

@@ -3,7 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Messages
{
@@ -11,7 +11,10 @@ namespace mRemoteNG.Messages
{
private readonly IList<IMessage> _messageList;
public IEnumerable<IMessage> Messages => _messageList;
public IEnumerable<IMessage> Messages
{
get { return _messageList; }
}
public MessageCollector()
{

View File

@@ -1,6 +1,7 @@
using System.Security;
using mRemoteNG.Security.SymmetricEncryption;
using Org.BouncyCastle.Security;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Security
{
@@ -10,7 +11,10 @@ namespace mRemoteNG.Security
private SecureString _secureString;
private readonly ICryptographyProvider _cryptographyProvider;
private static SecureString MachineKey => _machineKey ?? (_machineKey = GenerateNewMachineKey(32));
private static SecureString MachineKey
{
get { return _machineKey ?? (_machineKey = GenerateNewMachineKey(32)); }
}
public EncryptedSecureString()
{

View File

@@ -16,6 +16,7 @@ using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Security;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Security.SymmetricEncryption
{
@@ -36,7 +37,10 @@ namespace mRemoteNG.Security.SymmetricEncryption
protected virtual int MinPasswordLength { get; set; } = 1;
public int BlockSizeInBytes => _aeadBlockCipher.GetBlockSize();
public int BlockSizeInBytes
{
get { return _aeadBlockCipher.GetBlockSize(); }
}
public BlockCipherEngines CipherEngine
{

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text.RegularExpressions;
using mRemoteNG.App;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Tools.Cmdline
{
@@ -21,7 +22,10 @@ namespace mRemoteNG.Tools.Cmdline
private readonly StringDictionary _parameters;
// Retrieve a parameter value if it exists
public string this[string param] => (_parameters[param]);
public string this[string param]
{
get { return (_parameters[param]); }
}
public CmdArgumentsInterpreter(IEnumerable<string> args)
{

View File

@@ -6,6 +6,7 @@ using mRemoteNG.App;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Messages;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Tools
{
@@ -20,9 +21,15 @@ namespace mRemoteNG.Tools
public bool TryIntegrate { get; set; }
public ConnectionInfo ConnectionInfo { get; set; }
public Icon Icon => File.Exists(FileName) ? MiscTools.GetIconFromFile(FileName) : Resources.mRemote_Icon;
public Icon Icon
{
get { return File.Exists(FileName) ? MiscTools.GetIconFromFile(FileName) : Resources.mRemote_Icon; }
}
public Image Image => Icon?.ToBitmap() ?? Resources.mRemote_Icon.ToBitmap();
public Image Image
{
get { return Icon?.ToBitmap() ?? Resources.mRemote_Icon.ToBitmap(); }
}
#endregion

View File

@@ -2,7 +2,7 @@ using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Reflection;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Tools
{
@@ -30,7 +30,7 @@ namespace mRemoteNG.Tools
continue;
}
var commandAttribute = (CommandAttribute) (commandAttributes[0]);
var commandAttribute = (CommandAttribute) commandAttributes[0];
if (!commandAttribute.Command)
{
continue;
@@ -40,7 +40,7 @@ namespace mRemoteNG.Tools
var displayNameAttributes = method.GetCustomAttributes(typeof(DisplayNameAttribute), true);
if (displayNameAttributes.Length != 0)
{
var displayNameAttribute = (DisplayNameAttribute) (displayNameAttributes[0]);
var displayNameAttribute = (DisplayNameAttribute) displayNameAttributes[0];
if (!string.IsNullOrEmpty(displayNameAttribute.DisplayName))
{
displayName = displayNameAttribute.DisplayName;
@@ -71,7 +71,7 @@ namespace mRemoteNG.Tools
continue;
}
var commandAttribute = (CommandAttribute) (commandAttributes[0]);
var commandAttribute = (CommandAttribute) commandAttributes[0];
if (!commandAttribute.Command)
{
continue;
@@ -81,7 +81,7 @@ namespace mRemoteNG.Tools
var displayNameAttributes = method.GetCustomAttributes(typeof(DisplayNameAttribute), true);
if (displayNameAttributes.Length != 0)
{
var displayNameAttribute = (DisplayNameAttribute) (displayNameAttributes[0]);
var displayNameAttribute = (DisplayNameAttribute) displayNameAttributes[0];
if (!string.IsNullOrEmpty(displayNameAttribute.DisplayName))
{
displayName = displayNameAttribute.DisplayName;
@@ -101,52 +101,58 @@ namespace mRemoteNG.Tools
public IComponent Component
{
get { throw (new NotSupportedException()); }
get { throw new NotSupportedException(); }
}
public IContainer Container => null;
public IContainer Container
{
get { return null; }
}
public bool DesignMode => true;
public bool DesignMode
{
get { return true; }
}
public string Name
{
get { throw (new NotSupportedException()); }
set { throw (new NotSupportedException()); }
get { throw new NotSupportedException(); }
set { throw new NotSupportedException(); }
}
public void AddCommand(MenuCommand command)
{
throw (new NotSupportedException());
throw new NotSupportedException();
}
public void AddVerb(DesignerVerb verb)
{
throw (new NotSupportedException());
throw new NotSupportedException();
}
public MenuCommand FindCommand(CommandID commandId)
{
throw (new NotSupportedException());
throw new NotSupportedException();
}
public bool GlobalInvoke(CommandID commandId)
{
throw (new NotSupportedException());
throw new NotSupportedException();
}
public void RemoveCommand(MenuCommand command)
{
throw (new NotSupportedException());
throw new NotSupportedException();
}
public void RemoveVerb(DesignerVerb verb)
{
throw (new NotSupportedException());
throw new NotSupportedException();
}
public void ShowContextMenu(CommandID menuId, int x, int y)
{
throw (new NotSupportedException());
throw new NotSupportedException();
}
}

View File

@@ -1,6 +1,6 @@
using System;
using System.ComponentModel;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Tools
{
@@ -88,7 +88,10 @@ 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 => typeof(DefaultValueAttribute);
public override object TypeId
{
get { return typeof(DefaultValueAttribute); }
}
}
#region Special localization - with String.Format

View File

@@ -11,7 +11,7 @@ using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.UI.Controls
{
@@ -21,7 +21,10 @@ namespace mRemoteNG.UI.Controls
private readonly ConnectionTreeDragAndDropHandler _dragAndDropHandler = new ConnectionTreeDragAndDropHandler();
private readonly PuttySessionsManager _puttySessionsManager = PuttySessionsManager.Instance;
public ConnectionInfo SelectedNode => (ConnectionInfo) SelectedObject;
public ConnectionInfo SelectedNode
{
get { return (ConnectionInfo) SelectedObject; }
}
public NodeSearcher NodeSearcher { get; private set; }

View File

@@ -3,6 +3,7 @@ using System.Windows.Forms;
using BrightIdeasSoftware;
using mRemoteNG.Credential;
using mRemoteNG.Tree;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.UI.Forms
@@ -11,7 +12,11 @@ namespace mRemoteNG.UI.Forms
{
private readonly CredentialManager _credentialManager;
public ICredentialRecord SelectedRecord => objectListView1.SelectedObject as ICredentialRecord;
public ICredentialRecord SelectedRecord
{
get { return objectListView1.SelectedObject as ICredentialRecord; }
}
public IConfirm<ICredentialRecord> DeletionConfirmer { get; set; } = new AlwaysConfirmYes();
public CredentialManagerForm(CredentialManager credentialManager)

View File

@@ -1,6 +1,6 @@
using System;
using System.Windows.Forms;
using mRemoteNG.UI.Controls;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.UI.Forms
{
@@ -12,7 +12,10 @@ namespace mRemoteNG.UI.Forms
private bool Verify { get; set; }
public string Password => Verify ? txtVerify.Text : txtPassword.Text;
public string Password
{
get { return Verify ? txtVerify.Text : txtPassword.Text; }
}
#endregion

View File

@@ -9,7 +9,7 @@ using System.Drawing;
using System.Windows.Forms;
using mRemoteNG.UI.Controls;
using WeifenLuo.WinFormsUI.Docking;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.UI.Window
{
@@ -19,7 +19,10 @@ namespace mRemoteNG.UI.Window
private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
public ConnectionInfo SelectedNode => olvConnections.SelectedNode;
public ConnectionInfo SelectedNode
{
get { return olvConnections.SelectedNode; }
}
public ConnectionTree ConnectionTree
{