From 413d77ff1a19bc7172063086e89249a3f4eb2e66 Mon Sep 17 00:00:00 2001 From: Jonathan Rainier Date: Sat, 23 Apr 2022 15:53:25 -0400 Subject: Add Comments and Icon Support / Fix Unsorted - Add Comments - Add icon support for supported connection types - Fix empty unsorted folder from being added --- .../CsvConnectionsDeserializerRdmFormat.cs | 45 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/mRemoteNG/Config/Serializers/ConnectionSerializers/Csv/RemoteDesktopManager/CsvConnectionsDeserializerRdmFormat.cs b/mRemoteNG/Config/Serializers/ConnectionSerializers/Csv/RemoteDesktopManager/CsvConnectionsDeserializerRdmFormat.cs index de040776..ae2e4fd3 100644 --- a/mRemoteNG/Config/Serializers/ConnectionSerializers/Csv/RemoteDesktopManager/CsvConnectionsDeserializerRdmFormat.cs +++ b/mRemoteNG/Config/Serializers/ConnectionSerializers/Csv/RemoteDesktopManager/CsvConnectionsDeserializerRdmFormat.cs @@ -12,6 +12,9 @@ using mRemoteNG.Tree; namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Csv.RemoteDesktopManager; +/// +/// Import of connections from the Remote Desktop Manager (RDM) in a CSV file format +/// public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer { private readonly List _connectionTypes; @@ -21,8 +24,8 @@ public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer { - new(ProtocolType.RDP, "RDP (Microsoft Remote Desktop)", 3389), - new(ProtocolType.SSH2, "SSH Shell", 22) + new(ProtocolType.RDP, "RDP (Microsoft Remote Desktop)", 3389, "Remote Desktop"), + new(ProtocolType.SSH2, "SSH Shell", 22, "SSH") }; _groups = new HashSet(); @@ -32,6 +35,11 @@ public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer Containers { get; } + /// + /// Deserializes the CSV file into a + /// + /// Data from the CSV file + /// public ConnectionTreeModel Deserialize(string serializedData) { var lines = serializedData.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries); @@ -75,11 +83,18 @@ public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer + /// Parses a line from the CSV file and returns + /// + /// CSV Headers + /// CSV Columns + /// private (ConnectionInfo connectionInfo, string) ParseConnectionInfo(IList headers, IReadOnlyList connectionCsv) { if (headers.Count != connectionCsv.Count) return default; @@ -115,6 +130,7 @@ public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer x.Name == parentContainerName); if (parentContainer == default) { @@ -139,6 +156,12 @@ public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer + /// Adds a child to a container recursively + /// + /// Full path of the RDM Grouping + /// Segements of the group path + /// Parent container to add children to private void AddChildrenRecursive(string group, IList groupParts, ContainerInfo parentContainer) { if (_groups.Contains(group)) return; @@ -178,6 +201,13 @@ public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer + /// Adds a child to a container and returns the remaining group count + /// + /// Parent container + /// New child container + /// Remaining group count + /// private static int AddChild(ContainerInfo parentContainer, ContainerInfo newContainer, int groupCount) { parentContainer.AddChild(newContainer); @@ -186,4 +216,11 @@ public partial class CsvConnectionsDeserializerRdmFormat : IDeserializer +/// Record of supported connection types +/// +/// Procotol +/// Display Name +/// Default Port +/// Icon Name +internal sealed record RemoteDesktopManagerConnectionInfo(ProtocolType Protocol, string Name, int Port, string IconName); \ No newline at end of file -- cgit v1.2.3