mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-26 12:08:37 +08:00
Merge pull request #164 from mRemoteNG/Remove_RemoteDesktop2008_export_option
Closes #144
This commit is contained in:
@@ -79,10 +79,6 @@ namespace mRemoteNG.App
|
||||
case ConnectionsSaver.Format.mRCSV:
|
||||
serializer = new CsvConnectionsSerializerMremotengFormat();
|
||||
((CsvConnectionsSerializerMremotengFormat)serializer).SaveFilter = saveFilter;
|
||||
break;
|
||||
case ConnectionsSaver.Format.vRDCSV:
|
||||
serializer = new CsvConnectionsSerializerRemoteDesktop2008Format();
|
||||
((CsvConnectionsSerializerRemoteDesktop2008Format)serializer).SaveFilter = saveFilter;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(saveFormat), saveFormat, null);
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
@@ -29,17 +28,14 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
public class ConnectionsSaver
|
||||
{
|
||||
#region Public Enums
|
||||
public enum Format
|
||||
{
|
||||
None,
|
||||
mRXML,
|
||||
mRCSV,
|
||||
vRDvRE,
|
||||
vRDCSV,
|
||||
SQL
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
private XmlTextWriter _xmlTextWriter;
|
||||
@@ -77,9 +73,6 @@ namespace mRemoteNG.Config.Connections
|
||||
case Format.vRDvRE:
|
||||
SaveToVRE();
|
||||
break;
|
||||
case Format.vRDCSV:
|
||||
SaveToRemoteDesktop2008FormattedCsv();
|
||||
break;
|
||||
default:
|
||||
SaveToXml();
|
||||
if (!Export)
|
||||
@@ -264,14 +257,6 @@ namespace mRemoteNG.Config.Connections
|
||||
var csvContent = csvConnectionsSerializer.Serialize(ConnectionTreeModel);
|
||||
dataProvider.Save(csvContent);
|
||||
}
|
||||
|
||||
private void SaveToRemoteDesktop2008FormattedCsv()
|
||||
{
|
||||
var csvSerializer = new CsvConnectionsSerializerRemoteDesktop2008Format();
|
||||
var dataProvider = new FileDataProvider(ConnectionFileName);
|
||||
var csvContent = csvSerializer.Serialize(ConnectionTreeModel);
|
||||
dataProvider.Save(csvContent);
|
||||
}
|
||||
|
||||
#region vRD VRE
|
||||
// .VRE files are for ASG-Remote Desktop (prevously visionapp Remote Desktop)
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
|
||||
namespace mRemoteNG.Config.Serializers
|
||||
{
|
||||
public class CsvConnectionsSerializerRemoteDesktop2008Format : ISerializer<string>
|
||||
{
|
||||
private string _csv = "";
|
||||
public SaveFilter SaveFilter { get; set; }
|
||||
|
||||
public string Serialize(ConnectionTreeModel connectionTreeModel)
|
||||
{
|
||||
var rootNode = connectionTreeModel.RootNodes.First(node => node is RootNodeInfo);
|
||||
return Serialize(rootNode);
|
||||
}
|
||||
|
||||
public string Serialize(ConnectionInfo serializationTarget)
|
||||
{
|
||||
_csv = "";
|
||||
SerializeNodesRecursive(serializationTarget);
|
||||
return _csv;
|
||||
}
|
||||
|
||||
private void SerializeNodesRecursive(ConnectionInfo node)
|
||||
{
|
||||
var nodeAsContainer = node as ContainerInfo;
|
||||
if (nodeAsContainer != null)
|
||||
{
|
||||
foreach (var child in nodeAsContainer.Children)
|
||||
{
|
||||
if (child is ContainerInfo)
|
||||
SerializeNodesRecursive((ContainerInfo)child);
|
||||
else if (child.Protocol == ProtocolType.RDP)
|
||||
SerializeConnectionInfo(child);
|
||||
}
|
||||
}
|
||||
else if (node.Protocol == ProtocolType.RDP)
|
||||
SerializeConnectionInfo(node);
|
||||
}
|
||||
|
||||
private void SerializeConnectionInfo(ConnectionInfo con)
|
||||
{
|
||||
var nodePath = con.TreeNode.FullPath;
|
||||
|
||||
var firstSlash = nodePath.IndexOf("\\", StringComparison.Ordinal);
|
||||
nodePath = nodePath.Remove(0, firstSlash + 1);
|
||||
var lastSlash = nodePath.LastIndexOf("\\", StringComparison.Ordinal);
|
||||
|
||||
nodePath = lastSlash > 0 ? nodePath.Remove(lastSlash) : "";
|
||||
|
||||
_csv += con.Name + ";" + con.Hostname + ";" + con.MacAddress + ";;" + con.Port + ";" + con.UseConsoleSession + ";" + nodePath + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6704,15 +6704,6 @@ namespace mRemoteNG {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to visionapp Remote Desktop 2008 CSV.
|
||||
/// </summary>
|
||||
internal static string strVisionAppRemoteDesktopCsv {
|
||||
get {
|
||||
return ResourceManager.GetString("strVisionAppRemoteDesktopCsv", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to VNC.
|
||||
/// </summary>
|
||||
|
||||
@@ -2325,9 +2325,6 @@ mRemoteNG will now quit and begin with the installation.</value>
|
||||
<data name="strVersion" xml:space="preserve">
|
||||
<value>Version</value>
|
||||
</data>
|
||||
<data name="strVisionAppRemoteDesktopCsv" xml:space="preserve">
|
||||
<value>visionapp Remote Desktop 2008 CSV</value>
|
||||
</data>
|
||||
<data name="strVnc" xml:space="preserve">
|
||||
<value>VNC</value>
|
||||
</data>
|
||||
|
||||
@@ -28,26 +28,17 @@ namespace mRemoteNG.UI.Forms
|
||||
{
|
||||
get
|
||||
{
|
||||
ExportFormat exportFormat = cboFileFormat.SelectedItem as ExportFormat;
|
||||
if (exportFormat == null)
|
||||
{
|
||||
return Config.Connections.ConnectionsSaver.Format.mRXML;
|
||||
}
|
||||
else
|
||||
{
|
||||
return exportFormat.Format;
|
||||
}
|
||||
var exportFormat = cboFileFormat.SelectedItem as ExportFormat;
|
||||
return exportFormat?.Format ?? ConnectionsSaver.Format.mRXML;
|
||||
}
|
||||
set
|
||||
set
|
||||
{
|
||||
foreach (object item in cboFileFormat.Items)
|
||||
foreach (var item in cboFileFormat.Items)
|
||||
{
|
||||
ExportFormat exportFormat = item as ExportFormat;
|
||||
if (exportFormat?.Format == value)
|
||||
{
|
||||
cboFileFormat.SelectedItem = item;
|
||||
break;
|
||||
}
|
||||
var exportFormat = item as ExportFormat;
|
||||
if (exportFormat?.Format != value) continue;
|
||||
cboFileFormat.SelectedItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,9 +176,8 @@ namespace mRemoteNG.UI.Forms
|
||||
private void ExportForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
cboFileFormat.Items.Clear();
|
||||
cboFileFormat.Items.Add(new ExportFormat(Config.Connections.ConnectionsSaver.Format.mRXML));
|
||||
cboFileFormat.Items.Add(new ExportFormat(Config.Connections.ConnectionsSaver.Format.mRCSV));
|
||||
cboFileFormat.Items.Add(new ExportFormat(Config.Connections.ConnectionsSaver.Format.vRDCSV));
|
||||
cboFileFormat.Items.Add(new ExportFormat(ConnectionsSaver.Format.mRXML));
|
||||
cboFileFormat.Items.Add(new ExportFormat(ConnectionsSaver.Format.mRCSV));
|
||||
cboFileFormat.SelectedIndex = 0;
|
||||
|
||||
ApplyLanguage();
|
||||
@@ -276,12 +266,12 @@ namespace mRemoteNG.UI.Forms
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public Config.Connections.ConnectionsSaver.Format Format { get; }
|
||||
public ConnectionsSaver.Format Format { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public ExportFormat(Config.Connections.ConnectionsSaver.Format format)
|
||||
public ExportFormat(ConnectionsSaver.Format format)
|
||||
{
|
||||
Format = format;
|
||||
}
|
||||
@@ -292,12 +282,10 @@ namespace mRemoteNG.UI.Forms
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
case Config.Connections.ConnectionsSaver.Format.mRXML:
|
||||
case ConnectionsSaver.Format.mRXML:
|
||||
return Language.strMremoteNgXml;
|
||||
case Config.Connections.ConnectionsSaver.Format.mRCSV:
|
||||
case ConnectionsSaver.Format.mRCSV:
|
||||
return Language.strMremoteNgCsv;
|
||||
case Config.Connections.ConnectionsSaver.Format.vRDCSV:
|
||||
return Language.strVisionAppRemoteDesktopCsv;
|
||||
default:
|
||||
return Format.ToString();
|
||||
}
|
||||
|
||||
@@ -133,7 +133,6 @@
|
||||
<Compile Include="Config\Connections\Multiuser\RemoteConnectionsSyncronizer.cs" />
|
||||
<Compile Include="Config\Serializers\ActiveDirectoryDeserializer.cs" />
|
||||
<Compile Include="Config\Serializers\CsvConnectionsSerializerMremotengFormat.cs" />
|
||||
<Compile Include="Config\Serializers\CsvConnectionsSerializerRemoteDesktop2008Format.cs" />
|
||||
<Compile Include="Config\Serializers\DataTableDeserializer.cs" />
|
||||
<Compile Include="Config\Serializers\DataTableSerializer.cs" />
|
||||
<Compile Include="Config\Serializers\PortScanDeserializer.cs" />
|
||||
|
||||
Reference in New Issue
Block a user