diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 9753ae021..bf391e152 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -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: diff --git a/CREDITS.TXT b/CREDITS.TXT index cfcf2deb1..49842f602 100644 --- a/CREDITS.TXT +++ b/CREDITS.TXT @@ -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 diff --git a/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion22To23UpgraderTests.cs b/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion22To23UpgraderTests.cs index 5dabed138..2fdfd3338 100644 --- a/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion22To23UpgraderTests.cs +++ b/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion22To23UpgraderTests.cs @@ -13,7 +13,7 @@ namespace mRemoteNGTests.Config.Serializers.Versioning [SetUp] public void Setup() { - var sqlConnector = Substitute.For("", "", "", ""); + var sqlConnector = Substitute.For("", "", "", ""); _versionUpgrader = new SqlVersion22To23Upgrader(sqlConnector); } diff --git a/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion23To24UpgraderTests.cs b/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion23To24UpgraderTests.cs index a4a4b17a7..8d4e6cbd3 100644 --- a/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion23To24UpgraderTests.cs +++ b/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion23To24UpgraderTests.cs @@ -13,7 +13,7 @@ namespace mRemoteNGTests.Config.Serializers.Versioning [SetUp] public void Setup() { - var sqlConnector = Substitute.For("", "", "", ""); + var sqlConnector = Substitute.For("", "", "", ""); _versionUpgrader = new SqlVersion23To24Upgrader(sqlConnector); } diff --git a/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion24To25UpgraderTests.cs b/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion24To25UpgraderTests.cs index a4e491994..e32cdaac7 100644 --- a/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion24To25UpgraderTests.cs +++ b/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion24To25UpgraderTests.cs @@ -13,7 +13,7 @@ namespace mRemoteNGTests.Config.Serializers.Versioning [SetUp] public void Setup() { - var sqlConnector = Substitute.For("", "", "", ""); + var sqlConnector = Substitute.For("", "", "", ""); _versionUpgrader = new SqlVersion24To25Upgrader(sqlConnector); } diff --git a/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion25To26UpgraderTests.cs b/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion25To26UpgraderTests.cs index 03a410369..6396b0bfd 100644 --- a/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion25To26UpgraderTests.cs +++ b/mRemoteNGTests/Config/Serializers/Versioning/SqlVersion25To26UpgraderTests.cs @@ -13,7 +13,7 @@ namespace mRemoteNGTests.Config.Serializers.Versioning [SetUp] public void Setup() { - var sqlConnector = Substitute.For("", "", "", ""); + var sqlConnector = Substitute.For("", "", "", ""); _versionUpgrader = new SqlVersion25To26Upgrader(sqlConnector); } diff --git a/mRemoteV1/App/Info/ConnectionsFileInfo.cs b/mRemoteV1/App/Info/ConnectionsFileInfo.cs index 36793e36d..d317ed651 100644 --- a/mRemoteV1/App/Info/ConnectionsFileInfo.cs +++ b/mRemoteV1/App/Info/ConnectionsFileInfo.cs @@ -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; } } \ No newline at end of file diff --git a/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs b/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs index 66d8978ef..bdd6fc4ea 100644 --- a/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs +++ b/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs @@ -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(); } } } \ No newline at end of file diff --git a/mRemoteV1/Config/Connections/SqlConnectionsLoader.cs b/mRemoteV1/Config/Connections/SqlConnectionsLoader.cs index 9ebe970e9..d6c7260d3 100644 --- a/mRemoteV1/Config/Connections/SqlConnectionsLoader.cs +++ b/mRemoteV1/Config/Connections/SqlConnectionsLoader.cs @@ -17,7 +17,7 @@ using mRemoteNG.Tree.Root; namespace mRemoteNG.Config.Connections { - public class SqlConnectionsLoader : IConnectionsLoader + public class SqlConnectionsLoader : IConnectionsLoader { private readonly IDeserializer> _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); diff --git a/mRemoteV1/Config/Connections/SqlConnectionsSaver.cs b/mRemoteV1/Config/Connections/SqlConnectionsSaver.cs index 1786e3ca2..4b160847b 100644 --- a/mRemoteV1/Config/Connections/SqlConnectionsSaver.cs +++ b/mRemoteV1/Config/Connections/SqlConnectionsSaver.cs @@ -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() diff --git a/mRemoteV1/Config/DataProviders/SqlDataProvider.cs b/mRemoteV1/Config/DataProviders/SqlDataProvider.cs index 4b8cbe69a..68e433247 100644 --- a/mRemoteV1/Config/DataProviders/SqlDataProvider.cs +++ b/mRemoteV1/Config/DataProviders/SqlDataProvider.cs @@ -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 { - 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; } diff --git a/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnectionTester.cs b/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectionTester.cs similarity index 82% rename from mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnectionTester.cs rename to mRemoteV1/Config/DatabaseConnectors/DatabaseConnectionTester.cs index 2100920a4..2fd6b21df 100644 --- a/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnectionTester.cs +++ b/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectionTester.cs @@ -7,18 +7,19 @@ namespace mRemoteNG.Config.DatabaseConnectors /// /// A helper class for testing database connectivity /// - public class SqlDatabaseConnectionTester + public class DatabaseConnectionTester { - public async Task TestConnectivity(string server, + public async Task 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) diff --git a/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectorFactory.cs b/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectorFactory.cs index 39d7bcf4b..602a0bed4 100644 --- a/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectorFactory.cs +++ b/mRemoteV1/Config/DatabaseConnectors/DatabaseConnectorFactory.cs @@ -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); + } } } } \ No newline at end of file diff --git a/mRemoteV1/Config/DatabaseConnectors/IDatabaseConnector.cs b/mRemoteV1/Config/DatabaseConnectors/IDatabaseConnector.cs index c1f52a537..96eaece8a 100644 --- a/mRemoteV1/Config/DatabaseConnectors/IDatabaseConnector.cs +++ b/mRemoteV1/Config/DatabaseConnectors/IDatabaseConnector.cs @@ -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); } } \ No newline at end of file diff --git a/mRemoteV1/Config/DatabaseConnectors/MSSqlDatabaseConnector.cs b/mRemoteV1/Config/DatabaseConnectors/MSSqlDatabaseConnector.cs new file mode 100644 index 000000000..190193570 --- /dev/null +++ b/mRemoteV1/Config/DatabaseConnectors/MSSqlDatabaseConnector.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/DatabaseConnectors/MySqlDatabaseConnector.cs b/mRemoteV1/Config/DatabaseConnectors/MySqlDatabaseConnector.cs new file mode 100644 index 000000000..9275dc3ee --- /dev/null +++ b/mRemoteV1/Config/DatabaseConnectors/MySqlDatabaseConnector.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnector.cs b/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnector.cs deleted file mode 100644 index e55bfb0a4..000000000 --- a/mRemoteV1/Config/DatabaseConnectors/SqlDatabaseConnector.cs +++ /dev/null @@ -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(); - } - } -} \ No newline at end of file diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs index 944c3bd39..051b9c879 100644 --- a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs +++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/DataTableSerializer.cs @@ -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) { diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlDatabaseMetaDataRetriever.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlDatabaseMetaDataRetriever.cs index 16c34352b..72d26359e 100644 --- a/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlDatabaseMetaDataRetriever.cs +++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/MsSql/SqlDatabaseMetaDataRetriever.cs @@ -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 { diff --git a/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionDeserializer.cs b/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionDeserializer.cs index ae605f4c1..2b46466ff 100644 --- a/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionDeserializer.cs +++ b/mRemoteV1/Config/Serializers/MiscSerializers/RemoteDesktopConnectionDeserializer.cs @@ -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; } } } diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlDatabaseVersionVerifier.cs b/mRemoteV1/Config/Serializers/Versioning/SqlDatabaseVersionVerifier.cs index 607512c81..40f622f6a 100644 --- a/mRemoteV1/Config/Serializers/Versioning/SqlDatabaseVersionVerifier.cs +++ b/mRemoteV1/Config/Serializers/Versioning/SqlDatabaseVersionVerifier.cs @@ -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) diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion22To23Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion22To23Upgrader.cs index 5f8cbbad7..6a5daa3f8 100644 --- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion22To23Upgrader.cs +++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion22To23Upgrader.cs @@ -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); } diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion23To24Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion23To24Upgrader.cs index 535dad238..85e8a0990 100644 --- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion23To24Upgrader.cs +++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion23To24Upgrader.cs @@ -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); } diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion24To25Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion24To25Upgrader.cs index b51615db1..ecb2fd18a 100644 --- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion24To25Upgrader.cs +++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion24To25Upgrader.cs @@ -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); } diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion25To26Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion25To26Upgrader.cs index cfde93f0a..56da5a58c 100644 --- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion25To26Upgrader.cs +++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion25To26Upgrader.cs @@ -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); } diff --git a/mRemoteV1/Config/Serializers/Versioning/SqlVersion26To27Upgrader.cs b/mRemoteV1/Config/Serializers/Versioning/SqlVersion26To27Upgrader.cs index 176c295c0..078d8bb67 100644 --- a/mRemoteV1/Config/Serializers/Versioning/SqlVersion26To27Upgrader.cs +++ b/mRemoteV1/Config/Serializers/Versioning/SqlVersion26To27Upgrader.cs @@ -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); } diff --git a/mRemoteV1/Connection/ConnectionInfo.cs b/mRemoteV1/Connection/ConnectionInfo.cs index 53190f589..21e2906c6 100644 --- a/mRemoteV1/Connection/ConnectionInfo.cs +++ b/mRemoteV1/Connection/ConnectionInfo.cs @@ -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 diff --git a/mRemoteV1/Connection/Protocol/ISupportsViewOnly.cs b/mRemoteV1/Connection/Protocol/ISupportsViewOnly.cs new file mode 100644 index 000000000..4bb70be21 --- /dev/null +++ b/mRemoteV1/Connection/Protocol/ISupportsViewOnly.cs @@ -0,0 +1,20 @@ +namespace mRemoteNG.Connection.Protocol +{ + /// + /// 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. + /// + public interface ISupportsViewOnly + { + /// + /// Whether this control is in view only mode. + /// + bool ViewOnly { get; set; } + + /// + /// 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. + /// + void ToggleViewOnly(); + } +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs index ade6e5a53..2c3bebec5 100644 --- a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs +++ b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol.cs @@ -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 } } + /// + /// 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. + /// + 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 diff --git a/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs b/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs index c948ca5da..be25d5b91 100644 --- a/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs +++ b/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs @@ -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 diff --git a/mRemoteV1/Properties/Settings.Designer.cs b/mRemoteV1/Properties/Settings.Designer.cs index 54462bd0c..bf0185bd7 100644 --- a/mRemoteV1/Properties/Settings.Designer.cs +++ b/mRemoteV1/Properties/Settings.Designer.cs @@ -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; + } } } } diff --git a/mRemoteV1/Properties/Settings.settings b/mRemoteV1/Properties/Settings.settings index e547dc895..81e9bd82c 100644 --- a/mRemoteV1/Properties/Settings.settings +++ b/mRemoteV1/Properties/Settings.settings @@ -701,5 +701,8 @@ False + + mssql + \ No newline at end of file diff --git a/mRemoteV1/References/ADTree.dll b/mRemoteV1/References/ADTree.dll index efef39efd..681e99c44 100644 Binary files a/mRemoteV1/References/ADTree.dll and b/mRemoteV1/References/ADTree.dll differ diff --git a/mRemoteV1/References/VncSharp.dll b/mRemoteV1/References/VncSharp.dll index f9bd733ce..ab7ce8157 100644 Binary files a/mRemoteV1/References/VncSharp.dll and b/mRemoteV1/References/VncSharp.dll differ diff --git a/mRemoteV1/Resources/Help/SQLScript.txt b/mRemoteV1/Resources/Help/MSSQLScript.txt similarity index 97% rename from mRemoteV1/Resources/Help/SQLScript.txt rename to mRemoteV1/Resources/Help/MSSQLScript.txt index 43f1e5d1a..f8c57773a 100644 --- a/mRemoteV1/Resources/Help/SQLScript.txt +++ b/mRemoteV1/Resources/Help/MSSQLScript.txt @@ -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 diff --git a/mRemoteV1/Resources/Help/MySQLScript.txt b/mRemoteV1/Resources/Help/MySQLScript.txt new file mode 100644 index 000000000..a2a9767ac --- /dev/null +++ b/mRemoteV1/Resources/Help/MySQLScript.txt @@ -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 */; diff --git a/mRemoteV1/Resources/Help/ui_file_transfer.htm b/mRemoteV1/Resources/Help/ui_file_transfer.htm index cd6f572e7..390ba7d44 100644 --- a/mRemoteV1/Resources/Help/ui_file_transfer.htm +++ b/mRemoteV1/Resources/Help/ui_file_transfer.htm @@ -1,4 +1,4 @@ - + @@ -17,7 +17,7 @@
  • SSH File Transfer requires an SSH service to listen on an available network port (default 22) on a remote host.
  • A username and password must be supplied to connect with the remote host.
  • -
  • The remote host must have a writeable folder on its filesystem to place the transferred files.
  • +
  • The remote host must have a writable folder on its filesystem to place the transferred files.
@@ -62,6 +62,5 @@ [14] ERROR- SSH background transfer failed!
This issue was likely encountered due to a permissions issue. Ensure you have appropriate access to write to the specified Remote File. -

\ No newline at end of file diff --git a/mRemoteV1/Resources/Help/ui_sql_configuration.htm b/mRemoteV1/Resources/Help/ui_sql_configuration.htm index df6e948cb..47040c33c 100644 --- a/mRemoteV1/Resources/Help/ui_sql_configuration.htm +++ b/mRemoteV1/Resources/Help/ui_sql_configuration.htm @@ -1,4 +1,4 @@ - + @@ -46,11 +46,16 @@ - Microsoft™ SQL script + Microsoft™ SQL script Microsoft™ SQL Server - + + + MySQL™ script + + MySQL™ Server + diff --git a/mRemoteV1/Resources/Language/Language.Designer.cs b/mRemoteV1/Resources/Language/Language.Designer.cs index d0431b915..af6dbb1be 100644 --- a/mRemoteV1/Resources/Language/Language.Designer.cs +++ b/mRemoteV1/Resources/Language/Language.Designer.cs @@ -78,6 +78,15 @@ namespace mRemoteNG { } } + /// + /// Looks up a localized string similar to Clear search string. + /// + internal static string ClearSearchString { + get { + return ResourceManager.GetString("ClearSearchString", resourceCulture); + } + } + /// /// Looks up a localized string similar to Create a New Connection File. /// @@ -105,6 +114,15 @@ namespace mRemoteNG { } } + /// + /// Looks up a localized string similar to Connect in View Only mode. + /// + internal static string ConnectInViewOnlyMode { + get { + return ResourceManager.GetString("ConnectInViewOnlyMode", resourceCulture); + } + } + /// /// Looks up a localized string similar to The connection file could not be found.. /// @@ -3984,7 +4002,7 @@ namespace mRemoteNG { } /// - /// Looks up a localized string similar to View Only (VNC). + /// Looks up a localized string similar to View Only. /// internal static string strMenuViewOnly { get { diff --git a/mRemoteV1/Resources/Language/Language.de.resx b/mRemoteV1/Resources/Language/Language.de.resx index ca3d30256..c834cc5d5 100644 --- a/mRemoteV1/Resources/Language/Language.de.resx +++ b/mRemoteV1/Resources/Language/Language.de.resx @@ -1082,7 +1082,7 @@ Starte mit neuer Datei. Text anzeigen - SmartSize (RDP/VNC) + Smart-Size-Modus (RDP/VNC) SSH-Dateiübertragung @@ -1103,7 +1103,7 @@ Starte mit neuer Datei. &Ansicht - Nur Ansicht (VNC) + View-Only-Modus Webseite @@ -1157,7 +1157,7 @@ Starte mit neuer Datei. Normal - Keine automatische Größenanpassung (SmartSize) + Keine automatische Größenanpassung (Smart-Size) Keine Updates verfügbar @@ -1467,7 +1467,7 @@ Wenn Sie Fehler feststellen, dann sollten Sie eine neue Verbindungsdatei erstell Auflösung - SmartSize-Modus + Smart-Size-Modus Verwende Konsole @@ -2660,4 +2660,10 @@ Development umfasst Alphas, Betas und Release Candidates. Favoriten + + Suchbegriff löschen + + + Im View-Only-Modus verbinden + \ No newline at end of file diff --git a/mRemoteV1/Resources/Language/Language.resx b/mRemoteV1/Resources/Language/Language.resx index 6cf2ec228..dbf400715 100644 --- a/mRemoteV1/Resources/Language/Language.resx +++ b/mRemoteV1/Resources/Language/Language.resx @@ -1220,7 +1220,7 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for &View - View Only (VNC) + View Only Website @@ -2761,11 +2761,11 @@ Development Channel includes Alphas, Betas & Release Candidates. Proxy - Multi SSH: - + Multi SSH: + - Press ENTER to send. Ctrl+C is sent immediately. - + Press ENTER to send. Ctrl+C is sent immediately. + Show this connection in the favorites menu. @@ -2775,4 +2775,10 @@ Development Channel includes Alphas, Betas & Release Candidates. Favorites + + Clear search string + + + Connect in View Only mode + \ No newline at end of file diff --git a/mRemoteV1/Resources/Language/Language.zh-CN.resx b/mRemoteV1/Resources/Language/Language.zh-CN.resx index 4bbee3bf2..0b9a5765f 100644 --- a/mRemoteV1/Resources/Language/Language.zh-CN.resx +++ b/mRemoteV1/Resources/Language/Language.zh-CN.resx @@ -2705,4 +2705,4 @@ mRemoteNG 将退出并安装更新。 收藏夹 - \ No newline at end of file + diff --git a/mRemoteV1/Resources/PuTTYNG.exe b/mRemoteV1/Resources/PuTTYNG.exe index 5cb31deed..16717b8e0 100644 Binary files a/mRemoteV1/Resources/PuTTYNG.exe and b/mRemoteV1/Resources/PuTTYNG.exe differ diff --git a/mRemoteV1/Tools/MiscTools.cs b/mRemoteV1/Tools/MiscTools.cs index cf1ac14a7..f2300b72c 100644 --- a/mRemoteV1/Tools/MiscTools.cs +++ b/mRemoteV1/Tools/MiscTools.cs @@ -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) { diff --git a/mRemoteV1/UI/Controls/Base/NGSearchBox.cs b/mRemoteV1/UI/Controls/Base/NGSearchBox.cs new file mode 100644 index 000000000..2f891023e --- /dev/null +++ b/mRemoteV1/UI/Controls/Base/NGSearchBox.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/mRemoteV1/UI/Controls/Base/NGSearchBox.resx b/mRemoteV1/UI/Controls/Base/NGSearchBox.resx new file mode 100644 index 000000000..e5858cc29 --- /dev/null +++ b/mRemoteV1/UI/Controls/Base/NGSearchBox.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + \ No newline at end of file diff --git a/mRemoteV1/UI/Controls/ConnectionContextMenu.cs b/mRemoteV1/UI/Controls/ConnectionContextMenu.cs index 1a7176379..e99905fff 100644 --- a/mRemoteV1/UI/Controls/ConnectionContextMenu.cs +++ b/mRemoteV1/UI/Controls/ConnectionContextMenu.cs @@ -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); diff --git a/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.Designer.cs b/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.Designer.cs index 499698dde..3004c51fa 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.Designer.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.Designer.cs @@ -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; } } diff --git a/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.cs b/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.cs index 86502532f..f4afdc014 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.cs @@ -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; diff --git a/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs index d9ec226ae..8593b2e0b 100644 --- a/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs +++ b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs @@ -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 // diff --git a/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs index 07e0d9fea..af220114a 100644 --- a/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs +++ b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs @@ -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 diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs index 821c74960..b1f182998 100644 --- a/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs @@ -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; } diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs index b3723d319..3f2cd103b 100644 --- a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs @@ -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); } } diff --git a/mRemoteV1/UI/Window/ConnectionWindow.cs b/mRemoteV1/UI/Window/ConnectionWindow.cs index c0d91e8c9..f3567ca1f 100644 --- a/mRemoteV1/UI/Window/ConnectionWindow.cs +++ b/mRemoteV1/UI/Window/ConnectionWindow.cs @@ -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) { diff --git a/mRemoteV1/app.config b/mRemoteV1/app.config index 6986d55c5..34eaa8b28 100644 --- a/mRemoteV1/app.config +++ b/mRemoteV1/app.config @@ -735,6 +735,9 @@ False + + mssql + diff --git a/mRemoteV1/mRemoteV1.csproj b/mRemoteV1/mRemoteV1.csproj index 7e7a1419b..90515366b 100644 --- a/mRemoteV1/mRemoteV1.csproj +++ b/mRemoteV1/mRemoteV1.csproj @@ -62,7 +62,11 @@ ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll + + + ..\packages\MySql.Data.8.0.13\lib\net452\MySql.Data.dll + ..\packages\ObjectListView.Official.2.9.1\lib\net20\ObjectListView.dll @@ -70,12 +74,17 @@ ..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll + + + + + @@ -148,7 +157,8 @@ - + + @@ -223,7 +233,7 @@ - + @@ -239,6 +249,7 @@ + Component @@ -395,6 +406,9 @@ Component + + Component + Component @@ -835,6 +849,9 @@ NGRadioButton.cs + + NGSearchBox.cs + NGTextBox.cs @@ -911,6 +928,7 @@ SqlServerPage.cs + Designer StartupExitPage.cs @@ -1366,7 +1384,10 @@ PreserveNewest - + + PreserveNewest + + PreserveNewest diff --git a/mRemoteV1/packages.config b/mRemoteV1/packages.config index c1004900b..b9cdf9d4e 100644 --- a/mRemoteV1/packages.config +++ b/mRemoteV1/packages.config @@ -8,6 +8,7 @@ + \ No newline at end of file