more fix for Warning CA1416

This commit is contained in:
Dimitrij
2023-03-11 12:20:19 +00:00
parent 40af584afe
commit 05b418e9b6
87 changed files with 402 additions and 319 deletions

View File

@@ -1,7 +1,9 @@
using System;
using System.Runtime.Versioning;
namespace mRemoteNG.App.Info
{
[SupportedOSPlatform("windows")]
public static class ConnectionsFileInfo
{
public static readonly string DefaultConnectionsPath = SettingsFileInfo.SettingsPath;

View File

@@ -1,9 +1,11 @@
using System;
using System.Data.SqlClient;
using System.Runtime.Versioning;
using System.Threading.Tasks;
namespace mRemoteNG.Config.DatabaseConnectors
{
[SupportedOSPlatform("windows")]
/// <summary>
/// A helper class for testing database connectivity
/// </summary>

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Versioning;
using mRemoteNG.Config.Serializers.MiscSerializers;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Container;
@@ -8,6 +9,7 @@ using mRemoteNG.Tools;
namespace mRemoteNG.Config.Import
{
[SupportedOSPlatform("windows")]
public class PortScanImporter : IConnectionImporter<IEnumerable<ScanHost>>
{
private readonly ProtocolType _targetProtocolType;

View File

@@ -4,11 +4,13 @@ using System.Linq;
using mRemoteNG.Connection;
using mRemoteNG.Tree.Root;
using System.Net;
using System.Runtime.Versioning;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.Putty
{
[SupportedOSPlatform("windows")]
public abstract class AbstractPuttySessionsProvider
{
public virtual RootPuttySessionsNodeInfo RootInfo { get; } = new RootPuttySessionsNodeInfo();
@@ -60,20 +62,14 @@ namespace mRemoteNG.Config.Putty
if (string.IsNullOrEmpty(sessionInfo?.Name) || Sessions.Any(child => child.Name == sessionInfo.Name))
return;
RootInfo.AddChild(sessionInfo);
RaisePuttySessionCollectionChangedEvent(
new
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add,
sessionInfo));
RaisePuttySessionCollectionChangedEvent(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, sessionInfo));
}
protected virtual void RemoveSession(PuttySessionInfo sessionInfo)
{
if (!Sessions.Contains(sessionInfo)) return;
RootInfo.RemoveChild(sessionInfo);
RaisePuttySessionCollectionChangedEvent(
new
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove,
sessionInfo));
RaisePuttySessionCollectionChangedEvent(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, sessionInfo));
}
public virtual void StartWatcher()

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.Http;
@@ -12,6 +13,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Csv
{
[SupportedOSPlatform("windows")]
public class CsvConnectionsDeserializerMremotengFormat : IDeserializer<string, ConnectionTreeModel>
{
public ConnectionTreeModel Deserialize(string serializedData)

View File

@@ -1,5 +1,6 @@
using System;
using System.Linq;
using System.Runtime.Versioning;
using System.Text;
using mRemoteNG.Connection;
using mRemoteNG.Container;
@@ -11,6 +12,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Csv
{
[SupportedOSPlatform("windows")]
public class CsvConnectionsSerializerMremotengFormat : ISerializer<ConnectionInfo, string>
{
private readonly SaveFilter _saveFilter;

View File

@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Container;
@@ -10,217 +11,219 @@ using mRemoteNG.Tree;
#endregion
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Csv.RemoteDesktopManager;
/// <summary>
/// Import of connections from the Remote Desktop Manager (RDM) in a CSV file format
/// </summary>
public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer<string, ConnectionTreeModel>
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Csv.RemoteDesktopManager
{
private readonly List<RemoteDesktopManagerConnectionInfo> _connectionTypes;
private readonly HashSet<string> _groups;
public CsvConnectionsDeserializerRdmFormat()
[SupportedOSPlatform("windows")]
/// <summary>
/// Import of connections from the Remote Desktop Manager (RDM) in a CSV file format
/// </summary>
public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer<string, ConnectionTreeModel>
{
_connectionTypes = new List<RemoteDesktopManagerConnectionInfo>
private readonly List<RemoteDesktopManagerConnectionInfo> _connectionTypes;
private readonly HashSet<string> _groups;
public CsvConnectionsDeserializerRdmFormat()
{
_connectionTypes = new List<RemoteDesktopManagerConnectionInfo>
{
new(ProtocolType.RDP, "RDP (Microsoft Remote Desktop)", 3389, "Remote Desktop"),
new(ProtocolType.SSH2, "SSH Shell", 22, "SSH")
};
_groups = new HashSet<string>();
_groups = new HashSet<string>();
Containers = new List<ContainerInfo>();
}
private List<ContainerInfo> Containers { get; }
/// <summary>
/// Deserializes the CSV file into a <see cref="ConnectionTreeModel" />
/// </summary>
/// <param name="serializedData">Data from the CSV file</param>
/// <returns></returns>
public ConnectionTreeModel Deserialize(string serializedData)
{
var lines = serializedData.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
var csvHeaders = new List<string>();
var connections = new List<(ConnectionInfo, string)>(); // (ConnectionInfo, group)
for (var lineNumber = 0; lineNumber < lines.Length; lineNumber++)
{
var line = lines[lineNumber].Split(',');
if (lineNumber == 0)
{
csvHeaders = line.ToList();
}
else
{
var (connectionInfo, group) = ParseConnectionInfo(csvHeaders, line);
if (connectionInfo == default) continue;
connections.Add((connectionInfo, group));
}
Containers = new List<ContainerInfo>();
}
var connectionTreeModel = new ConnectionTreeModel();
var unsortedConnections = new ContainerInfo { Name = "Unsorted" };
private List<ContainerInfo> Containers { get; }
foreach (var containerInfo in Containers) connectionTreeModel.AddRootNode(containerInfo);
var allChildren = Containers.SelectMany(x => x.GetRecursiveChildList().Select(y => (ContainerInfo)y)).ToList();
foreach (var (connection, path) in connections)
if (string.IsNullOrEmpty(path))
{
unsortedConnections.AddChild(connection);
}
else
{
var container = allChildren.FirstOrDefault(x => x.ConstantID == path);
if (container == default) continue;
container.AddChild(connection);
}
if (unsortedConnections.HasChildren())
connectionTreeModel.AddRootNode(unsortedConnections);
return connectionTreeModel;
}
/// <summary>
/// Parses a line from the CSV file and returns <see cref="ConnectionInfo" />
/// </summary>
/// <param name="headers">CSV Headers</param>
/// <param name="connectionCsv">CSV Columns</param>
/// <returns></returns>
private (ConnectionInfo connectionInfo, string) ParseConnectionInfo(IList<string> headers, IReadOnlyList<string> connectionCsv)
{
if (headers.Count != connectionCsv.Count) return default;
var hostString = connectionCsv[headers.IndexOf("Host")].Trim();
if (string.IsNullOrEmpty(hostString)) return default;
var hostType = Uri.CheckHostName(hostString);
if (hostType == UriHostNameType.Unknown) return default;
var connectionTypeString = connectionCsv[headers.IndexOf("ConnectionType")];
if (string.IsNullOrEmpty(connectionTypeString)) return default;
var connectionType = _connectionTypes.FirstOrDefault(x => x.Name == connectionTypeString);
if (connectionType == default) return default;
var portString = connectionCsv[headers.IndexOf("Port")] ?? connectionType.Port.ToString();
if (!int.TryParse(portString, out var port)) port = connectionType.Port;
var name = connectionCsv[headers.IndexOf("Name")];
var description = connectionCsv[headers.IndexOf("Description")];
var group = connectionCsv[headers.IndexOf("Group")];
var username = connectionCsv[headers.IndexOf("CredentialUserName")];
var domain = connectionCsv[headers.IndexOf("CredentialDomain")];
var password = connectionCsv[headers.IndexOf("CredentialPassword")];
var connectionInfo = new ConnectionInfo(Guid.NewGuid().ToString())
/// <summary>
/// Deserializes the CSV file into a <see cref="ConnectionTreeModel" />
/// </summary>
/// <param name="serializedData">Data from the CSV file</param>
/// <returns></returns>
public ConnectionTreeModel Deserialize(string serializedData)
{
Name = name,
Hostname = hostString,
Port = port,
Username = username,
Password = password,
Domain = domain,
Icon = connectionType.IconName ?? "mRemoteNG",
Description = description,
Protocol = connectionType.Protocol
};
var lines = serializedData.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
var csvHeaders = new List<string>();
if (!string.IsNullOrEmpty(group))
if (group.Contains('\\'))
var connections = new List<(ConnectionInfo, string)>(); // (ConnectionInfo, group)
for (var lineNumber = 0; lineNumber < lines.Length; lineNumber++)
{
var groupParts = group.Split('\\').ToList();
var parentContainerName = groupParts[0];
var parentContainer = Containers.FirstOrDefault(x => x.Name == parentContainerName);
if (parentContainer == default)
var line = lines[lineNumber].Split(',');
if (lineNumber == 0)
{
parentContainer = new ContainerInfo(group) { Name = parentContainerName };
Containers.Add(parentContainer);
csvHeaders = line.ToList();
}
else
{
var (connectionInfo, group) = ParseConnectionInfo(csvHeaders, line);
if (connectionInfo == default) continue;
connections.Add((connectionInfo, group));
}
}
var connectionTreeModel = new ConnectionTreeModel();
var unsortedConnections = new ContainerInfo { Name = "Unsorted" };
foreach (var containerInfo in Containers) connectionTreeModel.AddRootNode(containerInfo);
var allChildren = Containers.SelectMany(x => x.GetRecursiveChildList().Select(y => (ContainerInfo)y)).ToList();
foreach (var (connection, path) in connections)
if (string.IsNullOrEmpty(path))
{
unsortedConnections.AddChild(connection);
}
else
{
var container = allChildren.FirstOrDefault(x => x.ConstantID == path);
if (container == default) continue;
container.AddChild(connection);
}
groupParts.RemoveAt(0);
if (unsortedConnections.HasChildren())
connectionTreeModel.AddRootNode(unsortedConnections);
AddChildrenRecursive(group, groupParts, parentContainer);
}
return connectionTreeModel;
}
return string.IsNullOrEmpty(group) ? (connectionInfo, default) : (connectionInfo, group);
}
/// <summary>
/// Adds a child to a container recursively
/// </summary>
/// <param name="group">Full path of the RDM Grouping</param>
/// <param name="groupParts">Segements of the group path</param>
/// <param name="parentContainer">Parent container to add children to</param>
private void AddChildrenRecursive(string group, IList<string> groupParts, ContainerInfo parentContainer)
{
if (_groups.Contains(group)) return;
var groupCount = groupParts.Count;
while (groupCount > 0)
/// <summary>
/// Parses a line from the CSV file and returns <see cref="ConnectionInfo" />
/// </summary>
/// <param name="headers">CSV Headers</param>
/// <param name="connectionCsv">CSV Columns</param>
/// <returns></returns>
private (ConnectionInfo connectionInfo, string) ParseConnectionInfo(IList<string> headers, IReadOnlyList<string> connectionCsv)
{
var childName = groupParts[0];
var newContainer = new ContainerInfo(group) { Name = childName };
if (headers.Count != connectionCsv.Count) return default;
var childrenNames = parentContainer.GetRecursiveChildList().Select(x => x.Name).ToList();
if (!childrenNames.Any())
{
groupCount = AddChild(parentContainer, newContainer, groupCount);
_groups.Add(group);
continue;
}
var hostString = connectionCsv[headers.IndexOf("Host")].Trim();
if (string.IsNullOrEmpty(hostString)) return default;
if (groupParts.Count > 1)
var hostType = Uri.CheckHostName(hostString);
if (hostType == UriHostNameType.Unknown) return default;
var connectionTypeString = connectionCsv[headers.IndexOf("ConnectionType")];
if (string.IsNullOrEmpty(connectionTypeString)) return default;
var connectionType = _connectionTypes.FirstOrDefault(x => x.Name == connectionTypeString);
if (connectionType == default) return default;
var portString = connectionCsv[headers.IndexOf("Port")] ?? connectionType.Port.ToString();
if (!int.TryParse(portString, out var port)) port = connectionType.Port;
var name = connectionCsv[headers.IndexOf("Name")];
var description = connectionCsv[headers.IndexOf("Description")];
var group = connectionCsv[headers.IndexOf("Group")];
var username = connectionCsv[headers.IndexOf("CredentialUserName")];
var domain = connectionCsv[headers.IndexOf("CredentialDomain")];
var password = connectionCsv[headers.IndexOf("CredentialPassword")];
var connectionInfo = new ConnectionInfo(Guid.NewGuid().ToString())
{
var childContainer = (ContainerInfo)parentContainer.Children.FirstOrDefault(x => x.Name == childName);
if (childContainer == default)
Name = name,
Hostname = hostString,
Port = port,
Username = username,
Password = password,
Domain = domain,
Icon = connectionType.IconName ?? "mRemoteNG",
Description = description,
Protocol = connectionType.Protocol
};
if (!string.IsNullOrEmpty(group))
if (group.Contains('\\'))
{
var groupParts = group.Split('\\').ToList();
var parentContainerName = groupParts[0];
var parentContainer = Containers.FirstOrDefault(x => x.Name == parentContainerName);
if (parentContainer == default)
{
parentContainer = new ContainerInfo(group) { Name = parentContainerName };
Containers.Add(parentContainer);
}
groupParts.RemoveAt(0);
AddChildrenRecursive(group, groupParts, parentContainer);
}
return string.IsNullOrEmpty(group) ? (connectionInfo, default) : (connectionInfo, group);
}
/// <summary>
/// Adds a child to a container recursively
/// </summary>
/// <param name="group">Full path of the RDM Grouping</param>
/// <param name="groupParts">Segements of the group path</param>
/// <param name="parentContainer">Parent container to add children to</param>
private void AddChildrenRecursive(string group, IList<string> groupParts, ContainerInfo parentContainer)
{
if (_groups.Contains(group)) return;
var groupCount = groupParts.Count;
while (groupCount > 0)
{
var childName = groupParts[0];
var newContainer = new ContainerInfo(group) { Name = childName };
var childrenNames = parentContainer.GetRecursiveChildList().Select(x => x.Name).ToList();
if (!childrenNames.Any())
{
groupCount = AddChild(parentContainer, newContainer, groupCount);
_groups.Add(group);
continue;
}
AddChildrenRecursive(group, groupParts.Skip(1).ToList(), childContainer);
}
else
{
parentContainer.AddChild(newContainer);
_groups.Add(group);
}
if (groupParts.Count > 1)
{
var childContainer = (ContainerInfo)parentContainer.Children.FirstOrDefault(x => x.Name == childName);
if (childContainer == default)
{
groupCount = AddChild(parentContainer, newContainer, groupCount);
continue;
}
AddChildrenRecursive(group, groupParts.Skip(1).ToList(), childContainer);
}
else
{
parentContainer.AddChild(newContainer);
_groups.Add(group);
}
groupCount--;
}
}
/// <summary>
/// Adds a child to a container and returns the remaining group count
/// </summary>
/// <param name="parentContainer">Parent container</param>
/// <param name="newContainer">New child container</param>
/// <param name="groupCount">Remaining group count</param>
/// <returns></returns>
private static int AddChild(ContainerInfo parentContainer, ContainerInfo newContainer, int groupCount)
{
parentContainer.AddChild(newContainer);
groupCount--;
return groupCount;
}
}
/// <summary>
/// Adds a child to a container and returns the remaining group count
/// Record of supported connection types
/// </summary>
/// <param name="parentContainer">Parent container</param>
/// <param name="newContainer">New child container</param>
/// <param name="groupCount">Remaining group count</param>
/// <returns></returns>
private static int AddChild(ContainerInfo parentContainer, ContainerInfo newContainer, int groupCount)
{
parentContainer.AddChild(newContainer);
groupCount--;
return groupCount;
}
}
/// <summary>
/// Record of supported connection types
/// </summary>
/// <param name="Protocol">Procotol</param>
/// <param name="Name">Display Name</param>
/// <param name="Port">Default Port</param>
/// <param name="IconName">Icon Name</param>
internal sealed record RemoteDesktopManagerConnectionInfo(ProtocolType Protocol, string Name, int Port, string IconName);
/// <param name="Protocol">Procotol</param>
/// <param name="Name">Display Name</param>
/// <param name="Port">Default Port</param>
/// <param name="IconName">Icon Name</param>
internal sealed record RemoteDesktopManagerConnectionInfo(ProtocolType Protocol, string Name, int Port, string IconName);
}

View File

@@ -1,4 +1,5 @@
using System.Linq;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
using mRemoteNG.Security;
using mRemoteNG.Tree;
@@ -6,6 +7,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
{
[SupportedOSPlatform("windows")]
public class XmlConnectionSerializerFactory
{
public ISerializer<ConnectionInfo, string> Build(

View File

@@ -1,10 +1,12 @@
using System;
using System.Runtime.Versioning;
using System.Xml.Linq;
using mRemoteNG.Security;
using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml
{
[SupportedOSPlatform("windows")]
public class XmlRootNodeSerializer
{
public XElement SerializeRootNodeInfo(RootNodeInfo rootNodeInfo, ICryptographyProvider cryptographyProvider, Version version, bool fullFileEncryption = false)

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Container;
@@ -8,6 +9,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.MiscSerializers
{
[SupportedOSPlatform("windows")]
public class PortScanDeserializer : IDeserializer<IEnumerable<ScanHost>, ConnectionTreeModel>
{
private readonly ProtocolType _targetProtocolType;

View File

@@ -8,9 +8,11 @@ using mRemoteNG.Properties;
using mRemoteNG.Tools;
using mRemoteNG.Tools.Attributes;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.Connection
{
[SupportedOSPlatform("windows")]
public abstract class AbstractConnectionRecord : INotifyPropertyChanged
{
#region Fields

View File

@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Versioning;
namespace mRemoteNG.Connection
{
[SupportedOSPlatform("windows")]
public class ConnectionInfoComparer<TProperty> : IComparer<ConnectionInfo> where TProperty : IComparable<TProperty>
{
private readonly Func<ConnectionInfo, TProperty> _sortExpression;

View File

@@ -5,9 +5,11 @@ using System.Reflection;
using mRemoteNG.Tools;
using mRemoteNG.Tree.Root;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.Connection
{
[SupportedOSPlatform("windows")]
public class ConnectionInfoInheritance
{
private ConnectionInfoInheritance _tempInheritanceStorage;

View File

@@ -1,5 +1,9 @@
using Mysqlx.Notice;
using System.Runtime.Versioning;
namespace mRemoteNG.Connection.Protocol.Http
{
[SupportedOSPlatform("windows")]
public class ProtocolHTTP : HTTPBase
{
public ProtocolHTTP(RenderingEngine RenderingEngine) : base(RenderingEngine)

View File

@@ -1,7 +1,10 @@
using System.Runtime.Versioning;
namespace mRemoteNG.Connection.Protocol.Http
{
public class ProtocolHTTPS : HTTPBase
{
[SupportedOSPlatform("windows")]
public ProtocolHTTPS(RenderingEngine RenderingEngine) : base(RenderingEngine)
{
httpOrS = "https";

View File

@@ -1,5 +1,8 @@
using System.Runtime.Versioning;
namespace mRemoteNG.Connection.Protocol.SSH
{
[SupportedOSPlatform("windows")]
public class ProtocolSSH1 : PuttyBase
{
public ProtocolSSH1()

View File

@@ -6,12 +6,14 @@ using mRemoteNG.App;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Connection.Protocol.VNC
{
[SupportedOSPlatform("windows")]
public class ProtocolVNC : ProtocolBase
{
#region Private Declarations

View File

@@ -3,12 +3,14 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Tree;
namespace mRemoteNG.Container
{
[SupportedOSPlatform("windows")]
[DefaultProperty("Name")]
public class ContainerInfo : ConnectionInfo, INotifyCollectionChanged
{

View File

@@ -1,10 +1,12 @@
using System;
using System.Runtime.Versioning;
using System.Windows.Forms;
using mRemoteNG.UI;
using mRemoteNG.UI.Window;
namespace mRemoteNG.Messages.MessageWriters
{
[SupportedOSPlatform("windows")]
public class NotificationPanelMessageWriter : IMessageWriter
{
private readonly ErrorAndInfoWindow _messageWindow;

View File

@@ -1,8 +1,10 @@
using System;
using System.Runtime.Versioning;
using mRemoteNG.App;
namespace mRemoteNG.Messages.MessageWriters
{
[SupportedOSPlatform("windows")]
public class TextLogMessageWriter : IMessageWriter
{
private readonly Logger _logger;

View File

@@ -1,7 +1,9 @@
using mRemoteNG.Security.SymmetricEncryption;
using System.Runtime.Versioning;
namespace mRemoteNG.Security.Factories
{
[SupportedOSPlatform("windows")]
public class LegacyInsecureCryptoProviderFactory : ICryptoProviderFactory
{
public ICryptographyProvider Build()

View File

@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Text;
@@ -10,6 +11,7 @@ using mRemoteNG.Resources.Language;
namespace mRemoteNG.Security.SymmetricEncryption
{
[SupportedOSPlatform("windows")]
public class LegacyRijndaelCryptographyProvider : ICryptographyProvider
{
public int BlockSizeInBytes { get; }
@@ -56,8 +58,7 @@ namespace mRemoteNG.Security.SymmetricEncryption
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
string.Format(Language.ErrorEncryptionFailed, ex.Message));
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, string.Format(Language.ErrorEncryptionFailed, ex.Message));
}
return strToEncrypt;

View File

@@ -1,10 +1,12 @@
namespace mRemoteNG.Themes
{
using System.Drawing;
using UI.Tabs;
using WeifenLuo.WinFormsUI.Docking;
using WeifenLuo.WinFormsUI.ThemeVS2015;
using System.Drawing;
using System.Runtime.Versioning;
using mRemoteNG.UI.Tabs;
using WeifenLuo.WinFormsUI.Docking;
using WeifenLuo.WinFormsUI.ThemeVS2015;
namespace mRemoteNG.Themes
{
[SupportedOSPlatform("windows")]
/// <summary>
/// Visual Studio 2015 Light theme.

View File

@@ -9,9 +9,11 @@ using System.Linq;
using mRemoteNG.Messages;
using mRemoteNG.Properties;
using WeifenLuo.WinFormsUI.Docking;
using System.Runtime.Versioning;
namespace mRemoteNG.Themes
{
[SupportedOSPlatform("windows")]
/// <summary>
/// Main class of the theming component. Centralizes creation, loading and deletion of themes
/// Implemented as a singleton

View File

@@ -1,9 +1,11 @@
using System.IO;
using System.IO;
using WeifenLuo.WinFormsUI.Docking;
using System.Linq;
using System.Runtime.Versioning;
namespace mRemoteNG.Themes
{
[SupportedOSPlatform("windows")]
public static class ThemeSerializer
{
/// <summary>

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using mRemoteNG.App;
@@ -8,6 +9,7 @@ using mRemoteNG.App;
namespace mRemoteNG.Tools.Cmdline
{
[SupportedOSPlatform("windows")]
//
//* Arguments class: application arguments interpreter
//*

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Runtime.Versioning;
using System.Windows.Forms;
using mRemoteNG.App.Info;
using mRemoteNG.Messages;
@@ -11,6 +12,7 @@ using mRemoteNG.Resources.Language;
namespace mRemoteNG.Tools.Cmdline
{
[SupportedOSPlatform("windows")]
public class StartupArgumentsInterpreter
{
private readonly MessageCollector _messageCollector;

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Versioning;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Connection;
@@ -10,6 +11,7 @@ using mRemoteNG.Tree;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class ConnectionsTreeToMenuItemsConverter
{
public MouseEventHandler MouseUpEventHandler { get; set; }

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.Versioning;
using mRemoteNG.App;
using mRemoteNG.Connection;
using mRemoteNG.Properties;
@@ -8,6 +9,7 @@ using mRemoteNG.Tools.Cmdline;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class ExternalToolArgumentParser
{
private readonly ConnectionInfo _connectionInfo;

View File

@@ -1,12 +1,13 @@
using System.Linq;
using System.Runtime.Versioning;
using mRemoteNG.Tools.CustomCollections;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class ExternalToolsService
{
public FullyObservableCollection<ExternalTool> ExternalTools { get; set; } =
new FullyObservableCollection<ExternalTool>();
public FullyObservableCollection<ExternalTool> ExternalTools { get; set; } = new FullyObservableCollection<ExternalTool>();
public ExternalTool GetExtAppByName(string name)
{

View File

@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Versioning;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class ExternalToolsTypeConverter : StringConverter
{
public static string[] ExternalTools

View File

@@ -1,10 +1,12 @@
using System;
using System.Drawing;
using System.Runtime.Versioning;
using System.Windows.Forms;
using mRemoteNG.App;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class MouseClickSimulator
{
public static void Click(Control controlToClick, Point currentMousePosition)

View File

@@ -5,6 +5,7 @@ using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using mRemoteNG.App;
using mRemoteNG.Messages;
@@ -12,6 +13,7 @@ using mRemoteNG.Messages;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class PortScanner
{
private readonly List<IPAddress> _ipAddresses = new List<IPAddress>();
@@ -113,9 +115,7 @@ namespace mRemoteNG.Tools
try
{
_hostCount = 0;
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
$"Tools.PortScan: Starting scan of {_ipAddresses.Count} hosts...",
true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, $"Tools.PortScan: Starting scan of {_ipAddresses.Count} hosts...", true);
foreach (var ipAddress in _ipAddresses)
{
RaiseBeginHostScanEvent(ipAddress);
@@ -130,17 +130,13 @@ namespace mRemoteNG.Tools
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
$"Tools.PortScan: Ping failed for {ipAddress} {Environment.NewLine} {ex.Message}",
true);
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, $"Tools.PortScan: Ping failed for {ipAddress} {Environment.NewLine} {ex.Message}", true);
}
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg,
$"StartScanBG failed (Tools.PortScan) {Environment.NewLine} {ex.Message}",
true);
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, $"StartScanBG failed (Tools.PortScan) {Environment.NewLine} {ex.Message}", true);
}
}

View File

@@ -5,9 +5,11 @@ using System.Text;
using mRemoteNG.App;
using mRemoteNG.Properties;
using mRemoteNG.Tools.Cmdline;
using System.Runtime.Versioning;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class ProcessController : IDisposable
{
#region Public Methods

View File

@@ -1,8 +1,10 @@
using mRemoteNG.Properties;
using mRemoteNG.Tools.Cmdline;
using System.Runtime.Versioning;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class PuttyProcessController : ProcessController
{
public bool Start(CommandLineArguments arguments = null)

View File

@@ -1,10 +1,12 @@
using System;
using System;
using System.Diagnostics;
using mRemoteNG.Connection.Protocol;
using System.IO;
using System.Runtime.Versioning;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class PuttyTypeDetector
{
public static PuttyType GetPuttyType()

View File

@@ -4,9 +4,11 @@ using mRemoteNG.Connection.Protocol;
using mRemoteNG.Container;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Versioning;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class SshTunnelTypeConverter : StringConverter
{
public static string[] SshTunnels

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Runtime.Versioning;
using mRemoteNG.App;
using mRemoteNG.Connection.Protocol.Http;
using mRemoteNG.Connection.Protocol.RDP;
@@ -13,6 +14,7 @@ using mRemoteNG.Resources.Language;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class ScanHost
{
#region Properties

View File

@@ -5,9 +5,11 @@ using Renci.SshNet;
using Renci.SshNet.Sftp;
using static System.IO.FileMode;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
internal class SecureTransfer : IDisposable
{
private readonly string Host;

View File

@@ -1,10 +1,12 @@
using System;
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using mRemoteNG.App;
using System.Runtime.Versioning;
namespace mRemoteNG.Tools
{
[SupportedOSPlatform("windows")]
public class WindowPlacement
{
private Form _form;

View File

@@ -1,8 +1,10 @@
using System;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
namespace mRemoteNG.Tree.ClickHandlers
{
[SupportedOSPlatform("windows")]
public class OpenConnectionClickHandler : ITreeNodeClickHandler<ConnectionInfo>
{
private readonly IConnectionInitiator _connectionInitiator;

View File

@@ -1,8 +1,10 @@
using System;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
namespace mRemoteNG.Tree.ClickHandlers
{
[SupportedOSPlatform("windows")]
public class SwitchToConnectionClickHandler : ITreeNodeClickHandler<ConnectionInfo>
{
private readonly IConnectionInitiator _connectionInitiator;

View File

@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
namespace mRemoteNG.Tree.ClickHandlers
{
[SupportedOSPlatform("windows")]
public class TreeNodeCompositeClickHandler : ITreeNodeClickHandler<ConnectionInfo>
{
public IEnumerable<ITreeNodeClickHandler<ConnectionInfo>> ClickHandlers { get; set; } =

View File

@@ -6,10 +6,11 @@ using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Tree.Root;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.Tree
{
[SupportedOSPlatform("windows")]
public class ConnectionTreeDragAndDropHandler
{
private readonly Color DropAllowedFeedbackColor = Color.Green;

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Properties;
@@ -9,6 +10,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Tree
{
[SupportedOSPlatform("windows")]
public sealed class ConnectionTreeModel : INotifyCollectionChanged, INotifyPropertyChanged
{
public List<ContainerInfo> RootNodes { get; } = new List<ContainerInfo>();

View File

@@ -1,10 +1,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Versioning;
using mRemoteNG.Connection;
namespace mRemoteNG.Tree
{
[SupportedOSPlatform("windows")]
public class NodeSearcher
{
private readonly ConnectionTreeModel _connectionTreeModel;

View File

@@ -3,10 +3,11 @@ using mRemoteNG.Container;
using System;
using System.Linq;
using mRemoteNG.UI.Controls.ConnectionTree;
using System.Runtime.Versioning;
namespace mRemoteNG.Tree
{
[SupportedOSPlatform("windows")]
public class PreviousSessionOpener : IConnectionTreeDelegate
{
private readonly IConnectionInitiator _connectionInitiator;

View File

@@ -1,10 +1,12 @@
using System.Linq;
using System.Runtime.Versioning;
using mRemoteNG.Container;
using mRemoteNG.UI.Controls.ConnectionTree;
namespace mRemoteNG.Tree
{
[SupportedOSPlatform("windows")]
public class PreviouslyOpenedFolderExpander : IConnectionTreeDelegate
{
public void Execute(IConnectionTree connectionTree)

View File

@@ -4,10 +4,11 @@ using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Tools;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.Tree.Root
{
[SupportedOSPlatform("windows")]
[DefaultProperty("Name")]
public class RootNodeInfo : ContainerInfo
{

View File

@@ -1,9 +1,11 @@
using mRemoteNG.Properties;
using mRemoteNG.Tools;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.Tree.Root
{
[SupportedOSPlatform("windows")]
public class RootPuttySessionsNodeInfo : RootNodeInfo
{
private string _name;

View File

@@ -1,11 +1,13 @@
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Runtime.Versioning;
using System.Windows.Forms.Design;
using mRemoteNG.App;
namespace mRemoteNG.UI.Controls.Adapters
{
[SupportedOSPlatform("windows")]
public class CredentialRecordListAdaptor : UITypeEditor
{
private IWindowsFormsEditorService _editorService;

View File

@@ -17,9 +17,11 @@ using mRemoteNG.Tools;
using mRemoteNG.Tools.Attributes;
using mRemoteNG.Tree.Root;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid
{
[SupportedOSPlatform("windows")]
public partial class ConnectionInfoPropertyGrid : FilteredPropertyGrid.FilteredPropertyGrid
{
private readonly Dictionary<Type, IEnumerable<PropertyInfo>> _propertyCache = new Dictionary<Type, IEnumerable<PropertyInfo>>();

View File

@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Runtime.Versioning;
using BrightIdeasSoftware;
using mRemoteNG.Connection;
namespace mRemoteNG.UI.Controls.ConnectionTree
{
[SupportedOSPlatform("windows")]
public class ConnectionTreeSearchTextFilter : IModelFilter
{
public string FilterText { get; set; } = "";

View File

@@ -6,9 +6,11 @@ using mRemoteNG.Messages;
using mRemoteNG.Tools;
using mRemoteNG.Tree;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Controls
{
[SupportedOSPlatform("windows")]
public class ExternalToolsToolStrip : ToolStrip
{
private IContainer components;
@@ -18,8 +20,7 @@ namespace mRemoteNG.UI.Controls
public ExternalToolsToolStrip()
{
Initialize();
Runtime.ExternalToolsService.ExternalTools.CollectionUpdated +=
(sender, args) => AddExternalToolsToToolBar();
Runtime.ExternalToolsService.ExternalTools.CollectionUpdated += (sender, args) => AddExternalToolsToToolBar();
}
private void Initialize()
@@ -105,9 +106,7 @@ namespace mRemoteNG.UI.Controls
extA.Start(selectedTreeNode);
else
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
"No connection was selected, external tool may return errors.",
true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "No connection was selected, external tool may return errors.", true);
extA.Start();
}
}

View File

@@ -8,9 +8,11 @@ using mRemoteNG.App;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Controls
{
[SupportedOSPlatform("windows")]
public partial class MultiSshToolStrip : ToolStrip
{
private IContainer components;
@@ -74,8 +76,7 @@ namespace mRemoteNG.UI.Controls
processHandlers.AddRange(ProcessOpenConnections(connection));
}
var connectionTreeConnections = Runtime.ConnectionsService.ConnectionTreeModel.GetRecursiveChildList()
.Where(item => item.OpenConnections.Count > 0);
var connectionTreeConnections = Runtime.ConnectionsService.ConnectionTreeModel.GetRecursiveChildList().Where(item => item.OpenConnections.Count > 0);
foreach (var connection in connectionTreeConnections)
{

View File

@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Versioning;
using System.Windows.Forms;
namespace mRemoteNG.UI.Controls.PageSequence
{
[SupportedOSPlatform("windows")]
public class PageSequence : IDisposable
{
private readonly Control _pageContainer;
@@ -13,8 +15,7 @@ namespace mRemoteNG.UI.Controls.PageSequence
public IEnumerable<SequencedControl> Pages => _pages;
public int CurrentPageIndex { get; private set; }
public PageSequence(Control pageContainer, IEnumerable<SequencedControl> pages) : this(pageContainer,
pages.ToArray())
public PageSequence(Control pageContainer, IEnumerable<SequencedControl> pages) : this(pageContainer, pages.ToArray())
{
}

View File

@@ -12,9 +12,11 @@ using mRemoteNG.Properties;
using mRemoteNG.Themes;
using mRemoteNG.Tools;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Controls
{
[SupportedOSPlatform("windows")]
public class QuickConnectToolStrip : ToolStrip
{
private IContainer components;

View File

@@ -1,10 +1,12 @@
using mRemoteNG.Tools;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Windows.Forms;
namespace mRemoteNG.UI.Controls
{
[SupportedOSPlatform("windows")]
public partial class MrngAdTree : UserControl
{
#region Public Methods

View File

@@ -1,9 +1,11 @@
using System.ComponentModel;
using System.Runtime.Versioning;
using System.Windows.Forms;
using mRemoteNG.Themes;
namespace mRemoteNG.UI.Controls
{
[SupportedOSPlatform("windows")]
public partial class MrngPictureBox : PictureBox
{
private ThemeManager _themeManager;

View File

@@ -8,9 +8,11 @@ using mRemoteNG.App.Info;
using mRemoteNG.Messages;
using mRemoteNG.UI.TaskDialog;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI
{
[SupportedOSPlatform("windows")]
public class DialogFactory
{
public static OpenFileDialog BuildLoadConnectionsDialog()

View File

@@ -6,9 +6,11 @@ using mRemoteNG.Resources.Language;
using System.Reflection;
using mRemoteNG.Properties;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms
{
[SupportedOSPlatform("windows")]
public partial class frmAbout : Form
{
public static frmAbout Instance { get; set; } = new frmAbout();

View File

@@ -7,9 +7,11 @@ using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Themes;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms
{
[SupportedOSPlatform("windows")]
public partial class FrmExport
{
private ThemeManager _themeManager;

View File

@@ -1,9 +1,11 @@
using System.Windows.Forms;
using mRemoteNG.Themes;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms
{
[SupportedOSPlatform("windows")]
public sealed partial class FrmInputBox : Form
{
internal string returnValue;

View File

@@ -5,9 +5,11 @@ using mRemoteNG.Security;
using mRemoteNG.Themes;
using mRemoteNG.Tools;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms
{
[SupportedOSPlatform("windows")]
public partial class FrmPassword : IKeyProvider
{
private readonly string _passwordName;

View File

@@ -1,8 +1,10 @@
using System;
using System.Runtime.Versioning;
using mRemoteNG.App.Info;
namespace mRemoteNG.UI.Forms
{
[SupportedOSPlatform("windows")]
/// <summary>
/// Interaction logic for FrmSplashScreenNew.xaml
/// </summary>

View File

@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Versioning;
using System.Text;
using System.Windows.Forms;
using mRemoteNG.App;
@@ -9,6 +10,7 @@ using mRemoteNG.Resources.Language;
namespace mRemoteNG.UI.Forms
{
[SupportedOSPlatform("windows")]
public partial class FrmUnhandledException : Form
{
private readonly bool _isFatal;

View File

@@ -8,9 +8,11 @@ using mRemoteNG.Connection.Protocol;
using mRemoteNG.Properties;
using mRemoteNG.Tools;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class AdvancedPage
{
public AdvancedPage()

View File

@@ -4,9 +4,11 @@ using mRemoteNG.App;
using mRemoteNG.Properties;
using mRemoteNG.Tools;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class AppearancePage
{
public AppearancePage()

View File

@@ -4,9 +4,11 @@ using System.Collections.Generic;
using mRemoteNG.Config.Connections;
using mRemoteNG.Properties;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class ConnectionsPage
{
private readonly FrmMain _frmMain = FrmMain.Default;

View File

@@ -3,9 +3,11 @@ using mRemoteNG.App;
using mRemoteNG.Properties;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class CredentialsPage : OptionsPage
{
public CredentialsPage()
@@ -51,8 +53,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
txtCredentialsUsername.Text = Properties.OptionsCredentialsPage.Default.DefaultUsername;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
txtCredentialsPassword.Text =
cryptographyProvider.Decrypt(Properties.OptionsCredentialsPage.Default.DefaultPassword, Runtime.EncryptionKey);
txtCredentialsPassword.Text = cryptographyProvider.Decrypt(Properties.OptionsCredentialsPage.Default.DefaultPassword, Runtime.EncryptionKey);
txtCredentialsDomain.Text = Properties.OptionsCredentialsPage.Default.DefaultDomain;
txtCredentialsUserViaAPI.Text = Properties.OptionsCredentialsPage.Default.UserViaAPIDefault;
}
@@ -74,8 +75,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
Properties.OptionsCredentialsPage.Default.DefaultUsername = txtCredentialsUsername.Text;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
Properties.OptionsCredentialsPage.Default.DefaultPassword =
cryptographyProvider.Encrypt(txtCredentialsPassword.Text, Runtime.EncryptionKey);
Properties.OptionsCredentialsPage.Default.DefaultPassword = cryptographyProvider.Encrypt(txtCredentialsPassword.Text, Runtime.EncryptionKey);
Properties.OptionsCredentialsPage.Default.DefaultDomain = txtCredentialsDomain.Text;
Properties.OptionsCredentialsPage.Default.UserViaAPIDefault = txtCredentialsUserViaAPI.Text;
}

View File

@@ -1,5 +1,6 @@
using System.Diagnostics;
using System.IO;
using System.Runtime.Versioning;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Properties;
@@ -7,6 +8,7 @@ using mRemoteNG.Resources.Language;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class NotificationsPage
{
public NotificationsPage()

View File

@@ -9,9 +9,11 @@ using mRemoteNG.Properties;
using mRemoteNG.Security;
using mRemoteNG.Security.Factories;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class SecurityPage : OptionsPage
{
public SecurityPage()

View File

@@ -5,9 +5,11 @@ using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Properties;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class SqlServerPage
{
private readonly DatabaseConnectionTester _databaseConnectionTester;

View File

@@ -1,11 +1,14 @@
using System;
using System.Runtime.Versioning;
using mRemoteNG.Properties;
using mRemoteNG.Resources.Language;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class StartupExitPage
{
[SupportedOSPlatform("windows")]
public StartupExitPage()
{
InitializeComponent();

View File

@@ -1,8 +1,10 @@
using mRemoteNG.Properties;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class TabsPanelsPage
{
public TabsPanelsPage()

View File

@@ -7,9 +7,11 @@ using BrightIdeasSoftware;
using mRemoteNG.Properties;
using mRemoteNG.UI.TaskDialog;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class ThemePage
{
#region Private Fields
@@ -177,9 +179,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
private void btnThemeNew_Click(object sender, EventArgs e)
{
using (var frmInputBox = new FrmInputBox(Language.OptionsThemeNewThemeCaption,
Language.OptionsThemeNewThemeText,
_themeManager.ActiveTheme.Name))
using (var frmInputBox = new FrmInputBox(Language.OptionsThemeNewThemeCaption, Language.OptionsThemeNewThemeText, _themeManager.ActiveTheme.Name))
{
var dr = frmInputBox.ShowDialog();
if (dr != DialogResult.OK) return;
@@ -191,9 +191,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
}
else
{
CTaskDialog.ShowTaskDialogBox(this, Language.Errors, Language.OptionsThemeNewThemeError, "",
"", "", "", "", "", ETaskDialogButtons.Ok, ESysIcons.Error,
ESysIcons.Information, 0);
CTaskDialog.ShowTaskDialogBox(this, Language.Errors, Language.OptionsThemeNewThemeError, "", "", "", "", "", "", ETaskDialogButtons.Ok, ESysIcons.Error, ESysIcons.Information, 0);
}
}
}

View File

@@ -9,9 +9,11 @@ using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.UI.TaskDialog;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class UpdatesPage
{
#region Private Fields

View File

@@ -3,9 +3,11 @@ using mRemoteNG.App;
using mRemoteNG.Themes;
using mRemoteNG.UI.Panels;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Forms
{
[SupportedOSPlatform("windows")]
public partial class FrmChoosePanel
{
private readonly PanelAdder _panelAdder;

View File

@@ -2,9 +2,11 @@
using System.Windows.Forms;
using mRemoteNG.Tools;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Menu
{
[SupportedOSPlatform("windows")]
// This class creates new menu items to menu that appears when you right click the top of the app (where the window title is)
public class AdvancedWindowMenu : IDisposable
{

View File

@@ -7,9 +7,11 @@ using mRemoteNG.Security;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.Window;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Menu
{
[SupportedOSPlatform("windows")]
public class FileMenu : ToolStripMenuItem
{
private ToolStripMenuItem _mMenToolsOptions;

View File

@@ -5,9 +5,11 @@ using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.UI.Forms;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Menu
{
[SupportedOSPlatform("windows")]
public class HelpMenu : ToolStripMenuItem
{
private ToolStripMenuItem _mMenInfoHelp;

View File

@@ -1,4 +1,5 @@
using System;
using System.Runtime.Versioning;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Credential;
@@ -6,6 +7,7 @@ using mRemoteNG.Resources.Language;
namespace mRemoteNG.UI.Menu
{
[SupportedOSPlatform("windows")]
public class ToolsMenu : ToolStripMenuItem
{
private ToolStripMenuItem _mMenToolsSshTransfer;

View File

@@ -8,9 +8,11 @@ using System.Linq;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Panels
{
[SupportedOSPlatform("windows")]
public class PanelAdder
{
public ConnectionWindow AddPanel(string title = "")

View File

@@ -10,9 +10,11 @@ using mRemoteNG.Properties;
using mRemoteNG.UI.TaskDialog;
using WeifenLuo.WinFormsUI.Docking;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Tabs
{
[SupportedOSPlatform("windows")]
public partial class ConnectionTab : DockContent
{
/// <summary>

View File

@@ -1,9 +1,11 @@
using mRemoteNG.App;
using mRemoteNG.UI.Window;
using System;
using System.Runtime.Versioning;
namespace mRemoteNG.UI.Tabs
{
[SupportedOSPlatform("windows")]
class TabHelper
{
private static readonly Lazy<TabHelper> lazyHelper = new Lazy<TabHelper>(() => new TabHelper());
@@ -23,8 +25,7 @@ namespace mRemoteNG.UI.Tabs
{
currentTab = value;
findCurrentPanel();
Runtime.MessageCollector.AddMessage(Messages.MessageClass.DebugMsg,
"Tab got focused: " + currentTab.TabText);
Runtime.MessageCollector.AddMessage(Messages.MessageClass.DebugMsg, "Tab got focused: " + currentTab.TabText);
}
}

View File

@@ -5,11 +5,7 @@ using System.Windows.Forms;
namespace mRemoteNG.UI.TaskDialog
{
[SupportedOSPlatform("windows")]
//--------------------------------------------------------------------------------
#region PUBLIC enums
//--------------------------------------------------------------------------------
public enum ESysIcons
{
Information,
@@ -28,10 +24,8 @@ namespace mRemoteNG.UI.TaskDialog
Cancel,
None
}
#endregion
//--------------------------------------------------------------------------------
public static class CTaskDialog
{
// PUBLIC static values...
@@ -52,20 +46,7 @@ namespace mRemoteNG.UI.TaskDialog
#region ShowTaskDialogBox
//--------------------------------------------------------------------------------
public static DialogResult ShowTaskDialogBox(IWin32Window owner,
string title,
string mainInstruction,
string content,
string expandedInfo,
string footer,
string verificationText,
string radioButtons,
string commandButtons,
ETaskDialogButtons buttons,
ESysIcons mainIcon,
ESysIcons footerIcon,
int defaultIndex)
public static DialogResult ShowTaskDialogBox(IWin32Window owner, string title, string mainInstruction, string content, string expandedInfo, string footer, string verificationText, string radioButtons, string commandButtons, ETaskDialogButtons buttons, ESysIcons mainIcon, ESysIcons footerIcon, int defaultIndex)
{
DialogResult result;
OnTaskDialogShown?.Invoke(null, EventArgs.Empty);
@@ -114,8 +95,7 @@ namespace mRemoteNG.UI.TaskDialog
ESysIcons mainIcon,
ESysIcons footerIcon)
{
return ShowTaskDialogBox(owner, title, mainInstruction, content, expandedInfo, footer, verificationText,
radioButtons, commandButtons, buttons, mainIcon, footerIcon, 0);
return ShowTaskDialogBox(owner, title, mainInstruction, content, expandedInfo, footer, verificationText, radioButtons, commandButtons, buttons, mainIcon, footerIcon, 0);
}
public static DialogResult ShowTaskDialogBox(string title,
@@ -130,8 +110,7 @@ namespace mRemoteNG.UI.TaskDialog
ESysIcons mainIcon,
ESysIcons footerIcon)
{
return ShowTaskDialogBox(null, title, mainInstruction, content, expandedInfo, footer, verificationText,
radioButtons, commandButtons, buttons, mainIcon, footerIcon, 0);
return ShowTaskDialogBox(null, title, mainInstruction, content, expandedInfo, footer, verificationText, radioButtons, commandButtons, buttons, mainIcon, footerIcon, 0);
}
#endregion
@@ -141,57 +120,27 @@ namespace mRemoteNG.UI.TaskDialog
#region MessageBox
//--------------------------------------------------------------------------------
public static DialogResult MessageBox(IWin32Window owner,
string title,
string mainInstruction,
string content,
string expandedInfo,
string footer,
string verificationText,
ETaskDialogButtons buttons,
ESysIcons mainIcon,
ESysIcons footerIcon)
public static DialogResult MessageBox(IWin32Window owner, string title, string mainInstruction, string content, string expandedInfo, string footer, string verificationText, ETaskDialogButtons buttons, ESysIcons mainIcon, ESysIcons footerIcon)
{
return ShowTaskDialogBox(owner, title, mainInstruction, content, expandedInfo, footer, verificationText, "",
"", buttons, mainIcon, footerIcon);
return ShowTaskDialogBox(owner, title, mainInstruction, content, expandedInfo, footer, verificationText, "", "", buttons, mainIcon, footerIcon);
}
//--------------------------------------------------------------------------------
// Overloaded versions...
//--------------------------------------------------------------------------------
public static DialogResult MessageBox(string title,
string mainInstruction,
string content,
string expandedInfo,
string footer,
string verificationText,
ETaskDialogButtons buttons,
ESysIcons mainIcon,
ESysIcons footerIcon)
public static DialogResult MessageBox(string title, string mainInstruction, string content, string expandedInfo, string footer, string verificationText, ETaskDialogButtons buttons, ESysIcons mainIcon, ESysIcons footerIcon)
{
return ShowTaskDialogBox(null, title, mainInstruction, content, expandedInfo, footer, verificationText, "",
"", buttons, mainIcon, footerIcon);
return ShowTaskDialogBox(null, title, mainInstruction, content, expandedInfo, footer, verificationText, "", "", buttons, mainIcon, footerIcon);
}
public static DialogResult MessageBox(IWin32Window owner,
string title,
string mainInstruction,
string content,
ETaskDialogButtons buttons,
ESysIcons mainIcon)
public static DialogResult MessageBox(IWin32Window owner, string title, string mainInstruction, string content, ETaskDialogButtons buttons, ESysIcons mainIcon)
{
return MessageBox(owner, title, mainInstruction, content, "", "", "", buttons, mainIcon,
ESysIcons.Information);
return MessageBox(owner, title, mainInstruction, content, "", "", "", buttons, mainIcon, ESysIcons.Information);
}
public static DialogResult MessageBox(string title,
string mainInstruction,
string content,
ETaskDialogButtons buttons,
ESysIcons mainIcon)
public static DialogResult MessageBox(string title, string mainInstruction, string content, ETaskDialogButtons buttons, ESysIcons mainIcon)
{
return MessageBox(null, title, mainInstruction, content, "", "", "", buttons, mainIcon,
ESysIcons.Information);
return MessageBox(null, title, mainInstruction, content, "", "", "", buttons, mainIcon, ESysIcons.Information);
}
//--------------------------------------------------------------------------------
@@ -215,9 +164,7 @@ namespace mRemoteNG.UI.TaskDialog
ESysIcons footerIcon,
int defaultIndex)
{
var res = ShowTaskDialogBox(owner, title, mainInstruction, content, expandedInfo, footer, verificationText,
radioButtons, "", ETaskDialogButtons.OkCancel, mainIcon, footerIcon,
defaultIndex);
var res = ShowTaskDialogBox(owner, title, mainInstruction, content, expandedInfo, footer, verificationText, radioButtons, "", ETaskDialogButtons.OkCancel, mainIcon, footerIcon, defaultIndex);
if (res == DialogResult.OK)
return RadioButtonResult;
return -1;
@@ -237,9 +184,7 @@ namespace mRemoteNG.UI.TaskDialog
ESysIcons footerIcon,
int defaultIndex)
{
var res = ShowTaskDialogBox(null, title, mainInstruction, content, expandedInfo, footer, verificationText,
radioButtons, "", ETaskDialogButtons.OkCancel, mainIcon, footerIcon,
defaultIndex);
var res = ShowTaskDialogBox(null, title, mainInstruction, content, expandedInfo, footer, verificationText, radioButtons, "", ETaskDialogButtons.OkCancel, mainIcon, footerIcon, defaultIndex);
if (res == DialogResult.OK)
return RadioButtonResult;
return -1;
@@ -256,8 +201,7 @@ namespace mRemoteNG.UI.TaskDialog
ESysIcons mainIcon,
ESysIcons footerIcon)
{
return ShowRadioBox(owner, title, mainInstruction, content, expandedInfo, footer, verificationText,
radioButtons, ESysIcons.Question, ESysIcons.Information, 0);
return ShowRadioBox(owner, title, mainInstruction, content, expandedInfo, footer, verificationText, radioButtons, ESysIcons.Question, ESysIcons.Information, 0);
}
public static int ShowRadioBox(IWin32Window owner,
@@ -267,8 +211,7 @@ namespace mRemoteNG.UI.TaskDialog
string radioButtons,
int defaultIndex)
{
return ShowRadioBox(owner, title, mainInstruction, content, "", "", "", radioButtons, ESysIcons.Question,
ESysIcons.Information, defaultIndex);
return ShowRadioBox(owner, title, mainInstruction, content, "", "", "", radioButtons, ESysIcons.Question, ESysIcons.Information, defaultIndex);
}
public static int ShowRadioBox(IWin32Window owner,
@@ -277,8 +220,7 @@ namespace mRemoteNG.UI.TaskDialog
string content,
string radioButtons)
{
return ShowRadioBox(owner, title, mainInstruction, content, "", "", "", radioButtons, ESysIcons.Question,
ESysIcons.Information, 0);
return ShowRadioBox(owner, title, mainInstruction, content, "", "", "", radioButtons, ESysIcons.Question, ESysIcons.Information, 0);
}
public static int ShowRadioBox(string title,
@@ -286,8 +228,7 @@ namespace mRemoteNG.UI.TaskDialog
string content,
string radioButtons)
{
return ShowRadioBox(null, title, mainInstruction, content, "", "", "", radioButtons, ESysIcons.Question,
ESysIcons.Information, 0);
return ShowRadioBox(null, title, mainInstruction, content, "", "", "", radioButtons, ESysIcons.Question, ESysIcons.Information, 0);
}
#endregion
@@ -348,18 +289,12 @@ namespace mRemoteNG.UI.TaskDialog
string commandButtons,
bool showCancelButton)
{
return ShowCommandBox(owner, title, mainInstruction, content, "", "", "", commandButtons, showCancelButton,
ESysIcons.Question, ESysIcons.Information);
return ShowCommandBox(owner, title, mainInstruction, content, "", "", "", commandButtons, showCancelButton, ESysIcons.Question, ESysIcons.Information);
}
public static int ShowCommandBox(string title,
string mainInstruction,
string content,
string commandButtons,
bool showCancelButton)
public static int ShowCommandBox(string title, string mainInstruction, string content, string commandButtons, bool showCancelButton)
{
return ShowCommandBox(null, title, mainInstruction, content, "", "", "", commandButtons, showCancelButton,
ESysIcons.Question, ESysIcons.Information);
return ShowCommandBox(null, title, mainInstruction, content, "", "", "", commandButtons, showCancelButton, ESysIcons.Question, ESysIcons.Information);
}
#endregion

View File

@@ -1,10 +1,12 @@
using System;
using System.Runtime.Versioning;
using System.Text;
using System.Windows.Forms;
using mRemoteNG.App;
namespace mRemoteNG.UI
{
[SupportedOSPlatform("windows")]
public static class TextBoxExtensions
{
public static bool SetCueBannerText(this TextBox textBox, string cueText, bool showCueWhenFocused = false)