mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 14:07:46 +08:00
re-adding some files lost during the migraton from sparerd/mRemoteNG-1
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,10 @@
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\bin\Debug\SharedLibraryNG.dll
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\bin\Debug\SharedLibraryNG.pdb
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.csprojResolveAssemblyReference.cache
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.dll
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.pdb
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\bin\Debug\SharedLibraryNG.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\bin\Debug\SharedLibraryNG.pdb
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.csprojResolveAssemblyReference.cache
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.pdb
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.csprojResolveAssemblyReference.cache
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
UI_tests.playlist
Normal file
1
UI_tests.playlist
Normal file
@@ -0,0 +1 @@
|
||||
<Playlist Version="1.0"><Add Test="mRemoteNGTests.UI.WindowListTests.TestMethod1" /><Add Test="mRemoteNGTests.UI.WindowListTests.AddWindowToList" /><Add Test="mRemoteNGTests.UI.WindowListTests.CountReturnsCorrectNumber" /></Playlist>
|
||||
25
mRemoteNGTests/App/LoggerTests.cs
Normal file
25
mRemoteNGTests/App/LoggerTests.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNG.App;
|
||||
using log4net;
|
||||
|
||||
namespace mRemoteNGTests.App
|
||||
{
|
||||
[TestFixture]
|
||||
public class LoggerTests
|
||||
{
|
||||
[Test]
|
||||
public void GetSingletonInstanceReturnsAnILogObject()
|
||||
{
|
||||
Assert.That(Logger.GetSingletonInstance(), Is.InstanceOf<ILog>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SingletonOnlyEverReturnsTheSameInstance()
|
||||
{
|
||||
ILog log1 = Logger.GetSingletonInstance();
|
||||
ILog log2 = Logger.GetSingletonInstance();
|
||||
Assert.That(log1, Is.EqualTo(log2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNG.Config;
|
||||
using mRemoteNG.Config.Connections;
|
||||
using NSubstitute;
|
||||
|
||||
namespace mRemoteNGTests.Config.Connections
|
||||
{
|
||||
[TestFixture]
|
||||
public class SqlConnectionUpdateCheckerTests
|
||||
{
|
||||
SqlConnectionsUpdateChecker _updateChecker;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_updateChecker = new SqlConnectionsUpdateChecker();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
_updateChecker.Dispose();
|
||||
_updateChecker = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Need to find a way to mock SqlConnector")]
|
||||
public void ReturnTrueIfUpdateIsAvailable()
|
||||
{
|
||||
Substitute.For<SqlConnector>();
|
||||
bool updateIsAvailable = _updateChecker.IsDatabaseUpdateAvailable();
|
||||
Assert.AreEqual(true,updateIsAvailable);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Need to find a way to mock SqlConnector")]
|
||||
public void ReturnFalseIfUpdateIsNotAvailable()
|
||||
{
|
||||
bool updateIsAvailable = _updateChecker.IsDatabaseUpdateAvailable();
|
||||
Assert.AreEqual(false, updateIsAvailable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNG.Config.Connections;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace mRemoteNGTests.Config.Connections
|
||||
{
|
||||
[TestFixture]
|
||||
public class SqlUpdateQueryBuilderTest
|
||||
{
|
||||
private SqlUpdateQueryBuilder _sqlUpdateQueryBuilder;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_sqlUpdateQueryBuilder = new SqlUpdateQueryBuilder();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
_sqlUpdateQueryBuilder = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SqlUpdateQueryBuilderReturnsSomeCommand()
|
||||
{
|
||||
SqlCommand command = _sqlUpdateQueryBuilder.BuildCommand();
|
||||
Assert.AreNotEqual(command.CommandText, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
40
mRemoteNGTests/Config/Connections/SqlUpdateTimerTests.cs
Normal file
40
mRemoteNGTests/Config/Connections/SqlUpdateTimerTests.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using mRemoteNG.Config.Connections;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Connections
|
||||
{
|
||||
[TestFixture]
|
||||
public class SqlUpdateTimerTests
|
||||
{
|
||||
private SqlUpdateTimer sqlUpdateChecker;
|
||||
|
||||
[SetUp]
|
||||
public void SetupSqlUpdateChecker()
|
||||
{
|
||||
sqlUpdateChecker = new SqlUpdateTimer();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDownSqlUpdateChecker()
|
||||
{
|
||||
sqlUpdateChecker.Dispose();
|
||||
sqlUpdateChecker = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EnableSQLUpdating()
|
||||
{
|
||||
sqlUpdateChecker.Enable();
|
||||
Assert.AreEqual(true, sqlUpdateChecker.IsUpdateCheckingEnabled());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DisableSQLUpdating()
|
||||
{
|
||||
sqlUpdateChecker.Enable();
|
||||
Assert.AreEqual(true, sqlUpdateChecker.IsUpdateCheckingEnabled());
|
||||
sqlUpdateChecker.Disable();
|
||||
Assert.AreEqual(false, sqlUpdateChecker.IsUpdateCheckingEnabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
250
mRemoteNGTests/ListViewTester.cs
Normal file
250
mRemoteNGTests/ListViewTester.cs
Normal file
@@ -0,0 +1,250 @@
|
||||
#region Copyright (c) 2003-2005, Luke T. Maxon
|
||||
|
||||
/********************************************************************************************************************
|
||||
'
|
||||
' Copyright (c) 2003-2005, Luke T. Maxon
|
||||
' All rights reserved.
|
||||
'
|
||||
' Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
' that the following conditions are met:
|
||||
'
|
||||
' * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
' following disclaimer.
|
||||
'
|
||||
' * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
' the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
'
|
||||
' * Neither the name of the author nor the names of its contributors may be used to endorse or
|
||||
' promote products derived from this software without specific prior written permission.
|
||||
'
|
||||
' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
' WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
' PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
' ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
' LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
' INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
' OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
' IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'
|
||||
'*******************************************************************************************************************/
|
||||
|
||||
#endregion
|
||||
|
||||
//Contributed by: Ian Cooper
|
||||
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace NUnit.Extensions.Forms
|
||||
{
|
||||
/// <summary>
|
||||
/// A ControlTester for testing List Views.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// It includes helper methods for selecting items from the list
|
||||
/// and for clearing those selections.</remarks>
|
||||
public class ListViewTester : ControlTester
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a ControlTester from the control name and the form instance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// It is best to use the overloaded Constructor that requires just the name
|
||||
/// parameter if possible.
|
||||
/// </remarks>
|
||||
/// <param name="name">The Control name.</param>
|
||||
/// <param name="form">The Form instance.</param>
|
||||
public ListViewTester(string name, Form form)
|
||||
: base(name, form)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a ControlTester from the control name and the form name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// It is best to use the overloaded Constructor that requires just the name
|
||||
/// parameter if possible.
|
||||
/// </remarks>
|
||||
/// <param name="name">The Control name.</param>
|
||||
/// <param name="formName">The Form name..</param>
|
||||
public ListViewTester(string name, string formName)
|
||||
: base(name, formName)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a ControlTester from the control name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is the best constructor.</remarks>
|
||||
/// <param name="name">The Control name.</param>
|
||||
public ListViewTester(string name)
|
||||
: base(name)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a ControlTester from a ControlTester and an index where the
|
||||
/// original tester's name is not unique.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// It is best to use the overloaded Constructor that requires just the name
|
||||
/// parameter if possible.
|
||||
/// </remarks>
|
||||
/// <param name="tester">The ControlTester.</param>
|
||||
/// <param name="index">The index to test.</param>
|
||||
public ListViewTester(ControlTester tester, int index)
|
||||
: base(tester, index)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to find a ListViewTester by index where the name is not unique.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This was added to support the ability to find controls where their name is
|
||||
/// not unique. If all of your controls are uniquely named (I recommend this) then
|
||||
/// you will not need this.
|
||||
/// </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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides access to all of the Properties of the ListBox.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to return the List View's Items property
|
||||
/// </summary>
|
||||
public ListView.ListViewItemCollection Items
|
||||
{
|
||||
get
|
||||
{
|
||||
return Properties.Items;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to return the columns of the list view
|
||||
/// </summary>
|
||||
public ListView.ColumnHeaderCollection Columns
|
||||
{
|
||||
get
|
||||
{
|
||||
return Properties.Columns;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the selections from the list box.
|
||||
/// </summary>
|
||||
public void ClearSelected()
|
||||
{
|
||||
foreach (ListViewItem item in Properties.Items)
|
||||
{
|
||||
item.Selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects an item in the ListBox according to its index.
|
||||
/// </summary>
|
||||
/// <param name="i">the index to select.</param>
|
||||
public void Select(int i)
|
||||
{
|
||||
Properties.Items[i].Selected = true;
|
||||
FireEvent("ItemActivate");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects an item in the list according to its string value.
|
||||
/// </summary>
|
||||
/// <param name="text">The item to select.</param>
|
||||
public void Select(string text)
|
||||
{
|
||||
int index = FindItemByString(text);
|
||||
|
||||
if (ItemFound(index))
|
||||
{
|
||||
Select(index);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiple selection of a range of items
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
public void SelectItems(string[] items)
|
||||
{
|
||||
foreach (string item in items)
|
||||
{
|
||||
Select(item);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that only the indicated items are selected
|
||||
/// </summary>
|
||||
/// <param name="matchList"></param>
|
||||
public bool SelectedItemsMatch(string[] matches)
|
||||
{
|
||||
ArrayList matchList = new ArrayList(matches);
|
||||
|
||||
if (matchList.Count != Properties.SelectedItems.Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (ListViewItem item in Properties.SelectedItems)
|
||||
{
|
||||
if (!matchList.Contains(item.Text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#region Implementation
|
||||
|
||||
private bool ItemFound(int index)
|
||||
{
|
||||
return index != -1;
|
||||
}
|
||||
|
||||
private int FindItemByString(string text)
|
||||
{
|
||||
for (int i = 0; i < Properties.Items.Count; i++)
|
||||
{
|
||||
if (Properties.Items[i].Text == text)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
36
mRemoteNGTests/Properties/AssemblyInfo.cs
Normal file
36
mRemoteNGTests/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("mRemoteNGTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("mRemoteNGTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("4e9583d3-2b1b-419d-bda5-f06e70e03b50")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
47
mRemoteNGTests/UI/Controls/CustomListViewTests.cs
Normal file
47
mRemoteNGTests/UI/Controls/CustomListViewTests.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using mRemoteNG.Controls;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Extensions.Forms;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Controls
|
||||
{
|
||||
public class CustomListViewTests
|
||||
{
|
||||
TestForm _testForm;
|
||||
mRemoteNG.Controls.ListView _listView;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_listView = new mRemoteNG.Controls.ListView();
|
||||
_listView.Name = "myTestListView";
|
||||
_listView.View = System.Windows.Forms.View.Tile;
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
_listView.Dispose();
|
||||
while (_listView.Disposing) ;
|
||||
_listView = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void a()
|
||||
{
|
||||
_testForm = new TestForm();
|
||||
_testForm.Controls.Add(_listView);
|
||||
_listView.Items.Add(new ListViewItem("mytestitem"));
|
||||
_testForm.Show();
|
||||
ListViewTester listviewTester = new ListViewTester("myTestListView", _testForm);
|
||||
while (true) ;
|
||||
Assert.That(listviewTester.Items.Count, Is.EqualTo(1));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
mRemoteNGTests/UI/Controls/TestForm.Designer.cs
generated
Normal file
48
mRemoteNGTests/UI/Controls/TestForm.Designer.cs
generated
Normal file
@@ -0,0 +1,48 @@
|
||||
namespace mRemoteNGTests.UI.Controls
|
||||
{
|
||||
partial class TestForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// TestForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.Name = "TestForm";
|
||||
this.Text = "TestForm";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
25
mRemoteNGTests/UI/Controls/TestForm.cs
Normal file
25
mRemoteNGTests/UI/Controls/TestForm.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Controls
|
||||
{
|
||||
public partial class TestForm : Form
|
||||
{
|
||||
public TestForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
120
mRemoteNGTests/UI/Controls/TestForm.resx
Normal file
120
mRemoteNGTests/UI/Controls/TestForm.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
41
mRemoteNGTests/UI/Forms/OptionsFormSetupAndTeardown.cs
Normal file
41
mRemoteNGTests/UI/Forms/OptionsFormSetupAndTeardown.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Forms;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.UI.Window;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms
|
||||
{
|
||||
public class OptionsFormSetupAndTeardown
|
||||
{
|
||||
protected OptionsForm _optionsForm;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void OnetimeSetup()
|
||||
{
|
||||
Runtime.MessageCollector = new MessageCollector(new ErrorAndInfoWindow(new DockContent()));
|
||||
Runtime.Log = Logger.GetSingletonInstance();
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_optionsForm = new OptionsForm();
|
||||
_optionsForm.Show();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
_optionsForm.Dispose();
|
||||
while (_optionsForm.Disposing) ;
|
||||
_optionsForm = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
44
mRemoteNGTests/UI/Forms/OptionsFormTests.cs
Normal file
44
mRemoteNGTests/UI/Forms/OptionsFormTests.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Controls;
|
||||
using mRemoteNG.Forms;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.UI.Window;
|
||||
using NUnit.Extensions.Forms;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsFormTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void ClickingCloseButtonClosesTheForm()
|
||||
{
|
||||
bool eventFired = false;
|
||||
_optionsForm.FormClosed += (o, e) => eventFired = true;
|
||||
ButtonTester cancelButton = new ButtonTester("CancelButtonControl", _optionsForm);
|
||||
cancelButton.Click();
|
||||
Assert.That(eventFired, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClickingOKButtonClosesTheForm()
|
||||
{
|
||||
bool eventFired = false;
|
||||
_optionsForm.FormClosed += (o, e) => eventFired = true;
|
||||
ButtonTester cancelButton = new ButtonTester("OkButton", _optionsForm);
|
||||
cancelButton.Click();
|
||||
Assert.That(eventFired, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ListViewContainsOptionsPages()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items.Count, Is.EqualTo(9));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNGTests.UI.Forms;
|
||||
using NUnit.Extensions.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms.OptionsPages
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsAdvancedPageTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void AdvancedPageLinkExistsInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[8].Text, Does.Match("Advanced"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AdvancedIconShownInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[8].ImageList, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelectingAdvancedPageLoadsSettings()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
listViewTester.Select("Advanced");
|
||||
CheckBoxTester checkboxTester = new CheckBoxTester("chkWriteLogFile", _optionsForm);
|
||||
Assert.That(checkboxTester.Text, Does.Match("Write log file"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNGTests.UI.Forms;
|
||||
using NUnit.Extensions.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms.OptionsPages
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsAppearancePageTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void AppearancePageLinkExistsInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[1].Text, Does.Match("Appearance"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IconShownInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[1].ImageList, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelectingAppearancePageLoadsSettings()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
listViewTester.Select("Appearance");
|
||||
CheckBoxTester checkboxTester = new CheckBoxTester("chkShowSystemTrayIcon", _optionsForm);
|
||||
Assert.That(checkboxTester.Text, Does.Match("show notification area icon"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNGTests.UI.Forms;
|
||||
using NUnit.Extensions.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms.OptionsPages
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsConnectionsPageTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void ConnectionsPageLinkExistsInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[3].Text, Does.Match("Connections"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConnectionsIconShownInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[3].ImageList, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelectingConnectionsPageLoadsSettings()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
listViewTester.Select("Connections");
|
||||
CheckBoxTester checkboxTester = new CheckBoxTester("chkSingleClickOnConnectionOpensIt", _optionsForm);
|
||||
Assert.That(checkboxTester.Text, Does.Match("Single click on connection"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNGTests.UI.Forms;
|
||||
using NUnit.Extensions.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms.OptionsPages
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsKeyboardPageTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void KeyboardPageLinkExistsInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[7].Text, Does.Match("Keyboard"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void KeyboardIconShownInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[7].ImageList, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelectingKeyboardPageLoadsSettings()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
listViewTester.Select("Keyboard");
|
||||
ButtonTester buttonTester = new ButtonTester("btnResetKeyboardShortcuts", _optionsForm);
|
||||
Assert.That(buttonTester.Text, Does.Match("Reset"));
|
||||
}
|
||||
}
|
||||
}
|
||||
34
mRemoteNGTests/UI/Forms/OptionsPages/OptionsSQLPageTests.cs
Normal file
34
mRemoteNGTests/UI/Forms/OptionsPages/OptionsSQLPageTests.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNGTests.UI.Forms;
|
||||
using NUnit.Extensions.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms.OptionsPages
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsSQLPageTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void SQLPageLinkExistsInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[4].Text, Does.Match("SQL Server"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SQLIconShownInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[4].ImageList, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelectingSQLPageLoadsSettings()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
listViewTester.Select("SQL Server");
|
||||
CheckBoxTester checkboxTester = new CheckBoxTester("chkUseSQLServer", _optionsForm);
|
||||
Assert.That(checkboxTester.Text, Does.Match("Use SQL"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNGTests.UI.Forms;
|
||||
using NUnit.Extensions.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms.OptionsPages
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsStartupExitPageTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void StartupExitPageLinkExistsInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[0].Text, Does.Match("Startup/Exit"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IconShownInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[0].ImageList, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelectingStartupExitPageLoadsSettings()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
listViewTester.Select("Startup/Exit");
|
||||
CheckBoxTester checkboxTester = new CheckBoxTester("chkSaveConsOnExit", _optionsForm);
|
||||
Assert.That(checkboxTester.Text, Does.Match("Save connections"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using NUnit.Extensions.Forms;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms.OptionsPages
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsTabsPanelPageTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void TabsPanelPageLinkExistsInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[2].Text, Does.Match("Tabs & Panels"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TabsPanelIconShownInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[2].ImageList, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelectingTabsPanelPageLoadsSettings()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
listViewTester.Select("Tabs & Panels");
|
||||
CheckBoxTester checkboxTester = new CheckBoxTester("chkAlwaysShowPanelTabs", _optionsForm);
|
||||
Assert.That(checkboxTester.Text, Does.Match("Always show panel tabs"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNGTests.UI.Forms;
|
||||
using NUnit.Extensions.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms.OptionsPages
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsThemePageTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void ThemePageLinkExistsInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[6].Text, Does.Match("Theme"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ThemeIconShownInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[6].ImageList, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelectingThemePageLoadsSettings()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
listViewTester.Select("Theme");
|
||||
ButtonTester buttonTester = new ButtonTester("btnThemeNew", _optionsForm);
|
||||
Assert.That(buttonTester.Text, Does.Match("New"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNGTests.UI.Forms;
|
||||
using NUnit.Extensions.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms.OptionsPages
|
||||
{
|
||||
[TestFixture]
|
||||
public class OptionsUpdatesPageTests : OptionsFormSetupAndTeardown
|
||||
{
|
||||
[Test]
|
||||
public void UpdatesPageLinkExistsInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[5].Text, Does.Match("Updates"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdatesIconShownInListView()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
Assert.That(listViewTester.Items[5].ImageList, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelectingUpdatesPageLoadsSettings()
|
||||
{
|
||||
ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
|
||||
listViewTester.Select("Updates");
|
||||
CheckBoxTester checkboxTester = new CheckBoxTester("chkCheckForUpdatesOnStartup", _optionsForm);
|
||||
Assert.That(checkboxTester.Text, Does.Match("Check for updates"));
|
||||
}
|
||||
}
|
||||
}
|
||||
49
mRemoteNGTests/UI/Forms/PasswordFormTests.cs
Normal file
49
mRemoteNGTests/UI/Forms/PasswordFormTests.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Extensions.Forms;
|
||||
using System.Threading.Tasks;
|
||||
using mRemoteNG.Forms;
|
||||
|
||||
namespace mRemoteNGTests.UI.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
public class PasswordFormTests
|
||||
{
|
||||
PasswordForm _passwordForm;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_passwordForm = new PasswordForm();
|
||||
_passwordForm.Show();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
_passwordForm.Dispose();
|
||||
while (_passwordForm.Disposing) ;
|
||||
_passwordForm = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PasswordFormText()
|
||||
{
|
||||
FormTester formTester = new FormTester("PasswordForm");
|
||||
Assert.That(formTester.Text, Does.Match("Password"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClickingCancelClosesPasswordForm()
|
||||
{
|
||||
bool eventFired = false;
|
||||
_passwordForm.FormClosed += (o, e) => eventFired = true;
|
||||
ButtonTester cancelButton = new ButtonTester("btnCancel", _passwordForm);
|
||||
cancelButton.Click();
|
||||
Assert.That(eventFired, Is.True);
|
||||
}
|
||||
}
|
||||
}
|
||||
138
mRemoteNGTests/UI/WindowListTests.cs
Normal file
138
mRemoteNGTests/UI/WindowListTests.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using mRemoteNG.UI.Window;
|
||||
|
||||
namespace mRemoteNGTests.UI
|
||||
{
|
||||
[TestFixture]
|
||||
public class WindowListTests
|
||||
{
|
||||
private WindowList _windowList;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_windowList = new WindowList();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
_windowList = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EmptyWhenInitialized()
|
||||
{
|
||||
Assert.That(_windowList, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WindowIsInListAfterBeingAdded()
|
||||
{
|
||||
BaseWindow window = new BaseWindow();
|
||||
_windowList.Add(window);
|
||||
Assert.That(_windowList, Has.Member(window));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WindowsAreInListAfterCallingAddRange()
|
||||
{
|
||||
BaseWindow window1 = new BaseWindow();
|
||||
BaseWindow window2 = new BaseWindow();
|
||||
BaseWindow window3 = new BaseWindow();
|
||||
BaseWindow[] windowArray = new BaseWindow[] {window1, window2, window3};
|
||||
_windowList.AddRange(windowArray);
|
||||
Assert.That(_windowList, Contains.Item(window1));
|
||||
Assert.That(_windowList, Contains.Item(window2));
|
||||
Assert.That(_windowList, Contains.Item(window3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CountReturnsCorrectNumberOfElements()
|
||||
{
|
||||
_windowList.Add(new BaseWindow());
|
||||
_windowList.Add(new BaseWindow());
|
||||
_windowList.Add(new BaseWindow());
|
||||
Assert.That(_windowList.Count, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IndexingByObjectReturnsTheCorrectObject()
|
||||
{
|
||||
BaseWindow window1 = new BaseWindow();
|
||||
BaseWindow window2 = new BaseWindow();
|
||||
_windowList.Add(window1);
|
||||
_windowList.Add(window2);
|
||||
Assert.That(_windowList[window1], Is.EqualTo(window1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IndexingByNumberReturnsTheCorrectObject()
|
||||
{
|
||||
BaseWindow window1 = new BaseWindow();
|
||||
BaseWindow window2 = new BaseWindow();
|
||||
_windowList.Add(window1);
|
||||
_windowList.Add(window2);
|
||||
Assert.That(_windowList[1], Is.EqualTo(window2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ThrowsExceptionWhenIndexingByObjectFails()
|
||||
{
|
||||
BaseWindow window1 = new BaseWindow();
|
||||
Assert.That(() => _windowList[window1], Throws.TypeOf<ArgumentOutOfRangeException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ItemIsNotInListAfterBeingRemoved()
|
||||
{
|
||||
BaseWindow window1 = new BaseWindow();
|
||||
BaseWindow window2 = new BaseWindow();
|
||||
_windowList.Add(window1);
|
||||
_windowList.Add(window2);
|
||||
_windowList.Remove(window1);
|
||||
Assert.That(() => _windowList[window1], Throws.TypeOf<ArgumentOutOfRangeException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ThrowsExceptionWhenIndexingPastListBounds()
|
||||
{
|
||||
BaseWindow window1 = new BaseWindow();
|
||||
_windowList.Add(window1);
|
||||
Assert.That(() => _windowList[100], Throws.TypeOf<ArgumentOutOfRangeException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CountIsReducedAfterItemRemoved()
|
||||
{
|
||||
BaseWindow window1 = new BaseWindow();
|
||||
BaseWindow window2 = new BaseWindow();
|
||||
_windowList.Add(window1);
|
||||
_windowList.Add(window2);
|
||||
_windowList.Remove(window1);
|
||||
Assert.That(_windowList.Count, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ListIsEmptyAfterLastItemRemoved()
|
||||
{
|
||||
BaseWindow window1 = new BaseWindow();
|
||||
_windowList.Add(window1);
|
||||
_windowList.Remove(window1);
|
||||
Assert.That(_windowList, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetWindowFromStringReturnsCorrectObject()
|
||||
{
|
||||
BaseWindow window1 = new BaseWindow();
|
||||
window1.SetFormText("TheWindowWeWant");
|
||||
BaseWindow window2 = new BaseWindow();
|
||||
window2.SetFormText("WeDontWantThisWindow");
|
||||
_windowList.Add(window1);
|
||||
_windowList.Add(window2);
|
||||
Assert.That(_windowList.FromString("TheWindowWeWant"), Is.EqualTo(window1));
|
||||
}
|
||||
}
|
||||
}
|
||||
148
mRemoteNGTests/mRemoteNGTests.csproj
Normal file
148
mRemoteNGTests/mRemoteNGTests.csproj
Normal file
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1453B37F-8621-499E-B0B2-6091F76DC0BB}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>mRemoteNGTests</RootNamespace>
|
||||
<AssemblyName>mRemoteNGTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\mRemoteV1\References\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NSubstitute, Version=1.10.0.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=3.2.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnitForms">
|
||||
<HintPath>nUnitForms\bin\NUnitForms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WeifenLuo.WinFormsUI.Docking, Version=2.5.0.15095, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\mRemoteV1\References\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="App\LoggerTests.cs" />
|
||||
<Compile Include="ListViewTester.cs" />
|
||||
<Compile Include="Config\Connections\SqlConnectionUpdateCheckerTests.cs" />
|
||||
<Compile Include="Config\Connections\SqlUpdateQueryBuilderTest.cs" />
|
||||
<Compile Include="Config\Connections\SqlUpdateTimerTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UI\Controls\CustomListViewTests.cs" />
|
||||
<Compile Include="UI\Controls\TestForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Controls\TestForm.Designer.cs">
|
||||
<DependentUpon>TestForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Forms\OptionsFormSetupAndTeardown.cs" />
|
||||
<Compile Include="UI\Forms\OptionsFormTests.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\OptionsAdvancedPageTests.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\OptionsAppearancePageTests.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\OptionsConnectionsPageTests.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\OptionsKeyboardPageTests.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\OptionsSQLPageTests.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\OptionsStartupExitPageTests.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\OptionsTabsPanelPageTests.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\OptionsThemePageTests.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\OptionsUpdatesPageTests.cs" />
|
||||
<Compile Include="UI\Forms\PasswordFormTests.cs" />
|
||||
<Compile Include="UI\WindowListTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\mRemoteV1\mRemoteV1.csproj">
|
||||
<Project>{4934a491-40bc-4e5b-9166-ea1169a220f6}</Project>
|
||||
<Name>mRemoteV1</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SharedLibraryNG\SharedLibraryNG.csproj">
|
||||
<Project>{0f615504-5f30-4cf2-8341-1de7fec95a23}</Project>
|
||||
<Name>SharedLibraryNG</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="UI\Controls\TestForm.resx">
|
||||
<DependentUpon>TestForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
75
mRemoteNGTests/nUnitForms/bin/Coverage.xsl
Normal file
75
mRemoteNGTests/nUnitForms/bin/Coverage.xsl
Normal file
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE internal [
|
||||
<!ENTITY nbsp " ">
|
||||
]>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
|
||||
|
||||
<xsl:template match="coverage">
|
||||
<html>
|
||||
<head>
|
||||
<title>Code Coverage Report</title>
|
||||
<style>BODY { font-family: Trebuchet MS; font-size: 10pt; }
|
||||
TD { font-family: Trebuchet MS; font-size: 10pt; }
|
||||
.title { font-size: 20pt; font-weight: bold; }
|
||||
.assembly { font-size: 14pt; }
|
||||
.module { color: navy; font-size: 8pt; }
|
||||
.method { color: maroon; font-size: 12pt; font-weight: bold; }
|
||||
.subtitle { color: black; font-size: 12pt; font-weight: bold; }
|
||||
.hdrcell { background-color: #DDEEFF; }
|
||||
.datacell { background-color: #FFFFEE; text-align: right; }
|
||||
.gooddatacell {background-color: #CCFFCC; text-align: right; }
|
||||
.hldatacell { background-color: #FFCCCC; text-align: right; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="title">Code Coverage Report</div>
|
||||
<p></p>
|
||||
<xsl:apply-templates select="module" />
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="module">
|
||||
<div class="assembly"><xsl:value-of select="@assembly"/></div>
|
||||
<div class="module"><xsl:value-of select="@name"/></div>
|
||||
<p></p>
|
||||
<xsl:apply-templates select="method"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="method">
|
||||
<div class="method"><xsl:value-of select="@class"/>.<xsl:value-of select="@name"/></div>
|
||||
<table border="1" cellpadding="3" cellspacing="0" bordercolor="black">
|
||||
<tr>
|
||||
<td class="hdrcell">Visit Count</td>
|
||||
<td class="hdrcell">Line</td>
|
||||
<td class="hdrcell">Column</td>
|
||||
<td class="hdrcell">End Line</td>
|
||||
<td class="hdrcell">End Column</td>
|
||||
<td class="hdrcell">Document</td>
|
||||
</tr>
|
||||
<xsl:apply-templates select="seqpnt"/>
|
||||
</table>
|
||||
<p></p>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="seqpnt">
|
||||
<tr>
|
||||
<td class="datacell">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@visitcount = 0">hldatacell</xsl:when>
|
||||
<xsl:when test="@visitcount != 0">gooddatacell</xsl:when>
|
||||
<xsl:otherwise>datacell</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@visitcount"/>
|
||||
</td>
|
||||
<td class="datacell"><xsl:value-of select="@line"/></td>
|
||||
<td class="datacell"><xsl:value-of select="@column"/></td>
|
||||
<td class="datacell"><xsl:value-of select="@endline"/></td>
|
||||
<td class="datacell"><xsl:value-of select="@endcolumn"/></td>
|
||||
<td class="datacell"><xsl:value-of select="@document"/></td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.Example.exe
Normal file
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.Example.exe
Normal file
Binary file not shown.
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.dll
Normal file
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.dll
Normal file
Binary file not shown.
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.exe
Normal file
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.exe
Normal file
Binary file not shown.
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.Test.dll
Normal file
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.Test.dll
Normal file
Binary file not shown.
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.dll
Normal file
BIN
mRemoteNGTests/nUnitForms/bin/NUnitForms.dll
Normal file
Binary file not shown.
2320
mRemoteNGTests/nUnitForms/bin/NUnitForms.xml
Normal file
2320
mRemoteNGTests/nUnitForms/bin/NUnitForms.xml
Normal file
File diff suppressed because it is too large
Load Diff
463
mRemoteNGTests/nUnitForms/bin/TestResult.xml
Normal file
463
mRemoteNGTests/nUnitForms/bin/TestResult.xml
Normal file
@@ -0,0 +1,463 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<!--This file represents the results of running a test suite-->
|
||||
<test-results name="C:\Documents and Settings\Maxon Family\Desktop\nf\NUnitForms-v1.3.1-src\build\bin\Project1.nunit" total="180" failures="0" not-run="3" date="11/6/2004" time="4:12 PM">
|
||||
<test-suite name="C:\Documents and Settings\Maxon Family\Desktop\nf\NUnitForms-v1.3.1-src\build\bin\Project1.nunit" success="True" time="6.234375" asserts="0">
|
||||
<results>
|
||||
<test-suite name="C:\Documents and Settings\Maxon Family\Desktop\nf\NUnitForms-v1.3.1-src\build\bin\NUnitForms.Test.dll" success="True" time="5.90625" asserts="0">
|
||||
<results>
|
||||
<test-suite name="NUnit" success="True" time="5.875" asserts="0">
|
||||
<results>
|
||||
<test-suite name="Extensions" success="True" time="5.859375" asserts="0">
|
||||
<results>
|
||||
<test-suite name="Forms" success="True" time="5.8125" asserts="0">
|
||||
<results>
|
||||
<test-suite name="Test" success="True" time="5.046875" asserts="0">
|
||||
<results>
|
||||
<test-suite name="FactoryTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FactoryTest.New" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FactoryTest.NewException" executed="True" success="True" time="0.000" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="SupportsAssertExtensionTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertExtensionTest.BaseClassIsTrue" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertExtensionTest.BaseClassIsFalse" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertExtensionTest.BaseClassAreEqual" executed="True" success="True" time="0.016" asserts="10" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertExtensionTest.BaseClassAreSame" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertExtensionTest.BaseClassAssertFail" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertExtensionTest.BaseClassAssertFailMessage" executed="True" success="True" time="0.000" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="SupportsAssertionExtensionTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertionExtensionTest.BaseClassAssert" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertionExtensionTest.BaseClassAssertEquals" executed="True" success="True" time="0.000" asserts="8" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertionExtensionTest.BaseClassAssertSame" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertionExtensionTest.BaseClassAssertFail" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportsAssertionExtensionTest.BaseClassAssertFailMessage" executed="True" success="True" time="0.000" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="SupportCurrentFormPropertyTest" success="True" time="0.046875" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportCurrentFormPropertyTest.ButtonClick" executed="True" success="True" time="0.047" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="SupportFormSpecificationTest" success="True" time="0" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportFormSpecificationTest.ButtonClick" executed="True" success="True" time="0.000" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="SupportFormTypeTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SupportFormTypeTest.ButtonClick" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ButtonTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ButtonTest.ButtonClick" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ButtonTest.ButtonText" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ButtonTest.FireEvent" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ButtonTest.FireEventWithArg" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="CheckBoxTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.CheckBoxTest.Check" executed="True" success="True" time="0.016" asserts="3" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.CheckBoxTest.UnCheck" executed="True" success="True" time="0.000" asserts="3" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.CheckBoxTest.UnCheck2" executed="True" success="True" time="0.016" asserts="3" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.CheckBoxTest.ToggleWithValue" executed="True" success="True" time="0.000" asserts="3" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ComboBoxTest" success="True" time="0.0625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ComboBoxTest.TextBox" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ComboBoxTest.Select" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ComboBoxTest.SelectByText" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ComboBoxTest.SelectByBadText" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ComboBoxTest.MethodInvokeOnControlTester" executed="True" success="True" time="0.016" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ContextMenuTest" success="True" time="0.078125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ContextMenuTest.ContextMenuClick" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ContextMenuTest.GeneratedTest" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ContextMenuTest.NoSuchControlFinder" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ContextMenuTest.AmbiguousNameBecauseWeUseTextNotNameForMenuItems" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ContextMenuTest.AmbiguousNameBecauseInSubMenusButNotQualified" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ContextMenuTest.NotAmbiguousNameBecauseInSubMenus" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ContextMenuTest.AmbiguousNameBecauseInTwoMenus" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ContextMenuTest.NotAmbiguousNameBecauseInTwoMenusButQualified" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ContextMenuTest.DontNeedToSpecifyWhichForm" executed="True" success="True" time="0.000" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ControlCollectionTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlCollectionTest.Count" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlCollectionTest.GetEnumerator" executed="True" success="True" time="0.000" asserts="7" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlCollectionTest.AddCollection" executed="True" success="True" time="0.000" asserts="7" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlCollectionTest.Indexer" executed="True" success="True" time="0.000" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ControlTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlTest.ControlText" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlTest.ControlClick" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlTest.Property" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ControlNameTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlNameTest.AmbiguousName" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlNameTest.NoSuchName" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlNameTest.FindNestedControl" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ControlNameTest.UseAUserControlCustomTester" executed="True" success="True" time="0.000" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="DatabindingTest" success="True" time="0.1875" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.DatabindingTest.CheckBoxDataSetBinding" executed="True" success="True" time="0.125" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.DatabindingTest.TextBoxDataSetBinding" executed="True" success="True" time="0.047" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.DatabindingTest.DataSetBindingWithGenericPropertySetter" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="DynamicControlsTest" success="True" time="0.0625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.DynamicControlsTest.DynamicButtonClick" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.DynamicControlsTest.DynamicControlsWithDuplicateNameIsAmbiguous" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.DynamicControlsTest.DynamicControlsWithDuplicateNameCount" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.DynamicControlsTest.DynamicControlsWithDuplicateNameEnumerator" executed="True" success="True" time="0.016" asserts="3" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.DynamicControlsTest.DynamicControlsWithDuplicateNameWorksByIndex" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.DynamicControlsTest.DynamicControlsWithDuplicateNameNotFound" executed="True" success="True" time="0.000" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="FormCollectionTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormCollectionTest.Contains" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormCollectionTest.Count" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormCollectionTest.GetEnumerator" executed="True" success="True" time="0.000" asserts="7" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormCollectionTest.AddCollection" executed="True" success="True" time="0.000" asserts="7" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormCollectionTest.Indexer" executed="True" success="True" time="0.000" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="FormFinderTest" success="True" time="0.046875" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormFinderTest.FindOneForm" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormFinderTest.FindOneFormOutOfTwo" executed="True" success="True" time="0.000" asserts="3" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormFinderTest.FindAll" executed="True" success="True" time="0.016" asserts="4" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormFinderTest.FindOneFormWhenThereAreTwo" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormFinderTest.FindOneFormWhenThereAreNone" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormFinderTest.FindTwoFormsWhenThereAreTwo" executed="True" success="True" time="0.000" asserts="3" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="FormTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.FormTest.Close" executed="True" success="True" time="0.016" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="LabelTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.LabelTest.LabelText" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.LabelTest.LabelClick" executed="True" success="True" time="0.000" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="LinkLabelTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.LinkLabelTest.LinkLabelClick" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ListBoxTest" success="True" time="0.0625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ListBoxTest.ListBoxPropertyAsserts" executed="True" success="True" time="0.016" asserts="3" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ListBoxTest.ListBoxSelection" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ListBoxTest.ListBoxMultiSelection" executed="True" success="True" time="0.016" asserts="5" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ListBoxTest.SelectDoesNotExist" executed="True" success="True" time="0.016" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="MainMenuTest" success="True" time="0.09375" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.PlainMenu" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.QualifiedMenu" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.SubMenuItem" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.PartiallyQualifiedSubMenuItem" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.FullyQualifiedMenuItem" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.FormQualifiedMenuItem" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.ItemWithAltKey" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.ItemWithDot" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.CantUseAmpsInName" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.CantUseDotInName" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MainMenuTest.MenuPopup" executed="True" success="True" time="0.016" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="MenuItemCollectionTest" success="True" time="0" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MenuItemCollectionTest.Count" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MenuItemCollectionTest.GetEnumerator" executed="True" success="True" time="0.000" asserts="7" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MenuItemCollectionTest.AddCollection" executed="True" success="True" time="0.000" asserts="7" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MenuItemCollectionTest.Indexer" executed="True" success="True" time="0.000" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ModalDialogsTest" success="True" time="0.0625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ModalDialogsTest.TestMessageBoxOK" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ModalDialogsTest.TestMessageBoxCancel" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ModalDialogsTest.TestSimpleMessageBox" executed="True" success="True" time="0.000" asserts="3" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ModalDialogsTest.TestOKCancelMessageBox" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ModalDialogsTest.UnexpectedModalIsClosedAndFails" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ModalDialogsTest.UnexpectedModalIsClosedAndFailsNoTitle" executed="True" success="True" time="0.016" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ModalFormsTest" success="True" time="0.046875" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ModalFormsTest.TestModalForm" executed="True" success="True" time="0.031" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ModalFormsTest.TestModalFormByString" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.ModalFormsTest.ModalFormDoesntShow" executed="True" success="True" time="0.000" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="MouseControllerTest" success="True" time="3.375" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.PositioningUnits" executed="True" success="True" time="0.109" asserts="12" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.PositioningUnitsWorld" executed="True" success="True" time="0.047" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.PositioningInForm" executed="True" success="True" time="0.047" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.PositioningInControl" executed="True" success="True" time="0.047" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.MissingControl" executed="True" success="True" time="0.047" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.PositioningEvents" executed="True" success="True" time="0.047" asserts="9" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.Hovering" executed="True" success="True" time="2.453" asserts="6" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.Disposing" executed="True" success="True" time="0.063" asserts="3" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.Buttons" executed="True" success="True" time="0.047" asserts="6" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.ButtonEvents" executed="True" success="True" time="0.047" asserts="4" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.XButtons" executed="False">
|
||||
<reason>
|
||||
<message><![CDATA[Unsure of the issue here. Investigate]]></message>
|
||||
</reason>
|
||||
</test-case>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.XButtonEvents" executed="False">
|
||||
<reason>
|
||||
<message><![CDATA[Unsure of the issue here. Investigate]]></message>
|
||||
</reason>
|
||||
</test-case>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.Clicking" executed="True" success="True" time="0.063" asserts="3" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.DoubleClicking" executed="True" success="True" time="0.047" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.Dragging" executed="True" success="True" time="0.047" asserts="14" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.DragNull" executed="True" success="True" time="0.031" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.DragOdd" executed="True" success="True" time="0.047" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.DragEmpty" executed="True" success="True" time="0.047" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.Modifiers" executed="False">
|
||||
<reason>
|
||||
<message><![CDATA[Unsure of the issue here. Investigate]]></message>
|
||||
</reason>
|
||||
</test-case>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.ModifiersInvalid1" executed="True" success="True" time="0.047" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MouseControllerTest.ModifiersInvalid2" executed="True" success="True" time="0.047" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="MultipleFormsTest" success="True" time="0.109375" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MultipleFormsTest.TestMultipleForms" executed="True" success="True" time="0.047" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MultipleFormsTest.TestMultipleFormsShouldNotFindLastButton" executed="True" success="True" time="0.031" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MultipleFormsTest.DontNeedToSpecifyForm" executed="True" success="True" time="0.016" asserts="4" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.MultipleFormsTest.AmbiguousNameWithMultipleForms" executed="True" success="True" time="0.016" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="RadioButtonTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.RadioButtonTest.SelectOption" executed="True" success="True" time="0.031" asserts="10" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="SimpleAPIKeyboardTest" success="True" time="0.140625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SimpleAPIKeyboardTest.PressEnterClicksButton" executed="True" success="True" time="0.047" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SimpleAPIKeyboardTest.TextBox" executed="True" success="True" time="0.047" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SimpleAPIKeyboardTest.ElaborateInputTest" executed="True" success="True" time="0.047" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="SimpleAPIMouseTest" success="True" time="0.203125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SimpleAPIMouseTest.CorrectMouseClicking" executed="True" success="True" time="0.047" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SimpleAPIMouseTest.CanClickMultipleControls" executed="True" success="True" time="0.047" asserts="4" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SimpleAPIMouseTest.IncorrectMouseClicking" executed="True" success="True" time="0.047" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.SimpleAPIMouseTest.IncorrectMouseClickingSimplifiedAPI" executed="True" success="True" time="0.063" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="TabControlTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.TabControlTest.TabControl" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.TabControlTest.ClickNonVisibleButton" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.TabControlTest.ClickVisibleButton" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="TextBoxTest" success="True" time="0.0625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.TextBoxTest.TextBox" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.TextBoxTest.DataSetBinding" executed="True" success="True" time="0.031" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.TextBoxTest.DataSetBindingWithGenericPropertySetter" executed="True" success="True" time="0.031" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="TreeViewTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Test.TreeViewTest.AfterSelectNode" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Test.TreeViewTest.AfterSelectNodeSubNodes" executed="True" success="True" time="0.000" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="Recorder" success="True" time="0.71875" asserts="0">
|
||||
<results>
|
||||
<test-suite name="Test" success="True" time="0.703125" asserts="0">
|
||||
<results>
|
||||
<test-suite name="CheckBoxRecorderTest" success="True" time="0.140625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.CheckBoxRecorderTest.CheckUnCheck" executed="True" success="True" time="0.141" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ComboBoxRecorderTest" success="True" time="0.078125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.ComboBoxRecorderTest.ComboBoxEnter" executed="True" success="True" time="0.031" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.ComboBoxRecorderTest.ComboBoxSelect" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.ComboBoxRecorderTest.ComboBoxEnterAndSelect" executed="True" success="True" time="0.031" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="DynamicControlsRecorderTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.DynamicControlsRecorderTest.DynamicControlRecorded" executed="True" success="True" time="0.031" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="EnterTextCollapsingProcessorTest" success="True" time="0" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.EnterTextCollapsingProcessorTest.CanCollapse" executed="True" success="True" time="0.000" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.EnterTextCollapsingProcessorTest.DontCollapseDifferentControls" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.EnterTextCollapsingProcessorTest.DontCollapseDifferentMethods" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.EnterTextCollapsingProcessorTest.CanCollapseMoreComplex" executed="True" success="True" time="0.000" asserts="5" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="LinkButtonRecorderTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.LinkButtonRecorderTest.Click" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ListBoxRecorderTest" success="True" time="0.078125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.ListBoxRecorderTest.SelectItem" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.ListBoxRecorderTest.MutlipleSelection" executed="True" success="True" time="0.031" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.ListBoxRecorderTest.SingleSelectBox" executed="True" success="True" time="0.031" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ListenerTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.ListenerTest.Listen" executed="True" success="True" time="0.016" asserts="4" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="MenuItemRecorderTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.MenuItemRecorderTest.MenuItemClick" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="MultipleFormsTest" success="True" time="0.109375" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.MultipleFormsTest.FormClose" executed="True" success="True" time="0.031" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.MultipleFormsTest.EventCausesAnother" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.MultipleFormsTest.MultipleForms" executed="True" success="True" time="0.031" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.MultipleFormsTest.NamesShouldAdapt" executed="True" success="True" time="0.031" asserts="4" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="NameResolverTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.NameResolverTest.AmbiguousButton" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="RadioButtonRecorderTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.RadioButtonRecorderTest.Click" executed="True" success="True" time="0.031" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="TabControlRecorderTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.TabControlRecorderTest.TabControlSelectIndex" executed="True" success="True" time="0.031" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="TestWriterTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.TestWriterTest.SimpleButton" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="TextBoxRecorderTest" success="True" time="0.0625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.TextBoxRecorderTest.TextBoxEnter" executed="True" success="True" time="0.031" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.TextBoxRecorderTest.ProgrammaticallyChangeTextIsNotRecorded" executed="True" success="True" time="0.016" asserts="2" />
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.TextBoxRecorderTest.ProgrammaticallyChangeTextIsNotRecordedTwoBoxes" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="TreeViewRecorderTest" success="True" time="0.015625" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.Recorder.Test.TreeViewRecorderTest.TreeViewAfterSelect" executed="True" success="True" time="0.016" asserts="2" />
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="C:\Documents and Settings\Maxon Family\Desktop\nf\NUnitForms-v1.3.1-src\build\bin\NUnitForms.Example.exe" success="True" time="0.3125" asserts="0">
|
||||
<results>
|
||||
<test-suite name="NUnit" success="True" time="0.3125" asserts="0">
|
||||
<results>
|
||||
<test-suite name="Extensions" success="True" time="0.3125" asserts="0">
|
||||
<results>
|
||||
<test-suite name="Forms" success="True" time="0.296875" asserts="0">
|
||||
<results>
|
||||
<test-suite name="ExampleApplication" success="True" time="0.296875" asserts="0">
|
||||
<results>
|
||||
<test-suite name="Test" success="True" time="0.296875" asserts="0">
|
||||
<results>
|
||||
<test-suite name="AppTest" success="True" time="0.046875" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.AppTest.ButtonLabelShouldDefaultToZero" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.AppTest.ButtonLabelShouldBeOneAfterClicked" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.AppTest.ButtonLabelShouldBeTwoAfterClickedTwice" executed="True" success="True" time="0.016" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.AppTest.ShowModalButtonShouldShowModalDialog" executed="True" success="True" time="0.016" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ControllerTest" success="True" time="0.03125" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.ControllerTest.ShowModal" executed="True" success="True" time="0.016" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.ControllerTest.Count" executed="True" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.ControllerTest.Data" executed="True" success="True" time="0.000" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="FormTest" success="True" time="0.21875" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.FormTest.ButtonLabelShouldBeControllerValue" executed="True" success="True" time="0.047" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.FormTest.CountButtonShouldInvokeControllerCount" executed="True" success="True" time="0.047" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.FormTest.ShowModalButtonShouldInvokeControllerShowModal" executed="True" success="True" time="0.063" asserts="0" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.FormTest.ButtonLabelShouldUpdateAfterClick" executed="True" success="True" time="0.063" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite name="ModelTest" success="True" time="0" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.ModelTest.DefaultValue" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.ModelTest.BusinessLogic" executed="True" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnit.Extensions.Forms.ExampleApplication.Test.ModelTest.MultipleBusinessLogic" executed="True" success="True" time="0.000" asserts="1" />
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</test-results>
|
||||
BIN
mRemoteNGTests/nUnitForms/bin/nmock.dll
Normal file
BIN
mRemoteNGTests/nUnitForms/bin/nmock.dll
Normal file
Binary file not shown.
BIN
mRemoteNGTests/nUnitForms/bin/nunit.core.dll
Normal file
BIN
mRemoteNGTests/nUnitForms/bin/nunit.core.dll
Normal file
Binary file not shown.
BIN
mRemoteNGTests/nUnitForms/bin/nunit.framework.dll
Normal file
BIN
mRemoteNGTests/nUnitForms/bin/nunit.framework.dll
Normal file
Binary file not shown.
27
mRemoteNGTests/nUnitForms/license.txt
Normal file
27
mRemoteNGTests/nUnitForms/license.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
/********************************************************************************************************************
|
||||
'
|
||||
' Copyright (c) 2003-2004, Luke T. Maxon
|
||||
' All rights reserved.
|
||||
'
|
||||
' Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
' that the following conditions are met:
|
||||
'
|
||||
' * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
' following disclaimer.
|
||||
'
|
||||
' * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
' the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
'
|
||||
' * Neither the name of the author nor the names of its contributors may be used to endorse or
|
||||
' promote products derived from this software without specific prior written permission.
|
||||
'
|
||||
' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
' WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
' PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
' ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
' LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
' INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
' OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
' IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'
|
||||
'*******************************************************************************************************************/
|
||||
5
mRemoteNGTests/packages.config
Normal file
5
mRemoteNGTests/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NSubstitute" version="1.10.0.0" targetFramework="net45" />
|
||||
<package id="NUnit" version="3.2.0" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -1,14 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
VisualStudioVersion = 12.0.40629.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = ".\mRemoteV1\mRemoteV1", ".\mRemoteV1\mRemoteV1.csproj", "{4934A491-40BC-4E5B-9166-EA1169A220F6}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mRemoteV1", "mRemoteV1\mRemoteV1.csproj", "{4934A491-40BC-4E5B-9166-EA1169A220F6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23} = {0F615504-5F30-4CF2-8341-1DE7FEC95A23}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibraryNG", ".\SharedLibraryNG\SharedLibraryNG.csproj", "{0F615504-5F30-4CF2-8341-1DE7FEC95A23}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibraryNG", "SharedLibraryNG\SharedLibraryNG.csproj", "{0F615504-5F30-4CF2-8341-1DE7FEC95A23}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mRemoteNGTests", "mRemoteNGTests\mRemoteNGTests.csproj", "{1453B37F-8621-499E-B0B2-6091F76DC0BB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -34,6 +36,14 @@ Global
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release Portable|Any CPU.Build.0 = Release|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1453B37F-8621-499E-B0B2-6091F76DC0BB}.Debug Portable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1453B37F-8621-499E-B0B2-6091F76DC0BB}.Debug Portable|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1453B37F-8621-499E-B0B2-6091F76DC0BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1453B37F-8621-499E-B0B2-6091F76DC0BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1453B37F-8621-499E-B0B2-6091F76DC0BB}.Release Portable|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1453B37F-8621-499E-B0B2-6091F76DC0BB}.Release Portable|Any CPU.Build.0 = Release|Any CPU
|
||||
{1453B37F-8621-499E-B0B2-6091F76DC0BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1453B37F-8621-499E-B0B2-6091F76DC0BB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Binary file not shown.
@@ -1,94 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
namespace mRemoteNG.App.Info
|
||||
{
|
||||
public class General
|
||||
{
|
||||
public static readonly string URLHome = "http://www.mremoteng.org/";
|
||||
public static readonly string URLDonate = "http://donate.mremoteng.org/";
|
||||
public static readonly string URLForum = "http://forum.mremoteng.org/";
|
||||
public static readonly string URLBugs = "http://bugs.mremoteng.org/";
|
||||
public static readonly string HomePath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath;
|
||||
public static string EncryptionKey = "mR3m";
|
||||
public static string ReportingFilePath = "";
|
||||
public static readonly string PuttyPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\PuTTYNG.exe";
|
||||
public static string UserAgent
|
||||
{
|
||||
get
|
||||
{
|
||||
List<string> details = new List<string>();
|
||||
details.Add("compatible");
|
||||
if (System.Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
{
|
||||
details.Add(string.Format("Windows NT {0}.{1}", System.Environment.OSVersion.Version.Major, System.Environment.OSVersion.Version.Minor));
|
||||
}
|
||||
else
|
||||
{
|
||||
details.Add(System.Environment.OSVersion.VersionString);
|
||||
}
|
||||
if (Tools.EnvironmentInfo.IsWow64)
|
||||
{
|
||||
details.Add("WOW64");
|
||||
}
|
||||
details.Add(Thread.CurrentThread.CurrentUICulture.Name);
|
||||
details.Add(string.Format(".NET CLR {0}", System.Environment.Version));
|
||||
string detailsString = string.Join("; ", details.ToArray());
|
||||
|
||||
return string.Format("Mozilla/4.0 ({0}) {1}/{2}", detailsString, System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Settings
|
||||
{
|
||||
#if !PORTABLE
|
||||
public static readonly string SettingsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName;
|
||||
#else
|
||||
public static readonly string SettingsPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath;
|
||||
#endif
|
||||
public static readonly string LayoutFileName = "pnlLayout.xml";
|
||||
public static readonly string ExtAppsFilesName = "extApps.xml";
|
||||
public const string ThemesFileName = "Themes.xml";
|
||||
}
|
||||
|
||||
public class Update
|
||||
{
|
||||
public static string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
#if DEBUG
|
||||
return "update-debug.txt";
|
||||
#else
|
||||
if ((string) (My.Settings.Default.UpdateChannel.ToLowerInvariant()) == "debug")
|
||||
{
|
||||
return "update-debug.txt";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "update.txt";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Connections
|
||||
{
|
||||
public static readonly string DefaultConnectionsPath = App.Info.Settings.SettingsPath;
|
||||
public static readonly string DefaultConnectionsFile = "confCons.xml";
|
||||
public static readonly string DefaultConnectionsFileNew = "confConsNew.xml";
|
||||
public static readonly double ConnectionFileVersion = 2.5;
|
||||
}
|
||||
|
||||
public class Credentials
|
||||
{
|
||||
public static readonly string CredentialsPath = App.Info.Settings.SettingsPath;
|
||||
public static readonly string CredentialsFile = "confCreds.xml";
|
||||
public static readonly string CredentialsFileNew = "confCredsNew.xml";
|
||||
public static readonly double CredentialsFileVersion = 1.0;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.Forms;
|
||||
using mRemoteNG.Config.Connections;
|
||||
|
||||
|
||||
namespace mRemoteNG.App
|
||||
@@ -16,13 +17,13 @@ namespace mRemoteNG.App
|
||||
|
||||
using (ExportForm exportForm = new ExportForm())
|
||||
{
|
||||
if (Tree.Node.GetNodeType(selectedTreeNode) == Tree.Node.Type.Container)
|
||||
if (Tree.Node.GetNodeType(selectedTreeNode) == Tree.TreeNodeType.Container)
|
||||
{
|
||||
exportForm.SelectedFolder = selectedTreeNode;
|
||||
}
|
||||
else if (Tree.Node.GetNodeType(selectedTreeNode) == Tree.Node.Type.Connection)
|
||||
else if (Tree.Node.GetNodeType(selectedTreeNode) == Tree.TreeNodeType.Connection)
|
||||
{
|
||||
if (Tree.Node.GetNodeType(selectedTreeNode.Parent) == Tree.Node.Type.Container)
|
||||
if (Tree.Node.GetNodeType(selectedTreeNode.Parent) == Tree.TreeNodeType.Container)
|
||||
{
|
||||
exportForm.SelectedFolder = selectedTreeNode.Parent;
|
||||
}
|
||||
@@ -62,29 +63,25 @@ namespace mRemoteNG.App
|
||||
}
|
||||
}
|
||||
|
||||
private static void SaveExportFile(string fileName, mRemoteNG.Config.Connections.Save.Format saveFormat, TreeNode rootNode, Security.Save saveSecurity)
|
||||
private static void SaveExportFile(string fileName, ConnectionsSaver.Format saveFormat, TreeNode rootNode, Security.Save saveSecurity)
|
||||
{
|
||||
bool previousTimerEnabled = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (Runtime.TimerSqlWatcher != null)
|
||||
if (Runtime.SQLConnProvider != null)
|
||||
{
|
||||
previousTimerEnabled = Runtime.TimerSqlWatcher.Enabled;
|
||||
Runtime.TimerSqlWatcher.Enabled = false;
|
||||
Runtime.SQLConnProvider.Disable();
|
||||
}
|
||||
|
||||
Config.Connections.Save connectionsSave = new Config.Connections.Save();
|
||||
ConnectionsSaver connectionsSave = new ConnectionsSaver();
|
||||
connectionsSave.Export = true;
|
||||
connectionsSave.ConnectionFileName = fileName;
|
||||
connectionsSave.SaveFormat = saveFormat;
|
||||
|
||||
connectionsSave.ConnectionList = Runtime.ConnectionList;
|
||||
connectionsSave.ContainerList = Runtime.ContainerList;
|
||||
connectionsSave.RootTreeNode = rootNode;
|
||||
|
||||
connectionsSave.SaveSecurity = saveSecurity;
|
||||
|
||||
connectionsSave.SaveConnections();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -93,11 +90,11 @@ namespace mRemoteNG.App
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Runtime.TimerSqlWatcher != null)
|
||||
if (Runtime.SQLConnProvider != null)
|
||||
{
|
||||
Runtime.TimerSqlWatcher.Enabled = previousTimerEnabled;
|
||||
Runtime.SQLConnProvider.Enable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using mRemoteNG.My;
|
||||
using PSTaskDialog;
|
||||
using mRemoteNG.Tree;
|
||||
|
||||
|
||||
namespace mRemoteNG.App
|
||||
@@ -68,12 +69,12 @@ namespace mRemoteNG.App
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
cTaskDialog.ShowTaskDialogBox(System.Windows.Forms.Application.ProductName, Language.strImportFileFailedMainInstruction, string.Format(Language.strImportFileFailedContent, fileName), Tools.Misc.GetExceptionMessageRecursive(ex), "", "", "", "", eTaskDialogButtons.OK, eSysIcons.Error, eSysIcons.Error);
|
||||
cTaskDialog.ShowTaskDialogBox(System.Windows.Forms.Application.ProductName, Language.strImportFileFailedMainInstruction, string.Format(Language.strImportFileFailedContent, fileName), Tools.MiscTools.GetExceptionMessageRecursive(ex), "", "", "", "", eTaskDialogButtons.OK, eSysIcons.Error, eSysIcons.Error);
|
||||
}
|
||||
}
|
||||
|
||||
parentTreeNode.Expand();
|
||||
Container.Info parentContainer = (Container.Info)parentTreeNode.Tag;
|
||||
Container.ContainerInfo parentContainer = (Container.ContainerInfo)parentTreeNode.Tag;
|
||||
if (parentContainer != null)
|
||||
{
|
||||
parentContainer.IsExpanded = true;
|
||||
@@ -93,8 +94,8 @@ namespace mRemoteNG.App
|
||||
{
|
||||
try
|
||||
{
|
||||
TreeNode rootTreeNode = Tree.Node.TreeView.Nodes[0];
|
||||
TreeNode selectedTreeNode = Tree.Node.TreeView.SelectedNode;
|
||||
TreeNode rootTreeNode = ConnectionTree.TreeView.Nodes[0];
|
||||
TreeNode selectedTreeNode = ConnectionTree.TreeView.SelectedNode;
|
||||
|
||||
TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode);
|
||||
if (parentTreeNode == null)
|
||||
@@ -105,7 +106,7 @@ namespace mRemoteNG.App
|
||||
Config.Import.ActiveDirectory.Import(ldapPath, parentTreeNode);
|
||||
|
||||
parentTreeNode.Expand();
|
||||
Container.Info parentContainer = (Container.Info)parentTreeNode.Tag;
|
||||
Container.ContainerInfo parentContainer = (Container.ContainerInfo)parentTreeNode.Tag;
|
||||
if (parentContainer != null)
|
||||
{
|
||||
parentContainer.IsExpanded = true;
|
||||
@@ -119,12 +120,12 @@ namespace mRemoteNG.App
|
||||
}
|
||||
}
|
||||
|
||||
public static void ImportFromPortScan(IEnumerable hosts, Connection.Protocol.Protocols protocol)
|
||||
public static void ImportFromPortScan(IEnumerable hosts, Connection.Protocol.ProtocolType protocol)
|
||||
{
|
||||
try
|
||||
{
|
||||
TreeNode rootTreeNode = Tree.Node.TreeView.Nodes[0];
|
||||
TreeNode selectedTreeNode = Tree.Node.TreeView.SelectedNode;
|
||||
TreeNode rootTreeNode = ConnectionTree.TreeView.Nodes[0];
|
||||
TreeNode selectedTreeNode = ConnectionTree.TreeView.SelectedNode;
|
||||
|
||||
TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode);
|
||||
if (parentTreeNode == null)
|
||||
@@ -135,7 +136,7 @@ namespace mRemoteNG.App
|
||||
Config.Import.PortScan.Import(hosts, protocol, parentTreeNode);
|
||||
|
||||
parentTreeNode.Expand();
|
||||
Container.Info parentContainer = (Container.Info)parentTreeNode.Tag;
|
||||
Container.ContainerInfo parentContainer = (Container.ContainerInfo)parentTreeNode.Tag;
|
||||
if (parentContainer != null)
|
||||
{
|
||||
parentContainer.IsExpanded = true;
|
||||
@@ -189,11 +190,11 @@ namespace mRemoteNG.App
|
||||
|
||||
private static TreeNode GetContainerTreeNode(TreeNode treeNode)
|
||||
{
|
||||
if ((Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Root) || (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Container))
|
||||
if ((Tree.Node.GetNodeType(treeNode) == Tree.TreeNodeType.Root) || (Tree.Node.GetNodeType(treeNode) == Tree.TreeNodeType.Container))
|
||||
{
|
||||
return treeNode;
|
||||
}
|
||||
else if (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Connection)
|
||||
else if (Tree.Node.GetNodeType(treeNode) == Tree.TreeNodeType.Connection)
|
||||
{
|
||||
return treeNode.Parent;
|
||||
}
|
||||
|
||||
10
mRemoteV1/App/Info/ConnectionsFileInfo.cs
Normal file
10
mRemoteV1/App/Info/ConnectionsFileInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace mRemoteNG.App.Info
|
||||
{
|
||||
public class ConnectionsFileInfo
|
||||
{
|
||||
public static readonly string DefaultConnectionsPath = SettingsFileInfo.SettingsPath;
|
||||
public static readonly string DefaultConnectionsFile = "confCons.xml";
|
||||
public static readonly string DefaultConnectionsFileNew = "confConsNew.xml";
|
||||
public static readonly double ConnectionFileVersion = 2.5;
|
||||
}
|
||||
}
|
||||
10
mRemoteV1/App/Info/CredentialsFileInfo.cs
Normal file
10
mRemoteV1/App/Info/CredentialsFileInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace mRemoteNG.App.Info
|
||||
{
|
||||
public class CredentialsFileInfo
|
||||
{
|
||||
public static readonly string CredentialsPath = SettingsFileInfo.SettingsPath;
|
||||
public static readonly string CredentialsFile = "confCreds.xml";
|
||||
public static readonly string CredentialsFileNew = "confCredsNew.xml";
|
||||
public static readonly double CredentialsFileVersion = 1.0;
|
||||
}
|
||||
}
|
||||
44
mRemoteV1/App/Info/GeneralAppInfo.cs
Normal file
44
mRemoteV1/App/Info/GeneralAppInfo.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
namespace mRemoteNG.App.Info
|
||||
{
|
||||
public class GeneralAppInfo
|
||||
{
|
||||
public static readonly string URLHome = "http://www.mremoteng.org/";
|
||||
public static readonly string URLDonate = "http://donate.mremoteng.org/";
|
||||
public static readonly string URLForum = "http://forum.mremoteng.org/";
|
||||
public static readonly string URLBugs = "http://bugs.mremoteng.org/";
|
||||
public static readonly string HomePath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath;
|
||||
public static string EncryptionKey = "mR3m";
|
||||
public static string ReportingFilePath = "";
|
||||
public static readonly string PuttyPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\PuTTYNG.exe";
|
||||
public static string UserAgent
|
||||
{
|
||||
get
|
||||
{
|
||||
List<string> details = new List<string>();
|
||||
details.Add("compatible");
|
||||
if (System.Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
{
|
||||
details.Add(string.Format("Windows NT {0}.{1}", System.Environment.OSVersion.Version.Major, System.Environment.OSVersion.Version.Minor));
|
||||
}
|
||||
else
|
||||
{
|
||||
details.Add(System.Environment.OSVersion.VersionString);
|
||||
}
|
||||
if (Tools.EnvironmentInfo.IsWow64)
|
||||
{
|
||||
details.Add("WOW64");
|
||||
}
|
||||
details.Add(Thread.CurrentThread.CurrentUICulture.Name);
|
||||
details.Add(string.Format(".NET CLR {0}", System.Environment.Version));
|
||||
string detailsString = string.Join("; ", details.ToArray());
|
||||
|
||||
return string.Format("Mozilla/4.0 ({0}) {1}/{2}", detailsString, System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
mRemoteV1/App/Info/SettingsFileInfo.cs
Normal file
15
mRemoteV1/App/Info/SettingsFileInfo.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace mRemoteNG.App.Info
|
||||
{
|
||||
public class SettingsFileInfo
|
||||
{
|
||||
#if !PORTABLE
|
||||
public static readonly string SettingsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName;
|
||||
#else
|
||||
public static readonly string SettingsPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath;
|
||||
#endif
|
||||
public static readonly string LayoutFileName = "pnlLayout.xml";
|
||||
public static readonly string ExtAppsFilesName = "extApps.xml";
|
||||
public const string ThemesFileName = "Themes.xml";
|
||||
}
|
||||
}
|
||||
20
mRemoteV1/App/Info/UpdateChannelInfo.cs
Normal file
20
mRemoteV1/App/Info/UpdateChannelInfo.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace mRemoteNG.App.Info
|
||||
{
|
||||
public class UpdateChannelInfo
|
||||
{
|
||||
public static string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
#if DEBUG
|
||||
return "update-debug.txt";
|
||||
#else
|
||||
if ((string)(My.Settings.Default.UpdateChannel.ToLowerInvariant()) == "debug")
|
||||
return "update-debug.txt";
|
||||
else
|
||||
return "update.txt";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
mRemoteV1/App/Logger.cs
Normal file
60
mRemoteV1/App/Logger.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using log4net;
|
||||
using log4net.Appender;
|
||||
using log4net.Config;
|
||||
using log4net.Repository;
|
||||
using System.IO;
|
||||
|
||||
namespace mRemoteNG.App
|
||||
{
|
||||
public class Logger
|
||||
{
|
||||
private static Logger _logger = null;
|
||||
private ILog _log;
|
||||
|
||||
public static ILog GetSingletonInstance()
|
||||
{
|
||||
if (_logger == null)
|
||||
_logger = new Logger();
|
||||
return _logger._log;
|
||||
}
|
||||
|
||||
private Logger()
|
||||
{
|
||||
this.Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
XmlConfigurator.Configure();
|
||||
string logFile = BuildLogFilePath();
|
||||
|
||||
ILoggerRepository repository = LogManager.GetRepository();
|
||||
IAppender[] appenders = repository.GetAppenders();
|
||||
|
||||
FileAppender fileAppender = default(FileAppender);
|
||||
foreach (IAppender appender in appenders)
|
||||
{
|
||||
fileAppender = appender as FileAppender;
|
||||
if (!(fileAppender == null || fileAppender.Name != "LogFileAppender"))
|
||||
{
|
||||
fileAppender.File = logFile;
|
||||
fileAppender.ActivateOptions();
|
||||
}
|
||||
}
|
||||
_log = LogManager.GetLogger("Logger");
|
||||
}
|
||||
|
||||
private static string BuildLogFilePath()
|
||||
{
|
||||
string logFilePath = "";
|
||||
#if !PORTABLE
|
||||
logFilePath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), System.Windows.Forms.Application.ProductName);
|
||||
#else
|
||||
logFilePath = System.Windows.Forms.Application.StartupPath;
|
||||
#endif
|
||||
string logFileName = Path.ChangeExtension(System.Windows.Forms.Application.ProductName, ".log");
|
||||
string logFile = Path.Combine(logFilePath, logFileName);
|
||||
return logFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace mRemoteNG.App
|
||||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||
public static extern IntPtr WindowFromPoint(Point point);
|
||||
#endregion
|
||||
|
||||
|
||||
#region Structures
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct WINDOWPOS
|
||||
@@ -73,7 +73,7 @@ namespace mRemoteNG.App
|
||||
public int flags;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Helpers
|
||||
public static int MAKELONG(int wLow, int wHigh)
|
||||
{
|
||||
@@ -105,25 +105,25 @@ namespace mRemoteNG.App
|
||||
return HIWORD(value.ToInt32());
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Constants
|
||||
// GetWindowLong
|
||||
public const int GWL_STYLE = (-16);
|
||||
|
||||
|
||||
// AppendMenu / ModifyMenu / DeleteMenu / RemoveMenu
|
||||
public const int MF_BYCOMMAND = 0x0;
|
||||
public const int MF_BYPOSITION = 0x400;
|
||||
public const int MF_STRING = 0x0;
|
||||
public const int MF_POPUP = 0x10;
|
||||
public const int MF_SEPARATOR = 0x800;
|
||||
|
||||
|
||||
// WM_LBUTTONDOWN / WM_LBUTTONUP
|
||||
public const int MK_LBUTTON = 0x1;
|
||||
|
||||
|
||||
// ShowWindow
|
||||
public const int SW_SHOWMAXIMIZED = 3;
|
||||
public const int SW_RESTORE = 9;
|
||||
|
||||
|
||||
// SetWindowPos / WM_WINDOWPOSCHANGING / WM_WINDOWPOSCHANGED
|
||||
public const int SWP_NOSIZE = 0x1;
|
||||
public const int SWP_NOMOVE = 0x2;
|
||||
@@ -142,12 +142,12 @@ namespace mRemoteNG.App
|
||||
public const int SWP_DEFERERASE = 0x2000;
|
||||
public const int SWP_ASYNCWINDOWPOS = 0x4000;
|
||||
public const int SWP_STATECHANGED = 0x8000;
|
||||
|
||||
|
||||
// WM_ACTIVATE
|
||||
public const int WA_INACTIVE = 0x0;
|
||||
public const int WA_ACTIVE = 0x1;
|
||||
public const int WA_CLICKACTIVE = 0x2;
|
||||
|
||||
|
||||
// Window Messages
|
||||
public const int WM_CREATE = 0x1;
|
||||
public const int WM_DESTROY = 0x2;
|
||||
@@ -176,13 +176,13 @@ namespace mRemoteNG.App
|
||||
public const int WM_EXITSIZEMOVE = 0x232;
|
||||
public const int WM_DRAWCLIPBOARD = 0x308;
|
||||
public const int WM_CHANGECBCHAIN = 0x30D;
|
||||
|
||||
|
||||
// Window Styles
|
||||
public const int WS_MAXIMIZE = 0x1000000;
|
||||
public const int WS_VISIBLE = 0x10000000;
|
||||
public const int WS_CHILD = 0x40000000;
|
||||
public const int WS_EX_MDICHILD = 0x40;
|
||||
|
||||
|
||||
// Virtual Key Codes
|
||||
public const int VK_CONTROL = 0x11;
|
||||
public const int VK_C = 0x67;
|
||||
@@ -13,11 +13,8 @@ namespace mRemoteNG
|
||||
[STAThread]
|
||||
public static void Main()
|
||||
{
|
||||
// Create main form
|
||||
mRemoteNG.frmMain mainForm = new frmMain();
|
||||
// Set default form
|
||||
mRemoteNG.frmMain.Default = mainForm;
|
||||
// Run the default form
|
||||
Application.Run(mainForm);
|
||||
}
|
||||
}
|
||||
|
||||
1429
mRemoteV1/App/Runtime.cs
Normal file
1429
mRemoteV1/App/Runtime.cs
Normal file
File diff suppressed because it is too large
Load Diff
36
mRemoteV1/App/Screens.cs
Normal file
36
mRemoteV1/App/Screens.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
|
||||
namespace mRemoteNG.App
|
||||
{
|
||||
public class Screens
|
||||
{
|
||||
public static void SendFormToScreen(Screen Screen)
|
||||
{
|
||||
bool wasMax = false;
|
||||
|
||||
if (frmMain.Default.WindowState == FormWindowState.Maximized)
|
||||
{
|
||||
wasMax = true;
|
||||
frmMain.Default.WindowState = FormWindowState.Normal;
|
||||
}
|
||||
|
||||
frmMain.Default.Location = Screen.Bounds.Location;
|
||||
|
||||
if (wasMax)
|
||||
{
|
||||
frmMain.Default.WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendPanelToScreen(DockContent Panel, Screen Screen)
|
||||
{
|
||||
Panel.DockState = DockState.Float;
|
||||
Panel.ParentForm.Left = Screen.Bounds.Location.X;
|
||||
Panel.ParentForm.Top = Screen.Bounds.Location.Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
87
mRemoteV1/App/Shutdown.cs
Normal file
87
mRemoteV1/App/Shutdown.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Tools;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace mRemoteNG.App
|
||||
{
|
||||
public class Shutdown
|
||||
{
|
||||
private static string _updateFilePath = null;
|
||||
|
||||
public static bool UpdatePending
|
||||
{
|
||||
get
|
||||
{
|
||||
return !string.IsNullOrEmpty(_updateFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Quit(string updateFilePath = null)
|
||||
{
|
||||
_updateFilePath = updateFilePath;
|
||||
frmMain.Default.Close();
|
||||
}
|
||||
|
||||
public static void Cleanup()
|
||||
{
|
||||
try
|
||||
{
|
||||
StopPuttySessionWatcher();
|
||||
DisposeNotificationAreaIcon();
|
||||
SaveConnections();
|
||||
SaveSettings();
|
||||
UnregisterBrowsers();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, My.Language.strSettingsCouldNotBeSavedOrTrayDispose + Environment.NewLine + ex.Message, true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void StopPuttySessionWatcher()
|
||||
{
|
||||
Config.Putty.Sessions.StopWatcher();
|
||||
}
|
||||
|
||||
private static void DisposeNotificationAreaIcon()
|
||||
{
|
||||
if (Runtime.NotificationAreaIcon != null && Runtime.NotificationAreaIcon.Disposed == false)
|
||||
Runtime.NotificationAreaIcon.Dispose();
|
||||
}
|
||||
|
||||
private static void SaveConnections()
|
||||
{
|
||||
if (My.Settings.Default.SaveConsOnExit)
|
||||
Runtime.SaveConnections();
|
||||
}
|
||||
|
||||
private static void SaveSettings()
|
||||
{
|
||||
Config.Settings.SettingsSaver.SaveSettings();
|
||||
}
|
||||
|
||||
private static void UnregisterBrowsers()
|
||||
{
|
||||
IeBrowserEmulation.Unregister();
|
||||
}
|
||||
|
||||
public static void StartUpdate()
|
||||
{
|
||||
try
|
||||
{
|
||||
RunUpdateFile();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "The update could not be started." + Environment.NewLine + ex.Message, true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void RunUpdateFile()
|
||||
{
|
||||
if (UpdatePending)
|
||||
Process.Start(_updateFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
467
mRemoteV1/App/Startup.cs
Normal file
467
mRemoteV1/App/Startup.cs
Normal file
@@ -0,0 +1,467 @@
|
||||
using Microsoft.Win32;
|
||||
using mRemoteNG.App.Update;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.My;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.UI.Window;
|
||||
using PSTaskDialog;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Management;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
using mRemoteNG.Config.Connections;
|
||||
|
||||
namespace mRemoteNG.App
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
private static AppUpdater _appUpdate;
|
||||
|
||||
|
||||
public static void CheckCompatibility()
|
||||
{
|
||||
CheckFipsPolicy();
|
||||
CheckLenovoAutoScrollUtility();
|
||||
}
|
||||
private static void CheckFipsPolicy()
|
||||
{
|
||||
RegistryKey regKey = default(RegistryKey);
|
||||
|
||||
bool isFipsPolicyEnabled = false;
|
||||
|
||||
// Windows XP/Windows Server 2003
|
||||
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa");
|
||||
if (regKey != null)
|
||||
{
|
||||
if (!((int)regKey.GetValue("FIPSAlgorithmPolicy") == 0))
|
||||
{
|
||||
isFipsPolicyEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Windows Vista/Windows Server 2008 and newer
|
||||
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy");
|
||||
if (regKey != null)
|
||||
{
|
||||
if (!((int)regKey.GetValue("Enabled") == 0))
|
||||
{
|
||||
isFipsPolicyEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFipsPolicyEnabled)
|
||||
{
|
||||
MessageBox.Show(frmMain.Default, string.Format(My.Language.strErrorFipsPolicyIncompatible, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName), (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
System.Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
private static void CheckLenovoAutoScrollUtility()
|
||||
{
|
||||
if (!Settings.Default.CompatibilityWarnLenovoAutoScrollUtility)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Process[] proccesses = new Process[] { };
|
||||
try
|
||||
{
|
||||
proccesses = Process.GetProcessesByName("virtscrl");
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
if (proccesses.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cTaskDialog.MessageBox(System.Windows.Forms.Application.ProductName, My.Language.strCompatibilityProblemDetected, string.Format(My.Language.strCompatibilityLenovoAutoScrollUtilityDetected, System.Windows.Forms.Application.ProductName), "", "", My.Language.strCheckboxDoNotShowThisMessageAgain, eTaskDialogButtons.OK, eSysIcons.Warning, eSysIcons.Warning);
|
||||
if (cTaskDialog.VerificationChecked)
|
||||
{
|
||||
Settings.Default.CompatibilityWarnLenovoAutoScrollUtility = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void CreatePanels()
|
||||
{
|
||||
Windows.configForm = new ConfigWindow(Windows.configPanel);
|
||||
Windows.configPanel = Windows.configForm;
|
||||
|
||||
Windows.treeForm = new ConnectionTreeWindow(Windows.treePanel);
|
||||
Windows.treePanel = Windows.treeForm;
|
||||
ConnectionTree.TreeView = Windows.treeForm.tvConnections;
|
||||
|
||||
Windows.errorsForm = new ErrorAndInfoWindow(Windows.errorsPanel);
|
||||
Windows.errorsPanel = Windows.errorsForm;
|
||||
|
||||
Windows.sessionsForm = new SessionsWindow(Windows.sessionsPanel);
|
||||
Windows.sessionsPanel = Windows.sessionsForm;
|
||||
|
||||
Windows.screenshotForm = new ScreenshotManagerWindow(Windows.screenshotPanel);
|
||||
Windows.screenshotPanel = Windows.screenshotForm;
|
||||
|
||||
Windows.updateForm = new UpdateWindow(Windows.updatePanel);
|
||||
Windows.updatePanel = Windows.updateForm;
|
||||
|
||||
Windows.AnnouncementForm = new AnnouncementWindow(Windows.AnnouncementPanel);
|
||||
Windows.AnnouncementPanel = Windows.AnnouncementForm;
|
||||
}
|
||||
public static void SetDefaultLayout()
|
||||
{
|
||||
frmMain.Default.pnlDock.Visible = false;
|
||||
|
||||
frmMain.Default.pnlDock.DockLeftPortion = frmMain.Default.pnlDock.Width * 0.2;
|
||||
frmMain.Default.pnlDock.DockRightPortion = frmMain.Default.pnlDock.Width * 0.2;
|
||||
frmMain.Default.pnlDock.DockTopPortion = frmMain.Default.pnlDock.Height * 0.25;
|
||||
frmMain.Default.pnlDock.DockBottomPortion = frmMain.Default.pnlDock.Height * 0.25;
|
||||
|
||||
Windows.treePanel.Show(frmMain.Default.pnlDock, DockState.DockLeft);
|
||||
Windows.configPanel.Show(frmMain.Default.pnlDock);
|
||||
Windows.configPanel.DockTo(Windows.treePanel.Pane, DockStyle.Bottom, -1);
|
||||
|
||||
Windows.screenshotForm.Hide();
|
||||
|
||||
frmMain.Default.pnlDock.Visible = true;
|
||||
}
|
||||
public static void GetConnectionIcons()
|
||||
{
|
||||
string iPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\Icons\\";
|
||||
if (Directory.Exists(iPath) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string f in Directory.GetFiles(iPath, "*.ico", SearchOption.AllDirectories))
|
||||
{
|
||||
FileInfo fInfo = new FileInfo(f);
|
||||
Array.Resize(ref ConnectionIcon.Icons, ConnectionIcon.Icons.Length + 1);
|
||||
ConnectionIcon.Icons.SetValue(fInfo.Name.Replace(".ico", ""), ConnectionIcon.Icons.Length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void CreateLogger()
|
||||
{
|
||||
Runtime.Log = Logger.GetSingletonInstance();
|
||||
}
|
||||
public static void LogStartupData()
|
||||
{
|
||||
if (Settings.Default.WriteLogFile)
|
||||
{
|
||||
LogApplicationData();
|
||||
LogCmdLineArgs();
|
||||
LogSystemData();
|
||||
LogCLRData();
|
||||
LogCultureData();
|
||||
}
|
||||
}
|
||||
private static void LogSystemData()
|
||||
{
|
||||
string osData = GetOperatingSystemData();
|
||||
string architecture = GetArchitectureData();
|
||||
Runtime.Log.InfoFormat(string.Join(" ", Array.FindAll(new string[] { osData, architecture }, s => !string.IsNullOrEmpty(Convert.ToString(s)))));
|
||||
}
|
||||
private static string GetOperatingSystemData()
|
||||
{
|
||||
string osVersion = string.Empty;
|
||||
string servicePack = string.Empty;
|
||||
string osData = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem WHERE Primary=True").Get())
|
||||
{
|
||||
osVersion = GetOSVersion(osVersion, managementObject);
|
||||
servicePack = GetOSServicePack(servicePack, managementObject);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.WarnFormat("Error retrieving operating system information from WMI. {0}", ex.Message);
|
||||
}
|
||||
osData = string.Join(" ", new string[] { osVersion, servicePack });
|
||||
return osData;
|
||||
}
|
||||
private static string GetOSVersion(string osVersion, ManagementObject managementObject)
|
||||
{
|
||||
osVersion = Convert.ToString(managementObject.GetPropertyValue("Caption")).Trim();
|
||||
return osVersion;
|
||||
}
|
||||
private static string GetOSServicePack(string servicePack, ManagementObject managementObject)
|
||||
{
|
||||
int servicePackNumber = Convert.ToInt32(managementObject.GetPropertyValue("ServicePackMajorVersion"));
|
||||
if (!(servicePackNumber == 0))
|
||||
{
|
||||
servicePack = string.Format("Service Pack {0}", servicePackNumber);
|
||||
}
|
||||
return servicePack;
|
||||
}
|
||||
private static string GetArchitectureData()
|
||||
{
|
||||
string architecture = string.Empty;
|
||||
try
|
||||
{
|
||||
foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_Processor WHERE DeviceID=\'CPU0\'").Get())
|
||||
{
|
||||
int addressWidth = Convert.ToInt32(managementObject.GetPropertyValue("AddressWidth"));
|
||||
architecture = string.Format("{0}-bit", addressWidth);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.WarnFormat("Error retrieving operating system address width from WMI. {0}", ex.Message);
|
||||
}
|
||||
return architecture;
|
||||
}
|
||||
private static void LogApplicationData()
|
||||
{
|
||||
#if !PORTABLE
|
||||
Log.InfoFormat("{0} {1} starting.", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion);
|
||||
#else
|
||||
Runtime.Log.InfoFormat("{0} {1} {2} starting.", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion, My.Language.strLabelPortableEdition);
|
||||
#endif
|
||||
}
|
||||
private static void LogCmdLineArgs()
|
||||
{
|
||||
Runtime.Log.InfoFormat("Command Line: {0}", Environment.GetCommandLineArgs());
|
||||
}
|
||||
private static void LogCLRData()
|
||||
{
|
||||
Runtime.Log.InfoFormat("Microsoft .NET CLR {0}", System.Environment.Version.ToString());
|
||||
}
|
||||
private static void LogCultureData()
|
||||
{
|
||||
Runtime.Log.InfoFormat("System Culture: {0}/{1}", Thread.CurrentThread.CurrentUICulture.Name, Thread.CurrentThread.CurrentUICulture.NativeName);
|
||||
}
|
||||
|
||||
|
||||
public static void CreateConnectionsProvider()
|
||||
{
|
||||
if (My.Settings.Default.UseSQLServer == true)
|
||||
{
|
||||
SqlConnectionsProvider _sqlConnectionsProvider = new SqlConnectionsProvider();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckForUpdate()
|
||||
{
|
||||
if (_appUpdate == null)
|
||||
{
|
||||
_appUpdate = new AppUpdater();
|
||||
}
|
||||
else if (_appUpdate.IsGetUpdateInfoRunning)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime nextUpdateCheck = Convert.ToDateTime(Settings.Default.CheckForUpdatesLastCheck.Add(TimeSpan.FromDays(Convert.ToDouble(Settings.Default.CheckForUpdatesFrequencyDays))));
|
||||
if (!Settings.Default.UpdatePending && DateTime.UtcNow < nextUpdateCheck)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_appUpdate.GetUpdateInfoCompletedEvent += GetUpdateInfoCompleted;
|
||||
_appUpdate.GetUpdateInfoAsync();
|
||||
}
|
||||
private static void GetUpdateInfoCompleted(object sender, AsyncCompletedEventArgs e)
|
||||
{
|
||||
if (Runtime.MainForm.InvokeRequired)
|
||||
{
|
||||
Runtime.MainForm.Invoke(new AsyncCompletedEventHandler(GetUpdateInfoCompleted), new object[] { sender, e });
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_appUpdate.GetUpdateInfoCompletedEvent -= GetUpdateInfoCompleted;
|
||||
|
||||
if (e.Cancelled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (e.Error != null)
|
||||
{
|
||||
throw (e.Error);
|
||||
}
|
||||
|
||||
if (_appUpdate.IsUpdateAvailable())
|
||||
{
|
||||
Windows.Show(WindowType.Update);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionMessage("GetUpdateInfoCompleted() failed.", ex, MessageClass.ErrorMsg, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void CheckForAnnouncement()
|
||||
{
|
||||
if (_appUpdate == null)
|
||||
_appUpdate = new AppUpdater();
|
||||
else if (_appUpdate.IsGetAnnouncementInfoRunning)
|
||||
return;
|
||||
|
||||
_appUpdate.GetAnnouncementInfoCompletedEvent += GetAnnouncementInfoCompleted;
|
||||
_appUpdate.GetAnnouncementInfoAsync();
|
||||
}
|
||||
private static void GetAnnouncementInfoCompleted(object sender, AsyncCompletedEventArgs e)
|
||||
{
|
||||
if (Runtime.MainForm.InvokeRequired)
|
||||
{
|
||||
Runtime.MainForm.Invoke(new AsyncCompletedEventHandler(GetAnnouncementInfoCompleted), new object[] { sender, e });
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_appUpdate.GetAnnouncementInfoCompletedEvent -= GetAnnouncementInfoCompleted;
|
||||
|
||||
if (e.Cancelled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (e.Error != null)
|
||||
{
|
||||
throw (e.Error);
|
||||
}
|
||||
|
||||
if (_appUpdate.IsAnnouncementAvailable())
|
||||
{
|
||||
Windows.Show(WindowType.Announcement);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionMessage("GetAnnouncementInfoCompleted() failed.", ex, MessageClass.ErrorMsg, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void ParseCommandLineArgs()
|
||||
{
|
||||
try
|
||||
{
|
||||
CmdArgumentsInterpreter cmd = new CmdArgumentsInterpreter(Environment.GetCommandLineArgs());
|
||||
|
||||
string ConsParam = "";
|
||||
if (cmd["cons"] != null)
|
||||
{
|
||||
ConsParam = "cons";
|
||||
}
|
||||
if (cmd["c"] != null)
|
||||
{
|
||||
ConsParam = "c";
|
||||
}
|
||||
|
||||
string ResetPosParam = "";
|
||||
if (cmd["resetpos"] != null)
|
||||
{
|
||||
ResetPosParam = "resetpos";
|
||||
}
|
||||
if (cmd["rp"] != null)
|
||||
{
|
||||
ResetPosParam = "rp";
|
||||
}
|
||||
|
||||
string ResetPanelsParam = "";
|
||||
if (cmd["resetpanels"] != null)
|
||||
{
|
||||
ResetPanelsParam = "resetpanels";
|
||||
}
|
||||
if (cmd["rpnl"] != null)
|
||||
{
|
||||
ResetPanelsParam = "rpnl";
|
||||
}
|
||||
|
||||
string ResetToolbarsParam = "";
|
||||
if (cmd["resettoolbar"] != null)
|
||||
{
|
||||
ResetToolbarsParam = "resettoolbar";
|
||||
}
|
||||
if (cmd["rtbr"] != null)
|
||||
{
|
||||
ResetToolbarsParam = "rtbr";
|
||||
}
|
||||
|
||||
if (cmd["reset"] != null)
|
||||
{
|
||||
ResetPosParam = "rp";
|
||||
ResetPanelsParam = "rpnl";
|
||||
ResetToolbarsParam = "rtbr";
|
||||
}
|
||||
|
||||
string NoReconnectParam = "";
|
||||
if (cmd["noreconnect"] != null)
|
||||
{
|
||||
NoReconnectParam = "noreconnect";
|
||||
}
|
||||
if (cmd["norc"] != null)
|
||||
{
|
||||
NoReconnectParam = "norc";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ConsParam))
|
||||
{
|
||||
if (File.Exists(cmd[ConsParam]) == false)
|
||||
{
|
||||
if (File.Exists((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\" + cmd[ConsParam]))
|
||||
{
|
||||
Settings.Default.LoadConsFromCustomLocation = true;
|
||||
Settings.Default.CustomConsPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\" + cmd[ConsParam];
|
||||
return;
|
||||
}
|
||||
else if (File.Exists(App.Info.ConnectionsFileInfo.DefaultConnectionsPath + "\\" + cmd[ConsParam]))
|
||||
{
|
||||
Settings.Default.LoadConsFromCustomLocation = true;
|
||||
Settings.Default.CustomConsPath = App.Info.ConnectionsFileInfo.DefaultConnectionsPath + "\\" + cmd[ConsParam];
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.Default.LoadConsFromCustomLocation = true;
|
||||
Settings.Default.CustomConsPath = cmd[ConsParam];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ResetPosParam))
|
||||
{
|
||||
Settings.Default.MainFormKiosk = false;
|
||||
Settings.Default.MainFormLocation = new Point(999, 999);
|
||||
Settings.Default.MainFormSize = new Size(900, 600);
|
||||
Settings.Default.MainFormState = FormWindowState.Normal;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ResetPanelsParam))
|
||||
{
|
||||
Settings.Default.ResetPanels = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(NoReconnectParam))
|
||||
{
|
||||
Settings.Default.NoReconnect = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ResetToolbarsParam))
|
||||
{
|
||||
Settings.Default.ResetToolbars = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, My.Language.strCommandLineArgsCouldNotBeParsed + Environment.NewLine + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,27 +5,12 @@ using System.Diagnostics;
|
||||
|
||||
namespace mRemoteNG.App
|
||||
{
|
||||
public class SupportedCultures : System.Collections.Generic.Dictionary<string, string>
|
||||
public class SupportedCultures : Dictionary<string, string>
|
||||
{
|
||||
|
||||
private SupportedCultures()
|
||||
{
|
||||
System.Globalization.CultureInfo CultureInfo = default(System.Globalization.CultureInfo);
|
||||
foreach (string CultureName in My.Settings.Default.SupportedUICultures.Split(','))
|
||||
{
|
||||
try
|
||||
{
|
||||
CultureInfo = new System.Globalization.CultureInfo(CultureName.Trim());
|
||||
Add(CultureInfo.Name, CultureInfo.TextInfo.ToTitleCase(CultureInfo.NativeName));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Print(string.Format("An exception occurred while adding the culture \'{0}\' to the list of supported cultures. {1}", CultureName, ex.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static SupportedCultures _Instance = null;
|
||||
private static SupportedCultures _Instance = null;
|
||||
|
||||
|
||||
|
||||
public static void InstantiateSingleton()
|
||||
{
|
||||
if (_Instance == null)
|
||||
@@ -33,6 +18,23 @@ namespace mRemoteNG.App
|
||||
_Instance = new SupportedCultures();
|
||||
}
|
||||
}
|
||||
|
||||
private SupportedCultures()
|
||||
{
|
||||
System.Globalization.CultureInfo CultureInfo = default(System.Globalization.CultureInfo);
|
||||
foreach (string CultureName in My.Settings.Default.SupportedUICultures.Split(','))
|
||||
{
|
||||
try
|
||||
{
|
||||
CultureInfo = new System.Globalization.CultureInfo(CultureName.Trim());
|
||||
Add(CultureInfo.Name, CultureInfo.TextInfo.ToTitleCase(CultureInfo.NativeName));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Print(string.Format("An exception occurred while adding the culture \'{0}\' to the list of supported cultures. {1}", CultureName, ex.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsNameSupported(string CultureName)
|
||||
{
|
||||
@@ -81,4 +83,4 @@ namespace mRemoteNG.App
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
mRemoteV1/App/Update/AnnouncementInfo.cs
Normal file
32
mRemoteV1/App/Update/AnnouncementInfo.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
namespace mRemoteNG.App.Update
|
||||
{
|
||||
public class AnnouncementInfo
|
||||
{
|
||||
#region Public Properties
|
||||
public bool IsValid { get; set; }
|
||||
public string Name { get; set; }
|
||||
public Uri Address { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public static AnnouncementInfo FromString(string input)
|
||||
{
|
||||
AnnouncementInfo newInfo = new AnnouncementInfo();
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
newInfo.IsValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateFile updateFile = new UpdateFile(input);
|
||||
newInfo.Name = updateFile.GetString("Name");
|
||||
newInfo.Address = updateFile.GetUri("URL");
|
||||
newInfo.IsValid = true;
|
||||
}
|
||||
return newInfo;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -8,79 +8,19 @@ using mRemoteNG.Tools;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
namespace mRemoteNG.App
|
||||
namespace mRemoteNG.App.Update
|
||||
{
|
||||
public class Update
|
||||
public class AppUpdater
|
||||
{
|
||||
#region Events
|
||||
private AsyncCompletedEventHandler GetUpdateInfoCompletedEventEvent;
|
||||
public event AsyncCompletedEventHandler GetUpdateInfoCompletedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Combine(GetUpdateInfoCompletedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Remove(GetUpdateInfoCompletedEventEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
private AsyncCompletedEventHandler GetChangeLogCompletedEventEvent;
|
||||
public event AsyncCompletedEventHandler GetChangeLogCompletedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Combine(GetChangeLogCompletedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Remove(GetChangeLogCompletedEventEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
private AsyncCompletedEventHandler GetAnnouncementInfoCompletedEventEvent;
|
||||
public event AsyncCompletedEventHandler GetAnnouncementInfoCompletedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Combine(GetAnnouncementInfoCompletedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Remove(GetAnnouncementInfoCompletedEventEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
private DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEventEvent;
|
||||
public event DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler) System.Delegate.Combine(DownloadUpdateProgressChangedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler) System.Delegate.Remove(DownloadUpdateProgressChangedEventEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
private AsyncCompletedEventHandler DownloadUpdateCompletedEventEvent;
|
||||
public event AsyncCompletedEventHandler DownloadUpdateCompletedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Combine(DownloadUpdateCompletedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Remove(DownloadUpdateCompletedEventEvent, value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private UpdateInfo _currentUpdateInfo;
|
||||
private string _changeLog;
|
||||
private AnnouncementInfo _currentAnnouncementInfo;
|
||||
private WebProxy _webProxy;
|
||||
private Thread _getUpdateInfoThread;
|
||||
private Thread _getChangeLogThread;
|
||||
private Thread _getAnnouncementInfoThread;
|
||||
|
||||
#region Public Properties
|
||||
private UpdateInfo _currentUpdateInfo;
|
||||
public UpdateInfo CurrentUpdateInfo
|
||||
{
|
||||
get
|
||||
@@ -88,8 +28,7 @@ namespace mRemoteNG.App
|
||||
return _currentUpdateInfo;
|
||||
}
|
||||
}
|
||||
|
||||
private string _changeLog;
|
||||
|
||||
public string ChangeLog
|
||||
{
|
||||
get
|
||||
@@ -97,8 +36,7 @@ namespace mRemoteNG.App
|
||||
return _changeLog;
|
||||
}
|
||||
}
|
||||
|
||||
private AnnouncementInfo _currentAnnouncementInfo;
|
||||
|
||||
public AnnouncementInfo CurrentAnnouncementInfo
|
||||
{
|
||||
get
|
||||
@@ -106,7 +44,7 @@ namespace mRemoteNG.App
|
||||
return _currentAnnouncementInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool IsGetUpdateInfoRunning
|
||||
{
|
||||
get
|
||||
@@ -121,7 +59,7 @@ namespace mRemoteNG.App
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool IsGetChangeLogRunning
|
||||
{
|
||||
get
|
||||
@@ -136,7 +74,7 @@ namespace mRemoteNG.App
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool IsGetAnnouncementInfoRunning
|
||||
{
|
||||
get
|
||||
@@ -151,7 +89,7 @@ namespace mRemoteNG.App
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool IsDownloadUpdateRunning
|
||||
{
|
||||
get
|
||||
@@ -160,16 +98,16 @@ namespace mRemoteNG.App
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Public Methods
|
||||
public Update()
|
||||
public AppUpdater()
|
||||
{
|
||||
SetProxySettings();
|
||||
}
|
||||
|
||||
public void SetProxySettings()
|
||||
{
|
||||
SetProxySettings(System.Convert.ToBoolean(My.Settings.Default.UpdateUseProxy), System.Convert.ToString(My.Settings.Default.UpdateProxyAddress), System.Convert.ToInt32(My.Settings.Default.UpdateProxyPort), System.Convert.ToBoolean(My.Settings.Default.UpdateProxyUseAuthentication), System.Convert.ToString(My.Settings.Default.UpdateProxyAuthUser), Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.UpdateProxyAuthPass), Info.General.EncryptionKey));
|
||||
SetProxySettings(System.Convert.ToBoolean(My.Settings.Default.UpdateUseProxy), System.Convert.ToString(My.Settings.Default.UpdateProxyAddress), System.Convert.ToInt32(My.Settings.Default.UpdateProxyPort), System.Convert.ToBoolean(My.Settings.Default.UpdateProxyUseAuthentication), System.Convert.ToString(My.Settings.Default.UpdateProxyAuthUser), Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.UpdateProxyAuthPass), Info.GeneralAppInfo.EncryptionKey));
|
||||
}
|
||||
|
||||
public void SetProxySettings(bool useProxy, string address, int port, bool useAuthentication, string username, string password)
|
||||
@@ -280,7 +218,7 @@ namespace mRemoteNG.App
|
||||
DownloadUpdateWebClient.DownloadFileAsync(CurrentUpdateInfo.DownloadAddress, _currentUpdateInfo.UpdateFilePath);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Private Properties
|
||||
private WebClient _downloadUpdateWebClient;
|
||||
private WebClient DownloadUpdateWebClient
|
||||
@@ -301,19 +239,12 @@ namespace mRemoteNG.App
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private WebProxy _webProxy;
|
||||
private Thread _getUpdateInfoThread;
|
||||
private Thread _getChangeLogThread;
|
||||
private Thread _getAnnouncementInfoThread;
|
||||
#endregion
|
||||
|
||||
|
||||
#region Private Methods
|
||||
private WebClient CreateWebClient()
|
||||
{
|
||||
WebClient webClient = new WebClient();
|
||||
webClient.Headers.Add("user-agent", Info.General.UserAgent);
|
||||
webClient.Headers.Add("user-agent", Info.GeneralAppInfo.UserAgent);
|
||||
webClient.Proxy = _webProxy;
|
||||
return webClient;
|
||||
}
|
||||
@@ -354,7 +285,7 @@ namespace mRemoteNG.App
|
||||
|
||||
private void GetUpdateInfo()
|
||||
{
|
||||
Uri updateFileUri = new Uri(new Uri(System.Convert.ToString(My.Settings.Default.UpdateAddress)), new Uri(Info.Update.FileName, UriKind.Relative));
|
||||
Uri updateFileUri = new Uri(new Uri(System.Convert.ToString(My.Settings.Default.UpdateAddress)), new Uri(Info.UpdateChannelInfo.FileName, UriKind.Relative));
|
||||
DownloadStringCompletedEventArgs e = DownloadString(updateFileUri);
|
||||
|
||||
if (!e.Cancelled && e.Error == null)
|
||||
@@ -452,172 +383,72 @@ namespace mRemoteNG.App
|
||||
_downloadUpdateWebClient = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Classes
|
||||
public class UpdateInfo
|
||||
{
|
||||
#region Public Properties
|
||||
public bool IsValid {get; set;}
|
||||
public Version Version {get; set;}
|
||||
public Uri DownloadAddress {get; set;}
|
||||
public string UpdateFilePath {get; set;}
|
||||
public Uri ChangeLogAddress {get; set;}
|
||||
public Uri ImageAddress {get; set;}
|
||||
public Uri ImageLinkAddress {get; set;}
|
||||
public string CertificateThumbprint {get; set;}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public static UpdateInfo FromString(string input)
|
||||
{
|
||||
UpdateInfo newInfo = new UpdateInfo();
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
newInfo.IsValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateFile updateFile = new UpdateFile(input);
|
||||
newInfo.Version = updateFile.GetVersion("Version");
|
||||
newInfo.DownloadAddress = updateFile.GetUri("dURL");
|
||||
newInfo.ChangeLogAddress = updateFile.GetUri("clURL");
|
||||
newInfo.ImageAddress = updateFile.GetUri("imgURL");
|
||||
newInfo.ImageLinkAddress = updateFile.GetUri("imgURLLink");
|
||||
newInfo.CertificateThumbprint = updateFile.GetThumbprint("CertificateThumbprint");
|
||||
newInfo.IsValid = true;
|
||||
}
|
||||
return newInfo;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class AnnouncementInfo
|
||||
{
|
||||
#region Public Properties
|
||||
public bool IsValid {get; set;}
|
||||
public string Name {get; set;}
|
||||
public Uri Address {get; set;}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public static AnnouncementInfo FromString(string input)
|
||||
{
|
||||
AnnouncementInfo newInfo = new AnnouncementInfo();
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
newInfo.IsValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateFile updateFile = new UpdateFile(input);
|
||||
newInfo.Name = updateFile.GetString("Name");
|
||||
newInfo.Address = updateFile.GetUri("URL");
|
||||
newInfo.IsValid = true;
|
||||
}
|
||||
return newInfo;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Classes
|
||||
private class UpdateFile
|
||||
{
|
||||
#region Public Properties
|
||||
private Dictionary<string, string> _items = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
// ReSharper disable MemberCanBePrivate.Local
|
||||
public Dictionary<string, string> Items
|
||||
{
|
||||
// ReSharper restore MemberCanBePrivate.Local
|
||||
get
|
||||
{
|
||||
return _items;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public UpdateFile(string content)
|
||||
{
|
||||
FromString(content);
|
||||
}
|
||||
|
||||
// ReSharper disable MemberCanBePrivate.Local
|
||||
public void FromString(string content)
|
||||
{
|
||||
// ReSharper restore MemberCanBePrivate.Local
|
||||
if (string.IsNullOrEmpty(content))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
char[] lineSeparators = new char[] {'\n', '\r'};
|
||||
char[] keyValueSeparators = new char[] {':', '='};
|
||||
char[] commentCharacters = new char[] {'#', ';', '\''};
|
||||
|
||||
string[] lines = content.Split(lineSeparators.ToString().ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
string trimmedLine = line.Trim();
|
||||
if (trimmedLine.Length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!(trimmedLine.Substring(0, 1).IndexOfAny(commentCharacters.ToString().ToCharArray()) == -1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
#region Events
|
||||
private AsyncCompletedEventHandler GetUpdateInfoCompletedEventEvent;
|
||||
public event AsyncCompletedEventHandler GetUpdateInfoCompletedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(GetUpdateInfoCompletedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(GetUpdateInfoCompletedEventEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
string[] parts = trimmedLine.Split(keyValueSeparators.ToString().ToCharArray(), 2);
|
||||
if (!(parts.Length == 2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string key = System.Convert.ToString(parts[0].Trim());
|
||||
string value = System.Convert.ToString(parts[1].Trim());
|
||||
|
||||
_items.Add(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable MemberCanBePrivate.Local
|
||||
public string GetString(string key)
|
||||
{
|
||||
// ReSharper restore MemberCanBePrivate.Local
|
||||
if (!Items.ContainsKey(key))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return this._items[key];
|
||||
}
|
||||
|
||||
public Version GetVersion(string key)
|
||||
{
|
||||
string value = GetString(key);
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Version(value);
|
||||
}
|
||||
|
||||
public Uri GetUri(string key)
|
||||
{
|
||||
string value = GetString(key);
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Uri(value);
|
||||
}
|
||||
|
||||
public string GetThumbprint(string key)
|
||||
{
|
||||
return GetString(key).Replace(" ", "").ToUpperInvariant();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
private AsyncCompletedEventHandler GetChangeLogCompletedEventEvent;
|
||||
public event AsyncCompletedEventHandler GetChangeLogCompletedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(GetChangeLogCompletedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(GetChangeLogCompletedEventEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
private AsyncCompletedEventHandler GetAnnouncementInfoCompletedEventEvent;
|
||||
public event AsyncCompletedEventHandler GetAnnouncementInfoCompletedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(GetAnnouncementInfoCompletedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(GetAnnouncementInfoCompletedEventEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
private DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEventEvent;
|
||||
public event DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)System.Delegate.Combine(DownloadUpdateProgressChangedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)System.Delegate.Remove(DownloadUpdateProgressChangedEventEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
private AsyncCompletedEventHandler DownloadUpdateCompletedEventEvent;
|
||||
public event AsyncCompletedEventHandler DownloadUpdateCompletedEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(DownloadUpdateCompletedEventEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(DownloadUpdateCompletedEventEvent, value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
103
mRemoteV1/App/Update/UpdateFile.cs
Normal file
103
mRemoteV1/App/Update/UpdateFile.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace mRemoteNG.App.Update
|
||||
{
|
||||
public class UpdateFile
|
||||
{
|
||||
#region Public Properties
|
||||
private Dictionary<string, string> _items = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
// ReSharper disable MemberCanBePrivate.Local
|
||||
public Dictionary<string, string> Items
|
||||
{
|
||||
// ReSharper restore MemberCanBePrivate.Local
|
||||
get
|
||||
{
|
||||
return _items;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public UpdateFile(string content)
|
||||
{
|
||||
FromString(content);
|
||||
}
|
||||
|
||||
// ReSharper disable MemberCanBePrivate.Local
|
||||
public void FromString(string content)
|
||||
{
|
||||
// ReSharper restore MemberCanBePrivate.Local
|
||||
if (string.IsNullOrEmpty(content))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
char[] lineSeparators = new char[] { '\n', '\r' };
|
||||
char[] keyValueSeparators = new char[] { ':', '=' };
|
||||
char[] commentCharacters = new char[] { '#', ';', '\'' };
|
||||
|
||||
string[] lines = content.Split(lineSeparators.ToString().ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
string trimmedLine = line.Trim();
|
||||
if (trimmedLine.Length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!(trimmedLine.Substring(0, 1).IndexOfAny(commentCharacters.ToString().ToCharArray()) == -1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string[] parts = trimmedLine.Split(keyValueSeparators.ToString().ToCharArray(), 2);
|
||||
if (!(parts.Length == 2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string key = System.Convert.ToString(parts[0].Trim());
|
||||
string value = System.Convert.ToString(parts[1].Trim());
|
||||
|
||||
_items.Add(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable MemberCanBePrivate.Local
|
||||
public string GetString(string key)
|
||||
{
|
||||
// ReSharper restore MemberCanBePrivate.Local
|
||||
if (!Items.ContainsKey(key))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return this._items[key];
|
||||
}
|
||||
|
||||
public Version GetVersion(string key)
|
||||
{
|
||||
string value = GetString(key);
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Version(value);
|
||||
}
|
||||
|
||||
public Uri GetUri(string key)
|
||||
{
|
||||
string value = GetString(key);
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Uri(value);
|
||||
}
|
||||
|
||||
public string GetThumbprint(string key)
|
||||
{
|
||||
return GetString(key).Replace(" ", "").ToUpperInvariant();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
39
mRemoteV1/App/Update/UpdateInfo.cs
Normal file
39
mRemoteV1/App/Update/UpdateInfo.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace mRemoteNG.App.Update
|
||||
{
|
||||
public class UpdateInfo
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public Version Version { get; set; }
|
||||
public Uri DownloadAddress { get; set; }
|
||||
public string UpdateFilePath { get; set; }
|
||||
public Uri ChangeLogAddress { get; set; }
|
||||
public Uri ImageAddress { get; set; }
|
||||
public Uri ImageLinkAddress { get; set; }
|
||||
public string CertificateThumbprint { get; set; }
|
||||
|
||||
public static UpdateInfo FromString(string input)
|
||||
{
|
||||
UpdateInfo newInfo = new UpdateInfo();
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
newInfo.IsValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateFile updateFile = new UpdateFile(input);
|
||||
newInfo.Version = updateFile.GetVersion("Version");
|
||||
newInfo.DownloadAddress = updateFile.GetUri("dURL");
|
||||
newInfo.ChangeLogAddress = updateFile.GetUri("clURL");
|
||||
newInfo.ImageAddress = updateFile.GetUri("imgURL");
|
||||
newInfo.ImageLinkAddress = updateFile.GetUri("imgURLLink");
|
||||
newInfo.CertificateThumbprint = updateFile.GetThumbprint("CertificateThumbprint");
|
||||
newInfo.IsValid = true;
|
||||
}
|
||||
return newInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
155
mRemoteV1/App/Windows.cs
Normal file
155
mRemoteV1/App/Windows.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using mRemoteNG.Forms;
|
||||
using mRemoteNG.Forms.OptionsPages;
|
||||
using mRemoteNG.Messages;
|
||||
using System;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
|
||||
namespace mRemoteNG.App
|
||||
{
|
||||
public class Windows
|
||||
{
|
||||
public static UI.Window.ConnectionTreeWindow treeForm;
|
||||
public static DockContent treePanel = new DockContent();
|
||||
public static UI.Window.ConfigWindow configForm;
|
||||
public static DockContent configPanel = new DockContent();
|
||||
public static UI.Window.ErrorAndInfoWindow errorsForm;
|
||||
public static DockContent errorsPanel = new DockContent();
|
||||
public static UI.Window.SessionsWindow sessionsForm;
|
||||
public static DockContent sessionsPanel = new DockContent();
|
||||
public static UI.Window.ScreenshotManagerWindow screenshotForm;
|
||||
public static DockContent screenshotPanel = new DockContent();
|
||||
public static ExportForm exportForm;
|
||||
public static DockContent exportPanel = new DockContent();
|
||||
public static UI.Window.AboutWindow aboutForm;
|
||||
public static DockContent aboutPanel = new DockContent();
|
||||
public static UI.Window.UpdateWindow updateForm;
|
||||
public static DockContent updatePanel = new DockContent();
|
||||
public static UI.Window.SSHTransferWindow sshtransferForm;
|
||||
public static DockContent sshtransferPanel = new DockContent();
|
||||
public static UI.Window.ActiveDirectoryImportWindow adimportForm;
|
||||
public static DockContent adimportPanel = new DockContent();
|
||||
public static UI.Window.HelpWindow helpForm;
|
||||
public static DockContent helpPanel = new DockContent();
|
||||
public static UI.Window.ExternalToolsWindow externalappsForm;
|
||||
public static DockContent externalappsPanel = new DockContent();
|
||||
public static UI.Window.PortScanWindow portscanForm;
|
||||
public static DockContent portscanPanel = new DockContent();
|
||||
public static UI.Window.UltraVNCWindow ultravncscForm;
|
||||
public static DockContent ultravncscPanel = new DockContent();
|
||||
public static UI.Window.ComponentsCheckWindow componentscheckForm;
|
||||
public static DockContent componentscheckPanel = new DockContent();
|
||||
public static UI.Window.AnnouncementWindow AnnouncementForm;
|
||||
public static DockContent AnnouncementPanel = new DockContent();
|
||||
|
||||
public static void Show(UI.Window.WindowType windowType, bool portScanImport = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (windowType.Equals(UI.Window.WindowType.About))
|
||||
{
|
||||
if (aboutForm == null || aboutForm.IsDisposed)
|
||||
{
|
||||
aboutForm = new UI.Window.AboutWindow(aboutPanel);
|
||||
aboutPanel = aboutForm;
|
||||
}
|
||||
aboutForm.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.ActiveDirectoryImport))
|
||||
{
|
||||
if (adimportForm == null || adimportForm.IsDisposed)
|
||||
{
|
||||
adimportForm = new UI.Window.ActiveDirectoryImportWindow(adimportPanel);
|
||||
adimportPanel = adimportForm;
|
||||
}
|
||||
adimportPanel.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.Options))
|
||||
{
|
||||
using (OptionsForm optionsForm = new OptionsForm())
|
||||
{
|
||||
optionsForm.ShowDialog(frmMain.Default);
|
||||
}
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.SSHTransfer))
|
||||
{
|
||||
sshtransferForm = new UI.Window.SSHTransferWindow(sshtransferPanel);
|
||||
sshtransferPanel = sshtransferForm;
|
||||
sshtransferForm.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.Update))
|
||||
{
|
||||
if (updateForm == null || updateForm.IsDisposed)
|
||||
{
|
||||
updateForm = new UI.Window.UpdateWindow(updatePanel);
|
||||
updatePanel = updateForm;
|
||||
}
|
||||
updateForm.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.Help))
|
||||
{
|
||||
if (helpForm == null || helpForm.IsDisposed)
|
||||
{
|
||||
helpForm = new UI.Window.HelpWindow(helpPanel);
|
||||
helpPanel = helpForm;
|
||||
}
|
||||
helpForm.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.ExternalApps))
|
||||
{
|
||||
if (externalappsForm == null || externalappsForm.IsDisposed)
|
||||
{
|
||||
externalappsForm = new UI.Window.ExternalToolsWindow(externalappsPanel);
|
||||
externalappsPanel = externalappsForm;
|
||||
}
|
||||
externalappsForm.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.PortScan))
|
||||
{
|
||||
portscanForm = new UI.Window.PortScanWindow(portscanPanel, portScanImport);
|
||||
portscanPanel = portscanForm;
|
||||
portscanForm.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.UltraVNCSC))
|
||||
{
|
||||
if (ultravncscForm == null || ultravncscForm.IsDisposed)
|
||||
{
|
||||
ultravncscForm = new UI.Window.UltraVNCWindow(ultravncscPanel);
|
||||
ultravncscPanel = ultravncscForm;
|
||||
}
|
||||
ultravncscForm.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.ComponentsCheck))
|
||||
{
|
||||
if (componentscheckForm == null || componentscheckForm.IsDisposed)
|
||||
{
|
||||
componentscheckForm = new UI.Window.ComponentsCheckWindow(componentscheckPanel);
|
||||
componentscheckPanel = componentscheckForm;
|
||||
}
|
||||
componentscheckForm.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
else if (windowType.Equals(UI.Window.WindowType.Announcement))
|
||||
{
|
||||
if (AnnouncementForm == null || AnnouncementForm.IsDisposed)
|
||||
{
|
||||
AnnouncementForm = new UI.Window.AnnouncementWindow(AnnouncementPanel);
|
||||
AnnouncementPanel = AnnouncementForm;
|
||||
}
|
||||
AnnouncementForm.Show(frmMain.Default.pnlDock);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "App.Runtime.Windows.Show() failed." + Environment.NewLine + ex.Message, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ShowUpdatesTab()
|
||||
{
|
||||
using (OptionsForm optionsForm = new OptionsForm())
|
||||
{
|
||||
optionsForm.ShowDialog(frmMain.Default, typeof(UpdatesPage));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
309
mRemoteV1/ClassDiagram1.cd
Normal file
309
mRemoteV1/ClassDiagram1.cd
Normal file
@@ -0,0 +1,309 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||
<Class Name="mRemoteNG.Connection.Info" Collapsed="true">
|
||||
<Position X="29.5" Y="0.5" Width="1.5" />
|
||||
<Compartments>
|
||||
<Compartment Name="Fields" Collapsed="true" />
|
||||
<Compartment Name="Properties" Collapsed="true" />
|
||||
<Compartment Name="Methods" Collapsed="true" />
|
||||
<Compartment Name="Nested Types" Collapsed="false" />
|
||||
</Compartments>
|
||||
<NestedTypes>
|
||||
<Enum Name="mRemoteNG.Connection.Info.Force" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Info.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Class Name="mRemoteNG.Connection.Info.Inheritance">
|
||||
<Compartments>
|
||||
<Compartment Name="Properties" Collapsed="true" />
|
||||
<Compartment Name="Methods" Collapsed="true" />
|
||||
</Compartments>
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Info.Inheritance.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
</NestedTypes>
|
||||
<TypeIdentifier>
|
||||
<HashCode>nsdT4YQ80AjyrN6+C3B3TRVBrwEyVASPjA5epmmggHg=</HashCode>
|
||||
<FileName>Connection\Connection.Info.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.List" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="27.75" Y="1.5" Width="1.5" />
|
||||
<Compartments>
|
||||
<Compartment Name="Properties" Collapsed="true" />
|
||||
<Compartment Name="Methods" Collapsed="true" />
|
||||
</Compartments>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAIAAAAAAAAAAAAACAAAAAQAAkAAAAAAAAAAAABEAAA=</HashCode>
|
||||
<FileName>Connection\Connection.List.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.PuttyBase">
|
||||
<Position X="17.25" Y="3.25" Width="2.75" />
|
||||
<Compartments>
|
||||
<Compartment Name="Fields" Collapsed="true" />
|
||||
<Compartment Name="Properties" Collapsed="true" />
|
||||
<Compartment Name="Methods" Collapsed="true" />
|
||||
</Compartments>
|
||||
<NestedTypes>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.PuttyBase.Putty_Protocol" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.PuttyBase.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.PuttyBase.Putty_SSHVersion" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.PuttyBase.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
</NestedTypes>
|
||||
<TypeIdentifier>
|
||||
<HashCode>BjAAQAAAQBAAgAAAgAAAAIAAAAAADoAAAAQAAAGAQgA=</HashCode>
|
||||
<FileName>Connection\Connection.Protocol.PuttyBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.Converter" Collapsed="true">
|
||||
<Position X="26" Y="0.5" Width="1.5" />
|
||||
<Compartments>
|
||||
<Compartment Name="Methods" Collapsed="true" />
|
||||
</Compartments>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Connection.Protocol.Protocols.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.Base">
|
||||
<Position X="12.25" Y="0.5" Width="1.5" />
|
||||
<Compartments>
|
||||
<Compartment Name="Fields" Collapsed="true" />
|
||||
<Compartment Name="Properties" Collapsed="true" />
|
||||
<Compartment Name="Methods" Collapsed="true" />
|
||||
<Compartment Name="Events" Collapsed="true" />
|
||||
</Compartments>
|
||||
<NestedTypes>
|
||||
<Delegate Name="mRemoteNG.Connection.Protocol.Base.SetTagToNothingCB" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.Base.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Delegate>
|
||||
<Delegate Name="mRemoteNG.Connection.Protocol.Base.ErrorOccuredEventHandler" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.Base.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Delegate>
|
||||
<Delegate Name="mRemoteNG.Connection.Protocol.Base.ClosingEventHandler" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.Base.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Delegate>
|
||||
<Delegate Name="mRemoteNG.Connection.Protocol.Base.ConnectedEventHandler" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.Base.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Delegate>
|
||||
<Delegate Name="mRemoteNG.Connection.Protocol.Base.DisconnectedEventHandler" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.Base.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Delegate>
|
||||
<Delegate Name="mRemoteNG.Connection.Protocol.Base.DisposeControlCB" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.Base.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Delegate>
|
||||
<Delegate Name="mRemoteNG.Connection.Protocol.Base.ConnectingEventHandler" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.Base.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Delegate>
|
||||
<Delegate Name="mRemoteNG.Connection.Protocol.Base.ClosedEventHandler" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.Base.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Delegate>
|
||||
<Delegate Name="mRemoteNG.Connection.Protocol.Base.DisposeInterfaceCB" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>Connection\Connection.Protocol.Base.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Delegate>
|
||||
</NestedTypes>
|
||||
<TypeIdentifier>
|
||||
<HashCode>ACSAAQAMAABAQQADAgBUoMSAlIAQAAgAAAAAkwGoABA=</HashCode>
|
||||
<FileName>Connection\Connection.Protocol.Base.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.InterfaceControl" Collapsed="true">
|
||||
<Position X="26" Y="1.5" Width="1.5" />
|
||||
<Compartments>
|
||||
<Compartment Name="Fields" Collapsed="true" />
|
||||
<Compartment Name="Properties" Collapsed="true" />
|
||||
<Compartment Name="Methods" Collapsed="true" />
|
||||
</Compartments>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAACAAAAAAAACAAABKAAAAAAAAAAAAAEAAABA=</HashCode>
|
||||
<FileName>Connection\Connection.InterfaceControl.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Icon" Collapsed="true">
|
||||
<Position X="27.75" Y="0.5" Width="1.5" />
|
||||
<Compartments>
|
||||
<Compartment Name="Fields" Collapsed="true" />
|
||||
<Compartment Name="Methods" Collapsed="true" />
|
||||
</Compartments>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAIAAAAAAAABACAAEAAAAAAAAAAAAAAAAAAAAAAAAAE=</HashCode>
|
||||
<FileName>Connection\Connection.Icon.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.VNC.ProtocolVNC" Collapsed="true">
|
||||
<Position X="10" Y="3.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AxQAAAAAIAgAAQABAAAAAYAQAQAAAAAAAAAAAEAAwAA=</HashCode>
|
||||
<FileName>Connection\Protocol\VNC\Connection.Protocol.VNC.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.Telnet.ProtocolTelnet" Collapsed="true">
|
||||
<Position X="16.75" Y="5.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\Telnet\Connection.Protocol.Telnet.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.SSH.ProtocolSSH1" Collapsed="true">
|
||||
<Position X="21.25" Y="5.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\SSH\Connection.Protocol.SSH1.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.SSH.ProtocolSSH2" Collapsed="true">
|
||||
<Position X="23.5" Y="5.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\SSH\Connection.Protocol.SSH2.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.Serial.ProtocolSerial" Collapsed="true">
|
||||
<Position X="19" Y="5.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\Serial\Connection.Protocol.Serial.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.Rlogin.ProtocolRlogin" Collapsed="true">
|
||||
<Position X="14.5" Y="5.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\Rlogin\Connection.Protocol.Rlogin.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.RDP.ProtocolRDP" Collapsed="true">
|
||||
<Position X="3.25" Y="3.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>ACQRAAAFIAQgIQACAIBACIAAQaAABIIbAIgUYgEAgAE=</HashCode>
|
||||
<FileName>Connection\Protocol\RDP\Connection.Protocol.RDP.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.RAW.ProtocolRAW" Collapsed="true">
|
||||
<Position X="12.25" Y="5.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\RAW\Connection.Protocol.RAW.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.ICA.ProtocolICA" Collapsed="true">
|
||||
<Position X="1" Y="3.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAEAABAAAAAQADAABAIIAIAQABBAAAAIiAAAAEAgA=</HashCode>
|
||||
<FileName>Connection\Protocol\ICA\Connection.Protocol.ICA.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.Http.ProtocolHTTP" Collapsed="true">
|
||||
<Position X="5.5" Y="4.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\Http\Connection.Protocol.HTTP.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.Http.HTTPBase" Collapsed="true">
|
||||
<Position X="6.75" Y="3.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AQAAAQAAABAAAQAIAAAAAKCAAAAAAAEAAAAAABAAAUA=</HashCode>
|
||||
<FileName>Connection\Protocol\Http\Connection.Protocol.HTTPBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="mRemoteNG.Connection.Protocol.Http.ProtocolHTTPS" Collapsed="true">
|
||||
<Position X="7.75" Y="4.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\Http\Connection.Protocol.HTTPS.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.Protocols" Collapsed="true">
|
||||
<Position X="29.5" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AEAwAgAAAQAQAEAAAAAAAAAAJAEABAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Connection.Protocol.Protocols.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.VNC.Defaults" Collapsed="true">
|
||||
<Position X="26" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\VNC\VNCEnum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.VNC.SpecialKeys" Collapsed="true">
|
||||
<Position X="29.5" Y="4.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\VNC\VNCEnum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.VNC.Compression" Collapsed="true">
|
||||
<Position X="29.5" Y="2.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAIAAAAAAAkAAAAAAAQAgAAQAAIAABAAAAAIBAIAA=</HashCode>
|
||||
<FileName>Connection\Protocol\VNC\VNCEnum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.VNC.Encoding" Collapsed="true">
|
||||
<Position X="27.75" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAQAEBAAIAAAAAAAIAAAEAAAQgAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\VNC\VNCEnum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.VNC.AuthMode" Collapsed="true">
|
||||
<Position X="26" Y="2.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAACAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\VNC\VNCEnum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.VNC.ProxyType" Collapsed="true">
|
||||
<Position X="26" Y="4.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>BAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAACAACAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\VNC\VNCEnum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.VNC.Colors" Collapsed="true">
|
||||
<Position X="27.75" Y="2.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAI=</HashCode>
|
||||
<FileName>Connection\Protocol\VNC\VNCEnum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="mRemoteNG.Connection.Protocol.VNC.SmartSizeMode" Collapsed="true">
|
||||
<Position X="27.75" Y="4.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAIAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\Protocol\VNC\VNCEnum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Font Name="Segoe UI" Size="9" />
|
||||
</ClassDiagram>
|
||||
54
mRemoteV1/ClassDiagram2.cd
Normal file
54
mRemoteV1/ClassDiagram2.cd
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||
<Class Name="mRemoteNG.Connection.New.ConnectionRecordImp" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="7.75" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAQAAAAAIAAAAAAAAAAAIIVAAAAAAAAAAAAAAAAAABA=</HashCode>
|
||||
<FileName>Connection\New\ConnectionRecordImp.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Orientation="Left" Position="0.1" />
|
||||
</Class>
|
||||
<Interface Name="mRemoteNG.Connection.New.Connectable">
|
||||
<Position X="2.75" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAQAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\New\Connectable.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="mRemoteNG.Connection.New.ConnectionRecord">
|
||||
<Position X="5" Y="2.5" Width="1.75" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAIAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\New\ConnectionRecord.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="mRemoteNG.Connection.New.Protocol">
|
||||
<Position X="1.5" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAIAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\New\Protocol.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="mRemoteNG.Connection.New.ProtocolRDP">
|
||||
<Position X="0.5" Y="4.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\New\ProtocolRDP.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="mRemoteNG.Connection.New.ProtocolSSH">
|
||||
<Position X="2.75" Y="4.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Connection\New\ProtocolSSH.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="mRemoteNG.Connection.RecordList" Collapsed="true">
|
||||
<Position X="7.75" Y="1.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAIAAAAAAAAAAAAACAAAAAQAAkAAAAAAAAAAAABEAAA=</HashCode>
|
||||
<FileName>Connection\New\RecordList.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Font Name="Segoe UI" Size="9" />
|
||||
</ClassDiagram>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,355 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
using mRemoteNG.App;
|
||||
using System.Xml;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Settings
|
||||
{
|
||||
public class Load
|
||||
{
|
||||
#region Public Properties
|
||||
private frmMain _MainForm;
|
||||
public frmMain MainForm
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._MainForm;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._MainForm = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public Load(frmMain MainForm)
|
||||
{
|
||||
this._MainForm = MainForm;
|
||||
}
|
||||
|
||||
public void LoadSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Migrate settings from previous version
|
||||
if (My.Settings.Default.DoUpgrade)
|
||||
{
|
||||
try
|
||||
{
|
||||
My.Settings.Default.Upgrade();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.Error("My.Settings.Upgrade() failed" + Environment.NewLine + ex.Message);
|
||||
}
|
||||
My.Settings.Default.DoUpgrade = false;
|
||||
|
||||
// Clear pending update flag
|
||||
// This is used for automatic updates, not for settings migration, but it
|
||||
// needs to be cleared here because we know that we just updated.
|
||||
My.Settings.Default.UpdatePending = false;
|
||||
}
|
||||
|
||||
App.SupportedCultures.InstantiateSingleton();
|
||||
if (!(My.Settings.Default.OverrideUICulture == "") && App.SupportedCultures.IsNameSupported(System.Convert.ToString(My.Settings.Default.OverrideUICulture)))
|
||||
{
|
||||
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(System.Convert.ToString(My.Settings.Default.OverrideUICulture));
|
||||
Runtime.Log.InfoFormat("Override Culture: {0}/{1}", System.Threading.Thread.CurrentThread.CurrentUICulture.Name, System.Threading.Thread.CurrentThread.CurrentUICulture.NativeName);
|
||||
}
|
||||
|
||||
Themes.ThemeManager.LoadTheme(System.Convert.ToString(My.Settings.Default.ThemeName));
|
||||
|
||||
this._MainForm.WindowState = FormWindowState.Normal;
|
||||
if (My.Settings.Default.MainFormState == FormWindowState.Normal)
|
||||
{
|
||||
if (!My.Settings.Default.MainFormLocation.IsEmpty)
|
||||
{
|
||||
this._MainForm.Location = My.Settings.Default.MainFormLocation;
|
||||
}
|
||||
if (!My.Settings.Default.MainFormSize.IsEmpty)
|
||||
{
|
||||
this._MainForm.Size = My.Settings.Default.MainFormSize;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!My.Settings.Default.MainFormRestoreLocation.IsEmpty)
|
||||
{
|
||||
this._MainForm.Location = My.Settings.Default.MainFormRestoreLocation;
|
||||
}
|
||||
if (!My.Settings.Default.MainFormRestoreSize.IsEmpty)
|
||||
{
|
||||
this._MainForm.Size = My.Settings.Default.MainFormRestoreSize;
|
||||
}
|
||||
}
|
||||
if (My.Settings.Default.MainFormState == FormWindowState.Maximized)
|
||||
{
|
||||
this._MainForm.WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
|
||||
// Make sure the form is visible on the screen
|
||||
const int minHorizontal = 300;
|
||||
const int minVertical = 150;
|
||||
System.Drawing.Rectangle screenBounds = Screen.FromHandle(this._MainForm.Handle).Bounds;
|
||||
System.Drawing.Rectangle newBounds = this._MainForm.Bounds;
|
||||
|
||||
if (newBounds.Right < screenBounds.Left + minHorizontal)
|
||||
{
|
||||
newBounds.X = screenBounds.Left + minHorizontal - newBounds.Width;
|
||||
}
|
||||
if (newBounds.Left > screenBounds.Right - minHorizontal)
|
||||
{
|
||||
newBounds.X = screenBounds.Right - minHorizontal;
|
||||
}
|
||||
if (newBounds.Bottom < screenBounds.Top + minVertical)
|
||||
{
|
||||
newBounds.Y = screenBounds.Top + minVertical - newBounds.Height;
|
||||
}
|
||||
if (newBounds.Top > screenBounds.Bottom - minVertical)
|
||||
{
|
||||
newBounds.Y = screenBounds.Bottom - minVertical;
|
||||
}
|
||||
|
||||
this._MainForm.Location = newBounds.Location;
|
||||
|
||||
if (My.Settings.Default.MainFormKiosk == true)
|
||||
{
|
||||
this._MainForm.Fullscreen.Value = true;
|
||||
this._MainForm.mMenViewFullscreen.Checked = true;
|
||||
}
|
||||
|
||||
if (My.Settings.Default.UseCustomPuttyPath)
|
||||
{
|
||||
Connection.Protocol.PuttyBase.PuttyPath = System.Convert.ToString(My.Settings.Default.CustomPuttyPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Connection.Protocol.PuttyBase.PuttyPath = App.Info.General.PuttyPath;
|
||||
}
|
||||
|
||||
if (My.Settings.Default.ShowSystemTrayIcon)
|
||||
{
|
||||
App.Runtime.NotificationAreaIcon = new Tools.Controls.NotificationAreaIcon();
|
||||
}
|
||||
|
||||
if (My.Settings.Default.AutoSaveEveryMinutes > 0)
|
||||
{
|
||||
this._MainForm.tmrAutoSave.Interval = System.Convert.ToInt32(My.Settings.Default.AutoSaveEveryMinutes * 60000);
|
||||
this._MainForm.tmrAutoSave.Enabled = true;
|
||||
}
|
||||
|
||||
My.Settings.Default.ConDefaultPassword = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.ConDefaultPassword), App.Info.General.EncryptionKey);
|
||||
|
||||
this.LoadPanelsFromXML();
|
||||
this.LoadExternalAppsFromXML();
|
||||
|
||||
if (My.Settings.Default.AlwaysShowPanelTabs)
|
||||
{
|
||||
frmMain.Default.pnlDock.DocumentStyle = DocumentStyle.DockingWindow;
|
||||
}
|
||||
|
||||
if (My.Settings.Default.ResetToolbars == false)
|
||||
{
|
||||
LoadToolbarsFromSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetToolbarsDefault();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.Error("Loading settings failed" + Environment.NewLine + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetToolbarsDefault()
|
||||
{
|
||||
ToolStripPanelFromString("top").Join(MainForm.tsQuickConnect, new Point(300, 0));
|
||||
MainForm.tsQuickConnect.Visible = true;
|
||||
ToolStripPanelFromString("bottom").Join(MainForm.tsExternalTools, new Point(3, 0));
|
||||
MainForm.tsExternalTools.Visible = false;
|
||||
}
|
||||
|
||||
public void LoadToolbarsFromSettings()
|
||||
{
|
||||
if (My.Settings.Default.QuickyTBLocation.X > My.Settings.Default.ExtAppsTBLocation.X)
|
||||
{
|
||||
AddDynamicPanels();
|
||||
AddStaticPanels();
|
||||
}
|
||||
else
|
||||
{
|
||||
AddStaticPanels();
|
||||
AddDynamicPanels();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddStaticPanels()
|
||||
{
|
||||
ToolStripPanelFromString(System.Convert.ToString(My.Settings.Default.QuickyTBParentDock)).Join(MainForm.tsQuickConnect, My.Settings.Default.QuickyTBLocation);
|
||||
MainForm.tsQuickConnect.Visible = System.Convert.ToBoolean(My.Settings.Default.QuickyTBVisible);
|
||||
}
|
||||
|
||||
private void AddDynamicPanels()
|
||||
{
|
||||
ToolStripPanelFromString(System.Convert.ToString(My.Settings.Default.ExtAppsTBParentDock)).Join(MainForm.tsExternalTools, My.Settings.Default.ExtAppsTBLocation);
|
||||
MainForm.tsExternalTools.Visible = System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBVisible);
|
||||
}
|
||||
|
||||
private ToolStripPanel ToolStripPanelFromString(string Panel)
|
||||
{
|
||||
switch (Panel.ToLower())
|
||||
{
|
||||
case "top":
|
||||
return MainForm.tsContainer.TopToolStripPanel;
|
||||
case "bottom":
|
||||
return MainForm.tsContainer.BottomToolStripPanel;
|
||||
case "left":
|
||||
return MainForm.tsContainer.LeftToolStripPanel;
|
||||
case "right":
|
||||
return MainForm.tsContainer.RightToolStripPanel;
|
||||
default:
|
||||
return MainForm.tsContainer.TopToolStripPanel;
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadPanelsFromXML()
|
||||
{
|
||||
try
|
||||
{
|
||||
Runtime.Windows.treePanel = null;
|
||||
Runtime.Windows.configPanel = null;
|
||||
Runtime.Windows.errorsPanel = null;
|
||||
|
||||
while (MainForm.pnlDock.Contents.Count > 0)
|
||||
{
|
||||
WeifenLuo.WinFormsUI.Docking.DockContent dc = (WeifenLuo.WinFormsUI.Docking.DockContent)MainForm.pnlDock.Contents[0];
|
||||
dc.Close();
|
||||
}
|
||||
|
||||
Runtime.Startup.CreatePanels();
|
||||
|
||||
string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.Settings.LayoutFileName;
|
||||
string newPath = App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.LayoutFileName;
|
||||
if (File.Exists(newPath))
|
||||
{
|
||||
MainForm.pnlDock.LoadFromXml(newPath, GetContentFromPersistString);
|
||||
#if !PORTABLE
|
||||
}
|
||||
else if (File.Exists(oldPath))
|
||||
{
|
||||
MainForm.pnlDock.LoadFromXml(oldPath, GetContentFromPersistString);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Runtime.Startup.SetDefaultLayout();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.Error("LoadPanelsFromXML failed" + Environment.NewLine + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadExternalAppsFromXML()
|
||||
{
|
||||
string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.Settings.ExtAppsFilesName;
|
||||
string newPath = App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.ExtAppsFilesName;
|
||||
XmlDocument xDom = new XmlDocument();
|
||||
if (File.Exists(newPath))
|
||||
{
|
||||
xDom.Load(newPath);
|
||||
#if !PORTABLE
|
||||
}
|
||||
else if (File.Exists(oldPath))
|
||||
{
|
||||
xDom.Load(oldPath);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (XmlElement xEl in xDom.DocumentElement.ChildNodes)
|
||||
{
|
||||
Tools.ExternalTool extA = new Tools.ExternalTool();
|
||||
extA.DisplayName = xEl.Attributes["DisplayName"].Value;
|
||||
extA.FileName = xEl.Attributes["FileName"].Value;
|
||||
extA.Arguments = xEl.Attributes["Arguments"].Value;
|
||||
|
||||
if (xEl.HasAttribute("WaitForExit"))
|
||||
{
|
||||
extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value);
|
||||
}
|
||||
|
||||
if (xEl.HasAttribute("TryToIntegrate"))
|
||||
{
|
||||
extA.TryIntegrate = bool.Parse(xEl.Attributes["TryToIntegrate"].Value);
|
||||
}
|
||||
|
||||
Runtime.ExternalTools.Add(extA);
|
||||
}
|
||||
|
||||
MainForm.SwitchToolBarText(System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBShowText));
|
||||
|
||||
xDom = null;
|
||||
|
||||
frmMain.Default.AddExternalToolsToToolBar();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private IDockContent GetContentFromPersistString(string persistString)
|
||||
{
|
||||
// pnlLayout.xml persistence XML fix for refactoring to mRemoteNG
|
||||
if (persistString.StartsWith("mRemote."))
|
||||
{
|
||||
persistString = persistString.Replace("mRemote.", "mRemoteNG.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (persistString == typeof(UI.Window.Config).ToString())
|
||||
{
|
||||
return Runtime.Windows.configPanel;
|
||||
}
|
||||
|
||||
if (persistString == typeof(UI.Window.Tree).ToString())
|
||||
{
|
||||
return Runtime.Windows.treePanel;
|
||||
}
|
||||
|
||||
if (persistString == typeof(UI.Window.ErrorsAndInfos).ToString())
|
||||
{
|
||||
return Runtime.Windows.errorsPanel;
|
||||
}
|
||||
|
||||
if (persistString == typeof(UI.Window.Sessions).ToString())
|
||||
{
|
||||
return Runtime.Windows.sessionsPanel;
|
||||
}
|
||||
|
||||
if (persistString == typeof(UI.Window.ScreenshotManager).ToString())
|
||||
{
|
||||
return Runtime.Windows.screenshotPanel;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.Error("GetContentFromPersistString failed" + Environment.NewLine + ex.Message);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
namespace mRemoteNG.Config
|
||||
{
|
||||
public enum ConfirmClose
|
||||
public enum ConfirmCloseEnum
|
||||
{
|
||||
Unspecified = 0,
|
||||
Never = 1,
|
||||
@@ -9,4 +8,4 @@ namespace mRemoteNG.Config
|
||||
Multiple = 3,
|
||||
All = 4
|
||||
}
|
||||
}
|
||||
}
|
||||
1277
mRemoteV1/Config/Connections/ConnectionsLoader.cs
Normal file
1277
mRemoteV1/Config/Connections/ConnectionsLoader.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,21 @@
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol.RDP;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using mRemoteNG.App;
|
||||
using System.Data.SqlClient;
|
||||
using mRemoteNG.Tools;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
public class Save
|
||||
public class ConnectionsSaver
|
||||
{
|
||||
#region Public Enums
|
||||
public enum Format
|
||||
@@ -34,7 +37,7 @@ namespace mRemoteNG.Config.Connections
|
||||
private SqlCommand _sqlQuery;
|
||||
|
||||
private int _currentNodeIndex = 0;
|
||||
private string _parentConstantId = System.Convert.ToString(0);
|
||||
private string _parentConstantId = Convert.ToString(0);
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
@@ -42,14 +45,14 @@ namespace mRemoteNG.Config.Connections
|
||||
public string SQLDatabaseName {get; set;}
|
||||
public string SQLUsername {get; set;}
|
||||
public string SQLPassword {get; set;}
|
||||
|
||||
|
||||
public string ConnectionFileName {get; set;}
|
||||
public TreeNode RootTreeNode {get; set;}
|
||||
public bool Export {get; set;}
|
||||
public Format SaveFormat {get; set;}
|
||||
public Security.Save SaveSecurity {get; set;}
|
||||
public Connection.ConnectionList ConnectionList {get; set;}
|
||||
public Container.List ContainerList {get; set;}
|
||||
public ConnectionList ConnectionList {get; set;}
|
||||
public ContainerList ContainerList {get; set;}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
@@ -81,7 +84,7 @@ namespace mRemoteNG.Config.Connections
|
||||
}
|
||||
break;
|
||||
}
|
||||
frmMain.Default.UsingSqlServer = SaveFormat == Format.SQL;
|
||||
frmMain.Default.AreWeUsingSqlServerForSavingConnections = SaveFormat == Format.SQL;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -183,7 +186,7 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
if ((tN.Tag as mRemoteNG.Root.Info).Password == true)
|
||||
{
|
||||
_password = System.Convert.ToString((tN.Tag as mRemoteNG.Root.Info).PasswordString);
|
||||
_password = Convert.ToString((tN.Tag as mRemoteNG.Root.Info).PasswordString);
|
||||
strProtected = Security.Crypt.Encrypt("ThisIsProtected", _password);
|
||||
}
|
||||
else
|
||||
@@ -199,7 +202,7 @@ namespace mRemoteNG.Config.Connections
|
||||
_sqlQuery = new SqlCommand("DELETE FROM tblRoot", _sqlConnection);
|
||||
_sqlQuery.ExecuteNonQuery();
|
||||
|
||||
_sqlQuery = new SqlCommand("INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" + Misc.PrepareValueForDB(tN.Text) + "\', 0, \'" + strProtected + "\'," + App.Info.Connections.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")", _sqlConnection);
|
||||
_sqlQuery = new SqlCommand("INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" + MiscTools.PrepareValueForDB(tN.Text) + "\', 0, \'" + strProtected + "\'," + App.Info.ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")", _sqlConnection);
|
||||
_sqlQuery.ExecuteNonQuery();
|
||||
|
||||
_sqlQuery = new SqlCommand("DELETE FROM tblCons", _sqlConnection);
|
||||
@@ -212,7 +215,7 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
_sqlQuery = new SqlCommand("DELETE FROM tblUpdate", _sqlConnection);
|
||||
_sqlQuery.ExecuteNonQuery();
|
||||
_sqlQuery = new SqlCommand("INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + Tools.Misc.DBDate(DateTime.Now) + "\')", _sqlConnection);
|
||||
_sqlQuery = new SqlCommand("INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + Tools.MiscTools.DBDate(DateTime.Now) + "\')", _sqlConnection);
|
||||
_sqlQuery.ExecuteNonQuery();
|
||||
|
||||
_sqlConnection.Close();
|
||||
@@ -224,38 +227,38 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
_currentNodeIndex++;
|
||||
|
||||
Connection.ConnectionRecordImp curConI = default(Connection.ConnectionRecordImp);
|
||||
ConnectionInfo curConI = default(ConnectionInfo);
|
||||
_sqlQuery = new SqlCommand("INSERT INTO tblCons (Name, Type, Expanded, Description, Icon, Panel, Username, " + "DomainName, Password, Hostname, Protocol, PuttySession, " + "Port, ConnectToConsole, RenderingEngine, ICAEncryptionStrength, RDPAuthenticationLevel, LoadBalanceInfo, Colors, Resolution, AutomaticResize, DisplayWallpaper, " + "DisplayThemes, EnableFontSmoothing, EnableDesktopComposition, CacheBitmaps, RedirectDiskDrives, RedirectPorts, " + "RedirectPrinters, RedirectSmartCards, RedirectSound, RedirectKeys, " + "Connected, PreExtApp, PostExtApp, MacAddress, UserField, ExtApp, VNCCompression, VNCEncoding, VNCAuthMode, " + "VNCProxyType, VNCProxyIP, VNCProxyPort, VNCProxyUsername, VNCProxyPassword, " + "VNCColors, VNCSmartSizeMode, VNCViewOnly, " + "RDGatewayUsageMethod, RDGatewayHostname, RDGatewayUseConnectionCredentials, RDGatewayUsername, RDGatewayPassword, RDGatewayDomain, " + "UseCredSsp, " + "InheritCacheBitmaps, InheritColors, " + "InheritDescription, InheritDisplayThemes, InheritDisplayWallpaper, InheritEnableFontSmoothing, InheritEnableDesktopComposition, InheritDomain, " + "InheritIcon, InheritPanel, InheritPassword, InheritPort, " + "InheritProtocol, InheritPuttySession, InheritRedirectDiskDrives, " + "InheritRedirectKeys, InheritRedirectPorts, InheritRedirectPrinters, " + "InheritRedirectSmartCards, InheritRedirectSound, InheritResolution, InheritAutomaticResize, " + "InheritUseConsoleSession, InheritRenderingEngine, InheritUsername, InheritICAEncryptionStrength, InheritRDPAuthenticationLevel, InheritLoadBalanceInfo, " + "InheritPreExtApp, InheritPostExtApp, InheritMacAddress, InheritUserField, InheritExtApp, InheritVNCCompression, InheritVNCEncoding, " + "InheritVNCAuthMode, InheritVNCProxyType, InheritVNCProxyIP, InheritVNCProxyPort, " + "InheritVNCProxyUsername, InheritVNCProxyPassword, InheritVNCColors, " + "InheritVNCSmartSizeMode, InheritVNCViewOnly, " + "InheritRDGatewayUsageMethod, InheritRDGatewayHostname, InheritRDGatewayUseConnectionCredentials, InheritRDGatewayUsername, InheritRDGatewayPassword, InheritRDGatewayDomain, "
|
||||
+ "InheritUseCredSsp, " + "PositionID, ParentID, ConstantID, LastChange)" + "VALUES (", _sqlConnection
|
||||
);
|
||||
|
||||
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(node) == Tree.Node.Type.Container)
|
||||
if (Tree.Node.GetNodeType(node) == TreeNodeType.Connection | Tree.Node.GetNodeType(node) == TreeNodeType.Container)
|
||||
{
|
||||
//_xmlTextWriter.WriteStartElement("Node")
|
||||
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(node.Text) + "\',"; //Name
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(node.Text) + "\',"; //Name
|
||||
_sqlQuery.CommandText += "\'" + Tree.Node.GetNodeType(node).ToString() + "\',"; //Type
|
||||
}
|
||||
|
||||
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) //container
|
||||
if (Tree.Node.GetNodeType(node) == TreeNodeType.Container) //container
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + this.ContainerList[node.Tag].IsExpanded + "\',"; //Expanded
|
||||
curConI = this.ContainerList[node.Tag].ConnectionRecord;
|
||||
curConI = this.ContainerList[node.Tag].ConnectionInfo;
|
||||
SaveConnectionFieldsSQL(curConI);
|
||||
|
||||
_sqlQuery.CommandText = Tools.Misc.PrepareForDB(_sqlQuery.CommandText);
|
||||
_sqlQuery.CommandText = Tools.MiscTools.PrepareForDB(_sqlQuery.CommandText);
|
||||
_sqlQuery.ExecuteNonQuery();
|
||||
//_parentConstantId = _currentNodeIndex
|
||||
SaveNodesSQL(node.Nodes);
|
||||
//_xmlTextWriter.WriteEndElement()
|
||||
}
|
||||
|
||||
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
|
||||
if (Tree.Node.GetNodeType(node) == TreeNodeType.Connection)
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
curConI = this.ConnectionList[node.Tag];
|
||||
SaveConnectionFieldsSQL(curConI);
|
||||
//_xmlTextWriter.WriteEndElement()
|
||||
_sqlQuery.CommandText = Tools.Misc.PrepareForDB(_sqlQuery.CommandText);
|
||||
_sqlQuery.CommandText = Tools.MiscTools.PrepareForDB(_sqlQuery.CommandText);
|
||||
_sqlQuery.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
@@ -263,16 +266,16 @@ namespace mRemoteNG.Config.Connections
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveConnectionFieldsSQL(Connection.ConnectionRecordImp curConI)
|
||||
private void SaveConnectionFieldsSQL(ConnectionInfo curConI)
|
||||
{
|
||||
Connection.ConnectionRecordImp with_1 = curConI;
|
||||
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Description) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Icon) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Panel) + "\',";
|
||||
ConnectionInfo with_1 = curConI;
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Description) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Icon) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Panel) + "\',";
|
||||
|
||||
if (this.SaveSecurity.Username == true)
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Username) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Username) + "\',";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -281,7 +284,7 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
if (this.SaveSecurity.Domain == true)
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Domain) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Domain) + "\',";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -290,36 +293,36 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
if (this.SaveSecurity.Password == true)
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(Security.Crypt.Encrypt(with_1.Password, _password)) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(Security.Crypt.Encrypt(with_1.Password, _password)) + "\',";
|
||||
}
|
||||
else
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + "" + "\',";
|
||||
}
|
||||
|
||||
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Hostname) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Hostname) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.Protocol.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.PuttySession) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Port) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.UseConsoleSession) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.PuttySession) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Port) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.UseConsoleSession) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.RenderingEngine.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.ICAEncryption.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.RDPAuthenticationLevel.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.LoadBalanceInfo + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.Colors.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.Resolution.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.AutomaticResize) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.DisplayWallpaper) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.DisplayThemes) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.EnableFontSmoothing) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.EnableDesktopComposition) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.CacheBitmaps) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectDiskDrives) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectPorts) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectPrinters) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectSmartCards) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.AutomaticResize) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.DisplayWallpaper) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.DisplayThemes) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.EnableFontSmoothing) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.EnableDesktopComposition) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.CacheBitmaps) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectDiskDrives) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectPorts) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectPrinters) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectSmartCards) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.RedirectSound.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectKeys) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectKeys) + "\',";
|
||||
|
||||
if (curConI.OpenConnections.Count > 0)
|
||||
{
|
||||
@@ -341,12 +344,12 @@ namespace mRemoteNG.Config.Connections
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCAuthMode.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCProxyType.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCProxyIP + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.VNCProxyPort) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCProxyPort) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCProxyUsername + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Security.Crypt.Encrypt(with_1.VNCProxyPassword, _password) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCColors.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCSmartSizeMode.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.VNCViewOnly) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCViewOnly) + "\',";
|
||||
|
||||
_sqlQuery.CommandText += "\'" + with_1.RDGatewayUsageMethod.ToString() + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.RDGatewayHostname + "\',";
|
||||
@@ -379,149 +382,149 @@ namespace mRemoteNG.Config.Connections
|
||||
_sqlQuery.CommandText += "\'" + "" + "\',";
|
||||
}
|
||||
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.UseCredSsp) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.UseCredSsp) + "\',";
|
||||
|
||||
if (this.SaveSecurity.Inheritance == true)
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.CacheBitmaps) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Colors) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Description) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.DisplayThemes) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.DisplayWallpaper) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.EnableFontSmoothing) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.EnableDesktopComposition) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Domain) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Icon) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Panel) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Password) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Port) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Protocol) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.PuttySession) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectDiskDrives) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectKeys) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectPorts) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectPrinters) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectSmartCards) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectSound) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Resolution) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.AutomaticResize) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.UseConsoleSession) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RenderingEngine) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Username) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.ICAEncryption) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDPAuthenticationLevel) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.LoadBalanceInfo) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.PreExtApp) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.PostExtApp) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.MacAddress) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.UserField) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.ExtApp) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.CacheBitmaps) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Colors) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Description) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.DisplayThemes) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.DisplayWallpaper) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.EnableFontSmoothing) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.EnableDesktopComposition) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Domain) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Icon) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Panel) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Password) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Port) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Protocol) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.PuttySession) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectDiskDrives) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectKeys) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectPorts) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectPrinters) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectSmartCards) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectSound) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Resolution) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.AutomaticResize) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.UseConsoleSession) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RenderingEngine) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Username) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.ICAEncryption) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDPAuthenticationLevel) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.LoadBalanceInfo) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.PreExtApp) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.PostExtApp) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.MacAddress) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.UserField) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.ExtApp) + "\',";
|
||||
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCCompression) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCEncoding) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCAuthMode) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyType) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyIP) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyPort) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyUsername) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyPassword) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCColors) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCSmartSizeMode) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCViewOnly) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCCompression) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCEncoding) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCAuthMode) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyType) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyIP) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyPort) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyUsername) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyPassword) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCColors) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCSmartSizeMode) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCViewOnly) + "\',";
|
||||
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayUsageMethod) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayHostname) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayUseConnectionCredentials) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayUsername) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayPassword) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayDomain) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayUsageMethod) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayHostname) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayUseConnectionCredentials) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayUsername) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayPassword) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayDomain) + "\',";
|
||||
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.UseCredSsp) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.UseCredSsp) + "\',";
|
||||
}
|
||||
else
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .AutomaticResize
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .LoadBalanceInfo
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .AutomaticResize
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .LoadBalanceInfo
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',";
|
||||
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayUsageMethod
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayHostname
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayUseConnectionCredentials
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayUsername
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayPassword
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayDomain
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayUsageMethod
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayHostname
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayUseConnectionCredentials
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayUsername
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayPassword
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayDomain
|
||||
|
||||
_sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .UseCredSsp
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .UseCredSsp
|
||||
}
|
||||
|
||||
with_1.MetaData.PositionID = _currentNodeIndex;
|
||||
with_1.PositionID = _currentNodeIndex;
|
||||
|
||||
if (with_1.MetaData.IsContainer == false)
|
||||
if (with_1.IsContainer == false)
|
||||
{
|
||||
if (with_1.Parent != null)
|
||||
{
|
||||
_parentConstantId = System.Convert.ToString((with_1.Parent as Container.Info).ConnectionRecord.MetaData.ConstantID);
|
||||
_parentConstantId = Convert.ToString((with_1.Parent as ContainerInfo).ConnectionInfo.ConstantID);
|
||||
}
|
||||
else
|
||||
{
|
||||
_parentConstantId = System.Convert.ToString(0);
|
||||
_parentConstantId = Convert.ToString(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((with_1.Parent as Container.Info).Parent != null)
|
||||
if ((with_1.Parent as ContainerInfo).Parent != null)
|
||||
{
|
||||
_parentConstantId = System.Convert.ToString(((with_1.Parent as Container.Info).Parent as Container.Info).ConnectionRecord.MetaData.ConstantID);
|
||||
_parentConstantId = Convert.ToString(((with_1.Parent as ContainerInfo).Parent as ContainerInfo).ConnectionInfo.ConstantID);
|
||||
}
|
||||
else
|
||||
{
|
||||
_parentConstantId = System.Convert.ToString(0);
|
||||
_parentConstantId = Convert.ToString(0);
|
||||
}
|
||||
}
|
||||
|
||||
_sqlQuery.CommandText += _currentNodeIndex + ",\'" + _parentConstantId + "\',\'" + with_1.MetaData.ConstantID + "\',\'" + Tools.Misc.DBDate(DateTime.Now) + "\')";
|
||||
_sqlQuery.CommandText += _currentNodeIndex + ",\'" + _parentConstantId + "\',\'" + with_1.ConstantID + "\',\'" + Tools.MiscTools.DBDate(DateTime.Now) + "\')";
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -553,13 +556,13 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
TreeNode treeNode = default(TreeNode);
|
||||
|
||||
if (Tree.Node.GetNodeType(RootTreeNode) == Tree.Node.Type.Root)
|
||||
if (Tree.Node.GetNodeType(RootTreeNode) == Tree.TreeNodeType.Root)
|
||||
{
|
||||
treeNode = (TreeNode)RootTreeNode.Clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
treeNode = new TreeNode("mR|Export (" + Tools.Misc.DBDate(DateTime.Now) + ")");
|
||||
treeNode = new TreeNode("mR|Export (" + Tools.MiscTools.DBDate(DateTime.Now) + ")");
|
||||
treeNode.Nodes.Add(System.Convert.ToString(RootTreeNode.Clone()));
|
||||
}
|
||||
|
||||
@@ -592,7 +595,7 @@ namespace mRemoteNG.Config.Connections
|
||||
}
|
||||
}
|
||||
|
||||
_xmlTextWriter.WriteAttributeString("ConfVersion", "", App.Info.Connections.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture));
|
||||
_xmlTextWriter.WriteAttributeString("ConfVersion", "", App.Info.ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
TreeNodeCollection treeNodeCollection = default(TreeNodeCollection);
|
||||
treeNodeCollection = treeNode.Nodes;
|
||||
@@ -629,25 +632,25 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
foreach (TreeNode node in tNC)
|
||||
{
|
||||
Connection.ConnectionRecordImp curConI = default(Connection.ConnectionRecordImp);
|
||||
Connection.ConnectionInfo curConI = default(Connection.ConnectionInfo);
|
||||
|
||||
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(node) == Tree.Node.Type.Container)
|
||||
if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection | Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Container)
|
||||
{
|
||||
_xmlTextWriter.WriteStartElement("Node");
|
||||
_xmlTextWriter.WriteAttributeString("Name", "", node.Text);
|
||||
_xmlTextWriter.WriteAttributeString("Type", "", Tree.Node.GetNodeType(node).ToString());
|
||||
}
|
||||
|
||||
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) //container
|
||||
if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Container) //container
|
||||
{
|
||||
_xmlTextWriter.WriteAttributeString("Expanded", "", System.Convert.ToString(this.ContainerList[node.Tag].TreeNode.IsExpanded));
|
||||
curConI = this.ContainerList[node.Tag].ConnectionRecord;
|
||||
curConI = this.ContainerList[node.Tag].ConnectionInfo;
|
||||
SaveConnectionFields(curConI);
|
||||
SaveNode(node.Nodes);
|
||||
_xmlTextWriter.WriteEndElement();
|
||||
}
|
||||
|
||||
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
|
||||
if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection)
|
||||
{
|
||||
curConI = this.ConnectionList[node.Tag];
|
||||
SaveConnectionFields(curConI);
|
||||
@@ -661,7 +664,7 @@ namespace mRemoteNG.Config.Connections
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveConnectionFields(Connection.ConnectionRecordImp curConI)
|
||||
private void SaveConnectionFields(Connection.ConnectionInfo curConI)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -976,20 +979,20 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
foreach (TreeNode node in tNC)
|
||||
{
|
||||
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
|
||||
if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection)
|
||||
{
|
||||
Connection.ConnectionRecordImp curConI = (Connection.ConnectionRecordImp)node.Tag;
|
||||
Connection.ConnectionInfo curConI = (Connection.ConnectionInfo)node.Tag;
|
||||
|
||||
WritemRCSVLine(curConI);
|
||||
}
|
||||
else if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container)
|
||||
else if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Container)
|
||||
{
|
||||
SaveNodemRCSV(node.Nodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void WritemRCSVLine(Connection.ConnectionRecordImp con)
|
||||
private void WritemRCSVLine(Connection.ConnectionInfo con)
|
||||
{
|
||||
string nodePath = con.TreeNode.FullPath;
|
||||
|
||||
@@ -1062,23 +1065,23 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
foreach (TreeNode node in tNC)
|
||||
{
|
||||
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
|
||||
if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection)
|
||||
{
|
||||
Connection.ConnectionRecordImp curConI = (Connection.ConnectionRecordImp)node.Tag;
|
||||
Connection.ConnectionInfo curConI = (Connection.ConnectionInfo)node.Tag;
|
||||
|
||||
if (curConI.Protocol == Connection.Protocol.Protocols.RDP)
|
||||
if (curConI.Protocol == Connection.Protocol.ProtocolType.RDP)
|
||||
{
|
||||
WritevRDCSVLine(curConI);
|
||||
}
|
||||
}
|
||||
else if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container)
|
||||
else if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Container)
|
||||
{
|
||||
SaveNodevRDCSV(node.Nodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void WritevRDCSVLine(Connection.ConnectionRecordImp con)
|
||||
private void WritevRDCSVLine(Connection.ConnectionInfo con)
|
||||
{
|
||||
string nodePath = con.TreeNode.FullPath;
|
||||
|
||||
@@ -1135,11 +1138,11 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
foreach (TreeNode node in tNC)
|
||||
{
|
||||
if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection)
|
||||
if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection)
|
||||
{
|
||||
Connection.ConnectionRecordImp curConI = (Connection.ConnectionRecordImp)node.Tag;
|
||||
Connection.ConnectionInfo curConI = (Connection.ConnectionInfo)node.Tag;
|
||||
|
||||
if (curConI.Protocol == Connection.Protocol.Protocols.RDP)
|
||||
if (curConI.Protocol == Connection.Protocol.ProtocolType.RDP)
|
||||
{
|
||||
_xmlTextWriter.WriteStartElement("Connection");
|
||||
_xmlTextWriter.WriteAttributeString("Id", "", "");
|
||||
@@ -1156,7 +1159,7 @@ namespace mRemoteNG.Config.Connections
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteVREitem(Connection.ConnectionRecordImp con)
|
||||
private void WriteVREitem(Connection.ConnectionInfo con)
|
||||
{
|
||||
//Name
|
||||
_xmlTextWriter.WriteStartElement("ConnectionName");
|
||||
@@ -1225,7 +1228,7 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
//Smart Size
|
||||
_xmlTextWriter.WriteStartElement("AutoSize");
|
||||
_xmlTextWriter.WriteValue(con.Resolution == Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions.SmartSize);
|
||||
_xmlTextWriter.WriteValue(con.Resolution == ProtocolRDP.RDPResolutions.SmartSize);
|
||||
_xmlTextWriter.WriteEndElement();
|
||||
|
||||
//SeparateResolutionX
|
||||
@@ -1238,7 +1241,7 @@ namespace mRemoteNG.Config.Connections
|
||||
_xmlTextWriter.WriteValue("768");
|
||||
_xmlTextWriter.WriteEndElement();
|
||||
|
||||
Rectangle resolution = Connection.Protocol.RDPConnectionProtocolImp.GetResolutionRectangle(con.Resolution);
|
||||
Rectangle resolution = ProtocolRDP.GetResolutionRectangle(con.Resolution);
|
||||
if (resolution.Width == 0)
|
||||
{
|
||||
resolution.Width = 1024;
|
||||
@@ -1280,4 +1283,4 @@ namespace mRemoteNG.Config.Connections
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
77
mRemoteV1/Config/Connections/SQLConnectionsProvider.cs
Normal file
77
mRemoteV1/Config/Connections/SQLConnectionsProvider.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Timers;
|
||||
using mRemoteNG.My;
|
||||
|
||||
namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
public class SqlConnectionsProvider : IDisposable
|
||||
{
|
||||
SqlUpdateTimer _updateTimer;
|
||||
SqlConnectionsUpdateChecker _sqlUpdateChecker;
|
||||
|
||||
|
||||
public SqlConnectionsProvider()
|
||||
{
|
||||
_updateTimer = new SqlUpdateTimer();
|
||||
_sqlUpdateChecker = new SqlConnectionsUpdateChecker();
|
||||
SqlUpdateTimer.SqlUpdateTimerElapsed += SqlUpdateTimer_SqlUpdateTimerElapsed;
|
||||
SqlConnectionsUpdateChecker.SQLUpdateCheckFinished += SQLUpdateCheckFinished;
|
||||
}
|
||||
|
||||
~SqlConnectionsProvider()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
_updateTimer.Enable();
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
{
|
||||
_updateTimer.Disable();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Dispose(bool itIsSafeToAlsoFreeManagedObjects)
|
||||
{
|
||||
if (itIsSafeToAlsoFreeManagedObjects)
|
||||
{
|
||||
DestroySQLUpdateHandlers();
|
||||
_updateTimer.Dispose();
|
||||
_sqlUpdateChecker.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroySQLUpdateHandlers()
|
||||
{
|
||||
SqlUpdateTimer.SqlUpdateTimerElapsed -= SqlUpdateTimer_SqlUpdateTimerElapsed;
|
||||
SqlConnectionsUpdateChecker.SQLUpdateCheckFinished -= SQLUpdateCheckFinished;
|
||||
}
|
||||
|
||||
private void SqlUpdateTimer_SqlUpdateTimerElapsed()
|
||||
{
|
||||
_sqlUpdateChecker.IsDatabaseUpdateAvailableAsync();
|
||||
}
|
||||
|
||||
private void SQLUpdateCheckFinished(bool UpdateIsAvailable)
|
||||
{
|
||||
if (UpdateIsAvailable)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, My.Language.strSqlUpdateCheckUpdateAvailable, true);
|
||||
Runtime.LoadConnectionsBG();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
mRemoteV1/Config/Connections/SqlCommandBuilder.cs
Normal file
9
mRemoteV1/Config/Connections/SqlCommandBuilder.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
public interface SqlCommandBuilder
|
||||
{
|
||||
SqlCommand BuildCommand();
|
||||
}
|
||||
}
|
||||
131
mRemoteV1/Config/Connections/SqlConnectionsUpdateChecker.cs
Normal file
131
mRemoteV1/Config/Connections/SqlConnectionsUpdateChecker.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Messages;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Threading;
|
||||
|
||||
namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
public class SqlConnectionsUpdateChecker : IDisposable
|
||||
{
|
||||
private SqlConnector sqlConnector;
|
||||
private SqlCommand sqlQuery;
|
||||
private SqlDataReader sqlReader;
|
||||
|
||||
|
||||
public SqlConnectionsUpdateChecker()
|
||||
{
|
||||
sqlConnector = default(SqlConnectorImp);
|
||||
sqlQuery = default(SqlCommand);
|
||||
sqlReader = default(SqlDataReader);
|
||||
}
|
||||
|
||||
~SqlConnectionsUpdateChecker()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
|
||||
public void IsDatabaseUpdateAvailableAsync()
|
||||
{
|
||||
Thread t = new Thread(IsDatabaseUpdateAvailableDelegate);
|
||||
t.SetApartmentState(ApartmentState.STA);
|
||||
t.Start();
|
||||
}
|
||||
|
||||
private void IsDatabaseUpdateAvailableDelegate()
|
||||
{
|
||||
IsDatabaseUpdateAvailable();
|
||||
}
|
||||
|
||||
public bool IsDatabaseUpdateAvailable()
|
||||
{
|
||||
ConnectToSqlDB();
|
||||
BuildSqlQueryToGetUpdateStatus();
|
||||
ExecuteQuery();
|
||||
bool updateIsAvailable = DatabaseIsMoreUpToDateThanUs();
|
||||
SendUpdateCheckFinishedEvent(updateIsAvailable);
|
||||
return updateIsAvailable;
|
||||
}
|
||||
private void ConnectToSqlDB()
|
||||
{
|
||||
try
|
||||
{
|
||||
sqlConnector = new SqlConnectorImp();
|
||||
sqlConnector.Connect();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "Unable to connect to Sql DB to check for updates." + Environment.NewLine + e.Message, true);
|
||||
}
|
||||
}
|
||||
private void BuildSqlQueryToGetUpdateStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
SqlCommandBuilder sqlCmdBuilder = new SqlUpdateQueryBuilder();
|
||||
sqlQuery = sqlCmdBuilder.BuildCommand();
|
||||
sqlConnector.AssociateItemToThisConnector(sqlQuery);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "Could not build query to check for updates from the Sql server." + Environment.NewLine + ex.Message, true);
|
||||
}
|
||||
}
|
||||
private void ExecuteQuery()
|
||||
{
|
||||
try
|
||||
{
|
||||
sqlReader = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
|
||||
sqlReader.Read();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "Error executing Sql query to get updates from the DB." + Environment.NewLine + ex.Message, true);
|
||||
}
|
||||
}
|
||||
private bool DatabaseIsMoreUpToDateThanUs()
|
||||
{
|
||||
if (GetLastUpdateTimeFromDBResponse() > Runtime.LastSqlUpdate)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
private DateTime GetLastUpdateTimeFromDBResponse()
|
||||
{
|
||||
DateTime LastUpdateInDB = default(DateTime);
|
||||
if (sqlReader.HasRows)
|
||||
LastUpdateInDB = Convert.ToDateTime(sqlReader["LastUpdate"]);
|
||||
return LastUpdateInDB;
|
||||
}
|
||||
private void SendUpdateCheckFinishedEvent(bool UpdateAvailable)
|
||||
{
|
||||
if (SQLUpdateCheckFinishedEvent != null)
|
||||
SQLUpdateCheckFinishedEvent(UpdateAvailable);
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
private void Dispose(bool itIsSafeToDisposeManagedObjects)
|
||||
{
|
||||
if (itIsSafeToDisposeManagedObjects)
|
||||
{
|
||||
sqlConnector.Disconnect();
|
||||
sqlConnector.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public delegate void SQLUpdateCheckFinishedEventHandler(bool UpdateAvailable);
|
||||
private static SQLUpdateCheckFinishedEventHandler SQLUpdateCheckFinishedEvent;
|
||||
public static event SQLUpdateCheckFinishedEventHandler SQLUpdateCheckFinished
|
||||
{
|
||||
add { SQLUpdateCheckFinishedEvent = (SQLUpdateCheckFinishedEventHandler)System.Delegate.Combine(SQLUpdateCheckFinishedEvent, value); }
|
||||
remove { SQLUpdateCheckFinishedEvent = (SQLUpdateCheckFinishedEventHandler)System.Delegate.Remove(SQLUpdateCheckFinishedEvent, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
24
mRemoteV1/Config/Connections/SqlUpdateQueryBuilder.cs
Normal file
24
mRemoteV1/Config/Connections/SqlUpdateQueryBuilder.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
public class SqlUpdateQueryBuilder : SqlCommandBuilder
|
||||
{
|
||||
private string _updateQuery;
|
||||
|
||||
public SqlUpdateQueryBuilder()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
_updateQuery = "SELECT * FROM tblUpdate";
|
||||
}
|
||||
|
||||
public SqlCommand BuildCommand()
|
||||
{
|
||||
return new SqlCommand(_updateQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
84
mRemoteV1/Config/Connections/SqlUpdateTimer.cs
Normal file
84
mRemoteV1/Config/Connections/SqlUpdateTimer.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Messages;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Timers;
|
||||
|
||||
namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
public class SqlUpdateTimer : IDisposable
|
||||
{
|
||||
private Timer _sqlUpdateTimer;
|
||||
|
||||
public SqlUpdateTimer()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
~SqlUpdateTimer()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
_sqlUpdateTimer = new Timer();
|
||||
_sqlUpdateTimer.Interval = 3000;
|
||||
_sqlUpdateTimer.Elapsed += sqlUpdateTimer_Elapsed;
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
_sqlUpdateTimer.Start();
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
{
|
||||
_sqlUpdateTimer.Stop();
|
||||
}
|
||||
|
||||
public bool IsUpdateCheckingEnabled()
|
||||
{
|
||||
return _sqlUpdateTimer.Enabled;
|
||||
}
|
||||
|
||||
private static void sqlUpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
SqlUpdateTimerElapsedEvent();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected void Dispose(bool itIsSafeToAlsoFreeManagedObjects)
|
||||
{
|
||||
if (itIsSafeToAlsoFreeManagedObjects)
|
||||
{
|
||||
StopTimer();
|
||||
}
|
||||
}
|
||||
private void StopTimer()
|
||||
{
|
||||
try
|
||||
{
|
||||
_sqlUpdateTimer.Stop();
|
||||
_sqlUpdateTimer.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public delegate void SqlUpdateTimerElapsedEventHandler();
|
||||
private static SqlUpdateTimerElapsedEventHandler SqlUpdateTimerElapsedEvent;
|
||||
public static event SqlUpdateTimerElapsedEventHandler SqlUpdateTimerElapsed
|
||||
{
|
||||
add { SqlUpdateTimerElapsedEvent = (SqlUpdateTimerElapsedEventHandler)Delegate.Combine(SqlUpdateTimerElapsedEvent, value); }
|
||||
remove { SqlUpdateTimerElapsedEvent = (SqlUpdateTimerElapsedEventHandler)Delegate.Remove(SqlUpdateTimerElapsedEvent, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ using System.DirectoryServices;
|
||||
using mRemoteNG.App;
|
||||
using System.Text.RegularExpressions;
|
||||
using mRemoteNG.My;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Import
|
||||
@@ -22,12 +24,12 @@ namespace mRemoteNG.Config.Import
|
||||
{
|
||||
try
|
||||
{
|
||||
TreeNode treeNode = Tree.Node.AddNode(Tree.Node.Type.Container);
|
||||
TreeNode treeNode = Tree.Node.AddNode(Tree.TreeNodeType.Container);
|
||||
|
||||
Container.Info containerInfo = new Container.Info();
|
||||
ContainerInfo containerInfo = new ContainerInfo();
|
||||
containerInfo.TreeNode = treeNode;
|
||||
containerInfo.ConnectionRecord = new Connection.ConnectionRecordImp(containerInfo);
|
||||
|
||||
containerInfo.ConnectionInfo = new ConnectionInfo(containerInfo);
|
||||
|
||||
string name = "";
|
||||
Match match = Regex.Match(ldapPath, "ou=([^,]*)", RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
@@ -42,13 +44,13 @@ namespace mRemoteNG.Config.Import
|
||||
containerInfo.Name = name;
|
||||
|
||||
// We can only inherit from a container node, not the root node or connection nodes
|
||||
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container)
|
||||
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.TreeNodeType.Container)
|
||||
{
|
||||
containerInfo.Parent = parentTreeNode.Tag;
|
||||
}
|
||||
else
|
||||
{
|
||||
containerInfo.ConnectionRecord.Inherit.TurnOffInheritanceCompletely();
|
||||
containerInfo.ConnectionInfo.Inherit.TurnOffInheritanceCompletely();
|
||||
}
|
||||
|
||||
treeNode.Text = name;
|
||||
@@ -91,18 +93,18 @@ namespace mRemoteNG.Config.Import
|
||||
{
|
||||
ldapResult = tempLoopVar_ldapResult;
|
||||
System.DirectoryServices.DirectoryEntry with_2 = ldapResult.GetDirectoryEntry();
|
||||
strDisplayName = System.Convert.ToString(with_2.Properties["cn"].Value);
|
||||
strDescription = System.Convert.ToString(with_2.Properties["Description"].Value);
|
||||
strHostName = System.Convert.ToString(with_2.Properties["dNSHostName"].Value);
|
||||
strDisplayName = Convert.ToString(with_2.Properties["cn"].Value);
|
||||
strDescription = Convert.ToString(with_2.Properties["Description"].Value);
|
||||
strHostName = Convert.ToString(with_2.Properties["dNSHostName"].Value);
|
||||
|
||||
TreeNode treeNode = Tree.Node.AddNode(Tree.Node.Type.Connection, strDisplayName);
|
||||
TreeNode treeNode = Tree.Node.AddNode(Tree.TreeNodeType.Connection, strDisplayName);
|
||||
|
||||
Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp();
|
||||
Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp inheritanceInfo = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo, true);
|
||||
ConnectionInfo connectionInfo = new ConnectionInfo();
|
||||
ConnectionInfoInheritance inheritanceInfo = new ConnectionInfoInheritance(connectionInfo, true);
|
||||
inheritanceInfo.Description = false;
|
||||
if (parentTreeNode.Tag is Container.Info)
|
||||
if (parentTreeNode.Tag is ContainerInfo)
|
||||
{
|
||||
connectionInfo.Parent = (Container.Info)parentTreeNode.Tag;
|
||||
connectionInfo.Parent = (ContainerInfo)parentTreeNode.Tag;
|
||||
}
|
||||
connectionInfo.Inherit = inheritanceInfo;
|
||||
connectionInfo.Name = strDisplayName;
|
||||
@@ -123,4 +125,4 @@ namespace mRemoteNG.Config.Import
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,75 +9,78 @@ using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Container;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Import
|
||||
{
|
||||
public class PortScan
|
||||
{
|
||||
public static void Import(IEnumerable hosts, Connection.Protocol.Protocols protocol, TreeNode parentTreeNode)
|
||||
public static void Import(IEnumerable hosts, ProtocolType protocol, TreeNode parentTreeNode)
|
||||
{
|
||||
foreach (Tools.PortScan.ScanHost host in hosts)
|
||||
{
|
||||
Connection.Protocol.Protocols finalProtocol = default(Connection.Protocol.Protocols);
|
||||
ProtocolType finalProtocol = default(ProtocolType);
|
||||
bool protocolValid = false;
|
||||
|
||||
TreeNode treeNode = Tree.Node.AddNode(Tree.Node.Type.Connection, host.HostNameWithoutDomain);
|
||||
TreeNode treeNode = Tree.Node.AddNode(Tree.TreeNodeType.Connection, host.HostNameWithoutDomain);
|
||||
|
||||
Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp();
|
||||
connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo);
|
||||
ConnectionInfo connectionInfo = new ConnectionInfo();
|
||||
connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo);
|
||||
|
||||
connectionInfo.Name = host.HostNameWithoutDomain;
|
||||
connectionInfo.Hostname = host.HostName;
|
||||
|
||||
switch (protocol)
|
||||
{
|
||||
case Connection.Protocol.Protocols.SSH2:
|
||||
case ProtocolType.SSH2:
|
||||
if (host.SSH)
|
||||
{
|
||||
finalProtocol = Connection.Protocol.Protocols.SSH2;
|
||||
finalProtocol = ProtocolType.SSH2;
|
||||
protocolValid = true;
|
||||
}
|
||||
break;
|
||||
case Connection.Protocol.Protocols.Telnet:
|
||||
case ProtocolType.Telnet:
|
||||
if (host.Telnet)
|
||||
{
|
||||
finalProtocol = Connection.Protocol.Protocols.Telnet;
|
||||
finalProtocol = ProtocolType.Telnet;
|
||||
protocolValid = true;
|
||||
}
|
||||
break;
|
||||
case Connection.Protocol.Protocols.HTTP:
|
||||
case ProtocolType.HTTP:
|
||||
if (host.HTTP)
|
||||
{
|
||||
finalProtocol = Connection.Protocol.Protocols.HTTP;
|
||||
finalProtocol = ProtocolType.HTTP;
|
||||
protocolValid = true;
|
||||
}
|
||||
break;
|
||||
case Connection.Protocol.Protocols.HTTPS:
|
||||
case ProtocolType.HTTPS:
|
||||
if (host.HTTPS)
|
||||
{
|
||||
finalProtocol = Connection.Protocol.Protocols.HTTPS;
|
||||
finalProtocol = ProtocolType.HTTPS;
|
||||
protocolValid = true;
|
||||
}
|
||||
break;
|
||||
case Connection.Protocol.Protocols.Rlogin:
|
||||
case ProtocolType.Rlogin:
|
||||
if (host.Rlogin)
|
||||
{
|
||||
finalProtocol = Connection.Protocol.Protocols.Rlogin;
|
||||
finalProtocol = ProtocolType.Rlogin;
|
||||
protocolValid = true;
|
||||
}
|
||||
break;
|
||||
case Connection.Protocol.Protocols.RDP:
|
||||
case ProtocolType.RDP:
|
||||
if (host.RDP)
|
||||
{
|
||||
finalProtocol = Connection.Protocol.Protocols.RDP;
|
||||
finalProtocol = ProtocolType.RDP;
|
||||
protocolValid = true;
|
||||
}
|
||||
break;
|
||||
case Connection.Protocol.Protocols.VNC:
|
||||
case ProtocolType.VNC:
|
||||
if (host.VNC)
|
||||
{
|
||||
finalProtocol = Connection.Protocol.Protocols.VNC;
|
||||
finalProtocol = ProtocolType.VNC;
|
||||
protocolValid = true;
|
||||
}
|
||||
break;
|
||||
@@ -91,9 +94,9 @@ namespace mRemoteNG.Config.Import
|
||||
treeNode.Tag = connectionInfo;
|
||||
parentTreeNode.Nodes.Add(treeNode);
|
||||
|
||||
if (parentTreeNode.Tag is Container.Info)
|
||||
if (parentTreeNode.Tag is ContainerInfo)
|
||||
{
|
||||
connectionInfo.Parent = (Container.Info)parentTreeNode.Tag;
|
||||
connectionInfo.Parent = (ContainerInfo)parentTreeNode.Tag;
|
||||
}
|
||||
|
||||
Runtime.ConnectionList.Add(connectionInfo);
|
||||
@@ -101,4 +104,4 @@ namespace mRemoteNG.Config.Import
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ using System.Xml;
|
||||
using System.IO;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Images;
|
||||
using mRemoteNG.Connection;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Import
|
||||
@@ -67,17 +69,17 @@ namespace mRemoteNG.Config.Import
|
||||
TreeNode treeNode = new TreeNode(name);
|
||||
parentTreeNode.Nodes.Add(treeNode);
|
||||
|
||||
Container.Info containerInfo = new Container.Info();
|
||||
Container.ContainerInfo containerInfo = new Container.ContainerInfo();
|
||||
containerInfo.TreeNode = treeNode;
|
||||
containerInfo.Name = name;
|
||||
|
||||
Connection.ConnectionRecordImp connectionInfo = CreateConnectionInfo(name);
|
||||
Connection.ConnectionInfo connectionInfo = CreateConnectionInfo(name);
|
||||
connectionInfo.Parent = containerInfo;
|
||||
connectionInfo.IsContainer = true;
|
||||
containerInfo.ConnectionRecord = connectionInfo;
|
||||
containerInfo.ConnectionInfo = connectionInfo;
|
||||
|
||||
// We can only inherit from a container node, not the root node or connection nodes
|
||||
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container)
|
||||
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.TreeNodeType.Container)
|
||||
{
|
||||
containerInfo.Parent = parentTreeNode.Tag;
|
||||
}
|
||||
@@ -88,8 +90,8 @@ namespace mRemoteNG.Config.Import
|
||||
|
||||
treeNode.Name = name;
|
||||
treeNode.Tag = containerInfo;
|
||||
treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container;
|
||||
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container;
|
||||
treeNode.ImageIndex = (int)TreeImageType.Container;
|
||||
treeNode.SelectedImageIndex = (int)TreeImageType.Container;
|
||||
|
||||
foreach (XmlNode childNode in xmlNode.SelectNodes("./*"))
|
||||
{
|
||||
@@ -127,48 +129,48 @@ namespace mRemoteNG.Config.Import
|
||||
TreeNode treeNode = new TreeNode(name);
|
||||
parentTreeNode.Nodes.Add(treeNode);
|
||||
|
||||
Connection.ConnectionRecordImp connectionInfo = ConnectionInfoFromXml(connectionNode);
|
||||
Connection.ConnectionInfo connectionInfo = ConnectionInfoFromXml(connectionNode);
|
||||
connectionInfo.TreeNode = treeNode;
|
||||
connectionInfo.Parent = (Container.Info)parentTreeNode.Tag;
|
||||
connectionInfo.Parent = (Container.ContainerInfo)parentTreeNode.Tag;
|
||||
|
||||
treeNode.Name = name;
|
||||
treeNode.Tag = connectionInfo;
|
||||
treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
|
||||
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
|
||||
treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
|
||||
Runtime.ConnectionList.Add(connectionInfo);
|
||||
}
|
||||
|
||||
private static Connection.ConnectionRecordImp CreateConnectionInfo(string name)
|
||||
private static ConnectionInfo CreateConnectionInfo(string name)
|
||||
{
|
||||
Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp();
|
||||
connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo);
|
||||
ConnectionInfo connectionInfo = new ConnectionInfo();
|
||||
connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo);
|
||||
connectionInfo.Name = name;
|
||||
return connectionInfo;
|
||||
}
|
||||
|
||||
private static Connection.ConnectionRecordImp ConnectionInfoFromXml(XmlNode xmlNode)
|
||||
private static ConnectionInfo ConnectionInfoFromXml(XmlNode xmlNode)
|
||||
{
|
||||
XmlNode connectionInfoNode = xmlNode.SelectSingleNode("./connection_info");
|
||||
|
||||
string name = connectionInfoNode.SelectSingleNode("./name").InnerText;
|
||||
Connection.ConnectionRecordImp connectionInfo = CreateConnectionInfo(name);
|
||||
ConnectionInfo connectionInfo = CreateConnectionInfo(name);
|
||||
|
||||
string protocol = connectionInfoNode.SelectSingleNode("./protocol").InnerText;
|
||||
switch (protocol.ToLowerInvariant())
|
||||
{
|
||||
case "telnet":
|
||||
connectionInfo.Protocol = Protocols.Telnet;
|
||||
connectionInfo.Protocol = ProtocolType.Telnet;
|
||||
break;
|
||||
case "ssh":
|
||||
connectionInfo.Protocol = Protocols.SSH2;
|
||||
connectionInfo.Protocol = ProtocolType.SSH2;
|
||||
break;
|
||||
default:
|
||||
throw (new FileFormatException(string.Format("Unrecognized protocol ({0}).", protocol)));
|
||||
}
|
||||
|
||||
connectionInfo.Hostname = connectionInfoNode.SelectSingleNode("./host").InnerText;
|
||||
connectionInfo.Port = System.Convert.ToInt32(connectionInfoNode.SelectSingleNode("./port").InnerText);
|
||||
connectionInfo.Port = Convert.ToInt32(connectionInfoNode.SelectSingleNode("./port").InnerText);
|
||||
connectionInfo.PuttySession = connectionInfoNode.SelectSingleNode("./session").InnerText;
|
||||
// ./commandline
|
||||
connectionInfo.Description = connectionInfoNode.SelectSingleNode("./description").InnerText;
|
||||
@@ -196,4 +198,4 @@ namespace mRemoteNG.Config.Import
|
||||
return connectionInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,10 @@ using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection.Protocol.RDP;
|
||||
using mRemoteNG.Images;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Connection;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Import
|
||||
@@ -24,20 +28,20 @@ namespace mRemoteNG.Config.Import
|
||||
TreeNode treeNode = new TreeNode(name);
|
||||
parentTreeNode.Nodes.Add(treeNode);
|
||||
|
||||
Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp();
|
||||
connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo);
|
||||
ConnectionInfo connectionInfo = new ConnectionInfo();
|
||||
connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo);
|
||||
connectionInfo.Name = name;
|
||||
connectionInfo.TreeNode = treeNode;
|
||||
|
||||
if (treeNode.Parent.Tag is Container.Info)
|
||||
if (treeNode.Parent.Tag is ContainerInfo)
|
||||
{
|
||||
connectionInfo.Parent = (Container.Info)treeNode.Parent.Tag;
|
||||
connectionInfo.Parent = (ContainerInfo)treeNode.Parent.Tag;
|
||||
}
|
||||
|
||||
treeNode.Name = name;
|
||||
treeNode.Tag = connectionInfo;
|
||||
treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
|
||||
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
|
||||
treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
@@ -56,12 +60,12 @@ namespace mRemoteNG.Config.Import
|
||||
Runtime.ConnectionList.Add(connectionInfo);
|
||||
}
|
||||
|
||||
private static void SetConnectionInfoParameter(Connection.ConnectionRecordImp connectionInfo, string key, string value)
|
||||
private static void SetConnectionInfoParameter(ConnectionInfo connectionInfo, string key, string value)
|
||||
{
|
||||
switch (key.ToLower())
|
||||
{
|
||||
case "full address":
|
||||
Uri uri = new Uri("dummyscheme" + System.Uri.SchemeDelimiter + value);
|
||||
Uri uri = new Uri("dummyscheme" + Uri.SchemeDelimiter + value);
|
||||
if (!string.IsNullOrEmpty(uri.Host))
|
||||
{
|
||||
connectionInfo.Hostname = uri.Host;
|
||||
@@ -72,7 +76,7 @@ namespace mRemoteNG.Config.Import
|
||||
}
|
||||
break;
|
||||
case "server port":
|
||||
connectionInfo.Port = System.Convert.ToInt32(value);
|
||||
connectionInfo.Port = Convert.ToInt32(value);
|
||||
break;
|
||||
case "username":
|
||||
connectionInfo.Username = value;
|
||||
@@ -84,19 +88,19 @@ namespace mRemoteNG.Config.Import
|
||||
switch (value)
|
||||
{
|
||||
case "8":
|
||||
connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors256;
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors256;
|
||||
break;
|
||||
case "15":
|
||||
connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors15Bit;
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors15Bit;
|
||||
break;
|
||||
case "16":
|
||||
connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors16Bit;
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors16Bit;
|
||||
break;
|
||||
case "24":
|
||||
connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors24Bit;
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors24Bit;
|
||||
break;
|
||||
case "32":
|
||||
connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors32Bit;
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors32Bit;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -113,11 +117,11 @@ namespace mRemoteNG.Config.Import
|
||||
case "screen mode id":
|
||||
if (value == "2")
|
||||
{
|
||||
connectionInfo.Resolution = Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions.Fullscreen;
|
||||
connectionInfo.Resolution = ProtocolRDP.RDPResolutions.Fullscreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionInfo.Resolution = Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions.FitToWindow;
|
||||
connectionInfo.Resolution = ProtocolRDP.RDPResolutions.FitToWindow;
|
||||
}
|
||||
break;
|
||||
case "connect to console":
|
||||
@@ -210,17 +214,17 @@ namespace mRemoteNG.Config.Import
|
||||
switch (value)
|
||||
{
|
||||
case "0":
|
||||
connectionInfo.RedirectSound = Connection.Protocol.RDPConnectionProtocolImp.RDPSounds.BringToThisComputer;
|
||||
connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.BringToThisComputer;
|
||||
break;
|
||||
case "1":
|
||||
connectionInfo.RedirectSound = Connection.Protocol.RDPConnectionProtocolImp.RDPSounds.LeaveAtRemoteComputer;
|
||||
connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.LeaveAtRemoteComputer;
|
||||
break;
|
||||
case "2":
|
||||
connectionInfo.RedirectSound = Connection.Protocol.RDPConnectionProtocolImp.RDPSounds.DoNotPlay;
|
||||
connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.DoNotPlay;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,10 @@ using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection.Protocol.RDP;
|
||||
using mRemoteNG.Images;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Import
|
||||
@@ -50,17 +54,17 @@ namespace mRemoteNG.Config.Import
|
||||
TreeNode treeNode = new TreeNode(name);
|
||||
parentTreeNode.Nodes.Add(treeNode);
|
||||
|
||||
Container.Info containerInfo = new Container.Info();
|
||||
Container.ContainerInfo containerInfo = new Container.ContainerInfo();
|
||||
containerInfo.TreeNode = treeNode;
|
||||
containerInfo.Name = name;
|
||||
|
||||
Connection.ConnectionRecordImp connectionInfo = ConnectionInfoFromXml(propertiesNode);
|
||||
Connection.ConnectionInfo connectionInfo = ConnectionInfoFromXml(propertiesNode);
|
||||
connectionInfo.Parent = containerInfo;
|
||||
connectionInfo.IsContainer = true;
|
||||
containerInfo.ConnectionRecord = connectionInfo;
|
||||
containerInfo.ConnectionInfo = connectionInfo;
|
||||
|
||||
// We can only inherit from a container node, not the root node or connection nodes
|
||||
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container)
|
||||
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.TreeNodeType.Container)
|
||||
{
|
||||
containerInfo.Parent = parentTreeNode.Tag;
|
||||
}
|
||||
@@ -71,8 +75,8 @@ namespace mRemoteNG.Config.Import
|
||||
|
||||
treeNode.Name = name;
|
||||
treeNode.Tag = containerInfo;
|
||||
treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container;
|
||||
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container;
|
||||
treeNode.ImageIndex = (int)TreeImageType.Container;
|
||||
treeNode.SelectedImageIndex = (int)TreeImageType.Container;
|
||||
|
||||
foreach (XmlNode childNode in xmlNode.SelectNodes("./group|./server"))
|
||||
{
|
||||
@@ -102,22 +106,22 @@ namespace mRemoteNG.Config.Import
|
||||
TreeNode treeNode = new TreeNode(name);
|
||||
parentTreeNode.Nodes.Add(treeNode);
|
||||
|
||||
Connection.ConnectionRecordImp connectionInfo = ConnectionInfoFromXml(serverNode);
|
||||
ConnectionInfo connectionInfo = ConnectionInfoFromXml(serverNode);
|
||||
connectionInfo.TreeNode = treeNode;
|
||||
connectionInfo.Parent = (Container.Info)parentTreeNode.Tag;
|
||||
connectionInfo.Parent = (ContainerInfo)parentTreeNode.Tag;
|
||||
|
||||
treeNode.Name = name;
|
||||
treeNode.Tag = connectionInfo;
|
||||
treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
|
||||
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
|
||||
treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
|
||||
Runtime.ConnectionList.Add(connectionInfo);
|
||||
}
|
||||
|
||||
private static Connection.ConnectionRecordImp ConnectionInfoFromXml(XmlNode xmlNode)
|
||||
private static ConnectionInfo ConnectionInfoFromXml(XmlNode xmlNode)
|
||||
{
|
||||
Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp();
|
||||
connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo);
|
||||
ConnectionInfo connectionInfo = new ConnectionInfo();
|
||||
connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo);
|
||||
|
||||
string name = xmlNode.SelectSingleNode("./name").InnerText;
|
||||
|
||||
@@ -166,7 +170,7 @@ namespace mRemoteNG.Config.Import
|
||||
connectionInfo.UseConsoleSession = bool.Parse(connectionSettingsNode.SelectSingleNode("./connectToConsole").InnerText);
|
||||
// ./startProgram
|
||||
// ./workingDir
|
||||
connectionInfo.Port = System.Convert.ToInt32(connectionSettingsNode.SelectSingleNode("./port").InnerText);
|
||||
connectionInfo.Port = Convert.ToInt32(connectionSettingsNode.SelectSingleNode("./port").InnerText);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -179,11 +183,11 @@ namespace mRemoteNG.Config.Import
|
||||
{
|
||||
if (gatewaySettingsNode.SelectSingleNode("./enabled").InnerText == "True")
|
||||
{
|
||||
connectionInfo.RDGatewayUsageMethod = RDPConnectionProtocolImp.RDGatewayUsageMethod.Always;
|
||||
connectionInfo.RDGatewayUsageMethod = ProtocolRDP.RDGatewayUsageMethod.Always;
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionInfo.RDGatewayUsageMethod = RDPConnectionProtocolImp.RDGatewayUsageMethod.Never;
|
||||
connectionInfo.RDGatewayUsageMethod = ProtocolRDP.RDGatewayUsageMethod.Never;
|
||||
}
|
||||
|
||||
connectionInfo.RDGatewayHostname = gatewaySettingsNode.SelectSingleNode("./hostName").InnerText;
|
||||
@@ -216,28 +220,28 @@ namespace mRemoteNG.Config.Import
|
||||
XmlNode remoteDesktopNode = xmlNode.SelectSingleNode("./remoteDesktop");
|
||||
if (remoteDesktopNode.Attributes["inherit"].Value == "None")
|
||||
{
|
||||
string resolutionString = System.Convert.ToString(remoteDesktopNode.SelectSingleNode("./size").InnerText.Replace(" ", ""));
|
||||
string resolutionString = Convert.ToString(remoteDesktopNode.SelectSingleNode("./size").InnerText.Replace(" ", ""));
|
||||
try
|
||||
{
|
||||
connectionInfo.Resolution = (Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions)Enum.Parse(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions), "Res" + resolutionString);
|
||||
connectionInfo.Resolution = (ProtocolRDP.RDPResolutions)Enum.Parse(typeof(ProtocolRDP.RDPResolutions), "Res" + resolutionString);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
connectionInfo.Resolution = RDPConnectionProtocolImp.RDPResolutions.FitToWindow;
|
||||
connectionInfo.Resolution = ProtocolRDP.RDPResolutions.FitToWindow;
|
||||
}
|
||||
|
||||
if (remoteDesktopNode.SelectSingleNode("./sameSizeAsClientArea").InnerText == "True")
|
||||
{
|
||||
connectionInfo.Resolution = RDPConnectionProtocolImp.RDPResolutions.FitToWindow;
|
||||
connectionInfo.Resolution = ProtocolRDP.RDPResolutions.FitToWindow;
|
||||
}
|
||||
|
||||
if (remoteDesktopNode.SelectSingleNode("./fullScreen").InnerText == "True")
|
||||
{
|
||||
connectionInfo.Resolution = RDPConnectionProtocolImp.RDPResolutions.Fullscreen;
|
||||
connectionInfo.Resolution = ProtocolRDP.RDPResolutions.Fullscreen;
|
||||
}
|
||||
|
||||
|
||||
connectionInfo.Colors = (Connection.Protocol.RDPConnectionProtocolImp.RDPColors)Enum.Parse(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPColors), remoteDesktopNode.SelectSingleNode("./colorDepth").InnerText);
|
||||
connectionInfo.Colors = (ProtocolRDP.RDPColors)Enum.Parse(typeof(ProtocolRDP.RDPColors), remoteDesktopNode.SelectSingleNode("./colorDepth").InnerText);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -251,13 +255,13 @@ namespace mRemoteNG.Config.Import
|
||||
switch (localResourcesNode.SelectSingleNode("./audioRedirection").InnerText)
|
||||
{
|
||||
case "0": // Bring to this computer
|
||||
connectionInfo.RedirectSound = RDPConnectionProtocolImp.RDPSounds.BringToThisComputer;
|
||||
connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.BringToThisComputer;
|
||||
break;
|
||||
case "1": // Leave at remote computer
|
||||
connectionInfo.RedirectSound = RDPConnectionProtocolImp.RDPSounds.LeaveAtRemoteComputer;
|
||||
connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.LeaveAtRemoteComputer;
|
||||
break;
|
||||
case "2": // Do not play
|
||||
connectionInfo.RedirectSound = RDPConnectionProtocolImp.RDPSounds.DoNotPlay;
|
||||
connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.DoNotPlay;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -299,13 +303,13 @@ namespace mRemoteNG.Config.Import
|
||||
switch (securitySettingsNode.SelectSingleNode("./authentication").InnerText)
|
||||
{
|
||||
case "0": // No authentication
|
||||
connectionInfo.RDPAuthenticationLevel = RDPConnectionProtocolImp.AuthenticationLevel.NoAuth;
|
||||
connectionInfo.RDPAuthenticationLevel = ProtocolRDP.AuthenticationLevel.NoAuth;
|
||||
break;
|
||||
case "1": // Do not connect if authentication fails
|
||||
connectionInfo.RDPAuthenticationLevel = RDPConnectionProtocolImp.AuthenticationLevel.AuthRequired;
|
||||
connectionInfo.RDPAuthenticationLevel = ProtocolRDP.AuthenticationLevel.AuthRequired;
|
||||
break;
|
||||
case "2": // Warn if authentication fails
|
||||
connectionInfo.RDPAuthenticationLevel = RDPConnectionProtocolImp.AuthenticationLevel.WarnOnFailedAuth;
|
||||
connectionInfo.RDPAuthenticationLevel = ProtocolRDP.AuthenticationLevel.WarnOnFailedAuth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -390,4 +394,4 @@ namespace mRemoteNG.Config.Import
|
||||
// ReSharper restore InconsistentNaming
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,10 @@ using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Images;
|
||||
using mRemoteNG.Config.Connections;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Connection;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Import
|
||||
@@ -23,20 +27,20 @@ namespace mRemoteNG.Config.Import
|
||||
TreeNode treeNode = new TreeNode(name);
|
||||
parentTreeNode.Nodes.Add(treeNode);
|
||||
|
||||
Container.Info containerInfo = new Container.Info();
|
||||
ContainerInfo containerInfo = new ContainerInfo();
|
||||
containerInfo.TreeNode = treeNode;
|
||||
containerInfo.Name = name;
|
||||
|
||||
Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp();
|
||||
connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo);
|
||||
ConnectionInfo connectionInfo = new ConnectionInfo();
|
||||
connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo);
|
||||
connectionInfo.Name = name;
|
||||
connectionInfo.TreeNode = treeNode;
|
||||
connectionInfo.Parent = containerInfo;
|
||||
connectionInfo.IsContainer = true;
|
||||
containerInfo.ConnectionRecord = connectionInfo;
|
||||
containerInfo.ConnectionInfo = connectionInfo;
|
||||
|
||||
// We can only inherit from a container node, not the root node or connection nodes
|
||||
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container)
|
||||
if (Tree.Node.GetNodeType(parentTreeNode) == Tree.TreeNodeType.Container)
|
||||
{
|
||||
containerInfo.Parent = parentTreeNode.Tag;
|
||||
}
|
||||
@@ -47,10 +51,10 @@ namespace mRemoteNG.Config.Import
|
||||
|
||||
treeNode.Name = name;
|
||||
treeNode.Tag = containerInfo;
|
||||
treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container;
|
||||
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container;
|
||||
treeNode.ImageIndex = (int)TreeImageType.Container;
|
||||
treeNode.SelectedImageIndex = (int)TreeImageType.Container;
|
||||
|
||||
Connections.Load connectionsLoad = new Connections.Load();
|
||||
ConnectionsLoader connectionsLoad = new ConnectionsLoader();
|
||||
connectionsLoad.ConnectionFileName = fileName;
|
||||
connectionsLoad.RootTreeNode = treeNode;
|
||||
connectionsLoad.ConnectionList = Runtime.ConnectionList;
|
||||
@@ -61,4 +65,4 @@ namespace mRemoteNG.Config.Import
|
||||
Runtime.ContainerList.Add(containerInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,457 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.ComponentModel;
|
||||
using mRemoteNG.App;
|
||||
using SharedLibraryNG;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config
|
||||
{
|
||||
public class KeyboardShortcuts
|
||||
{
|
||||
#region Public Properties
|
||||
private static KeyboardShortcutMap _defaultMap = null;
|
||||
public static KeyboardShortcutMap DefaultMap
|
||||
{
|
||||
get
|
||||
{
|
||||
LoadDefaultMap();
|
||||
return _defaultMap;
|
||||
}
|
||||
}
|
||||
|
||||
private static KeyboardShortcutMap _map;
|
||||
public static KeyboardShortcutMap Map
|
||||
{
|
||||
get
|
||||
{
|
||||
Load();
|
||||
return _map;
|
||||
}
|
||||
set
|
||||
{
|
||||
CancelKeyNotifications();
|
||||
_map = value;
|
||||
Save();
|
||||
RequestKeyNotifications(_handle);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public static void RequestKeyNotifications(IntPtr handle)
|
||||
{
|
||||
// ReSharper disable LocalizableElement
|
||||
if (handle == IntPtr.Zero)
|
||||
{
|
||||
throw (new ArgumentException("The handle cannot be null.", "handle"));
|
||||
}
|
||||
if (!(_handle == IntPtr.Zero) && !(_handle == handle))
|
||||
{
|
||||
throw (new ArgumentException("The handle must match the handle that was specified the first time this function was called.", "handle"));
|
||||
}
|
||||
// ReSharper restore LocalizableElement
|
||||
_handle = handle;
|
||||
foreach (ShortcutMapping shortcutMapping in Map.Mappings)
|
||||
{
|
||||
KeyboardHook.RequestKeyNotification(handle, shortcutMapping.Key.KeyCode, shortcutMapping.Key.ModifierKeys, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortcutCommand CommandFromHookKeyMessage(Message m)
|
||||
{
|
||||
KeyboardHook.HookKeyMsgData msgData = (SharedLibraryNG.KeyboardHook.HookKeyMsgData)Marshal.PtrToStructure(m.LParam, typeof(KeyboardHook.HookKeyMsgData));
|
||||
return Map.GetCommand(msgData.KeyCode, msgData.ModifierKeys);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
private static KeyboardHook _keyboardHook = new KeyboardHook();
|
||||
private static bool _mapLoaded = false;
|
||||
private static IntPtr _handle = IntPtr.Zero;
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private static void LoadDefaultMap()
|
||||
{
|
||||
if (_defaultMap != null)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
_defaultMap = new KeyboardShortcutMap();
|
||||
_defaultMap.AddFromConfigString(ShortcutCommand.PreviousTab, System.Convert.ToString(My.Settings.Default.Properties["KeysPreviousTab"].DefaultValue));
|
||||
_defaultMap.AddFromConfigString(ShortcutCommand.NextTab, System.Convert.ToString(My.Settings.Default.Properties["KeysNextTab"].DefaultValue));
|
||||
}
|
||||
|
||||
private static void Load()
|
||||
{
|
||||
if (_mapLoaded)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
_map = new KeyboardShortcutMap();
|
||||
_map.AddFromConfigString(ShortcutCommand.PreviousTab, System.Convert.ToString(My.Settings.Default.KeysPreviousTab));
|
||||
_map.AddFromConfigString(ShortcutCommand.NextTab, System.Convert.ToString(My.Settings.Default.KeysNextTab));
|
||||
_mapLoaded = true;
|
||||
}
|
||||
|
||||
private static void Save()
|
||||
{
|
||||
if (_map == null)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
My.Settings.Default.KeysPreviousTab = _map.GetConfigString(ShortcutCommand.PreviousTab);
|
||||
My.Settings.Default.KeysNextTab = _map.GetConfigString(ShortcutCommand.NextTab);
|
||||
}
|
||||
|
||||
private static void CancelKeyNotifications()
|
||||
{
|
||||
if (_handle == IntPtr.Zero)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
foreach (ShortcutMapping shortcutMapping in Map.Mappings)
|
||||
{
|
||||
KeyboardHook.CancelKeyNotification(_handle, shortcutMapping.Key.KeyCode, shortcutMapping.Key.ModifierKeys, false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class KeyboardShortcutMap : ICloneable
|
||||
{
|
||||
|
||||
#region Public Properties
|
||||
private List<ShortcutMapping> _mappings;
|
||||
public List<ShortcutMapping> Mappings
|
||||
{
|
||||
get
|
||||
{
|
||||
return _mappings;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public KeyboardShortcutMap()
|
||||
{
|
||||
_mappings = new List<ShortcutMapping>();
|
||||
}
|
||||
|
||||
public KeyboardShortcutMap(List<ShortcutMapping> mappings)
|
||||
{
|
||||
_mappings = mappings;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public void Add(ShortcutCommand command, ShortcutKey shortcutKey)
|
||||
{
|
||||
if (Mappings.Contains(new ShortcutMapping(command, shortcutKey)))
|
||||
{
|
||||
return ;
|
||||
}
|
||||
Mappings.Add(new ShortcutMapping(command, shortcutKey));
|
||||
}
|
||||
|
||||
public void AddRange(ShortcutCommand command, IEnumerable<ShortcutKey> shortcutKeys)
|
||||
{
|
||||
foreach (ShortcutKey shortcutKey in shortcutKeys)
|
||||
{
|
||||
Add(command, shortcutKey);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(ShortcutCommand command, ShortcutKey shortcutKey)
|
||||
{
|
||||
Mappings.Remove(new ShortcutMapping(command, shortcutKey));
|
||||
}
|
||||
|
||||
public void AddFromConfigString(ShortcutCommand command, string configString)
|
||||
{
|
||||
foreach (ShortcutKey shortcutKey in ParseConfigString(configString))
|
||||
{
|
||||
Add(command, shortcutKey);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetConfigString(ShortcutCommand command)
|
||||
{
|
||||
List<string> parts = new List<string>();
|
||||
foreach (ShortcutKey shortcutKey in GetShortcutKeys(command))
|
||||
{
|
||||
parts.Add(shortcutKey.ToConfigString());
|
||||
}
|
||||
return string.Join(", ", parts.ToArray());
|
||||
}
|
||||
|
||||
public ShortcutKey[] GetShortcutKeys(ShortcutCommand command)
|
||||
{
|
||||
List<ShortcutKey> shortcutKeys = new List<ShortcutKey>();
|
||||
foreach (ShortcutMapping shortcutMapping in Mappings)
|
||||
{
|
||||
if (shortcutMapping.Command == command)
|
||||
{
|
||||
shortcutKeys.Add(shortcutMapping.Key);
|
||||
}
|
||||
}
|
||||
return shortcutKeys.ToArray();
|
||||
}
|
||||
|
||||
public void SetShortcutKeys(ShortcutCommand command, IEnumerable<ShortcutKey> shortcutKeys)
|
||||
{
|
||||
ClearShortcutKeys(command);
|
||||
AddRange(command, shortcutKeys);
|
||||
}
|
||||
|
||||
public ShortcutCommand GetCommand(int keyCode, KeyboardHook.ModifierKeys modifierKeys)
|
||||
{
|
||||
return GetCommand(new ShortcutKey(keyCode, modifierKeys));
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
List<ShortcutMapping> newMappings = new List<ShortcutMapping>();
|
||||
newMappings.AddRange(Mappings);
|
||||
return new KeyboardShortcutMap(newMappings);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private static ShortcutKey[] ParseConfigString(string shortcutKeysString)
|
||||
{
|
||||
List<ShortcutKey> shortcutKeys = new List<ShortcutKey>();
|
||||
foreach (string shortcutKeyString in shortcutKeysString.Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
try
|
||||
{
|
||||
shortcutKeys.Add(ShortcutKey.FromConfigString(shortcutKeyString.Trim()));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionMessage(message: string.Format("KeyboardShortcuts.ParseShortcutKeysString({0}) failed at {1}.", shortcutKeysString, shortcutKeyString), ex: ex, logOnly: true);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return shortcutKeys.ToArray();
|
||||
}
|
||||
|
||||
private ShortcutCommand GetCommand(ShortcutKey shortcutKey)
|
||||
{
|
||||
foreach (ShortcutMapping shortcutMapping in Mappings)
|
||||
{
|
||||
if (ShortcutKeysMatch(shortcutMapping.Key, shortcutKey))
|
||||
{
|
||||
return shortcutMapping.Command;
|
||||
}
|
||||
}
|
||||
return ShortcutCommand.None;
|
||||
}
|
||||
|
||||
private static bool
|
||||
ShortcutKeysMatch(ShortcutKey wanted, ShortcutKey pressed)
|
||||
{
|
||||
if (!(wanted.KeyCode == pressed.KeyCode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return KeyboardHook.ModifierKeysMatch(wanted.ModifierKeys, pressed.ModifierKeys);
|
||||
}
|
||||
|
||||
private void ClearShortcutKeys(ShortcutCommand command)
|
||||
{
|
||||
List<ShortcutMapping> mappingsToRemove = new List<ShortcutMapping>();
|
||||
foreach (ShortcutMapping mapping in Mappings)
|
||||
{
|
||||
if (mapping.Command == command)
|
||||
{
|
||||
mappingsToRemove.Add(mapping);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ShortcutMapping mapping in mappingsToRemove)
|
||||
{
|
||||
Mappings.Remove(mapping);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[ImmutableObject(true)]
|
||||
public class ShortcutMapping : IEquatable<ShortcutMapping>
|
||||
{
|
||||
#region Public Properties
|
||||
private ShortcutCommand _command;
|
||||
public ShortcutCommand Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return _command;
|
||||
}
|
||||
}
|
||||
|
||||
private ShortcutKey _key;
|
||||
public ShortcutKey Key
|
||||
{
|
||||
get
|
||||
{
|
||||
return _key;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public ShortcutMapping(ShortcutCommand command, ShortcutKey key)
|
||||
{
|
||||
_command = command;
|
||||
_key = key;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public bool Equals(ShortcutMapping other)
|
||||
{
|
||||
if (!(Command == other.Command))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(Key == other.Key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[ImmutableObject(true)]
|
||||
public class ShortcutKey : IEquatable<ShortcutKey>
|
||||
{
|
||||
#region Public Properties
|
||||
private int _keyCode;
|
||||
public int KeyCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _keyCode;
|
||||
}
|
||||
}
|
||||
|
||||
private KeyboardHook.ModifierKeys _modifierKeys;
|
||||
public KeyboardHook.ModifierKeys ModifierKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
return _modifierKeys;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public ShortcutKey(int keyCode, KeyboardHook.ModifierKeys modifierKeys)
|
||||
{
|
||||
_keyCode = keyCode;
|
||||
_modifierKeys = modifierKeys;
|
||||
}
|
||||
|
||||
public ShortcutKey(Keys keysValue)
|
||||
{
|
||||
_keyCode = (int) (keysValue & Keys.KeyCode);
|
||||
if (!((keysValue & Keys.Shift) == 0))
|
||||
{
|
||||
_modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Shift;
|
||||
}
|
||||
if (!((keysValue & Keys.Control) == 0))
|
||||
{
|
||||
_modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Control;
|
||||
}
|
||||
if (!((keysValue & Keys.Alt) == 0))
|
||||
{
|
||||
_modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Alt;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public string ToConfigString()
|
||||
{
|
||||
return string.Join("/", new string[] {KeyCode.ToString(), (Convert.ToInt32(ModifierKeys)).ToString()});
|
||||
}
|
||||
|
||||
public static ShortcutKey FromConfigString(string shortcutKeyString)
|
||||
{
|
||||
string[] parts = shortcutKeyString.Split(new char[] {'/'}, 2);
|
||||
if (!(parts.Length == 2))
|
||||
{
|
||||
throw (new ArgumentException(string.Format("ShortcutKey.FromString({0}) failed. parts.Length != 2", shortcutKeyString), shortcutKeyString));
|
||||
}
|
||||
return new ShortcutKey(Convert.ToInt32(parts[0]), (SharedLibraryNG.KeyboardHook.ModifierKeys)Convert.ToInt32(parts[1]));
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return HotkeyControl.KeysToString((System.Windows.Forms.Keys)this.KeyCode);
|
||||
}
|
||||
|
||||
public bool Equals(ShortcutKey other)
|
||||
{
|
||||
if (!(KeyCode == other.KeyCode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(ModifierKeys == other.ModifierKeys))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
public static bool operator ==(ShortcutKey shortcutKey1, ShortcutKey shortcutKey2)
|
||||
{
|
||||
return shortcutKey1.Equals(shortcutKey2);
|
||||
}
|
||||
|
||||
public static bool operator !=(ShortcutKey shortcutKey1, ShortcutKey shortcutKey2)
|
||||
{
|
||||
return !shortcutKey1.Equals(shortcutKey2);
|
||||
}
|
||||
|
||||
// This is a narrowing conversion because (Keys Or Keys.Modifiers) cannot hold all possible values of KeyboardHook.ModifierKeys
|
||||
public static explicit operator Keys (ShortcutKey shortcutKey)
|
||||
{
|
||||
Keys keysValue = System.Windows.Forms.Keys.A;
|
||||
if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Shift) == 0))
|
||||
{
|
||||
keysValue = (Keys) (keysValue | Keys.Shift);
|
||||
}
|
||||
if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Control) == 0))
|
||||
{
|
||||
keysValue = (Keys) (keysValue | Keys.Control);
|
||||
}
|
||||
if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Alt) == 0))
|
||||
{
|
||||
keysValue = (Keys) (keysValue | Keys.Alt);
|
||||
}
|
||||
return keysValue;
|
||||
}
|
||||
|
||||
public static implicit operator ShortcutKey (Keys keys)
|
||||
{
|
||||
return new ShortcutKey(keys);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum ShortcutCommand
|
||||
{
|
||||
None = 0,
|
||||
PreviousTab,
|
||||
NextTab
|
||||
}
|
||||
}
|
||||
160
mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcutMap.cs
Normal file
160
mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcutMap.cs
Normal file
@@ -0,0 +1,160 @@
|
||||
using mRemoteNG.App;
|
||||
using SharedLibraryNG;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace mRemoteNG.Config.KeyboardShortcuts
|
||||
{
|
||||
public class KeyboardShortcutMap : ICloneable
|
||||
{
|
||||
private List<ShortcutMapping> _mappings;
|
||||
|
||||
|
||||
public List<ShortcutMapping> Mappings
|
||||
{
|
||||
get
|
||||
{
|
||||
return _mappings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public KeyboardShortcutMap()
|
||||
{
|
||||
_mappings = new List<ShortcutMapping>();
|
||||
}
|
||||
|
||||
public KeyboardShortcutMap(List<ShortcutMapping> mappings)
|
||||
{
|
||||
_mappings = mappings;
|
||||
}
|
||||
|
||||
|
||||
public void Add(ShortcutCommand command, ShortcutKey shortcutKey)
|
||||
{
|
||||
if (Mappings.Contains(new ShortcutMapping(command, shortcutKey)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Mappings.Add(new ShortcutMapping(command, shortcutKey));
|
||||
}
|
||||
|
||||
public void AddRange(ShortcutCommand command, IEnumerable<ShortcutKey> shortcutKeys)
|
||||
{
|
||||
foreach (ShortcutKey shortcutKey in shortcutKeys)
|
||||
{
|
||||
Add(command, shortcutKey);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(ShortcutCommand command, ShortcutKey shortcutKey)
|
||||
{
|
||||
Mappings.Remove(new ShortcutMapping(command, shortcutKey));
|
||||
}
|
||||
|
||||
public void AddFromConfigString(ShortcutCommand command, string configString)
|
||||
{
|
||||
foreach (ShortcutKey shortcutKey in ParseConfigString(configString))
|
||||
{
|
||||
Add(command, shortcutKey);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetConfigString(ShortcutCommand command)
|
||||
{
|
||||
List<string> parts = new List<string>();
|
||||
foreach (ShortcutKey shortcutKey in GetShortcutKeys(command))
|
||||
{
|
||||
parts.Add(shortcutKey.ToConfigString());
|
||||
}
|
||||
return string.Join(", ", parts.ToArray());
|
||||
}
|
||||
|
||||
public ShortcutKey[] GetShortcutKeys(ShortcutCommand command)
|
||||
{
|
||||
List<ShortcutKey> shortcutKeys = new List<ShortcutKey>();
|
||||
foreach (ShortcutMapping shortcutMapping in Mappings)
|
||||
{
|
||||
if (shortcutMapping.Command == command)
|
||||
{
|
||||
shortcutKeys.Add(shortcutMapping.Key);
|
||||
}
|
||||
}
|
||||
return shortcutKeys.ToArray();
|
||||
}
|
||||
|
||||
public void SetShortcutKeys(ShortcutCommand command, IEnumerable<ShortcutKey> shortcutKeys)
|
||||
{
|
||||
ClearShortcutKeys(command);
|
||||
AddRange(command, shortcutKeys);
|
||||
}
|
||||
|
||||
public ShortcutCommand GetCommand(int keyCode, KeyboardHook.ModifierKeys modifierKeys)
|
||||
{
|
||||
return GetCommand(new ShortcutKey(keyCode, modifierKeys));
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
List<ShortcutMapping> newMappings = new List<ShortcutMapping>();
|
||||
newMappings.AddRange(Mappings);
|
||||
return new KeyboardShortcutMap(newMappings);
|
||||
}
|
||||
|
||||
private static ShortcutKey[] ParseConfigString(string shortcutKeysString)
|
||||
{
|
||||
List<ShortcutKey> shortcutKeys = new List<ShortcutKey>();
|
||||
foreach (string shortcutKeyString in shortcutKeysString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
try
|
||||
{
|
||||
shortcutKeys.Add(ShortcutKey.FromConfigString(shortcutKeyString.Trim()));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionMessage(message: string.Format("KeyboardShortcuts.ParseShortcutKeysString({0}) failed at {1}.", shortcutKeysString, shortcutKeyString), ex: ex, logOnly: true);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return shortcutKeys.ToArray();
|
||||
}
|
||||
|
||||
private ShortcutCommand GetCommand(ShortcutKey shortcutKey)
|
||||
{
|
||||
foreach (ShortcutMapping shortcutMapping in Mappings)
|
||||
{
|
||||
if (ShortcutKeysMatch(shortcutMapping.Key, shortcutKey))
|
||||
{
|
||||
return shortcutMapping.Command;
|
||||
}
|
||||
}
|
||||
return ShortcutCommand.None;
|
||||
}
|
||||
|
||||
private static bool ShortcutKeysMatch(ShortcutKey wanted, ShortcutKey pressed)
|
||||
{
|
||||
if (!(wanted.KeyCode == pressed.KeyCode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return KeyboardHook.ModifierKeysMatch(wanted.ModifierKeys, pressed.ModifierKeys);
|
||||
}
|
||||
|
||||
private void ClearShortcutKeys(ShortcutCommand command)
|
||||
{
|
||||
List<ShortcutMapping> mappingsToRemove = new List<ShortcutMapping>();
|
||||
foreach (ShortcutMapping mapping in Mappings)
|
||||
{
|
||||
if (mapping.Command == command)
|
||||
{
|
||||
mappingsToRemove.Add(mapping);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ShortcutMapping mapping in mappingsToRemove)
|
||||
{
|
||||
Mappings.Remove(mapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
118
mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcuts.cs
Normal file
118
mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcuts.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using SharedLibraryNG;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.KeyboardShortcuts
|
||||
{
|
||||
public class KeyboardShortcuts
|
||||
{
|
||||
private static KeyboardHook _keyboardHook = new KeyboardHook();
|
||||
private static bool _mapLoaded = false;
|
||||
private static IntPtr _handle = IntPtr.Zero;
|
||||
|
||||
#region Public Properties
|
||||
private static KeyboardShortcutMap _defaultMap = null;
|
||||
public static KeyboardShortcutMap DefaultMap
|
||||
{
|
||||
get
|
||||
{
|
||||
LoadDefaultMap();
|
||||
return _defaultMap;
|
||||
}
|
||||
}
|
||||
|
||||
private static KeyboardShortcutMap _map;
|
||||
public static KeyboardShortcutMap Map
|
||||
{
|
||||
get
|
||||
{
|
||||
Load();
|
||||
return _map;
|
||||
}
|
||||
set
|
||||
{
|
||||
CancelKeyNotifications();
|
||||
_map = value;
|
||||
Save();
|
||||
RequestKeyNotifications(_handle);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public static void RequestKeyNotifications(IntPtr handle)
|
||||
{
|
||||
// ReSharper disable LocalizableElement
|
||||
if (handle == IntPtr.Zero)
|
||||
{
|
||||
throw (new ArgumentException("The handle cannot be null.", "handle"));
|
||||
}
|
||||
if (!(_handle == IntPtr.Zero) && !(_handle == handle))
|
||||
{
|
||||
throw (new ArgumentException("The handle must match the handle that was specified the first time this function was called.", "handle"));
|
||||
}
|
||||
// ReSharper restore LocalizableElement
|
||||
_handle = handle;
|
||||
foreach (ShortcutMapping shortcutMapping in Map.Mappings)
|
||||
{
|
||||
KeyboardHook.RequestKeyNotification(handle, shortcutMapping.Key.KeyCode, shortcutMapping.Key.ModifierKeys, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortcutCommand CommandFromHookKeyMessage(Message m)
|
||||
{
|
||||
KeyboardHook.HookKeyMsgData msgData = (SharedLibraryNG.KeyboardHook.HookKeyMsgData)Marshal.PtrToStructure(m.LParam, typeof(KeyboardHook.HookKeyMsgData));
|
||||
return Map.GetCommand(msgData.KeyCode, msgData.ModifierKeys);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private static void LoadDefaultMap()
|
||||
{
|
||||
if (_defaultMap != null)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
_defaultMap = new KeyboardShortcutMap();
|
||||
_defaultMap.AddFromConfigString(ShortcutCommand.PreviousTab, System.Convert.ToString(My.Settings.Default.Properties["KeysPreviousTab"].DefaultValue));
|
||||
_defaultMap.AddFromConfigString(ShortcutCommand.NextTab, System.Convert.ToString(My.Settings.Default.Properties["KeysNextTab"].DefaultValue));
|
||||
}
|
||||
|
||||
private static void Load()
|
||||
{
|
||||
if (_mapLoaded)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
_map = new KeyboardShortcutMap();
|
||||
_map.AddFromConfigString(ShortcutCommand.PreviousTab, System.Convert.ToString(My.Settings.Default.KeysPreviousTab));
|
||||
_map.AddFromConfigString(ShortcutCommand.NextTab, System.Convert.ToString(My.Settings.Default.KeysNextTab));
|
||||
_mapLoaded = true;
|
||||
}
|
||||
|
||||
private static void Save()
|
||||
{
|
||||
if (_map == null)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
My.Settings.Default.KeysPreviousTab = _map.GetConfigString(ShortcutCommand.PreviousTab);
|
||||
My.Settings.Default.KeysNextTab = _map.GetConfigString(ShortcutCommand.NextTab);
|
||||
}
|
||||
|
||||
private static void CancelKeyNotifications()
|
||||
{
|
||||
if (_handle == IntPtr.Zero)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
foreach (ShortcutMapping shortcutMapping in Map.Mappings)
|
||||
{
|
||||
KeyboardHook.CancelKeyNotification(_handle, shortcutMapping.Key.KeyCode, shortcutMapping.Key.ModifierKeys, false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
13
mRemoteV1/Config/KeyboardShortcuts/ShortcutCommandEnum.cs
Normal file
13
mRemoteV1/Config/KeyboardShortcuts/ShortcutCommandEnum.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace mRemoteNG.Config.KeyboardShortcuts
|
||||
{
|
||||
public enum ShortcutCommand
|
||||
{
|
||||
None = 0,
|
||||
PreviousTab,
|
||||
NextTab
|
||||
}
|
||||
}
|
||||
132
mRemoteV1/Config/KeyboardShortcuts/ShortcutKey.cs
Normal file
132
mRemoteV1/Config/KeyboardShortcuts/ShortcutKey.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using SharedLibraryNG;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace mRemoteNG.Config.KeyboardShortcuts
|
||||
{
|
||||
[ImmutableObject(true)]
|
||||
public class ShortcutKey : IEquatable<ShortcutKey>
|
||||
{
|
||||
#region Public Properties
|
||||
private int _keyCode;
|
||||
public int KeyCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _keyCode;
|
||||
}
|
||||
}
|
||||
|
||||
private KeyboardHook.ModifierKeys _modifierKeys;
|
||||
public KeyboardHook.ModifierKeys ModifierKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
return _modifierKeys;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public ShortcutKey(int keyCode, KeyboardHook.ModifierKeys modifierKeys)
|
||||
{
|
||||
_keyCode = keyCode;
|
||||
_modifierKeys = modifierKeys;
|
||||
}
|
||||
|
||||
public ShortcutKey(Keys keysValue)
|
||||
{
|
||||
_keyCode = (int)(keysValue & Keys.KeyCode);
|
||||
if (!((keysValue & Keys.Shift) == 0))
|
||||
{
|
||||
_modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Shift;
|
||||
}
|
||||
if (!((keysValue & Keys.Control) == 0))
|
||||
{
|
||||
_modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Control;
|
||||
}
|
||||
if (!((keysValue & Keys.Alt) == 0))
|
||||
{
|
||||
_modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Alt;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public string ToConfigString()
|
||||
{
|
||||
return string.Join("/", new string[] { KeyCode.ToString(), (Convert.ToInt32(ModifierKeys)).ToString() });
|
||||
}
|
||||
|
||||
public static ShortcutKey FromConfigString(string shortcutKeyString)
|
||||
{
|
||||
string[] parts = shortcutKeyString.Split(new char[] { '/' }, 2);
|
||||
if (!(parts.Length == 2))
|
||||
{
|
||||
throw (new ArgumentException(string.Format("ShortcutKey.FromString({0}) failed. parts.Length != 2", shortcutKeyString), shortcutKeyString));
|
||||
}
|
||||
return new ShortcutKey(Convert.ToInt32(parts[0]), (SharedLibraryNG.KeyboardHook.ModifierKeys)Convert.ToInt32(parts[1]));
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return HotkeyControl.KeysToString((System.Windows.Forms.Keys)this.KeyCode);
|
||||
}
|
||||
|
||||
public bool Equals(ShortcutKey other)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (KeyCode != other.KeyCode)
|
||||
return false;
|
||||
if (ModifierKeys != other.ModifierKeys)
|
||||
return false;
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
public static bool operator ==(ShortcutKey shortcutKey1, ShortcutKey shortcutKey2)
|
||||
{
|
||||
return shortcutKey1.Equals(shortcutKey2);
|
||||
}
|
||||
|
||||
public static bool operator !=(ShortcutKey shortcutKey1, ShortcutKey shortcutKey2)
|
||||
{
|
||||
return !shortcutKey1.Equals(shortcutKey2);
|
||||
}
|
||||
|
||||
// This is a narrowing conversion because (Keys Or Keys.Modifiers) cannot hold all possible values of KeyboardHook.ModifierKeys
|
||||
public static explicit operator Keys(ShortcutKey shortcutKey)
|
||||
{
|
||||
Keys keysValue = System.Windows.Forms.Keys.A;
|
||||
if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Shift) == 0))
|
||||
{
|
||||
keysValue = (Keys)(keysValue | Keys.Shift);
|
||||
}
|
||||
if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Control) == 0))
|
||||
{
|
||||
keysValue = (Keys)(keysValue | Keys.Control);
|
||||
}
|
||||
if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Alt) == 0))
|
||||
{
|
||||
keysValue = (Keys)(keysValue | Keys.Alt);
|
||||
}
|
||||
return keysValue;
|
||||
}
|
||||
|
||||
public static implicit operator ShortcutKey(Keys keys)
|
||||
{
|
||||
return new ShortcutKey(keys);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
45
mRemoteV1/Config/KeyboardShortcuts/ShortcutMapping.cs
Normal file
45
mRemoteV1/Config/KeyboardShortcuts/ShortcutMapping.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace mRemoteNG.Config.KeyboardShortcuts
|
||||
{
|
||||
[ImmutableObject(true)]
|
||||
public class ShortcutMapping : IEquatable<ShortcutMapping>
|
||||
{
|
||||
private ShortcutCommand _command;
|
||||
private ShortcutKey _key;
|
||||
|
||||
public ShortcutCommand Command
|
||||
{
|
||||
get { return _command; }
|
||||
}
|
||||
|
||||
public ShortcutKey Key
|
||||
{
|
||||
get { return _key; }
|
||||
}
|
||||
|
||||
|
||||
public ShortcutMapping(ShortcutCommand command, ShortcutKey key)
|
||||
{
|
||||
_command = command;
|
||||
_key = key;
|
||||
}
|
||||
|
||||
|
||||
public bool Equals(ShortcutMapping other)
|
||||
{
|
||||
if (!(Command == other.Command))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(Key == other.Key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,9 @@ using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.My;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Images;
|
||||
using mRemoteNG.Connection;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Putty
|
||||
@@ -43,12 +46,12 @@ namespace mRemoteNG.Config.Putty
|
||||
}
|
||||
|
||||
public abstract string[] GetSessionNames(bool raw = false);
|
||||
public abstract Connection.PuttySession.Info GetSession(string sessionName);
|
||||
public abstract PuttySessionInfo GetSession(string sessionName);
|
||||
|
||||
public virtual Connection.PuttySession.Info[] GetSessions()
|
||||
public virtual PuttySessionInfo[] GetSessions()
|
||||
{
|
||||
List<Connection.PuttySession.Info> sessionList = new List<Connection.PuttySession.Info>();
|
||||
Connection.PuttySession.Info sessionInfo = (Connection.PuttySession.Info)default(Connection.ConnectionRecordImp);
|
||||
List<PuttySessionInfo> sessionList = new List<PuttySessionInfo>();
|
||||
PuttySessionInfo sessionInfo = (PuttySessionInfo)default(ConnectionInfo);
|
||||
foreach (string sessionName in GetSessionNames(true))
|
||||
{
|
||||
sessionInfo = GetSession(sessionName);
|
||||
@@ -99,7 +102,7 @@ namespace mRemoteNG.Config.Putty
|
||||
private delegate TreeNode CreateRootTreeNodeDelegate();
|
||||
protected virtual TreeNode CreateRootTreeNode()
|
||||
{
|
||||
TreeView treeView = Tree.Node.TreeView;
|
||||
TreeView treeView = ConnectionTree.TreeView;
|
||||
if (treeView == null)
|
||||
{
|
||||
return null;
|
||||
@@ -115,8 +118,8 @@ namespace mRemoteNG.Config.Putty
|
||||
newTreeNode.Name = _rootInfo.Name;
|
||||
newTreeNode.Text = _rootInfo.Name;
|
||||
newTreeNode.Tag = _rootInfo;
|
||||
newTreeNode.ImageIndex = (int)Images.Enums.TreeImage.PuttySessions;
|
||||
newTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.PuttySessions;
|
||||
newTreeNode.ImageIndex = (int)TreeImageType.PuttySessions;
|
||||
newTreeNode.SelectedImageIndex = (int)TreeImageType.PuttySessions;
|
||||
|
||||
return newTreeNode;
|
||||
}
|
||||
@@ -125,22 +128,22 @@ namespace mRemoteNG.Config.Putty
|
||||
{
|
||||
Root.PuttySessions.Info newRootInfo = new Root.PuttySessions.Info();
|
||||
|
||||
if (string.IsNullOrEmpty(System.Convert.ToString(My.Settings.Default.PuttySavedSessionsName)))
|
||||
if (string.IsNullOrEmpty(Convert.ToString(My.Settings.Default.PuttySavedSessionsName)))
|
||||
{
|
||||
newRootInfo.Name = Language.strPuttySavedSessionsRootName;
|
||||
}
|
||||
else
|
||||
{
|
||||
newRootInfo.Name = System.Convert.ToString(My.Settings.Default.PuttySavedSessionsName);
|
||||
newRootInfo.Name = Convert.ToString(My.Settings.Default.PuttySavedSessionsName);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(System.Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel)))
|
||||
if (string.IsNullOrEmpty(Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel)))
|
||||
{
|
||||
newRootInfo.Panel = Language.strGeneral;
|
||||
}
|
||||
else
|
||||
{
|
||||
newRootInfo.Panel = System.Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel);
|
||||
newRootInfo.Panel = Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel);
|
||||
}
|
||||
|
||||
return newRootInfo;
|
||||
@@ -153,4 +156,4 @@ namespace mRemoteNG.Config.Putty
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Data;
|
||||
using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using System.Management;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Messages;
|
||||
using Microsoft.Win32;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Messages;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Management;
|
||||
using System.Security.Principal;
|
||||
|
||||
|
||||
@@ -20,6 +13,11 @@ namespace mRemoteNG.Config.Putty
|
||||
{
|
||||
public class RegistryProvider : Provider
|
||||
{
|
||||
#region Private Fields
|
||||
private const string PuttySessionsKey = "Software\\SimonTatham\\PuTTY\\Sessions";
|
||||
private static ManagementEventWatcher _eventWatcher;
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public override string[] GetSessionNames(bool raw = false)
|
||||
{
|
||||
@@ -60,7 +58,7 @@ namespace mRemoteNG.Config.Putty
|
||||
return sessionNames.ToArray();
|
||||
}
|
||||
|
||||
public override Connection.PuttySession.Info GetSession(string sessionName)
|
||||
public override PuttySessionInfo GetSession(string sessionName)
|
||||
{
|
||||
RegistryKey sessionsKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey);
|
||||
if (sessionsKey == null)
|
||||
@@ -76,7 +74,7 @@ namespace mRemoteNG.Config.Putty
|
||||
|
||||
sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"));
|
||||
|
||||
Connection.PuttySession.Info sessionInfo = new Connection.PuttySession.Info();
|
||||
PuttySessionInfo sessionInfo = new PuttySessionInfo();
|
||||
sessionInfo.PuttySession = sessionName;
|
||||
sessionInfo.Name = sessionName;
|
||||
sessionInfo.Hostname = System.Convert.ToString(sessionKey.GetValue("HostName"));
|
||||
@@ -89,10 +87,10 @@ namespace mRemoteNG.Config.Putty
|
||||
switch (protocol.ToLowerInvariant())
|
||||
{
|
||||
case "raw":
|
||||
sessionInfo.Protocol = Protocols.RAW;
|
||||
sessionInfo.Protocol = ProtocolType.RAW;
|
||||
break;
|
||||
case "rlogin":
|
||||
sessionInfo.Protocol = Protocols.Rlogin;
|
||||
sessionInfo.Protocol = ProtocolType.Rlogin;
|
||||
break;
|
||||
case "serial":
|
||||
return null;
|
||||
@@ -103,20 +101,20 @@ namespace mRemoteNG.Config.Putty
|
||||
int sshVersion = System.Convert.ToInt32(sshVersionObject);
|
||||
if (sshVersion >= 2)
|
||||
{
|
||||
sessionInfo.Protocol = Protocols.SSH2;
|
||||
sessionInfo.Protocol = ProtocolType.SSH2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sessionInfo.Protocol = Protocols.SSH1;
|
||||
sessionInfo.Protocol = ProtocolType.SSH1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sessionInfo.Protocol = Protocols.SSH2;
|
||||
sessionInfo.Protocol = ProtocolType.SSH2;
|
||||
}
|
||||
break;
|
||||
case "telnet":
|
||||
sessionInfo.Protocol = Protocols.Telnet;
|
||||
sessionInfo.Protocol = ProtocolType.Telnet;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
@@ -136,7 +134,7 @@ namespace mRemoteNG.Config.Putty
|
||||
try
|
||||
{
|
||||
string currentUserSid = WindowsIdentity.GetCurrent().User.Value;
|
||||
string key = System.Convert.ToString(string.Join("\\", new[] {currentUserSid, PuttySessionsKey}).Replace("\\", "\\\\"));
|
||||
string key = Convert.ToString(string.Join("\\", new[] {currentUserSid, PuttySessionsKey}).Replace("\\", "\\\\"));
|
||||
WqlEventQuery query = new WqlEventQuery(string.Format("SELECT * FROM RegistryTreeChangeEvent WHERE Hive = \'HKEY_USERS\' AND RootPath = \'{0}\'", key));
|
||||
_eventWatcher = new ManagementEventWatcher(query);
|
||||
_eventWatcher.EventArrived += OnManagementEventArrived;
|
||||
@@ -159,12 +157,7 @@ namespace mRemoteNG.Config.Putty
|
||||
_eventWatcher = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private const string PuttySessionsKey = "Software\\SimonTatham\\PuTTY\\Sessions";
|
||||
private static ManagementEventWatcher _eventWatcher;
|
||||
#endregion
|
||||
|
||||
|
||||
#region Private Methods
|
||||
private void OnManagementEventArrived(object sender, EventArrivedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Data;
|
||||
using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Images;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Putty
|
||||
@@ -20,7 +15,7 @@ namespace mRemoteNG.Config.Putty
|
||||
private delegate void AddSessionsToTreeDelegate();
|
||||
public static void AddSessionsToTree()
|
||||
{
|
||||
TreeView treeView = Tree.Node.TreeView;
|
||||
TreeView treeView = ConnectionTree.TreeView;
|
||||
if (treeView == null)
|
||||
{
|
||||
return ;
|
||||
@@ -36,7 +31,7 @@ namespace mRemoteNG.Config.Putty
|
||||
TreeNode rootTreeNode = provider.RootTreeNode;
|
||||
bool inUpdate = false;
|
||||
|
||||
List<Connection.ConnectionRecordImp> savedSessions = new List<Connection.ConnectionRecordImp>(provider.GetSessions());
|
||||
List<Connection.ConnectionInfo> savedSessions = new List<Connection.ConnectionInfo>(provider.GetSessions());
|
||||
if (!IsProviderEnabled(provider) || savedSessions == null || savedSessions.Count == 0)
|
||||
{
|
||||
if (rootTreeNode != null && treeView.Nodes.Contains(rootTreeNode))
|
||||
@@ -59,7 +54,7 @@ namespace mRemoteNG.Config.Putty
|
||||
}
|
||||
|
||||
List<TreeNode> newTreeNodes = new List<TreeNode>();
|
||||
foreach (Connection.PuttySession.Info sessionInfo in savedSessions)
|
||||
foreach (PuttySessionInfo sessionInfo in savedSessions)
|
||||
{
|
||||
TreeNode treeNode = default(TreeNode);
|
||||
bool isNewNode = false;
|
||||
@@ -70,14 +65,14 @@ namespace mRemoteNG.Config.Putty
|
||||
}
|
||||
else
|
||||
{
|
||||
treeNode = Tree.Node.AddNode(Tree.Node.Type.PuttySession, sessionInfo.Name);
|
||||
treeNode = Tree.Node.AddNode(TreeNodeType.PuttySession, sessionInfo.Name);
|
||||
if (treeNode == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
treeNode.Name = treeNode.Text;
|
||||
treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
|
||||
treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed;
|
||||
treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
isNewNode = true;
|
||||
}
|
||||
|
||||
@@ -95,7 +90,7 @@ namespace mRemoteNG.Config.Putty
|
||||
|
||||
foreach (TreeNode treeNode in rootTreeNode.Nodes)
|
||||
{
|
||||
if (!savedSessions.Contains((Connection.ConnectionRecordImp)treeNode.Tag))
|
||||
if (!savedSessions.Contains((ConnectionInfo)treeNode.Tag))
|
||||
{
|
||||
if (!inUpdate)
|
||||
{
|
||||
@@ -118,7 +113,7 @@ namespace mRemoteNG.Config.Putty
|
||||
|
||||
if (inUpdate)
|
||||
{
|
||||
Tree.Node.Sort(rootTreeNode, SortOrder.Ascending);
|
||||
ConnectionTree.Sort(rootTreeNode, SortOrder.Ascending);
|
||||
rootTreeNode.Expand();
|
||||
treeView.EndUpdate();
|
||||
}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Data;
|
||||
using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Messages;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
@@ -19,6 +12,13 @@ namespace mRemoteNG.Config.Putty
|
||||
{
|
||||
public class XmingProvider : Provider
|
||||
{
|
||||
#region Private Fields
|
||||
private const string RegistrySessionNameFormat = "{0} [registry]";
|
||||
private const string RegistrySessionNamePattern = "(.*)\\ \\[registry\\]";
|
||||
private static readonly RegistryProvider RegistryProvider = new RegistryProvider();
|
||||
private static FileSystemWatcher _eventWatcher;
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public override string[] GetSessionNames(bool raw = false)
|
||||
{
|
||||
@@ -27,8 +27,8 @@ namespace mRemoteNG.Config.Putty
|
||||
{
|
||||
return new string[] {};
|
||||
}
|
||||
|
||||
List<string> sessionNames = new List<string>();
|
||||
|
||||
List<string> sessionNames = new List<string>();
|
||||
foreach (string sessionName in Directory.GetFiles(sessionsFolderPath))
|
||||
{
|
||||
string _sessionFileName = Path.GetFileName(sessionName);
|
||||
@@ -56,8 +56,8 @@ namespace mRemoteNG.Config.Putty
|
||||
sessionNames.Insert(0, "Default Settings");
|
||||
}
|
||||
}
|
||||
|
||||
List<string> registrySessionNames = new List<string>();
|
||||
|
||||
List<string> registrySessionNames = new List<string>();
|
||||
foreach (string sessionName in RegistryProvider.GetSessionNames(raw))
|
||||
{
|
||||
registrySessionNames.Add(string.Format(RegistrySessionNameFormat, sessionName));
|
||||
@@ -69,7 +69,7 @@ namespace mRemoteNG.Config.Putty
|
||||
return sessionNames.ToArray();
|
||||
}
|
||||
|
||||
public override Connection.PuttySession.Info GetSession(string sessionName)
|
||||
public override PuttySessionInfo GetSession(string sessionName)
|
||||
{
|
||||
string registrySessionName = GetRegistrySessionName(sessionName);
|
||||
if (!string.IsNullOrEmpty(registrySessionName))
|
||||
@@ -92,7 +92,7 @@ namespace mRemoteNG.Config.Putty
|
||||
sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"));
|
||||
|
||||
SessionFileReader sessionFileReader = new SessionFileReader(sessionFile);
|
||||
Connection.PuttySession.Info sessionInfo = new Connection.PuttySession.Info();
|
||||
PuttySessionInfo sessionInfo = new PuttySessionInfo();
|
||||
sessionInfo.PuttySession = sessionName;
|
||||
sessionInfo.Name = sessionName;
|
||||
sessionInfo.Hostname = sessionFileReader.GetValue("HostName");
|
||||
@@ -105,10 +105,10 @@ namespace mRemoteNG.Config.Putty
|
||||
switch (protocol.ToLowerInvariant())
|
||||
{
|
||||
case "raw":
|
||||
sessionInfo.Protocol = Protocols.RAW;
|
||||
sessionInfo.Protocol = ProtocolType.RAW;
|
||||
break;
|
||||
case "rlogin":
|
||||
sessionInfo.Protocol = Protocols.Rlogin;
|
||||
sessionInfo.Protocol = ProtocolType.Rlogin;
|
||||
break;
|
||||
case "serial":
|
||||
return null;
|
||||
@@ -119,25 +119,25 @@ namespace mRemoteNG.Config.Putty
|
||||
int sshVersion = System.Convert.ToInt32(sshVersionObject);
|
||||
if (sshVersion >= 2)
|
||||
{
|
||||
sessionInfo.Protocol = Protocols.SSH2;
|
||||
sessionInfo.Protocol = ProtocolType.SSH2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sessionInfo.Protocol = Protocols.SSH1;
|
||||
sessionInfo.Protocol = ProtocolType.SSH1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sessionInfo.Protocol = Protocols.SSH2;
|
||||
sessionInfo.Protocol = ProtocolType.SSH2;
|
||||
}
|
||||
break;
|
||||
case "telnet":
|
||||
sessionInfo.Protocol = Protocols.Telnet;
|
||||
sessionInfo.Protocol = ProtocolType.Telnet;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
sessionInfo.Port = System.Convert.ToInt32(sessionFileReader.GetValue("PortNumber"));
|
||||
sessionInfo.Port = Convert.ToInt32(sessionFileReader.GetValue("PortNumber"));
|
||||
|
||||
return sessionInfo;
|
||||
}
|
||||
@@ -182,26 +182,18 @@ namespace mRemoteNG.Config.Putty
|
||||
_eventWatcher = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private const string RegistrySessionNameFormat = "{0} [registry]";
|
||||
private const string RegistrySessionNamePattern = "(.*)\\ \\[registry\\]";
|
||||
|
||||
private static readonly RegistryProvider RegistryProvider = new RegistryProvider();
|
||||
private static FileSystemWatcher _eventWatcher;
|
||||
#endregion
|
||||
|
||||
|
||||
#region Private Methods
|
||||
private static string GetPuttyConfPath()
|
||||
{
|
||||
string puttyPath = "";
|
||||
if (My.Settings.Default.UseCustomPuttyPath)
|
||||
{
|
||||
puttyPath = System.Convert.ToString(My.Settings.Default.CustomPuttyPath);
|
||||
puttyPath = Convert.ToString(My.Settings.Default.CustomPuttyPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
puttyPath = App.Info.General.PuttyPath;
|
||||
puttyPath = App.Info.GeneralAppInfo.PuttyPath;
|
||||
}
|
||||
return Path.Combine(Path.GetDirectoryName(puttyPath), "putty.conf");
|
||||
}
|
||||
@@ -233,7 +225,7 @@ namespace mRemoteNG.Config.Putty
|
||||
return groups[1].Value;
|
||||
}
|
||||
|
||||
private static Connection.PuttySession.Info ModifyRegistrySessionInfo(Connection.PuttySession.Info sessionInfo)
|
||||
private static PuttySessionInfo ModifyRegistrySessionInfo(PuttySessionInfo sessionInfo)
|
||||
{
|
||||
sessionInfo.Name = string.Format(RegistrySessionNameFormat, sessionInfo.Name);
|
||||
sessionInfo.PuttySession = string.Format(RegistrySessionNameFormat, sessionInfo.PuttySession);
|
||||
@@ -386,4 +378,4 @@ namespace mRemoteNG.Config.Putty
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
9
mRemoteV1/Config/Settings/Providers/ChooseProvider.cs
Normal file
9
mRemoteV1/Config/Settings/Providers/ChooseProvider.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace mRemoteNG.Config.Settings.Providers
|
||||
{
|
||||
public class ChooseProvider : PortableSettingsProvider
|
||||
{
|
||||
#if !PORTABLE
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,21 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Configuration;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Settings.Providers
|
||||
{
|
||||
public class ChooseProvider : PortableSettingsProvider
|
||||
{
|
||||
#if !PORTABLE
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
public class PortableSettingsProvider : SettingsProvider
|
||||
{
|
||||
const string SETTINGSROOT = "Settings"; //XML Root Node
|
||||
|
||||
public override void Initialize(string name, NameValueCollection col)
|
||||
{
|
||||
base.Initialize(this.ApplicationName, col);
|
||||
}
|
||||
|
||||
|
||||
public override string ApplicationName
|
||||
{
|
||||
get
|
||||
@@ -41,20 +35,20 @@ namespace mRemoteNG.Config.Settings.Providers
|
||||
//Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual public string GetAppSettingsPath()
|
||||
{
|
||||
//Used to determine where to store the settings
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(Application.ExecutablePath);
|
||||
return fi.DirectoryName;
|
||||
}
|
||||
|
||||
|
||||
virtual public string GetAppSettingsFilename()
|
||||
{
|
||||
//Used to determine the filename to store the settings
|
||||
return "portable.config"; //ApplicationName & ".settings"
|
||||
}
|
||||
|
||||
|
||||
public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
|
||||
{
|
||||
//Iterate through the settings to be stored
|
||||
@@ -73,7 +67,7 @@ namespace mRemoteNG.Config.Settings.Providers
|
||||
//Ignore if cant save, device been ejected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection props)
|
||||
{
|
||||
//Create new collection of values
|
||||
@@ -90,9 +84,9 @@ namespace mRemoteNG.Config.Settings.Providers
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
private System.Xml.XmlDocument m_SettingsXML = null;
|
||||
|
||||
|
||||
private System.Xml.XmlDocument SettingsXML
|
||||
{
|
||||
get
|
||||
@@ -122,7 +116,7 @@ namespace mRemoteNG.Config.Settings.Providers
|
||||
return m_SettingsXML;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string GetValue(SettingsProperty setting)
|
||||
{
|
||||
string ret = "";
|
||||
@@ -151,7 +145,7 @@ namespace mRemoteNG.Config.Settings.Providers
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private void SetValue(SettingsPropertyValue propVal)
|
||||
{
|
||||
System.Xml.XmlElement MachineNode = default(System.Xml.XmlElement);
|
||||
@@ -225,7 +219,7 @@ namespace mRemoteNG.Config.Settings.Providers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool IsRoaming(SettingsProperty prop)
|
||||
{
|
||||
//Determine if the setting is marked as Roaming
|
||||
359
mRemoteV1/Config/Settings/SettingsLoader.cs
Normal file
359
mRemoteV1/Config/Settings/SettingsLoader.cs
Normal file
@@ -0,0 +1,359 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
using mRemoteNG.App;
|
||||
using System.Xml;
|
||||
using System.Threading;
|
||||
using System.Globalization;
|
||||
using mRemoteNG.Themes;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.UI.Window;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Settings
|
||||
{
|
||||
public class SettingsLoader
|
||||
{
|
||||
private frmMain _MainForm;
|
||||
|
||||
public frmMain MainForm
|
||||
{
|
||||
get { return this._MainForm; }
|
||||
set { this._MainForm = value; }
|
||||
}
|
||||
|
||||
|
||||
public SettingsLoader(frmMain MainForm)
|
||||
{
|
||||
this._MainForm = MainForm;
|
||||
}
|
||||
|
||||
#region Public Methods
|
||||
public void LoadSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
EnsureSettingsAreSavedInNewestVersion();
|
||||
|
||||
SetSupportedCulture();
|
||||
|
||||
SetTheme();
|
||||
SetApplicationWindowPositionAndSize();
|
||||
SetKioskMode();
|
||||
|
||||
SetPuttyPath();
|
||||
SetShowSystemTrayIcon();
|
||||
SetAutoSave();
|
||||
SetConDefaultPassword();
|
||||
LoadPanelsFromXML();
|
||||
LoadExternalAppsFromXML();
|
||||
SetAlwaysShowPanelTabs();
|
||||
|
||||
if (My.Settings.Default.ResetToolbars == true)
|
||||
SetToolbarsDefault();
|
||||
else
|
||||
LoadToolbarsFromSettings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.Error("Loading settings failed" + Environment.NewLine + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetConDefaultPassword()
|
||||
{
|
||||
My.Settings.Default.ConDefaultPassword = Security.Crypt.Decrypt(My.Settings.Default.ConDefaultPassword, GeneralAppInfo.EncryptionKey);
|
||||
}
|
||||
|
||||
private static void SetAlwaysShowPanelTabs()
|
||||
{
|
||||
if (My.Settings.Default.AlwaysShowPanelTabs)
|
||||
{
|
||||
frmMain.Default.pnlDock.DocumentStyle = DocumentStyle.DockingWindow;
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetTheme()
|
||||
{
|
||||
ThemeManager.LoadTheme(My.Settings.Default.ThemeName);
|
||||
}
|
||||
|
||||
private static void SetSupportedCulture()
|
||||
{
|
||||
SupportedCultures.InstantiateSingleton();
|
||||
if (!(My.Settings.Default.OverrideUICulture == "") && SupportedCultures.IsNameSupported(My.Settings.Default.OverrideUICulture))
|
||||
{
|
||||
Thread.CurrentThread.CurrentUICulture = new CultureInfo(My.Settings.Default.OverrideUICulture);
|
||||
Runtime.Log.InfoFormat("Override Culture: {0}/{1}", Thread.CurrentThread.CurrentUICulture.Name, Thread.CurrentThread.CurrentUICulture.NativeName);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetApplicationWindowPositionAndSize()
|
||||
{
|
||||
_MainForm.WindowState = FormWindowState.Normal;
|
||||
if (My.Settings.Default.MainFormState == FormWindowState.Normal)
|
||||
{
|
||||
if (!My.Settings.Default.MainFormLocation.IsEmpty)
|
||||
_MainForm.Location = My.Settings.Default.MainFormLocation;
|
||||
if (!My.Settings.Default.MainFormSize.IsEmpty)
|
||||
_MainForm.Size = My.Settings.Default.MainFormSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!My.Settings.Default.MainFormRestoreLocation.IsEmpty)
|
||||
_MainForm.Location = My.Settings.Default.MainFormRestoreLocation;
|
||||
if (!My.Settings.Default.MainFormRestoreSize.IsEmpty)
|
||||
_MainForm.Size = My.Settings.Default.MainFormRestoreSize;
|
||||
}
|
||||
|
||||
if (My.Settings.Default.MainFormState == FormWindowState.Maximized)
|
||||
{
|
||||
_MainForm.WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
|
||||
// Make sure the form is visible on the screen
|
||||
const int minHorizontal = 300;
|
||||
const int minVertical = 150;
|
||||
Rectangle screenBounds = Screen.FromHandle(_MainForm.Handle).Bounds;
|
||||
Rectangle newBounds = _MainForm.Bounds;
|
||||
|
||||
if (newBounds.Right < screenBounds.Left + minHorizontal)
|
||||
newBounds.X = screenBounds.Left + minHorizontal - newBounds.Width;
|
||||
if (newBounds.Left > screenBounds.Right - minHorizontal)
|
||||
newBounds.X = screenBounds.Right - minHorizontal;
|
||||
if (newBounds.Bottom < screenBounds.Top + minVertical)
|
||||
newBounds.Y = screenBounds.Top + minVertical - newBounds.Height;
|
||||
if (newBounds.Top > screenBounds.Bottom - minVertical)
|
||||
newBounds.Y = screenBounds.Bottom - minVertical;
|
||||
|
||||
this._MainForm.Location = newBounds.Location;
|
||||
}
|
||||
|
||||
private void SetAutoSave()
|
||||
{
|
||||
if (My.Settings.Default.AutoSaveEveryMinutes > 0)
|
||||
{
|
||||
this._MainForm.tmrAutoSave.Interval = Convert.ToInt32(My.Settings.Default.AutoSaveEveryMinutes * 60000);
|
||||
this._MainForm.tmrAutoSave.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetKioskMode()
|
||||
{
|
||||
if (My.Settings.Default.MainFormKiosk == true)
|
||||
{
|
||||
_MainForm.Fullscreen.Value = true;
|
||||
_MainForm.mMenViewFullscreen.Checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetShowSystemTrayIcon()
|
||||
{
|
||||
if (My.Settings.Default.ShowSystemTrayIcon)
|
||||
Runtime.NotificationAreaIcon = new Tools.Controls.NotificationAreaIcon();
|
||||
}
|
||||
|
||||
private static void SetPuttyPath()
|
||||
{
|
||||
if (My.Settings.Default.UseCustomPuttyPath)
|
||||
PuttyBase.PuttyPath = Convert.ToString(My.Settings.Default.CustomPuttyPath);
|
||||
else
|
||||
PuttyBase.PuttyPath = GeneralAppInfo.PuttyPath;
|
||||
}
|
||||
|
||||
private static void EnsureSettingsAreSavedInNewestVersion()
|
||||
{
|
||||
if (My.Settings.Default.DoUpgrade)
|
||||
UpgradeSettingsVersion();
|
||||
}
|
||||
private static void UpgradeSettingsVersion()
|
||||
{
|
||||
try
|
||||
{
|
||||
My.Settings.Default.Upgrade();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.Error("My.Settings.Upgrade() failed" + Environment.NewLine + ex.Message);
|
||||
}
|
||||
My.Settings.Default.DoUpgrade = false;
|
||||
|
||||
// Clear pending update flag
|
||||
// This is used for automatic updates, not for settings migration, but it
|
||||
// needs to be cleared here because we know that we just updated.
|
||||
My.Settings.Default.UpdatePending = false;
|
||||
}
|
||||
|
||||
public void SetToolbarsDefault()
|
||||
{
|
||||
ToolStripPanelFromString("top").Join(MainForm.tsQuickConnect, new Point(300, 0));
|
||||
MainForm.tsQuickConnect.Visible = true;
|
||||
ToolStripPanelFromString("bottom").Join(MainForm.tsExternalTools, new Point(3, 0));
|
||||
MainForm.tsExternalTools.Visible = false;
|
||||
}
|
||||
|
||||
public void LoadToolbarsFromSettings()
|
||||
{
|
||||
if (My.Settings.Default.QuickyTBLocation.X > My.Settings.Default.ExtAppsTBLocation.X)
|
||||
{
|
||||
AddDynamicPanels();
|
||||
AddStaticPanels();
|
||||
}
|
||||
else
|
||||
{
|
||||
AddStaticPanels();
|
||||
AddDynamicPanels();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddStaticPanels()
|
||||
{
|
||||
ToolStripPanelFromString(Convert.ToString(My.Settings.Default.QuickyTBParentDock)).Join(MainForm.tsQuickConnect, My.Settings.Default.QuickyTBLocation);
|
||||
MainForm.tsQuickConnect.Visible = Convert.ToBoolean(My.Settings.Default.QuickyTBVisible);
|
||||
}
|
||||
|
||||
private void AddDynamicPanels()
|
||||
{
|
||||
ToolStripPanelFromString(Convert.ToString(My.Settings.Default.ExtAppsTBParentDock)).Join(MainForm.tsExternalTools, My.Settings.Default.ExtAppsTBLocation);
|
||||
MainForm.tsExternalTools.Visible = Convert.ToBoolean(My.Settings.Default.ExtAppsTBVisible);
|
||||
}
|
||||
|
||||
private ToolStripPanel ToolStripPanelFromString(string Panel)
|
||||
{
|
||||
switch (Panel.ToLower())
|
||||
{
|
||||
case "top":
|
||||
return MainForm.tsContainer.TopToolStripPanel;
|
||||
case "bottom":
|
||||
return MainForm.tsContainer.BottomToolStripPanel;
|
||||
case "left":
|
||||
return MainForm.tsContainer.LeftToolStripPanel;
|
||||
case "right":
|
||||
return MainForm.tsContainer.RightToolStripPanel;
|
||||
default:
|
||||
return MainForm.tsContainer.TopToolStripPanel;
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadPanelsFromXML()
|
||||
{
|
||||
try
|
||||
{
|
||||
Windows.treePanel = null;
|
||||
Windows.configPanel = null;
|
||||
Windows.errorsPanel = null;
|
||||
|
||||
while (MainForm.pnlDock.Contents.Count > 0)
|
||||
{
|
||||
WeifenLuo.WinFormsUI.Docking.DockContent dc = (WeifenLuo.WinFormsUI.Docking.DockContent)MainForm.pnlDock.Contents[0];
|
||||
dc.Close();
|
||||
}
|
||||
|
||||
Startup.CreatePanels();
|
||||
|
||||
string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.SettingsFileInfo.LayoutFileName;
|
||||
string newPath = App.Info.SettingsFileInfo.SettingsPath + "\\" + App.Info.SettingsFileInfo.LayoutFileName;
|
||||
if (File.Exists(newPath))
|
||||
{
|
||||
MainForm.pnlDock.LoadFromXml(newPath, GetContentFromPersistString);
|
||||
#if !PORTABLE
|
||||
}
|
||||
else if (File.Exists(oldPath))
|
||||
{
|
||||
MainForm.pnlDock.LoadFromXml(oldPath, GetContentFromPersistString);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Startup.SetDefaultLayout();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.Error("LoadPanelsFromXML failed" + Environment.NewLine + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadExternalAppsFromXML()
|
||||
{
|
||||
string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.SettingsFileInfo.ExtAppsFilesName;
|
||||
string newPath = App.Info.SettingsFileInfo.SettingsPath + "\\" + App.Info.SettingsFileInfo.ExtAppsFilesName;
|
||||
XmlDocument xDom = new XmlDocument();
|
||||
if (File.Exists(newPath))
|
||||
{
|
||||
xDom.Load(newPath);
|
||||
#if !PORTABLE
|
||||
}
|
||||
else if (File.Exists(oldPath))
|
||||
{
|
||||
xDom.Load(oldPath);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (XmlElement xEl in xDom.DocumentElement.ChildNodes)
|
||||
{
|
||||
Tools.ExternalTool extA = new Tools.ExternalTool();
|
||||
extA.DisplayName = xEl.Attributes["DisplayName"].Value;
|
||||
extA.FileName = xEl.Attributes["FileName"].Value;
|
||||
extA.Arguments = xEl.Attributes["Arguments"].Value;
|
||||
|
||||
if (xEl.HasAttribute("WaitForExit"))
|
||||
{
|
||||
extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value);
|
||||
}
|
||||
|
||||
if (xEl.HasAttribute("TryToIntegrate"))
|
||||
{
|
||||
extA.TryIntegrate = bool.Parse(xEl.Attributes["TryToIntegrate"].Value);
|
||||
}
|
||||
|
||||
Runtime.ExternalTools.Add(extA);
|
||||
}
|
||||
|
||||
MainForm.SwitchToolBarText(System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBShowText));
|
||||
|
||||
xDom = null;
|
||||
|
||||
frmMain.Default.AddExternalToolsToToolBar();
|
||||
}
|
||||
#endregion
|
||||
|
||||
private IDockContent GetContentFromPersistString(string persistString)
|
||||
{
|
||||
// pnlLayout.xml persistence XML fix for refactoring to mRemoteNG
|
||||
if (persistString.StartsWith("mRemote."))
|
||||
persistString = persistString.Replace("mRemote.", "mRemoteNG.");
|
||||
|
||||
try
|
||||
{
|
||||
if (persistString == typeof(ConfigWindow).ToString())
|
||||
return Windows.configPanel;
|
||||
|
||||
if (persistString == typeof(ConnectionTreeWindow).ToString())
|
||||
return Windows.treePanel;
|
||||
|
||||
if (persistString == typeof(ErrorAndInfoWindow).ToString())
|
||||
return Windows.errorsPanel;
|
||||
|
||||
if (persistString == typeof(SessionsWindow).ToString())
|
||||
return Windows.sessionsPanel;
|
||||
|
||||
if (persistString == typeof(ScreenshotManagerWindow).ToString())
|
||||
return Windows.screenshotPanel;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.Log.Error("GetContentFromPersistString failed" + Environment.NewLine + ex.Message);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using System.Xml;
|
||||
@@ -8,9 +7,8 @@ using System.IO;
|
||||
|
||||
namespace mRemoteNG.Config.Settings
|
||||
{
|
||||
public class Save
|
||||
public class SettingsSaver
|
||||
{
|
||||
#region Public Methods
|
||||
public static void SaveSettings()
|
||||
{
|
||||
try
|
||||
@@ -56,7 +54,7 @@ namespace mRemoteNG.Config.Settings
|
||||
}
|
||||
My.Settings.Default.QuickyTBVisible = with_1.tsQuickConnect.Visible;
|
||||
|
||||
My.Settings.Default.ConDefaultPassword = Security.Crypt.Encrypt(System.Convert.ToString(My.Settings.Default.ConDefaultPassword), App.Info.General.EncryptionKey);
|
||||
My.Settings.Default.ConDefaultPassword = Security.Crypt.Encrypt(System.Convert.ToString(My.Settings.Default.ConDefaultPassword), App.Info.GeneralAppInfo.EncryptionKey);
|
||||
|
||||
My.Settings.Default.Save();
|
||||
|
||||
@@ -73,12 +71,12 @@ namespace mRemoteNG.Config.Settings
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(App.Info.Settings.SettingsPath) == false)
|
||||
if (Directory.Exists(App.Info.SettingsFileInfo.SettingsPath) == false)
|
||||
{
|
||||
Directory.CreateDirectory(App.Info.Settings.SettingsPath);
|
||||
Directory.CreateDirectory(App.Info.SettingsFileInfo.SettingsPath);
|
||||
}
|
||||
|
||||
frmMain.Default.pnlDock.SaveAsXml(App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.LayoutFileName);
|
||||
frmMain.Default.pnlDock.SaveAsXml(App.Info.SettingsFileInfo.SettingsPath + "\\" + App.Info.SettingsFileInfo.LayoutFileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -90,12 +88,12 @@ namespace mRemoteNG.Config.Settings
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(App.Info.Settings.SettingsPath) == false)
|
||||
if (Directory.Exists(App.Info.SettingsFileInfo.SettingsPath) == false)
|
||||
{
|
||||
Directory.CreateDirectory(App.Info.Settings.SettingsPath);
|
||||
Directory.CreateDirectory(App.Info.SettingsFileInfo.SettingsPath);
|
||||
}
|
||||
|
||||
XmlTextWriter xmlTextWriter = new XmlTextWriter(App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.ExtAppsFilesName, System.Text.Encoding.UTF8);
|
||||
XmlTextWriter xmlTextWriter = new XmlTextWriter(App.Info.SettingsFileInfo.SettingsPath + "\\" + App.Info.SettingsFileInfo.ExtAppsFilesName, System.Text.Encoding.UTF8);
|
||||
xmlTextWriter.Formatting = Formatting.Indented;
|
||||
xmlTextWriter.Indentation = 4;
|
||||
|
||||
@@ -123,6 +121,5 @@ namespace mRemoteNG.Config.Settings
|
||||
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SaveExternalAppsToXML failed" + Environment.NewLine + Environment.NewLine + ex.Message, false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user