Merge branch 'develop' into develop

This commit is contained in:
Faryan Rezagholi
2019-04-16 17:39:20 +02:00
committed by GitHub
57 changed files with 1149 additions and 391 deletions

View File

@@ -1,15 +1,29 @@
1.77.0 (2018-xx-xx):
1.77.0 (2019-xx-xx):
Features/Enhancements:
----------------------
#1336: Added ability to run External tools on folders
#1320: Added ability to favorite items in the connection tree
#1318: Added support for saving connections in MySQL
#1246: Improved connections loading to tolerate missing attributes in the confCons xml file
#1223: Open External Links in Default Web Browser
#1220: Added an Apple/Mac connection icon
#1218: A splashscreen has been added when mRemoteNG starts
#1216: Connection tree search bar can be placed at the top or bottom of connection tree
#1201: The help files packaged with mRemoteNG have been rewritten
#1186: Certain dialogs are not correctly using localized text for buttons
#1170: The Options window no longer displays in the Windows taskbar when open
#1159: Added a dialog that will display when unhandled exceptions occur
#1141: 'Copy Hostname' option added to connection tree context menu
#1129: Spanish translation improvements
#1072: Russian translation improvements
#1016: Chinese (simplified) translation improvements
#951: Added property to Enable/Disable Clipboard Sharing for RDP connections
#929: Added the hostname to certain RDP error/disconnect messages where it was missing
#928: Add context menu items to 'Close all but this' and 'Close all tabs to the right'
#765: Port Scan Issues (single port scan option now available)
#416: Added ability to Enable/Disable Clipboard Sharing for RDP connections
#321: Added support for displaying on HiDPI screens
#155: Replace MagicLibrary with DockPanelSuite
#154: MR-139: Close Button on Each Tab - new default theme has a close button on each tab
@@ -21,9 +35,32 @@ Fixes:
#1238: Connection panel not translated until opened for the first time
#1186: Fixed several dialog boxes to use localized button text
#1170: Prevent Options window from showing up in taskbar
#1132: loadbalanceinfo field now correctly imported from RDP files
#1064: "Esc" button does does not close some dialogs
#1044: Dragging (grabbing) the program window requires 2 clicks
1.76.18 (2019-03-20):
Fixes:
------
#1365: PuTTY window not centered after 0.71 update
1.76.17 (2019-03-20):
Fixes:
------
#1362: Updated PuTTYNG to 0.71
1.76.16 (2019-03-14):
Fixes:
------
#1347: Remote Desktop Gateway username field encrypted instead of password
1.76.15 (2019-03-09):
Fixes:

View File

@@ -28,6 +28,7 @@ Stephan (github.com/st-schuler)
Aleksey Reytsman (github.com/areytsman)
Cristian Abelleira (github.com/CrAbelleira)
github.com/MitchellBot
github.com/mjbnz
Past Contributors

View File

@@ -13,7 +13,7 @@ namespace mRemoteNGTests.Config.Serializers.Versioning
[SetUp]
public void Setup()
{
var sqlConnector = Substitute.For<SqlDatabaseConnector>("", "", "", "");
var sqlConnector = Substitute.For<MSSqlDatabaseConnector>("", "", "", "");
_versionUpgrader = new SqlVersion22To23Upgrader(sqlConnector);
}

View File

@@ -13,7 +13,7 @@ namespace mRemoteNGTests.Config.Serializers.Versioning
[SetUp]
public void Setup()
{
var sqlConnector = Substitute.For<SqlDatabaseConnector>("", "", "", "");
var sqlConnector = Substitute.For<MSSqlDatabaseConnector>("", "", "", "");
_versionUpgrader = new SqlVersion23To24Upgrader(sqlConnector);
}

View File

@@ -13,7 +13,7 @@ namespace mRemoteNGTests.Config.Serializers.Versioning
[SetUp]
public void Setup()
{
var sqlConnector = Substitute.For<SqlDatabaseConnector>("", "", "", "");
var sqlConnector = Substitute.For<MSSqlDatabaseConnector>("", "", "", "");
_versionUpgrader = new SqlVersion24To25Upgrader(sqlConnector);
}

View File

@@ -13,7 +13,7 @@ namespace mRemoteNGTests.Config.Serializers.Versioning
[SetUp]
public void Setup()
{
var sqlConnector = Substitute.For<SqlDatabaseConnector>("", "", "", "");
var sqlConnector = Substitute.For<MSSqlDatabaseConnector>("", "", "", "");
_versionUpgrader = new SqlVersion25To26Upgrader(sqlConnector);
}

View File

@@ -5,6 +5,6 @@
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.6;
public static readonly double ConnectionFileVersion = 2.7;
}
}

View File

@@ -4,23 +4,23 @@ using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Threading;
namespace mRemoteNG.Config.Connections
{
public class SqlConnectionsUpdateChecker : IConnectionsUpdateChecker
{
private readonly SqlDatabaseConnector _sqlConnector;
private readonly SqlCommand _sqlQuery;
private readonly IDatabaseConnector _dbConnector;
private readonly DbCommand _dbQuery;
private DateTime LastUpdateTime => Runtime.ConnectionsService.LastSqlUpdate;
private DateTime _lastDatabaseUpdateTime;
public SqlConnectionsUpdateChecker()
{
_sqlConnector = DatabaseConnectorFactory.SqlDatabaseConnectorFromSettings();
_sqlQuery = new SqlCommand("SELECT * FROM tblUpdate", _sqlConnector.SqlConnection);
_dbConnector = DatabaseConnectorFactory.DatabaseConnectorFromSettings();
_dbQuery = _dbConnector.DbCommand("SELECT * FROM tblUpdate");
_lastDatabaseUpdateTime = default(DateTime);
}
@@ -46,7 +46,7 @@ namespace mRemoteNG.Config.Connections
{
try
{
_sqlConnector.Connect();
_dbConnector.Connect();
}
catch (Exception e)
{
@@ -76,7 +76,7 @@ namespace mRemoteNG.Config.Connections
var lastUpdateInDb = default(DateTime);
try
{
var sqlReader = _sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
var sqlReader = _dbQuery.ExecuteReader(CommandBehavior.CloseConnection);
sqlReader.Read();
if (sqlReader.HasRows)
lastUpdateInDb = Convert.ToDateTime(sqlReader["LastUpdate"]);
@@ -114,7 +114,7 @@ namespace mRemoteNG.Config.Connections
private void RaiseConnectionsUpdateAvailableEvent()
{
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, "Remote connection update is available");
var args = new ConnectionsUpdateAvailableEventArgs(_sqlConnector, _lastDatabaseUpdateTime);
var args = new ConnectionsUpdateAvailableEventArgs(_dbConnector, _lastDatabaseUpdateTime);
ConnectionsUpdateAvailable?.Invoke(this, args);
}
@@ -126,9 +126,9 @@ namespace mRemoteNG.Config.Connections
private void Dispose(bool itIsSafeToDisposeManagedObjects)
{
if (!itIsSafeToDisposeManagedObjects) return;
_sqlConnector.Disconnect();
_sqlConnector.Dispose();
_sqlQuery.Dispose();
_dbConnector.Disconnect();
_dbConnector.Dispose();
_dbQuery.Dispose();
}
}
}

View File

@@ -17,7 +17,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Connections
{
public class SqlConnectionsLoader : IConnectionsLoader
public class SqlConnectionsLoader : IConnectionsLoader
{
private readonly IDeserializer<string, IEnumerable<LocalConnectionPropertiesModel>>
_localConnectionPropertiesDeserializer;
@@ -38,7 +38,7 @@ namespace mRemoteNG.Config.Connections
public ConnectionTreeModel Load()
{
var connector = DatabaseConnectorFactory.SqlDatabaseConnectorFromSettings();
var connector = DatabaseConnectorFactory.DatabaseConnectorFromSettings();
var dataProvider = new SqlDataProvider(connector);
var metaDataRetriever = new SqlDatabaseMetaDataRetriever();
var databaseVersionVerifier = new SqlDatabaseVersionVerifier(connector);
@@ -93,7 +93,7 @@ namespace mRemoteNG.Config.Connections
});
}
private SqlConnectionListMetaData HandleFirstRun(SqlDatabaseMetaDataRetriever metaDataRetriever, SqlDatabaseConnector connector)
private SqlConnectionListMetaData HandleFirstRun(SqlDatabaseMetaDataRetriever metaDataRetriever, IDatabaseConnector connector)
{
metaDataRetriever.WriteDatabaseMetaData(new RootNodeInfo(RootNodeType.Connection), connector);
return metaDataRetriever.GetDatabaseMetaData(connector);

View File

@@ -59,12 +59,12 @@ namespace mRemoteNG.Config.Connections
return;
}
using (var sqlConnector = DatabaseConnectorFactory.SqlDatabaseConnectorFromSettings())
using (var dbConnector = DatabaseConnectorFactory.DatabaseConnectorFromSettings())
{
sqlConnector.Connect();
var databaseVersionVerifier = new SqlDatabaseVersionVerifier(sqlConnector);
dbConnector.Connect();
var databaseVersionVerifier = new SqlDatabaseVersionVerifier(dbConnector);
var metaDataRetriever = new SqlDatabaseMetaDataRetriever();
var metaData = metaDataRetriever.GetDatabaseMetaData(sqlConnector);
var metaData = metaDataRetriever.GetDatabaseMetaData(dbConnector);
if (!databaseVersionVerifier.VerifyDatabaseVersion(metaData.ConfVersion))
{
@@ -73,9 +73,10 @@ namespace mRemoteNG.Config.Connections
return;
}
metaDataRetriever.WriteDatabaseMetaData(rootTreeNode, sqlConnector);
UpdateConnectionsTable(rootTreeNode, sqlConnector);
UpdateUpdatesTable(sqlConnector);
metaDataRetriever.WriteDatabaseMetaData(rootTreeNode, dbConnector);
UpdateConnectionsTable(rootTreeNode, dbConnector);
UpdateUpdatesTable(dbConnector);
}
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, "Saved connections to database");
@@ -111,7 +112,7 @@ namespace mRemoteNG.Config.Connections
Runtime.MessageCollector.AddMessage(MessageClass.DebugMsg, "Saved local connection properties");
}
private void UpdateRootNodeTable(RootNodeInfo rootTreeNode, SqlDatabaseConnector sqlDatabaseConnector)
private void UpdateRootNodeTable(RootNodeInfo rootTreeNode, IDatabaseConnector databaseConnector)
{
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
string strProtected;
@@ -132,19 +133,17 @@ namespace mRemoteNG.Config.Connections
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", Runtime.EncryptionKey);
}
var sqlQuery = new SqlCommand("DELETE FROM tblRoot", sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
var dbQuery = databaseConnector.DbCommand("DELETE FROM tblRoot");
dbQuery.ExecuteNonQuery();
if (rootTreeNode != null)
{
sqlQuery =
new SqlCommand(
"INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" +
MiscTools.PrepareValueForDB(rootTreeNode.Name) + "\', 0, \'" + strProtected + "\'," +
ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) +
")",
sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
dbQuery =
databaseConnector.DbCommand(
"INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" +
MiscTools.PrepareValueForDB(rootTreeNode.Name) + "\', 0, \'" + strProtected + "\'," +
ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")");
dbQuery.ExecuteNonQuery();
}
else
{
@@ -153,28 +152,26 @@ namespace mRemoteNG.Config.Connections
}
}
private void UpdateConnectionsTable(RootNodeInfo rootTreeNode, SqlDatabaseConnector sqlDatabaseConnector)
private void UpdateConnectionsTable(RootNodeInfo rootTreeNode, IDatabaseConnector databaseConnector)
{
var cryptoProvider = new LegacyRijndaelCryptographyProvider();
var serializer = new DataTableSerializer(_saveFilter, cryptoProvider,
rootTreeNode.PasswordString.ConvertToSecureString());
var dataTable = serializer.Serialize(rootTreeNode);
var dataProvider = new SqlDataProvider(sqlDatabaseConnector);
var dataProvider = new SqlDataProvider(databaseConnector);
var dbQuery = databaseConnector.DbCommand("DELETE FROM tblCons");
dbQuery.ExecuteNonQuery();
var sqlQuery = new SqlCommand("DELETE FROM tblCons", sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
dataProvider.Save(dataTable);
}
private void UpdateUpdatesTable(SqlDatabaseConnector sqlDatabaseConnector)
private void UpdateUpdatesTable(IDatabaseConnector databaseConnector)
{
var sqlQuery = new SqlCommand("DELETE FROM tblUpdate", sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
sqlQuery = new SqlCommand(
"INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + MiscTools.DBDate(DateTime.Now) +
"\')",
sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
var dbQuery = databaseConnector.DbCommand("DELETE FROM tblUpdate");
dbQuery.ExecuteNonQuery();
dbQuery = databaseConnector.DbCommand("INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + MiscTools.DBDate(DateTime.Now) + "\')");
dbQuery.ExecuteNonQuery();
}
private bool SqlUserIsReadOnly()

View File

@@ -1,66 +1,93 @@
using System.Data;
using System.Data.SqlClient;
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
using mRemoteNG.App;
using MySql.Data.MySqlClient;
using System.Data.SqlClient;
namespace mRemoteNG.Config.DataProviders
{
public class SqlDataProvider : IDataProvider<DataTable>
{
public SqlDatabaseConnector SqlDatabaseConnector { get; }
public IDatabaseConnector DatabaseConnector { get; }
public SqlDataProvider(SqlDatabaseConnector sqlDatabaseConnector)
public SqlDataProvider(IDatabaseConnector databaseConnector)
{
SqlDatabaseConnector = sqlDatabaseConnector;
DatabaseConnector = databaseConnector;
}
public DataTable Load()
{
var dataTable = new DataTable();
var sqlQuery = new SqlCommand("SELECT * FROM tblCons ORDER BY PositionID ASC");
SqlDatabaseConnector.AssociateItemToThisConnector(sqlQuery);
if (!SqlDatabaseConnector.IsConnected)
var dbQuery = DatabaseConnector.DbCommand("SELECT * FROM tblCons ORDER BY PositionID ASC");
DatabaseConnector.AssociateItemToThisConnector(dbQuery);
if (!DatabaseConnector.IsConnected)
OpenConnection();
var sqlDataReader = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
var dbDataReader = dbQuery.ExecuteReader(CommandBehavior.CloseConnection);
if (sqlDataReader.HasRows)
dataTable.Load(sqlDataReader);
sqlDataReader.Close();
if (dbDataReader.HasRows)
dataTable.Load(dbDataReader);
dbDataReader.Close();
return dataTable;
}
public void Save(DataTable dataTable)
{
if (SqlUserIsReadOnly())
if (DbUserIsReadOnly())
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg,
"Trying to save connections but the SQL read only checkbox is checked, aborting!");
return;
}
if (!SqlDatabaseConnector.IsConnected)
if (!DatabaseConnector.IsConnected)
OpenConnection();
using (var sqlBulkCopy = new SqlBulkCopy(SqlDatabaseConnector.SqlConnection))
if (DatabaseConnector.GetType() == typeof(MSSqlDatabaseConnector))
{
foreach (DataColumn col in dataTable.Columns)
sqlBulkCopy.ColumnMappings.Add(col.ColumnName, col.ColumnName);
sqlBulkCopy.DestinationTableName = "dbo.tblCons";
sqlBulkCopy.WriteToServer(dataTable);
using (var sqlBulkCopy = new SqlBulkCopy((SqlConnection)DatabaseConnector.DbConnection()))
{
foreach (DataColumn col in dataTable.Columns)
sqlBulkCopy.ColumnMappings.Add(col.ColumnName, col.ColumnName);
sqlBulkCopy.DestinationTableName = "dbo.tblCons";
sqlBulkCopy.WriteToServer(dataTable);
}
}
else if (DatabaseConnector.GetType() == typeof(MySqlDatabaseConnector))
{
var dbConnection = (MySqlConnection) DatabaseConnector.DbConnection();
using (MySqlTransaction transaction = dbConnection.BeginTransaction(System.Data.IsolationLevel.Serializable))
{
using (MySqlCommand sqlCommand = new MySqlCommand())
{
sqlCommand.Connection = dbConnection;
sqlCommand.Transaction = transaction;
sqlCommand.CommandText = "SELECT * FROM tblCons";
using (MySqlDataAdapter dataAdapter = new MySqlDataAdapter(sqlCommand))
{
dataAdapter.UpdateBatchSize = 1000;
using (MySqlCommandBuilder cb = new MySqlCommandBuilder(dataAdapter))
{
dataAdapter.Update(dataTable);
transaction.Commit();
}
}
}
}
}
}
public void OpenConnection()
{
SqlDatabaseConnector.Connect();
DatabaseConnector.Connect();
}
public void CloseConnection()
{
SqlDatabaseConnector.Disconnect();
DatabaseConnector.Disconnect();
}
private bool SqlUserIsReadOnly()
private bool DbUserIsReadOnly()
{
return mRemoteNG.Settings.Default.SQLReadOnly;
}

View File

@@ -7,18 +7,19 @@ namespace mRemoteNG.Config.DatabaseConnectors
/// <summary>
/// A helper class for testing database connectivity
/// </summary>
public class SqlDatabaseConnectionTester
public class DatabaseConnectionTester
{
public async Task<ConnectionTestResult> TestConnectivity(string server,
public async Task<ConnectionTestResult> TestConnectivity(string type,
string server,
string database,
string username,
string password)
{
using (var sqlConnector = new SqlDatabaseConnector(server, database, username, password))
using (var dbConnector = DatabaseConnectorFactory.DatabaseConnector(type, server, database, username, password))
{
try
{
await sqlConnector.ConnectAsync();
await dbConnector.ConnectAsync();
return ConnectionTestResult.ConnectionSucceded;
}
catch (SqlException sqlException)

View File

@@ -5,14 +5,28 @@ namespace mRemoteNG.Config.DatabaseConnectors
{
public class DatabaseConnectorFactory
{
public static SqlDatabaseConnector SqlDatabaseConnectorFromSettings()
public static IDatabaseConnector DatabaseConnectorFromSettings()
{
var sqlType = mRemoteNG.Settings.Default.SQLServerType;
var sqlHost = mRemoteNG.Settings.Default.SQLHost;
var sqlCatalog = mRemoteNG.Settings.Default.SQLDatabaseName;
var sqlUsername = mRemoteNG.Settings.Default.SQLUser;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
var sqlPassword = cryptographyProvider.Decrypt(mRemoteNG.Settings.Default.SQLPass, Runtime.EncryptionKey);
return new SqlDatabaseConnector(sqlHost, sqlCatalog, sqlUsername, sqlPassword);
return DatabaseConnector(sqlType, sqlHost, sqlCatalog, sqlUsername, sqlPassword);
}
public static IDatabaseConnector DatabaseConnector(string type, string server, string database, string username, string password)
{
switch (type)
{
case "mysql":
return new MySqlDatabaseConnector(server, database, username, password);
case "mssql":
default:
return new MSSqlDatabaseConnector(server, database, username, password);
}
}
}
}

View File

@@ -1,13 +1,17 @@
using System;
using System.Data.SqlClient;
using System.Data.Common;
using System.Threading.Tasks;
namespace mRemoteNG.Config.DatabaseConnectors
{
public interface IDatabaseConnector : IDisposable
{
DbConnection DbConnection();
DbCommand DbCommand(string dbCommand);
bool IsConnected { get; }
void Connect();
Task ConnectAsync();
void Disconnect();
void AssociateItemToThisConnector(SqlCommand sqlCommand);
void AssociateItemToThisConnector(DbCommand dbCommand);
}
}

View File

@@ -0,0 +1,99 @@
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Threading.Tasks;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.DatabaseConnectors
{
public class MSSqlDatabaseConnector : IDatabaseConnector
{
private DbConnection _dbConnection { get; set; } = default(SqlConnection);
private string _dbConnectionString = "";
private readonly string _dbHost;
private readonly string _dbCatalog;
private readonly string _dbUsername;
private readonly string _dbPassword;
public DbConnection DbConnection()
{
return _dbConnection;
}
public DbCommand DbCommand(string dbCommand)
{
return new SqlCommand(dbCommand, (SqlConnection) _dbConnection);
}
public bool IsConnected
{
get { return (_dbConnection.State == ConnectionState.Open); }
}
public MSSqlDatabaseConnector(string sqlServer, string catalog, string username, string password)
{
_dbHost = sqlServer;
_dbCatalog = catalog;
_dbUsername = username;
_dbPassword = password;
Initialize();
}
private void Initialize()
{
BuildSqlConnectionString();
_dbConnection = new SqlConnection(_dbConnectionString);
}
private void BuildSqlConnectionString()
{
if (_dbUsername != "")
BuildDbConnectionStringWithCustomCredentials();
else
BuildDbConnectionStringWithDefaultCredentials();
}
private void BuildDbConnectionStringWithCustomCredentials()
{
_dbConnectionString = $"Data Source={_dbHost};Initial Catalog={_dbCatalog};User Id={_dbUsername};Password={_dbPassword}";
}
private void BuildDbConnectionStringWithDefaultCredentials()
{
_dbConnectionString = $"Data Source={_dbHost};Initial Catalog={_dbCatalog};Integrated Security=True";
}
public void Connect()
{
_dbConnection.Open();
}
public async Task ConnectAsync()
{
await _dbConnection.OpenAsync();
}
public void Disconnect()
{
_dbConnection.Close();
}
public void AssociateItemToThisConnector(DbCommand dbCommand)
{
dbCommand.Connection = (SqlConnection) _dbConnection;
}
public void Dispose()
{
Dispose(true);
}
private void Dispose(bool itIsSafeToFreeManagedObjects)
{
if (!itIsSafeToFreeManagedObjects) return;
_dbConnection.Close();
_dbConnection.Dispose();
}
}
}

View File

@@ -0,0 +1,88 @@
using System.Data;
using System.Data.Common;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.DatabaseConnectors
{
public class MySqlDatabaseConnector : IDatabaseConnector
{
private DbConnection _dbConnection { get; set; } = default(MySqlConnection);
private string _dbConnectionString = "";
private readonly string _dbHost;
private readonly string _dbPort;
private readonly string _dbName;
private readonly string _dbUsername;
private readonly string _dbPassword;
public DbConnection DbConnection()
{
return _dbConnection;
}
public DbCommand DbCommand(string dbCommand)
{
return new MySqlCommand(dbCommand, (MySqlConnection) _dbConnection);
}
public bool IsConnected
{
get { return (_dbConnection.State == ConnectionState.Open); }
}
public MySqlDatabaseConnector(string host, string database, string username, string password)
{
string[] hostParts = host.Split(new char[]{':'}, 2);
_dbHost = hostParts[0];
_dbPort = (hostParts.Length == 2)?hostParts[1]:"3306";
_dbName = database;
_dbUsername = username;
_dbPassword = password;
Initialize();
}
private void Initialize()
{
BuildSqlConnectionString();
_dbConnection = new MySqlConnection(_dbConnectionString);
}
private void BuildSqlConnectionString()
{
_dbConnectionString = $"server={_dbHost};user={_dbUsername};database={_dbName};port={_dbPort};password={_dbPassword}";
}
public void Connect()
{
_dbConnection.Open();
}
public async Task ConnectAsync()
{
await _dbConnection.OpenAsync();
}
public void Disconnect()
{
_dbConnection.Close();
}
public void AssociateItemToThisConnector(DbCommand dbCommand)
{
dbCommand.Connection = (MySqlConnection) _dbConnection;
}
public void Dispose()
{
Dispose(true);
}
private void Dispose(bool itIsSafeToFreeManagedObjects)
{
if (!itIsSafeToFreeManagedObjects) return;
_dbConnection.Close();
_dbConnection.Dispose();
}
}
}

View File

@@ -1,89 +0,0 @@
using System.Data;
using System.Data.SqlClient;
using System.Threading.Tasks;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Config.DatabaseConnectors
{
public class SqlDatabaseConnector : IDatabaseConnector
{
public SqlConnection SqlConnection { get; private set; } = default(SqlConnection);
private string _sqlConnectionString = "";
private readonly string _sqlHost;
private readonly string _sqlCatalog;
private readonly string _sqlUsername;
private readonly string _sqlPassword;
public bool IsConnected
{
get { return (SqlConnection.State == ConnectionState.Open); }
}
public SqlDatabaseConnector(string sqlServer, string catalog, string username, string password)
{
_sqlHost = sqlServer;
_sqlCatalog = catalog;
_sqlUsername = username;
_sqlPassword = password;
Initialize();
}
private void Initialize()
{
BuildSqlConnectionString();
SqlConnection = new SqlConnection(_sqlConnectionString);
}
private void BuildSqlConnectionString()
{
if (_sqlUsername != "")
BuildSqlConnectionStringWithCustomCredentials();
else
BuildSqlConnectionStringWithDefaultCredentials();
}
private void BuildSqlConnectionStringWithCustomCredentials()
{
_sqlConnectionString =
$"Data Source={_sqlHost};Initial Catalog={_sqlCatalog};User Id={_sqlUsername};Password={_sqlPassword}";
}
private void BuildSqlConnectionStringWithDefaultCredentials()
{
_sqlConnectionString = $"Data Source={_sqlHost};Initial Catalog={_sqlCatalog};Integrated Security=True";
}
public void Connect()
{
SqlConnection.Open();
}
public async Task ConnectAsync()
{
await SqlConnection.OpenAsync();
}
public void Disconnect()
{
SqlConnection.Close();
}
public void AssociateItemToThisConnector(SqlCommand sqlCommand)
{
sqlCommand.Connection = SqlConnection;
}
public void Dispose()
{
Dispose(true);
}
private void Dispose(bool itIsSafeToFreeManagedObjects)
{
if (!itIsSafeToFreeManagedObjects) return;
SqlConnection.Close();
SqlConnection.Dispose();
}
}
}

View File

@@ -6,7 +6,6 @@ using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using System;
using System.Data;
using System.Data.SqlTypes;
using System.Linq;
using System.Security;
@@ -72,7 +71,7 @@ namespace mRemoteNG.Config.Serializers.MsSql
dataTable.Columns.Add("ConstantID", typeof(string));
dataTable.Columns.Add("PositionID", typeof(int));
dataTable.Columns.Add("ParentID", typeof(string));
dataTable.Columns.Add("LastChange", typeof(SqlDateTime));
dataTable.Columns.Add("LastChange", MiscTools.DBTimeStampType());
dataTable.Columns.Add("Name", typeof(string));
dataTable.Columns.Add("Type", typeof(string));
dataTable.Columns.Add("Expanded", typeof(bool));
@@ -215,7 +214,7 @@ namespace mRemoteNG.Config.Serializers.MsSql
dataRow["ConstantID"] = connectionInfo.ConstantID;
dataRow["ParentID"] = connectionInfo.Parent?.ConstantID ?? "";
dataRow["PositionID"] = _currentNodeIndex;
dataRow["LastChange"] = (SqlDateTime)DateTime.Now;
dataRow["LastChange"] = MiscTools.DBTimeStampNow();
dataRow["Expanded"] =
false; // TODO: this column can eventually be removed. we now save this property locally
dataRow["Description"] = connectionInfo.Description;
@@ -276,9 +275,8 @@ namespace mRemoteNG.Config.Serializers.MsSql
dataRow["RDGatewayUsageMethod"] = connectionInfo.RDGatewayUsageMethod;
dataRow["RDGatewayHostname"] = connectionInfo.RDGatewayHostname;
dataRow["RDGatewayUseConnectionCredentials"] = connectionInfo.RDGatewayUseConnectionCredentials;
dataRow["RDGatewayUsername"] =
_cryptographyProvider.Encrypt(connectionInfo.RDGatewayUsername, _encryptionKey);
dataRow["RDGatewayPassword"] = connectionInfo.RDGatewayPassword;
dataRow["RDGatewayUsername"] = connectionInfo.RDGatewayUsername;
dataRow["RDGatewayPassword"] = _cryptographyProvider.Encrypt(connectionInfo.RDGatewayPassword, _encryptionKey);
dataRow["RDGatewayDomain"] = connectionInfo.RDGatewayDomain;
if (_saveFilter.SaveInheritance)
{

View File

@@ -1,5 +1,5 @@
using System;
using System.Data.SqlClient;
using System.Data.Common;
using System.Globalization;
using mRemoteNG.App;
using mRemoteNG.App.Info;
@@ -12,30 +12,31 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.MsSql
{
public class SqlDatabaseMetaDataRetriever
public class SqlDatabaseMetaDataRetriever
{
public SqlConnectionListMetaData GetDatabaseMetaData(SqlDatabaseConnector sqlDatabaseConnector)
public SqlConnectionListMetaData GetDatabaseMetaData(IDatabaseConnector databaseConnector)
{
SqlConnectionListMetaData metaData;
SqlDataReader sqlDataReader = null;
DbDataReader dbDataReader = null;
try
{
var sqlCommand = new SqlCommand("SELECT * FROM tblRoot", sqlDatabaseConnector.SqlConnection);
if (!sqlDatabaseConnector.IsConnected)
sqlDatabaseConnector.Connect();
sqlDataReader = sqlCommand.ExecuteReader();
if (!sqlDataReader.HasRows)
var dbCommand = databaseConnector.DbCommand("SELECT * FROM tblRoot");
if (!databaseConnector.IsConnected)
databaseConnector.Connect();
dbDataReader = dbCommand.ExecuteReader();
if (!dbDataReader.HasRows)
return null; // assume new empty database
else
sqlDataReader.Read();
dbDataReader.Read();
metaData = new SqlConnectionListMetaData
{
Name = sqlDataReader["Name"] as string ?? "",
Protected = sqlDataReader["Protected"] as string ?? "",
Export = (bool)sqlDataReader["Export"],
Name = dbDataReader["Name"] as string ?? "",
Protected = dbDataReader["Protected"] as string ?? "",
Export = (bool)dbDataReader["Export"],
ConfVersion =
new Version(Convert.ToString(sqlDataReader["confVersion"], CultureInfo.InvariantCulture))
new Version(Convert.ToString(dbDataReader["confVersion"], CultureInfo.InvariantCulture))
};
}
catch (Exception ex)
@@ -45,14 +46,14 @@ namespace mRemoteNG.Config.Serializers.MsSql
}
finally
{
if (sqlDataReader != null && !sqlDataReader.IsClosed)
sqlDataReader.Close();
if (dbDataReader != null && !dbDataReader.IsClosed)
dbDataReader.Close();
}
return metaData;
}
public void WriteDatabaseMetaData(RootNodeInfo rootTreeNode, SqlDatabaseConnector sqlDatabaseConnector)
public void WriteDatabaseMetaData(RootNodeInfo rootTreeNode, IDatabaseConnector databaseConnector)
{
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
string strProtected;
@@ -73,18 +74,16 @@ namespace mRemoteNG.Config.Serializers.MsSql
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", Runtime.EncryptionKey);
}
var sqlQuery = new SqlCommand("DELETE FROM tblRoot", sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
var cmd = databaseConnector.DbCommand("DELETE FROM tblRoot");
cmd.ExecuteNonQuery();
if (rootTreeNode != null)
{
sqlQuery =
new SqlCommand(
"INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" +
cmd = databaseConnector.DbCommand(
"INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" +
MiscTools.PrepareValueForDB(rootTreeNode.Name) + "\', 0, \'" + strProtected + "\'," +
ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")",
sqlDatabaseConnector.SqlConnection);
sqlQuery.ExecuteNonQuery();
ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")");
cmd.ExecuteNonQuery();
}
else
{

View File

@@ -18,7 +18,7 @@ namespace mRemoteNG.Config.Serializers
var connectionInfo = new ConnectionInfo();
foreach (var line in rdcFileContent.Split(Environment.NewLine.ToCharArray()))
{
var parts = line.Split(new[] {':'}, 3);
var parts = line.Split(new[] { ':' }, 3);
if (parts.Length < 3)
{
continue;
@@ -75,7 +75,6 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.Colors = RdpProtocol.RDPColors.Colors32Bit;
break;
}
break;
case "bitmapcachepersistenable":
connectionInfo.CacheBitmaps = value == "1";
@@ -128,11 +127,27 @@ namespace mRemoteNG.Config.Serializers
connectionInfo.RedirectSound = RdpProtocol.RDPSounds.DoNotPlay;
break;
}
break;
case "loadbalanceinfo":
connectionInfo.LoadBalanceInfo = value;
break;
case "gatewayusagemethod":
switch (value)
{
case "0":
connectionInfo.RDGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Never;
break;
case "1":
connectionInfo.RDGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Always;
break;
case "2":
connectionInfo.RDGatewayUsageMethod = RdpProtocol.RDGatewayUsageMethod.Detect;
break;
}
break;
case "gatewayhostname":
connectionInfo.RDGatewayHostname = value;
break;
}
}
}

View File

@@ -8,14 +8,14 @@ namespace mRemoteNG.Config.Serializers.Versioning
{
public class SqlDatabaseVersionVerifier
{
private readonly SqlDatabaseConnector _sqlDatabaseConnector;
private readonly IDatabaseConnector _databaseConnector;
public SqlDatabaseVersionVerifier(SqlDatabaseConnector sqlDatabaseConnector)
public SqlDatabaseVersionVerifier(IDatabaseConnector DatabaseConnector)
{
if (sqlDatabaseConnector == null)
throw new ArgumentNullException(nameof(sqlDatabaseConnector));
if (DatabaseConnector == null)
throw new ArgumentNullException(nameof(DatabaseConnector));
_sqlDatabaseConnector = sqlDatabaseConnector;
_databaseConnector = DatabaseConnector;
}
public bool VerifyDatabaseVersion(Version dbVersion)
@@ -32,11 +32,11 @@ namespace mRemoteNG.Config.Serializers.Versioning
var dbUpgraders = new IVersionUpgrader[]
{
new SqlVersion22To23Upgrader(_sqlDatabaseConnector),
new SqlVersion23To24Upgrader(_sqlDatabaseConnector),
new SqlVersion24To25Upgrader(_sqlDatabaseConnector),
new SqlVersion25To26Upgrader(_sqlDatabaseConnector),
new SqlVersion26To27Upgrader(_sqlDatabaseConnector),
new SqlVersion22To23Upgrader(_databaseConnector),
new SqlVersion23To24Upgrader(_databaseConnector),
new SqlVersion24To25Upgrader(_databaseConnector),
new SqlVersion25To26Upgrader(_databaseConnector),
new SqlVersion26To27Upgrader(_databaseConnector),
};
foreach (var upgrader in dbUpgraders)

View File

@@ -2,20 +2,19 @@
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
using System;
using System.Data.SqlClient;
namespace mRemoteNG.Config.Serializers.Versioning
{
public class SqlVersion22To23Upgrader : IVersionUpgrader
{
private readonly SqlDatabaseConnector _sqlDatabaseConnector;
private readonly IDatabaseConnector _databaseConnector;
public SqlVersion22To23Upgrader(SqlDatabaseConnector sqlDatabaseConnector)
public SqlVersion22To23Upgrader(IDatabaseConnector databaseConnector)
{
if (sqlDatabaseConnector == null)
throw new ArgumentNullException(nameof(sqlDatabaseConnector));
if (databaseConnector == null)
throw new ArgumentNullException(nameof(databaseConnector));
_sqlDatabaseConnector = sqlDatabaseConnector;
_databaseConnector = databaseConnector;
}
public bool CanUpgrade(Version currentVersion)
@@ -33,8 +32,8 @@ ADD EnableFontSmoothing bit NOT NULL DEFAULT 0,
EnableDesktopComposition bit NOT NULL DEFAULT 0,
InheritEnableFontSmoothing bit NOT NULL DEFAULT 0,
InheritEnableDesktopComposition bit NOT NULL DEFAULT 0;";
var sqlCommand = new SqlCommand(sqlText, _sqlDatabaseConnector.SqlConnection);
sqlCommand.ExecuteNonQuery();
var dbCommand = _databaseConnector.DbCommand(sqlText);
dbCommand.ExecuteNonQuery();
return new Version(2, 3);
}

View File

@@ -2,20 +2,19 @@
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
using System;
using System.Data.SqlClient;
namespace mRemoteNG.Config.Serializers.Versioning
{
public class SqlVersion23To24Upgrader : IVersionUpgrader
{
private readonly SqlDatabaseConnector _sqlDatabaseConnector;
private readonly IDatabaseConnector _databaseConnector;
public SqlVersion23To24Upgrader(SqlDatabaseConnector sqlDatabaseConnector)
public SqlVersion23To24Upgrader(IDatabaseConnector databaseConnector)
{
if (sqlDatabaseConnector == null)
throw new ArgumentNullException(nameof(sqlDatabaseConnector));
if (databaseConnector == null)
throw new ArgumentNullException(nameof(databaseConnector));
_sqlDatabaseConnector = sqlDatabaseConnector;
_databaseConnector = databaseConnector;
}
public bool CanUpgrade(Version currentVersion)
@@ -31,8 +30,8 @@ namespace mRemoteNG.Config.Serializers.Versioning
ALTER TABLE tblCons
ADD UseCredSsp bit NOT NULL DEFAULT 1,
InheritUseCredSsp bit NOT NULL DEFAULT 0;";
var sqlCommand = new SqlCommand(sqlText, _sqlDatabaseConnector.SqlConnection);
sqlCommand.ExecuteNonQuery();
var dbCommand = _databaseConnector.DbCommand(sqlText);
dbCommand.ExecuteNonQuery();
return new Version(2, 4);
}

View File

@@ -2,20 +2,19 @@
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
using System;
using System.Data.SqlClient;
namespace mRemoteNG.Config.Serializers.Versioning
{
public class SqlVersion24To25Upgrader : IVersionUpgrader
{
private readonly SqlDatabaseConnector _sqlDatabaseConnector;
private readonly IDatabaseConnector _databaseConnector;
public SqlVersion24To25Upgrader(SqlDatabaseConnector sqlDatabaseConnector)
public SqlVersion24To25Upgrader(IDatabaseConnector databaseConnector)
{
if (sqlDatabaseConnector == null)
throw new ArgumentNullException(nameof(sqlDatabaseConnector));
if (databaseConnector == null)
throw new ArgumentNullException(nameof(databaseConnector));
_sqlDatabaseConnector = sqlDatabaseConnector;
_databaseConnector = databaseConnector;
}
public bool CanUpgrade(Version currentVersion)
@@ -33,8 +32,8 @@ ADD LoadBalanceInfo varchar (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
AutomaticResize bit NOT NULL DEFAULT 1,
InheritLoadBalanceInfo bit NOT NULL DEFAULT 0,
InheritAutomaticResize bit NOT NULL DEFAULT 0;";
var sqlCommand = new SqlCommand(sqlText, _sqlDatabaseConnector.SqlConnection);
sqlCommand.ExecuteNonQuery();
var dbCommand = _databaseConnector.DbCommand(sqlText);
dbCommand.ExecuteNonQuery();
return new Version(2, 5);
}

View File

@@ -2,20 +2,19 @@
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
using System;
using System.Data.SqlClient;
namespace mRemoteNG.Config.Serializers.Versioning
{
public class SqlVersion25To26Upgrader : IVersionUpgrader
{
private readonly SqlDatabaseConnector _sqlDatabaseConnector;
private readonly IDatabaseConnector _databaseConnector;
public SqlVersion25To26Upgrader(SqlDatabaseConnector sqlDatabaseConnector)
public SqlVersion25To26Upgrader(IDatabaseConnector databaseConnector)
{
if (sqlDatabaseConnector == null)
throw new ArgumentNullException(nameof(sqlDatabaseConnector));
if (databaseConnector == null)
throw new ArgumentNullException(nameof(databaseConnector));
_sqlDatabaseConnector = sqlDatabaseConnector;
_databaseConnector = databaseConnector;
}
public bool CanUpgrade(Version currentVersion)
@@ -37,8 +36,8 @@ ADD RDPMinutesToIdleTimeout int NOT NULL DEFAULT 0,
InheritSoundQuality bit NOT NULL DEFAULT 0;
UPDATE tblRoot
SET ConfVersion='2.6'";
var sqlCommand = new SqlCommand(sqlText, _sqlDatabaseConnector.SqlConnection);
sqlCommand.ExecuteNonQuery();
var dbCommand = _databaseConnector.DbCommand(sqlText);
dbCommand.ExecuteNonQuery();
return new Version(2, 6);
}

View File

@@ -2,20 +2,19 @@
using mRemoteNG.Config.DatabaseConnectors;
using mRemoteNG.Messages;
using System;
using System.Data.SqlClient;
namespace mRemoteNG.Config.Serializers.Versioning
{
public class SqlVersion26To27Upgrader : IVersionUpgrader
{
private readonly SqlDatabaseConnector _sqlDatabaseConnector;
private readonly IDatabaseConnector _databaseConnector;
public SqlVersion26To27Upgrader(SqlDatabaseConnector sqlDatabaseConnector)
public SqlVersion26To27Upgrader(IDatabaseConnector databaseConnector)
{
if (sqlDatabaseConnector == null)
throw new ArgumentNullException(nameof(sqlDatabaseConnector));
if (databaseConnector == null)
throw new ArgumentNullException(nameof(databaseConnector));
_sqlDatabaseConnector = sqlDatabaseConnector;
_databaseConnector = databaseConnector;
}
public bool CanUpgrade(Version currentVersion)
@@ -33,8 +32,8 @@ ADD RedirectClipboard bit NOT NULL DEFAULT 0,
InheritRedirectClipboard bit NOT NULL DEFAULT 0;
UPDATE tblRoot
SET ConfVersion='2.7'";
var sqlCommand = new SqlCommand(sqlText, _sqlDatabaseConnector.SqlConnection);
sqlCommand.ExecuteNonQuery();
var dbCommand = _databaseConnector.DbCommand(sqlText);
dbCommand.ExecuteNonQuery();
return new Version(2, 7);
}

View File

@@ -1,4 +1,9 @@
using mRemoteNG.App;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using mRemoteNG.App;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.Http;
using mRemoteNG.Connection.Protocol.ICA;
@@ -10,11 +15,6 @@ using mRemoteNG.Connection.Protocol.Telnet;
using mRemoteNG.Connection.Protocol.VNC;
using mRemoteNG.Container;
using mRemoteNG.Tree;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace mRemoteNG.Connection
@@ -163,7 +163,8 @@ namespace mRemoteNG.Connection
DoNotJump = 4,
OverridePanel = 8,
DontUseConsoleSession = 16,
NoCredentials = 32
NoCredentials = 32,
ViewOnly = 64
}
#endregion

View File

@@ -0,0 +1,20 @@
namespace mRemoteNG.Connection.Protocol
{
/// <summary>
/// Signifies that a protocol supports View Only mode. When in View Only mode,
/// the control will not capture and send input events to the remote host.
/// </summary>
public interface ISupportsViewOnly
{
/// <summary>
/// Whether this control is in view only mode.
/// </summary>
bool ViewOnly { get; set; }
/// <summary>
/// Toggles whether the control will capture and send input events to the remote host.
/// The local host will continue to receive data from the remote host regardless of this setting.
/// </summary>
void ToggleViewOnly();
}
}

View File

@@ -1,3 +1,9 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using AxMSTSCLib;
using mRemoteNG.App;
using mRemoteNG.Messages;
@@ -6,16 +12,10 @@ using mRemoteNG.Tools;
using mRemoteNG.UI;
using mRemoteNG.UI.Forms;
using MSTSCLib;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
namespace mRemoteNG.Connection.Protocol.RDP
{
public class RdpProtocol : ProtocolBase
public class RdpProtocol : ProtocolBase, ISupportsViewOnly
{
/* RDP v8 requires Windows 7 with:
* https://support.microsoft.com/en-us/kb/2592687
@@ -24,6 +24,7 @@ namespace mRemoteNG.Connection.Protocol.RDP
*
* Windows 8+ support RDP v8 out of the box.
*/
private AxHost _axHost;
private MsRdpClient8NotSafeForScripting _rdpClient;
private Version _rdpVersion;
private ConnectionInfo _connectionInfo;
@@ -86,6 +87,12 @@ namespace mRemoteNG.Connection.Protocol.RDP
public bool LoadBalanceInfoUseUtf8 { get; set; }
public bool ViewOnly
{
get => !_axHost.Enabled;
set => _axHost.Enabled = !value;
}
#endregion
#region Constructors
@@ -116,7 +123,8 @@ namespace mRemoteNG.Connection.Protocol.RDP
Application.DoEvents();
}
_rdpClient = (MsRdpClient8NotSafeForScripting)((AxMsRdpClient8NotSafeForScripting)Control).GetOcx();
_axHost = (AxMsRdpClient8NotSafeForScripting)Control;
_rdpClient = (MsRdpClient8NotSafeForScripting)_axHost.GetOcx();
}
catch (System.Runtime.InteropServices.COMException ex)
{
@@ -160,6 +168,7 @@ namespace mRemoteNG.Connection.Protocol.RDP
SetAuthenticationLevel();
SetLoadBalanceInfo();
SetRdGateway();
ViewOnly = Force.HasFlag(ConnectionInfo.Force.ViewOnly);
_rdpClient.ColorDepth = (int)_connectionInfo.Colors;
@@ -187,6 +196,7 @@ namespace mRemoteNG.Connection.Protocol.RDP
{
_rdpClient.Connect();
base.Connect();
return true;
}
catch (Exception ex)
@@ -234,6 +244,22 @@ namespace mRemoteNG.Connection.Protocol.RDP
}
}
/// <summary>
/// Toggles whether the RDP ActiveX control will capture and send input events to the remote host.
/// The local host will continue to receive data from the remote host regardless of this setting.
/// </summary>
public void ToggleViewOnly()
{
try
{
ViewOnly = !ViewOnly;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, $"Could not toggle view only mode for host {_connectionInfo.Hostname}");
}
}
public override void Focus()
{
try

View File

@@ -1,15 +1,15 @@
using System;
using System.ComponentModel;
using mRemoteNG.App;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using System;
using System.ComponentModel;
// ReSharper disable ArrangeAccessorOwnerBody
namespace mRemoteNG.Connection.Protocol.VNC
{
public class ProtocolVNC : ProtocolBase
public class ProtocolVNC : ProtocolBase, ISupportsViewOnly
{
#region Properties

View File

@@ -2817,6 +2817,18 @@ namespace mRemoteNG {
set {
this["InhDefaultFavorite"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("mssql")]
public string SQLServerType {
get {
return ((string)(this["SQLServerType"]));
}
set {
this["SQLServerType"] = value;
}
}
}
}

View File

@@ -701,5 +701,8 @@
<Setting Name="InhDefaultFavorite" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="SQLServerType" Type="System.String" Scope="User">
<Value Profile="(Default)">mssql</Value>
</Setting>
</Settings>
</SettingsFile>

Binary file not shown.

Binary file not shown.

View File

@@ -128,7 +128,9 @@ CREATE TABLE [dbo].[tblCons] (
[LoadBalanceInfo] [varchar] (1024) NULL ,
[AutomaticResize] [bit] NOT NULL DEFAULT 1 ,
[InheritLoadBalanceInfo] [bit] NOT NULL DEFAULT 0 ,
[InheritAutomaticResize] [bit] NOT NULL DEFAULT 0
[InheritAutomaticResize] [bit] NOT NULL DEFAULT 0 ,
[RedirectClipboard] [bit] NOT NULL DEFAULT 0 ,
[InheritRedirectClipboard] [bit] NOT NULL DEFAULT 0
) ON [PRIMARY]
GO

View File

@@ -0,0 +1,181 @@

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `tblCons`
--
DROP TABLE IF EXISTS `tblCons`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tblCons` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ConstantID` varchar(128) DEFAULT NULL,
`PositionID` int(11) NOT NULL,
`ParentID` varchar(128) DEFAULT NULL,
`LastChange` datetime NOT NULL,
`Name` varchar(128) NOT NULL,
`Type` varchar(32) NOT NULL,
`Expanded` tinyint(1) NOT NULL,
`Description` varchar(1024) DEFAULT NULL,
`Icon` varchar(128) NOT NULL,
`Panel` varchar(128) NOT NULL,
`Username` varchar(512) DEFAULT NULL,
`DomainName` varchar(512) DEFAULT NULL,
`Password` varchar(1024) DEFAULT NULL,
`Hostname` varchar(512) DEFAULT NULL,
`Protocol` varchar(32) NOT NULL,
`PuttySession` varchar(128) DEFAULT NULL,
`Port` int(11) NOT NULL,
`ConnectToConsole` tinyint(1) NOT NULL,
`UseCredSsp` tinyint(1) NOT NULL,
`RenderingEngine` varchar(10) DEFAULT NULL,
`ICAEncryptionStrength` varchar(32) NOT NULL,
`RDPAuthenticationLevel` varchar(32) NOT NULL,
`RDPMinutesToIdleTimeout` int(11) NOT NULL,
`RDPAlertIdleTimeout` tinyint(1) NOT NULL,
`Colors` varchar(32) NOT NULL,
`Resolution` varchar(32) NOT NULL,
`DisplayWallpaper` tinyint(1) NOT NULL,
`DisplayThemes` tinyint(1) NOT NULL,
`EnableFontSmoothing` tinyint(1) NOT NULL,
`EnableDesktopComposition` tinyint(1) NOT NULL,
`CacheBitmaps` tinyint(1) NOT NULL,
`RedirectDiskDrives` tinyint(1) NOT NULL,
`RedirectPorts` tinyint(1) NOT NULL,
`RedirectPrinters` tinyint(1) NOT NULL,
`RedirectSmartCards` tinyint(1) NOT NULL,
`RedirectSound` varchar(64) NOT NULL,
`SoundQuality` varchar(20) NOT NULL,
`RedirectKeys` tinyint(1) NOT NULL,
`Connected` tinyint(1) NOT NULL,
`PreExtApp` varchar(256) DEFAULT NULL,
`PostExtApp` varchar(256) DEFAULT NULL,
`MacAddress` varchar(32) DEFAULT NULL,
`UserField` varchar(256) DEFAULT NULL,
`ExtApp` varchar(256) DEFAULT NULL,
`VNCCompression` varchar(10) DEFAULT NULL,
`VNCEncoding` varchar(20) DEFAULT NULL,
`VNCAuthMode` varchar(10) DEFAULT NULL,
`VNCProxyType` varchar(20) DEFAULT NULL,
`VNCProxyIP` varchar(128) DEFAULT NULL,
`VNCProxyPort` int(11) DEFAULT NULL,
`VNCProxyUsername` varchar(512) DEFAULT NULL,
`VNCProxyPassword` varchar(1024) DEFAULT NULL,
`VNCColors` varchar(10) DEFAULT NULL,
`VNCSmartSizeMode` varchar(20) DEFAULT NULL,
`VNCViewOnly` tinyint(1) NOT NULL,
`RDGatewayUsageMethod` varchar(32) NOT NULL,
`RDGatewayHostname` varchar(512) DEFAULT NULL,
`RDGatewayUseConnectionCredentials` varchar(32) NOT NULL,
`RDGatewayUsername` varchar(512) DEFAULT NULL,
`RDGatewayPassword` varchar(1024) DEFAULT NULL,
`RDGatewayDomain` varchar(512) DEFAULT NULL,
`InheritCacheBitmaps` tinyint(1) NOT NULL,
`InheritColors` tinyint(1) NOT NULL,
`InheritDescription` tinyint(1) NOT NULL,
`InheritDisplayThemes` tinyint(1) NOT NULL,
`InheritDisplayWallpaper` tinyint(1) NOT NULL,
`InheritEnableFontSmoothing` tinyint(1) NOT NULL,
`InheritEnableDesktopComposition` tinyint(1) NOT NULL,
`InheritDomain` tinyint(1) NOT NULL,
`InheritIcon` tinyint(1) NOT NULL,
`InheritPanel` tinyint(1) NOT NULL,
`InheritPassword` tinyint(1) NOT NULL,
`InheritPort` tinyint(1) NOT NULL,
`InheritProtocol` tinyint(1) NOT NULL,
`InheritPuttySession` tinyint(1) NOT NULL,
`InheritRedirectDiskDrives` tinyint(1) NOT NULL,
`InheritRedirectKeys` tinyint(1) NOT NULL,
`InheritRedirectPorts` tinyint(1) NOT NULL,
`InheritRedirectPrinters` tinyint(1) NOT NULL,
`InheritRedirectSmartCards` tinyint(1) NOT NULL,
`InheritRedirectSound` tinyint(1) NOT NULL,
`InheritSoundQuality` tinyint(1) NOT NULL,
`InheritResolution` tinyint(1) NOT NULL,
`InheritUseConsoleSession` tinyint(1) NOT NULL,
`InheritUseCredSsp` tinyint(1) NOT NULL,
`InheritRenderingEngine` tinyint(1) NOT NULL,
`InheritICAEncryptionStrength` tinyint(1) NOT NULL,
`InheritRDPAuthenticationLevel` tinyint(1) NOT NULL,
`InheritRDPMinutesToIdleTimeout` tinyint(1) NOT NULL,
`InheritRDPAlertIdleTimeout` tinyint(1) NOT NULL,
`InheritUsername` tinyint(1) NOT NULL,
`InheritPreExtApp` tinyint(1) NOT NULL,
`InheritPostExtApp` tinyint(1) NOT NULL,
`InheritMacAddress` tinyint(1) NOT NULL,
`InheritUserField` tinyint(1) NOT NULL,
`InheritExtApp` tinyint(1) NOT NULL,
`InheritVNCCompression` tinyint(1) NOT NULL,
`InheritVNCEncoding` tinyint(1) NOT NULL,
`InheritVNCAuthMode` tinyint(1) NOT NULL,
`InheritVNCProxyType` tinyint(1) NOT NULL,
`InheritVNCProxyIP` tinyint(1) NOT NULL,
`InheritVNCProxyPort` tinyint(1) NOT NULL,
`InheritVNCProxyUsername` tinyint(1) NOT NULL,
`InheritVNCProxyPassword` tinyint(1) NOT NULL,
`InheritVNCColors` tinyint(1) NOT NULL,
`InheritVNCSmartSizeMode` tinyint(1) NOT NULL,
`InheritVNCViewOnly` tinyint(1) NOT NULL,
`InheritRDGatewayUsageMethod` tinyint(1) NOT NULL,
`InheritRDGatewayHostname` tinyint(1) NOT NULL,
`InheritRDGatewayUseConnectionCredentials` tinyint(1) NOT NULL,
`InheritRDGatewayUsername` tinyint(1) NOT NULL,
`InheritRDGatewayPassword` tinyint(1) NOT NULL,
`InheritRDGatewayDomain` tinyint(1) NOT NULL,
`LoadBalanceInfo` varchar(1024) DEFAULT NULL,
`AutomaticResize` tinyint(1) NOT NULL DEFAULT 1,
`InheritLoadBalanceInfo` tinyint(1) NOT NULL DEFAULT 0,
`InheritAutomaticResize` tinyint(1) NOT NULL DEFAULT 0,
`RedirectClipboard` tinyint(1) NOT NULL DEFAULT 0,
`InheritRedirectClipboard` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3324 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tblRoot`
--
DROP TABLE IF EXISTS `tblRoot`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tblRoot` (
`Name` varchar(2048) NOT NULL,
`Export` tinyint(1) NOT NULL,
`Protected` varchar(4048) NOT NULL,
`ConfVersion` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tblUpdate`
--
DROP TABLE IF EXISTS `tblUpdate`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tblUpdate` (
`LastUpdate` datetime(3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8"/>
@@ -17,7 +17,7 @@
<ul>
<li>SSH File Transfer requires an SSH service to listen on an available network port (default 22) on a remote host.</li>
<li>A username and password must be supplied to connect with the remote host.</li>
<li>The remote host must have a writeable folder on its filesystem to place the transferred files.</li>
<li>The remote host must have a writable folder on its filesystem to place the transferred files.</li>
</ul>
<!-- Prerequisites - #end -->
<!-- Configuration - #start -->
@@ -62,6 +62,5 @@
<b>[14] ERROR- SSH background transfer failed!</b>
<br/>This issue was likely encountered due to a permissions issue. Ensure you have appropriate access to write to the specified Remote File.
</div>
</p>
</body>
</html>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8"/>
@@ -46,11 +46,16 @@
</tr>
<tr>
<td>
<a href="SQLScript.txt">Microsoft&trade; SQL script</a>
<a href="MSSQLScript.txt">Microsoft&trade; SQL script</a>
</td>
<td>Microsoft&trade; SQL Server</td>
</tr>
<!-- <tr><td><a href="MySQLScript.txt">MySQL&trade; script</a></td><td>MySQL&trade; Server</td></tr> -->
<tr>
<td>
<a href="MySQLScript.txt">MySQL&trade; script</a>
</td>
<td>MySQL&trade; Server</td>
</tr>
</table>
</div>
</body>

View File

@@ -78,6 +78,15 @@ namespace mRemoteNG {
}
}
/// <summary>
/// Looks up a localized string similar to Clear search string.
/// </summary>
internal static string ClearSearchString {
get {
return ResourceManager.GetString("ClearSearchString", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create a New Connection File.
/// </summary>
@@ -105,6 +114,15 @@ namespace mRemoteNG {
}
}
/// <summary>
/// Looks up a localized string similar to Connect in View Only mode.
/// </summary>
internal static string ConnectInViewOnlyMode {
get {
return ResourceManager.GetString("ConnectInViewOnlyMode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The connection file could not be found..
/// </summary>
@@ -3984,7 +4002,7 @@ namespace mRemoteNG {
}
/// <summary>
/// Looks up a localized string similar to View Only (VNC).
/// Looks up a localized string similar to View Only.
/// </summary>
internal static string strMenuViewOnly {
get {

View File

@@ -1082,7 +1082,7 @@ Starte mit neuer Datei.</value>
<value>Text anzeigen</value>
</data>
<data name="strMenuSmartSize" xml:space="preserve">
<value>SmartSize (RDP/VNC)</value>
<value>Smart-Size-Modus (RDP/VNC)</value>
</data>
<data name="strMenuSSHFileTransfer" xml:space="preserve">
<value>SSH-Dateiübertragung</value>
@@ -1103,7 +1103,7 @@ Starte mit neuer Datei.</value>
<value>&amp;Ansicht</value>
</data>
<data name="strMenuViewOnly" xml:space="preserve">
<value>Nur Ansicht (VNC)</value>
<value>View-Only-Modus</value>
</data>
<data name="strMenuWebsite" xml:space="preserve">
<value>Webseite</value>
@@ -1157,7 +1157,7 @@ Starte mit neuer Datei.</value>
<value>Normal</value>
</data>
<data name="strNoSmartSize" xml:space="preserve">
<value>Keine automatische Größenanpassung (SmartSize)</value>
<value>Keine automatische Größenanpassung (Smart-Size)</value>
</data>
<data name="strNoUpdateAvailable" xml:space="preserve">
<value>Keine Updates verfügbar</value>
@@ -1467,7 +1467,7 @@ Wenn Sie Fehler feststellen, dann sollten Sie eine neue Verbindungsdatei erstell
<value>Auflösung</value>
</data>
<data name="strPropertyNameSmartSizeMode" xml:space="preserve">
<value>SmartSize-Modus</value>
<value>Smart-Size-Modus</value>
</data>
<data name="strPropertyNameUseConsoleSession" xml:space="preserve">
<value>Verwende Konsole</value>
@@ -2660,4 +2660,10 @@ Development umfasst Alphas, Betas und Release Candidates.</value>
<data name="Favorites" xml:space="preserve">
<value>Favoriten</value>
</data>
<data name="ClearSearchString" xml:space="preserve">
<value>Suchbegriff löschen</value>
</data>
<data name="ConnectInViewOnlyMode" xml:space="preserve">
<value>Im View-Only-Modus verbinden</value>
</data>
</root>

View File

@@ -1220,7 +1220,7 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for
<value>&amp;View</value>
</data>
<data name="strMenuViewOnly" xml:space="preserve">
<value>View Only (VNC)</value>
<value>View Only</value>
</data>
<data name="strMenuWebsite" xml:space="preserve">
<value>Website</value>
@@ -2761,11 +2761,11 @@ Development Channel includes Alphas, Betas &amp; Release Candidates.</value>
<value>Proxy</value>
</data>
<data name="strMultiSSH" xml:space="preserve">
<value>Multi SSH:</value>
</data>
<value>Multi SSH:</value>
</data>
<data name="strMultiSSHToolTip" xml:space="preserve">
<value>Press ENTER to send. Ctrl+C is sent immediately.</value>
</data>
<value>Press ENTER to send. Ctrl+C is sent immediately.</value>
</data>
<data name="strPropertyDescriptionFavorite" xml:space="preserve">
<value>Show this connection in the favorites menu.</value>
</data>
@@ -2775,4 +2775,10 @@ Development Channel includes Alphas, Betas &amp; Release Candidates.</value>
<data name="Favorites" xml:space="preserve">
<value>Favorites</value>
</data>
<data name="ClearSearchString" xml:space="preserve">
<value>Clear search string</value>
</data>
<data name="ConnectInViewOnlyMode" xml:space="preserve">
<value>Connect in View Only mode</value>
</data>
</root>

View File

@@ -2705,4 +2705,4 @@ mRemoteNG 将退出并安装更新。</value>
<data name="Favorites" xml:space="preserve">
<value>收藏夹</value>
</data>
</root>
</root>

Binary file not shown.

View File

@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Data.SqlTypes;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
@@ -8,6 +9,7 @@ using System.Security;
using mRemoteNG.App;
using mRemoteNG.Messages;
using mRemoteNG.UI.Forms;
using MySql.Data.Types;
using static System.String;
namespace mRemoteNG.Tools
@@ -66,13 +68,40 @@ namespace mRemoteNG.Tools
public static string DBDate(DateTime Dt)
{
var strDate = Dt.Year + LeadingZero(Convert.ToString(Dt.Month)) + LeadingZero(Convert.ToString(Dt.Day)) +
" " + LeadingZero(Convert.ToString(Dt.Hour)) + ":" +
LeadingZero(Convert.ToString(Dt.Minute)) + ":" + LeadingZero(Convert.ToString(Dt.Second));
return strDate;
}
{
switch (Settings.Default.SQLServerType)
{
case "mysql":
return Dt.ToString("yyyy/MM/dd HH:mm:ss");
case "mssql":
default:
return Dt.ToString("yyyyMMdd HH:mm:ss");
}
}
public static Type DBTimeStampType()
{
switch (Settings.Default.SQLServerType)
{
case "mysql":
return typeof(MySqlDateTime);
case "mssql":
default:
return typeof(SqlDateTime);
}
}
public static object DBTimeStampNow()
{
switch (Settings.Default.SQLServerType)
{
case "mysql":
return new MySqlDateTime(DateTime.Now);
case "mssql":
default:
return (SqlDateTime)DateTime.Now;
}
}
public static string PrepareValueForDB(string Text)
{

View File

@@ -0,0 +1,65 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace mRemoteNG.UI.Controls.Base
{
public class NGSearchBox : NGTextBox
{
private PictureBox pbClear = new PictureBox();
private ToolTip btClearToolTip = new ToolTip();
public NGSearchBox()
{
InitializeComponent();
LostFocus += FocusLost;
GotFocus += FocusGot;
AddClearButton();
ApplyLanguage();
}
private void ApplyLanguage()
{
btClearToolTip.SetToolTip(pbClear, Language.ClearSearchString);
}
private void AddClearButton()
{
pbClear.Image = Resources.Delete;
pbClear.Width = 20;
pbClear.Dock = DockStyle.Right;
pbClear.Cursor = Cursors.Default;
pbClear.Click += PbClear_Click;
pbClear.LostFocus += FocusLost;
Controls.Add(pbClear);
}
private void FocusLost(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(Text))
{
Text = Language.strSearchPrompt;
pbClear.Visible = false;
}
}
private void FocusGot(object sender, EventArgs e) => Text = "";
private void InitializeComponent()
{
this.SuspendLayout();
//
// NGSearchBox
//
this.TextChanged += new System.EventHandler(this.NGSearchBox_TextChanged);
this.ResumeLayout(false);
}
private void PbClear_Click(object sender, EventArgs e) => Text = string.Empty;
private void NGSearchBox_TextChanged(object sender, EventArgs e)
{
pbClear.Visible = Text == Language.strSearchPrompt ? false : TextLength > 0;
}
}
}

View File

@@ -0,0 +1,123 @@
<?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>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@@ -26,6 +26,7 @@ namespace mRemoteNG.UI.Controls
private ToolStripMenuItem _cMenTreeConnectWithOptionsConnectToConsoleSession;
private ToolStripMenuItem _cMenTreeConnectWithOptionsNoCredentials;
private ToolStripMenuItem _cMenTreeConnectWithOptionsConnectInFullscreen;
private ToolStripMenuItem _cMenTreeConnectWithOptionsViewOnly;
private ToolStripMenuItem _cMenTreeDisconnect;
private ToolStripSeparator _cMenTreeSep2;
private ToolStripMenuItem _cMenTreeToolsTransferFile;
@@ -82,6 +83,7 @@ namespace mRemoteNG.UI.Controls
_cMenTreeConnectWithOptionsConnectInFullscreen = new ToolStripMenuItem();
_cMenTreeConnectWithOptionsNoCredentials = new ToolStripMenuItem();
_cMenTreeConnectWithOptionsChoosePanelBeforeConnecting = new ToolStripMenuItem();
_cMenTreeConnectWithOptionsViewOnly = new ToolStripMenuItem();
_cMenTreeDisconnect = new ToolStripMenuItem();
_cMenTreeSep1 = new ToolStripSeparator();
_cMenTreeToolsExternalApps = new ToolStripMenuItem();
@@ -157,7 +159,8 @@ namespace mRemoteNG.UI.Controls
_cMenTreeConnectWithOptionsDontConnectToConsoleSession,
_cMenTreeConnectWithOptionsConnectInFullscreen,
_cMenTreeConnectWithOptionsNoCredentials,
_cMenTreeConnectWithOptionsChoosePanelBeforeConnecting
_cMenTreeConnectWithOptionsChoosePanelBeforeConnecting,
_cMenTreeConnectWithOptionsViewOnly
});
_cMenTreeConnectWithOptions.Name = "_cMenTreeConnectWithOptions";
_cMenTreeConnectWithOptions.Size = new System.Drawing.Size(199, 22);
@@ -207,6 +210,15 @@ namespace mRemoteNG.UI.Controls
_cMenTreeConnectWithOptionsChoosePanelBeforeConnecting.Text = "Choose panel before connecting";
_cMenTreeConnectWithOptionsChoosePanelBeforeConnecting.Click += OnChoosePanelBeforeConnectingClicked;
//
// cMenTreeConnectWithOptionsViewOnly
//
_cMenTreeConnectWithOptionsViewOnly.Image = Resources.View;
_cMenTreeConnectWithOptionsViewOnly.Name =
"_cMenTreeConnectWithOptionsViewOnly";
_cMenTreeConnectWithOptionsViewOnly.Size = new System.Drawing.Size(245, 22);
_cMenTreeConnectWithOptionsViewOnly.Text = Language.ConnectInViewOnlyMode;
_cMenTreeConnectWithOptionsViewOnly.Click += ConnectWithOptionsViewOnlyOnClick;
//
// cMenTreeDisconnect
//
_cMenTreeDisconnect.Image = Resources.Pause;
@@ -396,6 +408,7 @@ namespace mRemoteNG.UI.Controls
_cMenTreeConnectWithOptionsConnectInFullscreen.Text = Language.strConnectInFullscreen;
_cMenTreeConnectWithOptionsNoCredentials.Text = Language.strConnectNoCredentials;
_cMenTreeConnectWithOptionsChoosePanelBeforeConnecting.Text = Language.strChoosePanelBeforeConnecting;
_cMenTreeConnectWithOptionsViewOnly.Text = Language.ConnectInViewOnlyMode;
_cMenTreeDisconnect.Text = Language.strMenuDisconnect;
_cMenTreeToolsExternalApps.Text = Language.strMenuExternalTools;
@@ -436,13 +449,13 @@ namespace mRemoteNG.UI.Controls
{
ShowHideMenuItemsForRootConnectionNode();
}
else if (_connectionTree.SelectedNode is ContainerInfo)
else if (_connectionTree.SelectedNode is ContainerInfo containerInfo)
{
ShowHideMenuItemsForContainer(_connectionTree.SelectedNode);
ShowHideMenuItemsForContainer(containerInfo);
}
else if (_connectionTree.SelectedNode is PuttySessionInfo)
else if (_connectionTree.SelectedNode is PuttySessionInfo puttyNode)
{
ShowHideMenuItemsForPuttyNode(_connectionTree.SelectedNode);
ShowHideMenuItemsForPuttyNode(puttyNode);
}
else
{
@@ -475,6 +488,7 @@ namespace mRemoteNG.UI.Controls
_cMenTreeDelete.Enabled = false;
_cMenTreeMoveUp.Enabled = false;
_cMenTreeMoveDown.Enabled = false;
_cMenTreeConnectWithOptionsViewOnly.Enabled = false;
}
internal void ShowHideMenuItemsForRootConnectionNode()
@@ -491,22 +505,22 @@ namespace mRemoteNG.UI.Controls
_cMenTreeDelete.Enabled = false;
_cMenTreeMoveUp.Enabled = false;
_cMenTreeMoveDown.Enabled = false;
_cMenTreeConnectWithOptionsViewOnly.Enabled = false;
}
internal void ShowHideMenuItemsForContainer(ConnectionInfo connectionInfo)
internal void ShowHideMenuItemsForContainer(ContainerInfo containerInfo)
{
_cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false;
_cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false;
_cMenTreeDisconnect.Enabled = false;
var openConnections = ((ContainerInfo)connectionInfo).Children.Sum(child => child.OpenConnections.Count);
if (openConnections > 0)
_cMenTreeDisconnect.Enabled = true;
var hasOpenConnections = containerInfo.Children.Any(child => child.OpenConnections.Count > 0);
_cMenTreeDisconnect.Enabled = hasOpenConnections;
_cMenTreeToolsTransferFile.Enabled = false;
_cMenTreeConnectWithOptionsViewOnly.Enabled = false;
}
internal void ShowHideMenuItemsForPuttyNode(ConnectionInfo connectionInfo)
internal void ShowHideMenuItemsForPuttyNode(PuttySessionInfo connectionInfo)
{
_cMenTreeAddConnection.Enabled = false;
_cMenTreeAddFolder.Enabled = false;
@@ -527,6 +541,7 @@ namespace mRemoteNG.UI.Controls
_cMenTreeMoveDown.Enabled = false;
_cMenTreeImport.Enabled = false;
_cMenTreeExportFile.Enabled = false;
_cMenTreeConnectWithOptionsViewOnly.Enabled = false;
}
internal void ShowHideMenuItemsForConnectionNode(ConnectionInfo connectionInfo)
@@ -545,6 +560,9 @@ namespace mRemoteNG.UI.Controls
if (connectionInfo.Protocol == ProtocolType.IntApp)
_cMenTreeConnectWithOptionsNoCredentials.Enabled = false;
if (connectionInfo.Protocol != ProtocolType.RDP && connectionInfo.Protocol != ProtocolType.VNC)
_cMenTreeConnectWithOptionsViewOnly.Enabled = false;
}
internal void DisableShortcutKeys()
@@ -691,6 +709,13 @@ namespace mRemoteNG.UI.Controls
ConnectionInfo.Force.DoNotJump);
}
private void ConnectWithOptionsViewOnlyOnClick(object sender, EventArgs e)
{
var connectionTarget = _connectionTree.SelectedNode as ContainerInfo
?? _connectionTree.SelectedNode;
_connectionInitiator.OpenConnection(connectionTarget, ConnectionInfo.Force.ViewOnly);
}
private void OnDisconnectClicked(object sender, EventArgs e)
{
DisconnectConnection(_connectionTree.SelectedNode);

View File

@@ -18,6 +18,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
// System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SqlServerPage));
this.lblSQLDatabaseName = new mRemoteNG.UI.Controls.Base.NGLabel();
this.txtSQLDatabaseName = new mRemoteNG.UI.Controls.Base.NGTextBox();
this.lblExperimental = new mRemoteNG.UI.Controls.Base.NGLabel();
@@ -34,13 +35,15 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.lblTestConnectionResults = new mRemoteNG.UI.Controls.Base.NGLabel();
this.chkSQLReadOnly = new mRemoteNG.UI.Controls.Base.NGCheckBox();
this.lblSQLReadOnly = new mRemoteNG.UI.Controls.Base.NGLabel();
this.lblSQLType = new mRemoteNG.UI.Controls.Base.NGLabel();
this.txtSQLType = new mRemoteNG.UI.Controls.Base.NGComboBox();
((System.ComponentModel.ISupportInitialize)(this.imgConnectionStatus)).BeginInit();
this.SuspendLayout();
//
// lblSQLDatabaseName
//
this.lblSQLDatabaseName.Enabled = false;
this.lblSQLDatabaseName.Location = new System.Drawing.Point(23, 132);
this.lblSQLDatabaseName.Location = new System.Drawing.Point(23, 156);
this.lblSQLDatabaseName.Name = "lblSQLDatabaseName";
this.lblSQLDatabaseName.Size = new System.Drawing.Size(111, 13);
this.lblSQLDatabaseName.TabIndex = 5;
@@ -51,7 +54,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
//
this.txtSQLDatabaseName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSQLDatabaseName.Enabled = false;
this.txtSQLDatabaseName.Location = new System.Drawing.Point(140, 130);
this.txtSQLDatabaseName.Location = new System.Drawing.Point(140, 154);
this.txtSQLDatabaseName.Name = "txtSQLDatabaseName";
this.txtSQLDatabaseName.Size = new System.Drawing.Size(153, 22);
this.txtSQLDatabaseName.TabIndex = 6;
@@ -86,7 +89,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
// lblSQLUsername
//
this.lblSQLUsername.Enabled = false;
this.lblSQLUsername.Location = new System.Drawing.Point(23, 158);
this.lblSQLUsername.Location = new System.Drawing.Point(23, 182);
this.lblSQLUsername.Name = "lblSQLUsername";
this.lblSQLUsername.Size = new System.Drawing.Size(111, 13);
this.lblSQLUsername.TabIndex = 7;
@@ -97,7 +100,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
//
this.txtSQLPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSQLPassword.Enabled = false;
this.txtSQLPassword.Location = new System.Drawing.Point(140, 182);
this.txtSQLPassword.Location = new System.Drawing.Point(140, 206);
this.txtSQLPassword.Name = "txtSQLPassword";
this.txtSQLPassword.Size = new System.Drawing.Size(153, 22);
this.txtSQLPassword.TabIndex = 10;
@@ -120,7 +123,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
// lblSQLServer
//
this.lblSQLServer.Enabled = false;
this.lblSQLServer.Location = new System.Drawing.Point(23, 106);
this.lblSQLServer.Location = new System.Drawing.Point(23, 130);
this.lblSQLServer.Name = "lblSQLServer";
this.lblSQLServer.Size = new System.Drawing.Size(111, 13);
this.lblSQLServer.TabIndex = 3;
@@ -131,7 +134,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
//
this.txtSQLUsername.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSQLUsername.Enabled = false;
this.txtSQLUsername.Location = new System.Drawing.Point(140, 156);
this.txtSQLUsername.Location = new System.Drawing.Point(140, 180);
this.txtSQLUsername.Name = "txtSQLUsername";
this.txtSQLUsername.Size = new System.Drawing.Size(153, 22);
this.txtSQLUsername.TabIndex = 8;
@@ -140,7 +143,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
//
this.txtSQLServer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSQLServer.Enabled = false;
this.txtSQLServer.Location = new System.Drawing.Point(140, 103);
this.txtSQLServer.Location = new System.Drawing.Point(140, 128);
this.txtSQLServer.Name = "txtSQLServer";
this.txtSQLServer.Size = new System.Drawing.Size(153, 22);
this.txtSQLServer.TabIndex = 4;
@@ -148,7 +151,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
// lblSQLPassword
//
this.lblSQLPassword.Enabled = false;
this.lblSQLPassword.Location = new System.Drawing.Point(23, 184);
this.lblSQLPassword.Location = new System.Drawing.Point(23, 208);
this.lblSQLPassword.Name = "lblSQLPassword";
this.lblSQLPassword.Size = new System.Drawing.Size(111, 13);
this.lblSQLPassword.TabIndex = 9;
@@ -159,7 +162,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
//
this.btnTestConnection._mice = mRemoteNG.UI.Controls.Base.NGButton.MouseState.HOVER;
this.btnTestConnection.Enabled = false;
this.btnTestConnection.Location = new System.Drawing.Point(140, 228);
this.btnTestConnection.Location = new System.Drawing.Point(140, 252);
this.btnTestConnection.Name = "btnTestConnection";
this.btnTestConnection.Size = new System.Drawing.Size(153, 23);
this.btnTestConnection.TabIndex = 11;
@@ -170,7 +173,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
// imgConnectionStatus
//
this.imgConnectionStatus.Image = global::mRemoteNG.Resources.Help;
this.imgConnectionStatus.Location = new System.Drawing.Point(297, 231);
this.imgConnectionStatus.Location = new System.Drawing.Point(297, 255);
this.imgConnectionStatus.Name = "imgConnectionStatus";
this.imgConnectionStatus.Size = new System.Drawing.Size(16, 16);
this.imgConnectionStatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -180,7 +183,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
// lblTestConnectionResults
//
this.lblTestConnectionResults.AutoSize = true;
this.lblTestConnectionResults.Location = new System.Drawing.Point(137, 254);
this.lblTestConnectionResults.Location = new System.Drawing.Point(137, 278);
this.lblTestConnectionResults.Name = "lblTestConnectionResults";
this.lblTestConnectionResults.Size = new System.Drawing.Size(124, 13);
this.lblTestConnectionResults.TabIndex = 13;
@@ -191,7 +194,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.chkSQLReadOnly._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER;
this.chkSQLReadOnly.AutoSize = true;
this.chkSQLReadOnly.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chkSQLReadOnly.Location = new System.Drawing.Point(140, 208);
this.chkSQLReadOnly.Location = new System.Drawing.Point(140, 232);
this.chkSQLReadOnly.Name = "chkSQLReadOnly";
this.chkSQLReadOnly.Size = new System.Drawing.Size(15, 14);
this.chkSQLReadOnly.TabIndex = 14;
@@ -200,17 +203,42 @@ namespace mRemoteNG.UI.Forms.OptionsPages
// lblSQLReadOnly
//
this.lblSQLReadOnly.Enabled = false;
this.lblSQLReadOnly.Location = new System.Drawing.Point(23, 208);
this.lblSQLReadOnly.Location = new System.Drawing.Point(23, 232);
this.lblSQLReadOnly.Name = "lblSQLReadOnly";
this.lblSQLReadOnly.Size = new System.Drawing.Size(111, 13);
this.lblSQLReadOnly.TabIndex = 15;
this.lblSQLReadOnly.Text = "Read Only:";
this.lblSQLReadOnly.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// lblSQLType
//
this.lblSQLType.Enabled = false;
this.lblSQLType.Location = new System.Drawing.Point(23, 106);
this.lblSQLType.Name = "lblSQLType";
this.lblSQLType.Size = new System.Drawing.Size(111, 13);
this.lblSQLType.TabIndex = 20;
this.lblSQLType.Text = "SQL Server Type:";
this.lblSQLType.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// txtSQLType
//
this.txtSQLType._mice = mRemoteNG.UI.Controls.Base.NGComboBox.MouseState.HOVER;
this.txtSQLType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.txtSQLType.FormattingEnabled = true;
this.txtSQLType.Items.AddRange(new object[] {
"mssql",
"mysql"});
this.txtSQLType.Location = new System.Drawing.Point(140, 102);
this.txtSQLType.Name = "txtSQLType";
this.txtSQLType.Size = new System.Drawing.Size(153, 21);
this.txtSQLType.TabIndex = 21;
//
// SqlServerPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.txtSQLType);
this.Controls.Add(this.lblSQLType);
this.Controls.Add(this.lblSQLReadOnly);
this.Controls.Add(this.chkSQLReadOnly);
this.Controls.Add(this.lblTestConnectionResults);
@@ -233,7 +261,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
((System.ComponentModel.ISupportInitialize)(this.imgConnectionStatus)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
internal Controls.Base.NGLabel lblSQLDatabaseName;
internal Controls.Base.NGTextBox txtSQLDatabaseName;
@@ -251,5 +278,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
private Controls.Base.NGLabel lblTestConnectionResults;
private Controls.Base.NGCheckBox chkSQLReadOnly;
internal Controls.Base.NGLabel lblSQLReadOnly;
internal Controls.Base.NGLabel lblSQLType;
private Controls.Base.NGComboBox txtSQLType;
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using mRemoteNG.App;
using mRemoteNG.Config.Connections;
using mRemoteNG.Config.Connections.Multiuser;
@@ -9,14 +9,14 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
public sealed partial class SqlServerPage
{
private readonly SqlDatabaseConnectionTester _databaseConnectionTester;
private readonly DatabaseConnectionTester _databaseConnectionTester;
public SqlServerPage()
{
InitializeComponent();
ApplyTheme();
PageIcon = Resources.Database_Icon;
_databaseConnectionTester = new SqlDatabaseConnectionTester();
_databaseConnectionTester = new DatabaseConnectionTester();
}
public override string PageName
@@ -44,6 +44,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
public override void LoadSettings()
{
chkUseSQLServer.Checked = Settings.Default.UseSQLServer;
txtSQLType.Text = Settings.Default.SQLServerType;
txtSQLServer.Text = Settings.Default.SQLHost;
txtSQLDatabaseName.Text = Settings.Default.SQLDatabaseName;
txtSQLUsername.Text = Settings.Default.SQLUser;
@@ -59,6 +60,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
var sqlServerWasPreviouslyEnabled = Settings.Default.UseSQLServer;
Settings.Default.UseSQLServer = chkUseSQLServer.Checked;
Settings.Default.SQLServerType = txtSQLType.Text;
Settings.Default.SQLHost = txtSQLServer.Text;
Settings.Default.SQLDatabaseName = txtSQLDatabaseName.Text;
Settings.Default.SQLUser = txtSQLUsername.Text;
@@ -94,11 +96,13 @@ namespace mRemoteNG.UI.Forms.OptionsPages
private void toggleSQLPageControls(bool useSQLServer)
{
lblSQLType.Enabled = useSQLServer;
lblSQLServer.Enabled = useSQLServer;
lblSQLDatabaseName.Enabled = useSQLServer;
lblSQLUsername.Enabled = useSQLServer;
lblSQLPassword.Enabled = useSQLServer;
lblSQLReadOnly.Enabled = useSQLServer;
txtSQLType.Enabled = useSQLServer;
txtSQLServer.Enabled = useSQLServer;
txtSQLDatabaseName.Enabled = useSQLServer;
txtSQLUsername.Enabled = useSQLServer;
@@ -109,6 +113,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
private async void btnTestConnection_Click(object sender, EventArgs e)
{
var type = txtSQLType.Text;
var server = txtSQLServer.Text;
var database = txtSQLDatabaseName.Text;
var username = txtSQLUsername.Text;
@@ -119,7 +124,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
btnTestConnection.Enabled = false;
var connectionTestResult =
await _databaseConnectionTester.TestConnectivity(server, database, username, password);
await _databaseConnectionTester.TestConnectivity(type, server, database, username, password);
btnTestConnection.Enabled = true;

View File

@@ -1,4 +1,4 @@

using mRemoteNG.Themes;
@@ -64,7 +64,7 @@ namespace mRemoteNG.UI.Window
//
// ActiveDirectoryTree
//
this.ActiveDirectoryTree.ADPath = null;
this.ActiveDirectoryTree.AdPath = null;
this.ActiveDirectoryTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
@@ -76,7 +76,7 @@ namespace mRemoteNG.UI.Window
this.ActiveDirectoryTree.SelectedNode = null;
this.ActiveDirectoryTree.Size = new System.Drawing.Size(510, 285);
this.ActiveDirectoryTree.TabIndex = 3;
this.ActiveDirectoryTree.ADPathChanged += new ADTree.ADtree.ADPathChangedEventHandler(this.ActiveDirectoryTree_ADPathChanged);
this.ActiveDirectoryTree.AdPathChanged += new ADTree.ADtree.AdPathChangedEventHandler(this.ActiveDirectoryTree_ADPathChanged);
//
// btnClose
//

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
@@ -57,7 +57,7 @@ namespace mRemoteNG.UI.Window
else
importDestination = Runtime.ConnectionsService.ConnectionTreeModel.RootNodes.First();
Import.ImportFromActiveDirectory(ActiveDirectoryTree.ADPath, importDestination, chkSubOU.Checked);
Import.ImportFromActiveDirectory(ActiveDirectoryTree.AdPath, importDestination, chkSubOU.Checked);
}
/*
@@ -80,6 +80,7 @@ namespace mRemoteNG.UI.Window
ChangeDomain();
}
// ReSharper disable once UnusedParameter.Local
private void ActiveDirectoryTree_ADPathChanged(object sender)
{
EnableDisableImportButton();
@@ -105,7 +106,7 @@ namespace mRemoteNG.UI.Window
private void EnableDisableImportButton()
{
btnImport.Enabled = !string.IsNullOrEmpty(ActiveDirectoryTree.ADPath);
btnImport.Enabled = !string.IsNullOrEmpty(ActiveDirectoryTree.AdPath);
}
#endregion

View File

@@ -1,4 +1,4 @@

using mRemoteNG.Connection;
using mRemoteNG.Tree;
@@ -29,14 +29,14 @@ namespace mRemoteNG.UI.Window
this.mMenViewExpandAllFolders = new System.Windows.Forms.ToolStripMenuItem();
this.mMenViewCollapseAllFolders = new System.Windows.Forms.ToolStripMenuItem();
this.mMenSortAscending = new System.Windows.Forms.ToolStripMenuItem();
this.vsToolStripExtender = new WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender(this.components);
this.PictureBoxSearch = new mRemoteNG.UI.Controls.Base.NGPictureBox(this.components);
this.txtSearch = new mRemoteNG.UI.Controls.Base.NGTextBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.mMenFavorites = new System.Windows.Forms.ToolStripMenuItem();
this.vsToolStripExtender = new WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender(this.components);
this.pbSearch = new mRemoteNG.UI.Controls.Base.NGPictureBox(this.components);
this.txtSearch = new mRemoteNG.UI.Controls.Base.NGSearchBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.olvConnections)).BeginInit();
this.msMain.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxSearch)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbSearch)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
@@ -133,21 +133,29 @@ namespace mRemoteNG.UI.Window
this.mMenSortAscending.Name = "mMenSortAscending";
this.mMenSortAscending.Size = new System.Drawing.Size(28, 20);
//
// mMenFavorites
//
this.mMenFavorites.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.mMenFavorites.Image = global::mRemoteNG.Resources.star;
this.mMenFavorites.Name = "mMenFavorites";
this.mMenFavorites.Size = new System.Drawing.Size(28, 20);
this.mMenFavorites.Text = "Favorites";
//
// vsToolStripExtender
//
this.vsToolStripExtender.DefaultRenderer = null;
//
// PictureBoxSearch
// pbSearch
//
this.PictureBoxSearch.Dock = System.Windows.Forms.DockStyle.Fill;
this.PictureBoxSearch.Image = global::mRemoteNG.Resources.Search;
this.PictureBoxSearch.Location = new System.Drawing.Point(0, 0);
this.PictureBoxSearch.Margin = new System.Windows.Forms.Padding(0);
this.PictureBoxSearch.Name = "PictureBoxSearch";
this.PictureBoxSearch.Size = new System.Drawing.Size(26, 21);
this.PictureBoxSearch.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.PictureBoxSearch.TabIndex = 1;
this.PictureBoxSearch.TabStop = false;
this.pbSearch.Dock = System.Windows.Forms.DockStyle.Fill;
this.pbSearch.Image = global::mRemoteNG.Resources.Search;
this.pbSearch.Location = new System.Drawing.Point(0, 0);
this.pbSearch.Margin = new System.Windows.Forms.Padding(0);
this.pbSearch.Name = "pbSearch";
this.pbSearch.Size = new System.Drawing.Size(26, 21);
this.pbSearch.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbSearch.TabIndex = 1;
this.pbSearch.TabStop = false;
//
// txtSearch
//
@@ -163,9 +171,7 @@ namespace mRemoteNG.UI.Window
this.txtSearch.TabStop = false;
this.txtSearch.Text = "Search";
this.txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChanged);
this.txtSearch.GotFocus += new System.EventHandler(this.txtSearch_GotFocus);
this.txtSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtSearch_KeyDown);
this.txtSearch.LostFocus += new System.EventHandler(this.txtSearch_LostFocus);
//
// tableLayoutPanel1
//
@@ -173,7 +179,7 @@ namespace mRemoteNG.UI.Window
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.PictureBoxSearch, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.pbSearch, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.txtSearch);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 390);
@@ -183,14 +189,6 @@ namespace mRemoteNG.UI.Window
this.tableLayoutPanel1.Size = new System.Drawing.Size(204, 21);
this.tableLayoutPanel1.TabIndex = 32;
//
// mMenFavorites
//
this.mMenFavorites.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.mMenFavorites.Image = global::mRemoteNG.Resources.star;
this.mMenFavorites.Name = "mMenFavorites";
this.mMenFavorites.Size = new System.Drawing.Size(28, 20);
this.mMenFavorites.Text = "Favorites";
//
// ConnectionTreeWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@@ -209,7 +207,7 @@ namespace mRemoteNG.UI.Window
((System.ComponentModel.ISupportInitialize)(this.olvConnections)).EndInit();
this.msMain.ResumeLayout(false);
this.msMain.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxSearch)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbSearch)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
@@ -221,8 +219,8 @@ namespace mRemoteNG.UI.Window
private System.ComponentModel.IContainer components;
private Controls.ConnectionTree olvConnections;
private WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender vsToolStripExtender;
internal Controls.Base.NGPictureBox PictureBoxSearch;
internal Controls.Base.NGTextBox txtSearch;
internal Controls.Base.NGPictureBox pbSearch;
internal Controls.Base.NGSearchBox txtSearch;
public System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
internal System.Windows.Forms.ToolStripMenuItem mMenFavorites;
}

View File

@@ -103,7 +103,7 @@ namespace mRemoteNG.UI.Window
_themeManager.ActiveTheme.Theme);
if (!_themeManager.ActiveAndExtended) return;
//Treelistview need to be manually themed
//Treelistview needs to be manually themed
olvConnections.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TreeView_Background");
olvConnections.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TreeView_Foreground");
olvConnections.SelectedBackColor =
@@ -117,6 +117,8 @@ namespace mRemoteNG.UI.Window
//There is a border around txtSearch that dont theme well
txtSearch.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
txtSearch.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
//Picturebox needs to be manually themed
pbSearch.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TreeView_Background");
}
#endregion
@@ -252,18 +254,6 @@ namespace mRemoteNG.UI.Window
#region Search
private void txtSearch_GotFocus(object sender, EventArgs e)
{
if (txtSearch.Text == Language.strSearchPrompt)
txtSearch.Text = "";
}
private void txtSearch_LostFocus(object sender, EventArgs e)
{
if (txtSearch.Text != "") return;
txtSearch.Text = Language.strSearchPrompt;
}
private void txtSearch_KeyDown(object sender, KeyEventArgs e)
{
try
@@ -295,9 +285,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(
"txtSearch_KeyDown (UI.Window.ConnectionTreeWindow) failed",
ex);
Runtime.MessageCollector.AddExceptionStackTrace("txtSearch_KeyDown (UI.Window.ConnectionTreeWindow) failed", ex);
}
}
@@ -360,9 +348,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(
"tvConnections_KeyPress (UI.Window.ConnectionTreeWindow) failed",
ex);
Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_KeyPress (UI.Window.ConnectionTreeWindow) failed", ex);
}
}
@@ -384,9 +370,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace(
"tvConnections_KeyDown (UI.Window.ConnectionTreeWindow) failed",
ex);
Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_KeyDown (UI.Window.ConnectionTreeWindow) failed", ex);
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@@ -15,9 +15,9 @@ using mRemoteNG.Themes;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.Forms.Input;
using mRemoteNG.UI.Tabs;
using mRemoteNG.UI.TaskDialog;
using WeifenLuo.WinFormsUI.Docking;
using mRemoteNG.UI.Tabs;
namespace mRemoteNG.UI.Window
{
@@ -363,6 +363,16 @@ namespace mRemoteNG.UI.Window
var interfaceControl = GetInterfaceControl();
if (interfaceControl == null) return;
if (interfaceControl.Protocol is ISupportsViewOnly viewOnly)
{
cmenTabViewOnly.Visible = true;
cmenTabViewOnly.Checked = viewOnly.ViewOnly;
}
else
{
cmenTabViewOnly.Visible = false;
}
if (interfaceControl.Info.Protocol == ProtocolType.RDP)
{
var rdp = (RdpProtocol)interfaceControl.Protocol;
@@ -381,18 +391,15 @@ namespace mRemoteNG.UI.Window
{
var vnc = (ProtocolVNC)interfaceControl.Protocol;
cmenTabSendSpecialKeys.Visible = true;
cmenTabViewOnly.Visible = true;
cmenTabSmartSize.Visible = true;
cmenTabStartChat.Visible = true;
cmenTabRefreshScreen.Visible = true;
cmenTabTransferFile.Visible = false;
cmenTabSmartSize.Checked = vnc.SmartSize;
cmenTabViewOnly.Checked = vnc.ViewOnly;
}
else
{
cmenTabSendSpecialKeys.Visible = false;
cmenTabViewOnly.Visible = false;
cmenTabStartChat.Visible = false;
cmenTabRefreshScreen.Visible = false;
cmenTabTransferFile.Visible = false;
@@ -500,9 +507,11 @@ namespace mRemoteNG.UI.Window
try
{
var interfaceControl = GetInterfaceControl();
if (!(interfaceControl?.Protocol is ProtocolVNC vnc)) return;
if (!(interfaceControl?.Protocol is ISupportsViewOnly viewOnly))
return;
cmenTabViewOnly.Checked = !cmenTabViewOnly.Checked;
vnc.ToggleViewOnly();
viewOnly.ToggleViewOnly();
}
catch (Exception ex)
{

View File

@@ -735,6 +735,9 @@
<setting name="InhDefaultFavorite" serializeAs="String">
<value>False</value>
</setting>
<setting name="SQLServerType" serializeAs="String">
<value>mssql</value>
</setting>
</mRemoteNG.Settings>
</userSettings>
<applicationSettings>

View File

@@ -62,7 +62,11 @@
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="mscorlib" />
<Reference Include="MySql.Data, Version=8.0.13.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.13\lib\net452\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="ObjectListView, Version=2.9.1.1072, Culture=neutral, PublicKeyToken=b1c5bf581481bcd4, processorArchitecture=MSIL">
<HintPath>..\packages\ObjectListView.Official.2.9.1\lib\net20\ObjectListView.dll</HintPath>
</Reference>
@@ -70,12 +74,17 @@
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Management" />
<Reference Include="System.Security" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
@@ -148,7 +157,8 @@
<Compile Include="Config\CredentialRepositoryListSaver.cs" />
<Compile Include="Config\DatabaseConnectors\ConnectionTestResult.cs" />
<Compile Include="Config\DatabaseConnectors\DatabaseConnectorFactory.cs" />
<Compile Include="Config\DatabaseConnectors\SqlDatabaseConnectionTester.cs" />
<Compile Include="Config\DatabaseConnectors\DatabaseConnectionTester.cs" />
<Compile Include="Config\DatabaseConnectors\MSSqlDatabaseConnector.cs" />
<Compile Include="Config\DataProviders\FileBackupCreator.cs" />
<Compile Include="Config\DataProviders\FileBackupPruner.cs" />
<Compile Include="Config\DataProviders\InMemoryStringDataProvider.cs" />
@@ -223,7 +233,7 @@
<Compile Include="Config\Putty\PuttySessionsManager.cs" />
<Compile Include="Config\Putty\AbstractPuttySessionsProvider.cs" />
<Compile Include="Config\DatabaseConnectors\IDatabaseConnector.cs" />
<Compile Include="Config\DatabaseConnectors\SqlDatabaseConnector.cs" />
<Compile Include="Config\DatabaseConnectors\MySqlDatabaseConnector.cs" />
<Compile Include="Connection\AbstractConnectionRecord.cs" />
<Compile Include="Connection\ConnectionInfoComparer.cs" />
<Compile Include="Connection\ConnectionInfoInheritance.cs" />
@@ -239,6 +249,7 @@
<Compile Include="Connection\Protocol\Http\Connection.Protocol.HTTPS.CertEvent.cs" />
<Compile Include="Connection\Protocol\ProtocolFactory.cs" />
<Compile Include="Connection\Protocol\RDP\AzureLoadBalanceInfoEncoder.cs" />
<Compile Include="Connection\Protocol\ISupportsViewOnly.cs" />
<Compile Include="Connection\Protocol\RDP\RdpClientWrap.cs">
<SubType>Component</SubType>
</Compile>
@@ -395,6 +406,9 @@
<Compile Include="UI\Controls\Base\NGRadioButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\Base\NGSearchBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\Base\NGTextBox.cs">
<SubType>Component</SubType>
</Compile>
@@ -835,6 +849,9 @@
<EmbeddedResource Include="UI\Controls\Base\NGRadioButton.resx">
<DependentUpon>NGRadioButton.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Controls\Base\NGSearchBox.resx">
<DependentUpon>NGSearchBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Controls\Base\NGTextBox.resx">
<DependentUpon>NGTextBox.cs</DependentUpon>
</EmbeddedResource>
@@ -911,6 +928,7 @@
</EmbeddedResource>
<EmbeddedResource Include="UI\Forms\OptionsPages\SqlServerPage.resx">
<DependentUpon>SqlServerPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="UI\Forms\OptionsPages\StartupExitPage.resx">
<DependentUpon>StartupExitPage.cs</DependentUpon>
@@ -1366,7 +1384,10 @@
<Content Include="Resources\Help\Screenshots\Reference\01.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Resources\Help\SQLScript.txt">
<Content Include="Resources\Help\MSSQLScript.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Resources\Help\MySQLScript.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Resources\Help\ui_file_transfer.htm">

View File

@@ -8,6 +8,7 @@
<package id="DockPanelSuite.ThemeVS2015" version="3.0.6" targetFramework="net46" />
<package id="Geckofx45" version="45.0.34" targetFramework="net46" />
<package id="log4net" version="2.0.8" targetFramework="net46" />
<package id="MySql.Data" version="8.0.13" targetFramework="net46" />
<package id="ObjectListView.Official" version="2.9.1" targetFramework="net46" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net46" />
</packages>