From 35b6e2bf35ea648b01486d40f030eeec01f1b5fd Mon Sep 17 00:00:00 2001 From: David Sparer Date: Wed, 17 Aug 2016 09:02:43 -0600 Subject: [PATCH] minor cleanup of PuttySessionInfo --- mRemoteV1/Connection/PuttySessionInfo.cs | 129 ++++++++++++----------- 1 file changed, 65 insertions(+), 64 deletions(-) diff --git a/mRemoteV1/Connection/PuttySessionInfo.cs b/mRemoteV1/Connection/PuttySessionInfo.cs index 7d54557af..4e9c15331 100644 --- a/mRemoteV1/Connection/PuttySessionInfo.cs +++ b/mRemoteV1/Connection/PuttySessionInfo.cs @@ -1,21 +1,77 @@ using mRemoteNG.App; using mRemoteNG.Messages; -using mRemoteNG.My; using mRemoteNG.Tools; using System; using System.ComponentModel; +using mRemoteNG.Connection.Protocol; +using mRemoteNG.Root.PuttySessions; namespace mRemoteNG.Connection { public class PuttySessionInfo : ConnectionInfo, IComponent { - [Command(),LocalizedAttributes.LocalizedDisplayName("strPuttySessionSettings")] + #region Properties + [Browsable(false)] + public PuttySessionsNodeInfo RootPuttySessionsInfo { get; set; } + + [ReadOnly(true)] + public override string PuttySession { get; set; } + + [ReadOnly(true)] + public override string Name { get; set; } + + [ReadOnly(true), Browsable(false)] + public override string Description { get; set; } + + [ReadOnly(true), Browsable(false)] + public override string Icon + { + get { return "PuTTY"; } + set { } + } + + [ReadOnly(true), Browsable(false)] + public override string Panel + { + get { return RootPuttySessionsInfo.Panel; } + set { } + } + + [ReadOnly(true)] + public override string Hostname { get; set; } + + [ReadOnly(true)] + public override string Username { get; set; } + + [ReadOnly(true), Browsable(false)] + public override string Password { get; set; } + + [ReadOnly(true)] + public override ProtocolType Protocol { get; set; } + + [ReadOnly(true)] + public override int Port { get; set; } + + [ReadOnly(true), Browsable(false)] + public override string PreExtApp { get; set; } + + [ReadOnly(true), Browsable(false)] + public override string PostExtApp { get; set; } + + [ReadOnly(true), Browsable(false)] + public override string MacAddress { get; set; } + + [ReadOnly(true), Browsable(false)] + public override string UserField { get; set; } + #endregion + + [Command(),LocalizedAttributes.LocalizedDisplayName("strPuttySessionSettings")] public void SessionSettings() { try { - PuttyProcessController puttyProcess = new PuttyProcessController(); + var puttyProcess = new PuttyProcessController(); if (!puttyProcess.Start()) { return ; @@ -30,65 +86,11 @@ namespace mRemoteNG.Connection } catch (Exception ex) { - Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strErrorCouldNotLaunchPutty + Environment.NewLine + ex.Message, false); + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strErrorCouldNotLaunchPutty + Environment.NewLine + ex.Message); } } - - #region Properties - [Browsable(false)] - public Root.PuttySessions.PuttySessionsNodeInfo RootPuttySessionsInfo { get; set; } - - [ReadOnly(true)] - public override string PuttySession { get; set; } - - [ReadOnly(true)] - public override string Name { get; set; } - - [ReadOnly(true), Browsable(false)] - public override string Description { get; set; } - - [ReadOnly(true), Browsable(false)] - public override string Icon - { - get { return "PuTTY"; } - set { } - } - - [ReadOnly(true), Browsable(false)] - public override string Panel - { - get { return RootPuttySessionsInfo.Panel; } - set { } - } - - [ReadOnly(true)] - public override string Hostname { get; set; } - - [ReadOnly(true)] - public override string Username { get; set; } - - [ReadOnly(true), Browsable(false)] - public override string Password { get; set; } - - [ReadOnly(true)] - public override Protocol.ProtocolType Protocol { get; set; } - - [ReadOnly(true)] - public override int Port { get; set; } - - [ReadOnly(true), Browsable(false)] - public override string PreExtApp { get; set; } - - [ReadOnly(true), Browsable(false)] - public override string PostExtApp { get; set; } - - [ReadOnly(true), Browsable(false)] - public override string MacAddress { get; set; } - - [ReadOnly(true), Browsable(false)] - public override string UserField { get; set; } - #endregion - + + #region IComponent [Browsable(false)] public ISite Site @@ -99,11 +101,10 @@ namespace mRemoteNG.Connection public void Dispose() { - if (Disposed != null) - Disposed(this, EventArgs.Empty); + Disposed?.Invoke(this, EventArgs.Empty); } - - public event EventHandler Disposed; + + public event EventHandler Disposed; #endregion } } \ No newline at end of file