fixed syntax style inconsistencies

This commit is contained in:
Faryan Rezagholi
2020-09-27 15:11:29 +02:00
parent b344e3a749
commit 2cf5a4317d
31 changed files with 108 additions and 210 deletions

View File

@@ -26,10 +26,7 @@ namespace mRemoteNG.Config.DatabaseConnectors
return new SqlCommand(dbCommand, (SqlConnection) _dbConnection);
}
public bool IsConnected
{
get { return (_dbConnection.State == ConnectionState.Open); }
}
public bool IsConnected => (_dbConnection.State == ConnectionState.Open);
public MSSqlDatabaseConnector(string sqlServer, string catalog, string username, string password)
{

View File

@@ -27,10 +27,7 @@ namespace mRemoteNG.Config.DatabaseConnectors
return new MySqlCommand(dbCommand, (MySqlConnection) _dbConnection);
}
public bool IsConnected
{
get { return (_dbConnection.State == ConnectionState.Open); }
}
public bool IsConnected => (_dbConnection.State == ConnectionState.Open);
public MySqlDatabaseConnector(string host, string database, string username, string password)
{

View File

@@ -13,10 +13,7 @@ namespace mRemoteNG.Config.Putty
{
public virtual RootPuttySessionsNodeInfo RootInfo { get; } = new RootPuttySessionsNodeInfo();
protected virtual List<PuttySessionInfo> Sessions
{
get { return RootInfo.Children.OfType<PuttySessionInfo>().ToList(); }
}
protected virtual List<PuttySessionInfo> Sessions => RootInfo.Children.OfType<PuttySessionInfo>().ToList();
#region Public Methods

View File

@@ -14,10 +14,7 @@ namespace mRemoteNG.Config.Putty
private readonly List<AbstractPuttySessionsProvider> _providers = new List<AbstractPuttySessionsProvider>();
public IEnumerable<AbstractPuttySessionsProvider> Providers
{
get { return _providers; }
}
public IEnumerable<AbstractPuttySessionsProvider> Providers => _providers;
public List<RootPuttySessionsNodeInfo> RootPuttySessionsNodes { get; } = new List<RootPuttySessionsNodeInfo>();
@@ -134,10 +131,7 @@ namespace mRemoteNG.Config.Putty
public class SessionList : StringConverter
{
public static string[] Names
{
get { return Instance.GetSessionNames(); }
}
public static string[] Names => Instance.GetSessionNames();
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{

View File

@@ -616,8 +616,8 @@ namespace mRemoteNG.Connection
AttributeUsedInProtocol(ProtocolType.RDP)]
public bool RedirectClipboard
{
get { return GetPropertyValue("RedirectClipboard", _redirectClipboard); }
set { SetField(ref _redirectClipboard, value, "RedirectClipboard"); }
get => GetPropertyValue("RedirectClipboard", _redirectClipboard);
set => SetField(ref _redirectClipboard, value, "RedirectClipboard");
}

View File

@@ -21,10 +21,7 @@ namespace mRemoteNG.Connection.Protocol
}
}
public new int Count
{
get { return List.Count; }
}
public new int Count => List.Count;
public void Add(ProtocolBase cProt)

View File

@@ -34,10 +34,7 @@ namespace mRemoteNG.Connection.Protocol
public static string PuttyPath { get; set; }
public bool Focused
{
get { return NativeMethods.GetForegroundWindow() == PuttyHandle; }
}
public bool Focused => NativeMethods.GetForegroundWindow() == PuttyHandle;
#endregion

View File

@@ -43,19 +43,13 @@ namespace mRemoteNG.Connection.Protocol.RDP
public virtual bool SmartSize
{
get => _rdpClient.AdvancedSettings2.SmartSizing;
protected set
{
_rdpClient.AdvancedSettings2.SmartSizing = value;
}
protected set => _rdpClient.AdvancedSettings2.SmartSizing = value;
}
public virtual bool Fullscreen
{
get => _rdpClient.FullScreen;
protected set
{
_rdpClient.FullScreen = value;
}
protected set => _rdpClient.FullScreen = value;
}
private bool RedirectKeys

View File

@@ -18,13 +18,13 @@ namespace mRemoteNG.Connection.Protocol.VNC
public bool SmartSize
{
get { return _vnc.Scaled; }
set { _vnc.Scaled = value; }
get => _vnc.Scaled;
set => _vnc.Scaled = value;
}
public bool ViewOnly
{
get { return _vnc.ViewOnly; }
get => _vnc.ViewOnly;
set => _vnc.ViewOnly = value;
}

View File

@@ -26,7 +26,7 @@ namespace mRemoteNG.Container
[Browsable(false)]
public override bool IsContainer
{
get { return true; }
get => true;
set { }
}

View File

@@ -16,7 +16,7 @@ namespace mRemoteNG.Credential
public string Title
{
get { return _title; }
get => _title;
set
{
_title = value;
@@ -26,7 +26,7 @@ namespace mRemoteNG.Credential
public string Username
{
get { return _username; }
get => _username;
set
{
_username = value;
@@ -36,7 +36,7 @@ namespace mRemoteNG.Credential
public SecureString Password
{
get { return _password; }
get => _password;
set
{
_password = value;
@@ -46,7 +46,7 @@ namespace mRemoteNG.Credential
public string Domain
{
get { return _domain; }
get => _domain;
set
{
_domain = value;

View File

@@ -16,7 +16,7 @@ namespace mRemoteNG.Credential.Repositories
public string Title
{
get { return _title; }
get => _title;
set
{
_title = value;
@@ -26,7 +26,7 @@ namespace mRemoteNG.Credential.Repositories
public string TypeName
{
get { return _typeName; }
get => _typeName;
set
{
_typeName = value;
@@ -36,7 +36,7 @@ namespace mRemoteNG.Credential.Repositories
public string Source
{
get { return _source; }
get => _source;
set
{
_source = value;
@@ -46,7 +46,7 @@ namespace mRemoteNG.Credential.Repositories
public SecureString Key
{
get { return _key; }
get => _key;
set
{
_key = value;
@@ -56,7 +56,7 @@ namespace mRemoteNG.Credential.Repositories
public bool Loaded
{
get { return _loaded; }
get => _loaded;
set
{
_loaded = value;

View File

@@ -6,26 +6,26 @@ namespace mRemoteNG.Messages.MessageFilteringOptions
{
public bool AllowDebugMessages
{
get { return Settings.Default.TextLogMessageWriterWriteDebugMsgs; }
set { Settings.Default.TextLogMessageWriterWriteDebugMsgs = value; }
get => Settings.Default.TextLogMessageWriterWriteDebugMsgs;
set => Settings.Default.TextLogMessageWriterWriteDebugMsgs = value;
}
public bool AllowInfoMessages
{
get { return Settings.Default.TextLogMessageWriterWriteInfoMsgs; }
set { Settings.Default.TextLogMessageWriterWriteInfoMsgs = value; }
get => Settings.Default.TextLogMessageWriterWriteInfoMsgs;
set => Settings.Default.TextLogMessageWriterWriteInfoMsgs = value;
}
public bool AllowWarningMessages
{
get { return Settings.Default.TextLogMessageWriterWriteWarningMsgs; }
set { Settings.Default.TextLogMessageWriterWriteWarningMsgs = value; }
get => Settings.Default.TextLogMessageWriterWriteWarningMsgs;
set => Settings.Default.TextLogMessageWriterWriteWarningMsgs = value;
}
public bool AllowErrorMessages
{
get { return Settings.Default.TextLogMessageWriterWriteErrorMsgs; }
set { Settings.Default.TextLogMessageWriterWriteErrorMsgs = value; }
get => Settings.Default.TextLogMessageWriterWriteErrorMsgs;
set => Settings.Default.TextLogMessageWriterWriteErrorMsgs = value;
}
}
}

View File

@@ -6,26 +6,26 @@ namespace mRemoteNG.Messages.MessageFilteringOptions
{
public bool AllowDebugMessages
{
get { return Settings.Default.NotificationPanelWriterWriteDebugMsgs; }
set { Settings.Default.NotificationPanelWriterWriteDebugMsgs = value; }
get => Settings.Default.NotificationPanelWriterWriteDebugMsgs;
set => Settings.Default.NotificationPanelWriterWriteDebugMsgs = value;
}
public bool AllowInfoMessages
{
get { return Settings.Default.NotificationPanelWriterWriteInfoMsgs; }
set { Settings.Default.NotificationPanelWriterWriteInfoMsgs = value; }
get => Settings.Default.NotificationPanelWriterWriteInfoMsgs;
set => Settings.Default.NotificationPanelWriterWriteInfoMsgs = value;
}
public bool AllowWarningMessages
{
get { return Settings.Default.NotificationPanelWriterWriteWarningMsgs; }
set { Settings.Default.NotificationPanelWriterWriteWarningMsgs = value; }
get => Settings.Default.NotificationPanelWriterWriteWarningMsgs;
set => Settings.Default.NotificationPanelWriterWriteWarningMsgs = value;
}
public bool AllowErrorMessages
{
get { return Settings.Default.NotificationPanelWriterWriteErrorMsgs; }
set { Settings.Default.NotificationPanelWriterWriteErrorMsgs = value; }
get => Settings.Default.NotificationPanelWriterWriteErrorMsgs;
set => Settings.Default.NotificationPanelWriterWriteErrorMsgs = value;
}
}
}

View File

@@ -6,26 +6,26 @@ namespace mRemoteNG.Messages.MessageFilteringOptions
{
public bool AllowDebugMessages
{
get { return false; }
get => false;
set { }
}
public bool AllowInfoMessages
{
get { return Settings.Default.SwitchToMCOnInformation; }
set { Settings.Default.SwitchToMCOnInformation = value; }
get => Settings.Default.SwitchToMCOnInformation;
set => Settings.Default.SwitchToMCOnInformation = value;
}
public bool AllowWarningMessages
{
get { return Settings.Default.SwitchToMCOnWarning; }
set { Settings.Default.SwitchToMCOnWarning = value; }
get => Settings.Default.SwitchToMCOnWarning;
set => Settings.Default.SwitchToMCOnWarning = value;
}
public bool AllowErrorMessages
{
get { return Settings.Default.SwitchToMCOnError; }
set { Settings.Default.SwitchToMCOnError = value; }
get => Settings.Default.SwitchToMCOnError;
set => Settings.Default.SwitchToMCOnError = value;
}
}
}

View File

@@ -6,26 +6,26 @@ namespace mRemoteNG.Messages.MessageFilteringOptions
{
public bool AllowDebugMessages
{
get { return Settings.Default.PopupMessageWriterWriteDebugMsgs; }
set { Settings.Default.PopupMessageWriterWriteDebugMsgs = value; }
get => Settings.Default.PopupMessageWriterWriteDebugMsgs;
set => Settings.Default.PopupMessageWriterWriteDebugMsgs = value;
}
public bool AllowInfoMessages
{
get { return Settings.Default.PopupMessageWriterWriteInfoMsgs; }
set { Settings.Default.PopupMessageWriterWriteInfoMsgs = value; }
get => Settings.Default.PopupMessageWriterWriteInfoMsgs;
set => Settings.Default.PopupMessageWriterWriteInfoMsgs = value;
}
public bool AllowWarningMessages
{
get { return Settings.Default.PopupMessageWriterWriteWarningMsgs; }
set { Settings.Default.PopupMessageWriterWriteWarningMsgs = value; }
get => Settings.Default.PopupMessageWriterWriteWarningMsgs;
set => Settings.Default.PopupMessageWriterWriteWarningMsgs = value;
}
public bool AllowErrorMessages
{
get { return Settings.Default.PopupMessageWriterWriteErrorMsgs; }
set { Settings.Default.PopupMessageWriterWriteErrorMsgs = value; }
get => Settings.Default.PopupMessageWriterWriteErrorMsgs;
set => Settings.Default.PopupMessageWriterWriteErrorMsgs = value;
}
}
}

View File

@@ -23,10 +23,7 @@ namespace mRemoteNG.Tools.Cmdline
private readonly 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(IEnumerable<string> args)
{

View File

@@ -17,8 +17,8 @@ namespace mRemoteNG.Tools.CustomCollections
public T this[int index]
{
get { return _list[index]; }
set { _list[index] = value; }
get => _list[index];
set => _list[index] = value;
}
public FullyObservableCollection()

View File

@@ -31,19 +31,19 @@ namespace mRemoteNG.Tools
public string DisplayName
{
get { return _displayName; }
set { SetField(ref _displayName, value, nameof(DisplayName)); }
get => _displayName;
set => SetField(ref _displayName, value, nameof(DisplayName));
}
public string FileName
{
get { return _fileName; }
set { SetField(ref _fileName, value, nameof(FileName)); }
get => _fileName;
set => SetField(ref _fileName, value, nameof(FileName));
}
public bool WaitForExit
{
get { return _waitForExit; }
get => _waitForExit;
set
{
// WaitForExit cannot be turned on when TryIntegrate is true
@@ -55,19 +55,19 @@ namespace mRemoteNG.Tools
public string Arguments
{
get { return _arguments; }
set { SetField(ref _arguments, value, nameof(Arguments)); }
get => _arguments;
set => SetField(ref _arguments, value, nameof(Arguments));
}
public string WorkingDir
{
get { return _workingDir; }
set { SetField(ref _workingDir, value, nameof(WorkingDir)); }
get => _workingDir;
set => SetField(ref _workingDir, value, nameof(WorkingDir));
}
public bool TryIntegrate
{
get { return _tryIntegrate; }
get => _tryIntegrate;
set
{
// WaitForExit cannot be turned on when TryIntegrate is true
@@ -79,27 +79,21 @@ namespace mRemoteNG.Tools
public bool ShowOnToolbar
{
get { return _showOnToolbar; }
set { SetField(ref _showOnToolbar, value, nameof(ShowOnToolbar)); }
get => _showOnToolbar;
set => SetField(ref _showOnToolbar, value, nameof(ShowOnToolbar));
}
public bool RunElevated
{
get { return _runElevated; }
set { SetField(ref _runElevated, value, nameof(RunElevated)); }
get => _runElevated;
set => SetField(ref _runElevated, value, nameof(RunElevated));
}
public ConnectionInfo ConnectionInfo { get; set; }
public Icon Icon
{
get { return File.Exists(FileName) ? MiscTools.GetIconFromFile(FileName) : Properties.Resources.mRemoteNG_Icon; }
}
public Icon Icon => File.Exists(FileName) ? MiscTools.GetIconFromFile(FileName) : Properties.Resources.mRemoteNG_Icon;
public Image Image
{
get { return Icon?.ToBitmap() ?? Properties.Resources.mRemoteNG_Icon.ToBitmap(); }
}
public Image Image => Icon?.ToBitmap() ?? Properties.Resources.mRemoteNG_Icon.ToBitmap();
#endregion

View File

@@ -103,25 +103,16 @@ namespace mRemoteNG.Tools
return serviceType == typeof(IMenuCommandService) ? this : null;
}
public IComponent Component
{
get { throw new NotSupportedException(); }
}
public IComponent Component => throw new NotSupportedException();
public IContainer Container
{
get { return null; }
}
public IContainer Container => null;
public bool DesignMode
{
get { return true; }
}
public bool DesignMode => 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)

View File

@@ -87,40 +87,19 @@ namespace mRemoteNG.Tools
}
}
public string RdpName
{
get { return BoolToYesNo(Rdp); }
}
public string RdpName => BoolToYesNo(Rdp);
public string VncName
{
get { return BoolToYesNo(Vnc); }
}
public string VncName => BoolToYesNo(Vnc);
public string SshName
{
get { return BoolToYesNo(Rdp); }
}
public string SshName => BoolToYesNo(Rdp);
public string TelnetName
{
get { return BoolToYesNo(Telnet); }
}
public string TelnetName => BoolToYesNo(Telnet);
public string RloginName
{
get { return BoolToYesNo(Rlogin); }
}
public string RloginName => BoolToYesNo(Rlogin);
public string HttpName
{
get { return BoolToYesNo(Http); }
}
public string HttpName => BoolToYesNo(Http);
public string HttpsName
{
get { return BoolToYesNo(Https); }
}
public string HttpsName => BoolToYesNo(Https);
public string OpenPortsName
{

View File

@@ -90,10 +90,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

View File

@@ -20,8 +20,8 @@ namespace mRemoteNG.Tools
public Form Form
{
get { return _form; }
set { _form = value; }
get => _form;
set => _form = value;
}
public bool RestoreToMaximized

View File

@@ -24,12 +24,9 @@ namespace mRemoteNG.Tree.Root
[LocalizedAttributes.LocalizedDefaultValue("strPuttySavedSessionsRootName")]
public override string Name
{
get { return _name; }
set
{
_name = value;
//Settings.Default.PuttySavedSessionsName = value;
}
get => _name;
set => _name = value;
//Settings.Default.PuttySavedSessionsName = value;
}
[LocalizedAttributes.LocalizedCategory(nameof(Language.Display)),
@@ -37,7 +34,7 @@ namespace mRemoteNG.Tree.Root
LocalizedAttributes.LocalizedDescription(nameof(Language.PropertyDescriptionPanel))]
public override string Panel
{
get { return _panel; }
get => _panel;
set
{
_panel = value;

View File

@@ -16,7 +16,7 @@ namespace mRemoteNG.UI.Controls
public ICredentialRepositoryList CredentialRepositoryList
{
get { return _credentialRepositoryList; }
get => _credentialRepositoryList;
set
{
_credentialRepositoryList.RepositoriesUpdated -= CredentialRepositoryListOnRepositoriesUpdated;

View File

@@ -15,7 +15,7 @@ namespace mRemoteNG.UI.Controls
public ICredentialRepositoryList CredentialRepositoryList
{
get { return _credentialRepositoryList; }
get => _credentialRepositoryList;
set
{
_credentialRepositoryList.RepositoriesUpdated -= OnRepositoriesUpdated;

View File

@@ -20,7 +20,7 @@ namespace mRemoteNG.UI.Controls
[Browsable(true)]
public char PasswordChar
{
get { return _passwordChar; }
get => _passwordChar;
set
{
_passwordChar = value;
@@ -32,7 +32,7 @@ namespace mRemoteNG.UI.Controls
[Browsable(true)]
public bool UseSystemPasswordChar
{
get { return _useSystemPasswordChar; }
get => _useSystemPasswordChar;
set
{
_useSystemPasswordChar = value;

View File

@@ -199,14 +199,8 @@ namespace mRemoteNG.UI.Controls
public event ConnectRequestedEventHandler ConnectRequested
{
add
{
ConnectRequestedEvent = (ConnectRequestedEventHandler)Delegate.Combine(ConnectRequestedEvent, value);
}
remove
{
ConnectRequestedEvent = (ConnectRequestedEventHandler)Delegate.Remove(ConnectRequestedEvent, value);
}
add => ConnectRequestedEvent = (ConnectRequestedEventHandler)Delegate.Combine(ConnectRequestedEvent, value);
remove => ConnectRequestedEvent = (ConnectRequestedEventHandler)Delegate.Remove(ConnectRequestedEvent, value);
}
@@ -232,8 +226,8 @@ namespace mRemoteNG.UI.Controls
public event ProtocolChangedEventHandler ProtocolChanged
{
add { ProtocolChangedEvent = (ProtocolChangedEventHandler)Delegate.Combine(ProtocolChangedEvent, value); }
remove { ProtocolChangedEvent = (ProtocolChangedEventHandler)Delegate.Remove(ProtocolChangedEvent, value); }
add => ProtocolChangedEvent = (ProtocolChangedEventHandler)Delegate.Combine(ProtocolChangedEvent, value);
remove => ProtocolChangedEvent = (ProtocolChangedEventHandler)Delegate.Remove(ProtocolChangedEvent, value);
}

View File

@@ -7,7 +7,7 @@ namespace mRemoteNG.UI.Controls
{
public new ToolStripDropDown DropDown
{
get { return base.DropDown; }
get => base.DropDown;
set
{
if (base.DropDown != value)

View File

@@ -40,7 +40,7 @@ namespace mRemoteNG.UI.TaskDialog
// Override this to make sure the control is invalidated (repainted) when 'Text' is changed
public override string Text
{
get { return base.Text; }
get => base.Text;
set
{
base.Text = value;
@@ -61,7 +61,7 @@ namespace mRemoteNG.UI.TaskDialog
[DefaultValue(true)]
public bool AutoHeight
{
get { return m_autoHeight; }
get => m_autoHeight;
set
{
m_autoHeight = value;

View File

@@ -110,13 +110,7 @@ namespace mRemoteNGTests
/// </remarks>
/// <value>The ControlTester at the specified index.</value>
/// <param name="index">The index of the ListViewTester.</param>
public new ListViewTester this[int index]
{
get
{
return new ListViewTester(this, index);
}
}
public new ListViewTester this[int index] => new ListViewTester(this, index);
/// <summary>
/// Provides access to all of the Properties of the ListBox.
@@ -125,35 +119,17 @@ namespace mRemoteNGTests
/// Allows typed access to all of the properties of the underlying control.
/// </remarks>
/// <value>The underlying control.</value>
public ListView Properties
{
get
{
return (ListView)Control;
}
}
public ListView Properties => (ListView)Control;
/// <summary>
/// Helper method to return the List View's Items property
/// </summary>
public ListView.ListViewItemCollection Items
{
get
{
return Properties.Items;
}
}
public ListView.ListViewItemCollection Items => Properties.Items;
/// <summary>
/// Helper method to return the columns of the list view
/// </summary>
public ListView.ColumnHeaderCollection Columns
{
get
{
return Properties.Columns;
}
}
public ListView.ColumnHeaderCollection Columns => Properties.Columns;
/// <summary>
/// Clears the selections from the list box.