Compare commits

..

178 Commits

Author SHA1 Message Date
Sean Kaim
3a173821d7 1.75 Alpha 3 2016-08-12 14:12:57 -04:00
Sean Kaim
4555db8e97 MR-965, MR-871, MR-629: Error 264 on RDP Connect
Error 264 is a timeout:
RDP disconnected!
264 This computer can't connect to the remote computer.

The two computers couldn't connect in the amount of time allotted. Try
connecting again. If the problem continues, contact your network
administrator or technical support.
2016-08-11 16:52:57 -04:00
Sean Kaim
1bbd20de3c Merge PR #130 - port scan button width 2016-08-10 16:48:42 -04:00
Sean Kaim
d1f4164498 Update changelog 2016-08-10 16:41:56 -04:00
Sean Kaim
d1c238a812 Merge pull request #134 from mRemoteNG/MR-946_Initial_SSH.NET
MR-946 initial ssh.net - File xfer
2016-08-10 16:03:56 -04:00
Sean Kaim
675bbd602f Remove old components, update credits.txt 2016-08-10 15:59:14 -04:00
Sean Kaim
ab1be61fda SFTP file transfer now works fully 2016-08-10 15:52:02 -04:00
Sean Kaim
8097ab146c Merge remote-tracking branch 'refs/remotes/origin/develop' into MR-946_Initial_SSH.NET 2016-08-10 12:04:02 -04:00
David Sparer
c0c4b69c64 Rename interface "Inheritance" to "IInheritable" 2016-08-10 09:24:48 -06:00
David Sparer
315d90391c Merge branch 'MR-906_default_Inherit_All_not_saved' into develop 2016-08-10 09:14:18 -06:00
David Sparer
869a5fd773 Created several simple unit & integration tests for DefaultConnectionInheritance 2016-08-10 09:06:44 -06:00
David Sparer
9940cfcf12 Minor cleanup of the Config window class 2016-08-10 08:28:35 -06:00
Sean Kaim
463b6cd791 progress bar style 2016-08-09 17:53:02 -04:00
David Sparer
b981516913 Fix issue setting ICAEncryptionStrength through inheritance 2016-08-09 15:50:56 -06:00
David Sparer
9ffdbee400 Fix self-reference initialization error 2016-08-09 15:49:52 -06:00
Sean Kaim
def55c9dfe code formatting/clean up 2016-08-09 17:48:22 -04:00
Sean Kaim
69668c5e55 background transfer 2016-08-09 17:45:46 -04:00
David Sparer
f41adec096 Minor cleanup of ConnectionInfo 2016-08-09 15:25:21 -06:00
David Sparer
3cc56f9886 Minor cleanup of ConnectionInfoInheritance 2016-08-09 15:25:03 -06:00
Sean Kaim
be8b302e20 Merge remote-tracking branch 'refs/remotes/origin/develop' into MR-946_Initial_SSH.NET 2016-08-09 16:58:57 -04:00
Sean Kaim
6da05af387 code clean up & fix complier warnings 2016-08-09 16:58:44 -04:00
Sean Kaim
2eb74afc20 upload with progress bar working 2016-08-09 16:41:46 -04:00
David Sparer
c44bb1e27d Made DefaultConnectionInheritance.SaveTo a generic method to decouple it from Settings 2016-08-09 11:08:06 -06:00
David Sparer
12cd38a047 Made DefaultConnectionInheritance LoadFrom a generic method to decouple it from the Settings class 2016-08-09 11:02:53 -06:00
David Sparer
e5c896cb36 Refactored much of the inheritance code to use System.Reflection instead of hardcoded values.
Refactored DefaultInheritance to its own class which inherits from the ConnectionInfoInheritance class.
Fixed issue with DefaultInheritance not saving to settings.
2016-08-09 10:34:51 -06:00
Sean Kaim
d89a2487e7 Merge remote-tracking branch 'refs/remotes/origin/develop' into MR-946_Initial_SSH.NET 2016-08-08 17:56:10 -04:00
David Sparer
e59f91a976 Minor refactoring 2016-08-05 09:37:22 -06:00
David Sparer
9a80777fe9 Minor code cleanup in ConnectionInfoInheritance 2016-08-05 09:02:17 -06:00
David Sparer
69b1da50b8 Removed redundant namespace qualifier 2016-08-05 08:55:45 -06:00
Sean Kaim
04ada28ffc Latest SSH.NET package 2016-08-04 17:48:26 -04:00
David Sparer
369a6c2f04 Merge branch 'MR-896_RDP_Class_not_registered' into develop 2016-08-04 13:39:37 -06:00
David Sparer
f438fb65f8 Installer now checkes for KB2574819 on win7 before installation can occur 2016-08-04 13:37:36 -06:00
David Sparer
6590011ef1 Refactored the CustomActions for checking if a KB is installed. Made it more generic 2016-08-04 13:36:08 -06:00
David Sparer
b6eb3d2361 Added the CustomActions project to build by default for Release and Debug builds 2016-08-03 13:26:32 -06:00
David Sparer
13b9b77f0d Added exception catching to a CustomAction method 2016-08-03 13:25:38 -06:00
David Sparer
20419856c1 Minor update to changelog 2016-08-03 13:25:02 -06:00
David Sparer
43100930cd update changelog for 1.75 alpha 2 2016-08-03 12:40:56 -06:00
David Sparer
aac7e4cc53 Merge branch 'MR-874_incorrect_rdp_check_in_installer' into develop 2016-08-03 12:16:31 -06:00
David Sparer
1c8f3e2328 Some more code cleanup 2016-08-03 12:10:36 -06:00
David Sparer
a54f0a2e89 Cleaned up some CustomActions code 2016-08-03 12:08:03 -06:00
David Sparer
fdb3cecf8e Refactored CustomActions to extract a class 2016-08-03 12:07:13 -06:00
David Sparer
8762c39dd5 Refactored the way we verify the minimum RDP version is installed. Now, instead of using a dynamically named variable based on the required KB, we boil this down to a statically named variable that indicates if the minimum KB is installed. 2016-08-03 11:57:17 -06:00
David Sparer
fc56c56883 Cleanup of some custom action code 2016-08-03 11:14:36 -06:00
David Sparer
ae950ac075 Use var for local variables in CustomActions file 2016-08-03 10:26:37 -06:00
Sean Kaim
8bbb9a70c6 code clean up, ui tweaks, new backend class 2016-07-29 21:52:06 -04:00
Sean Kaim
e6532dc155 code clean up, Eng translation for reconn all 2016-07-29 15:47:44 -04:00
Sean Kaim
ee6af8c187 Merge pull request #133 from yegorich/reconnect
Add an option to reconnect all opened tabs
2016-07-29 15:32:57 -04:00
David Sparer
bc1a0725df Merge branch 'develop' into MR-942_refactor_connection_loader 2016-07-28 14:56:30 -06:00
Sean Kaim
37905f8249 Add nuget packages to tests 2016-07-28 16:49:44 -04:00
Sean Kaim
8163e7273e Add nuget packages to tests 2016-07-28 16:47:45 -04:00
Yegor Yefremov
58fdba1d89 Add an option to reconnect all opened tabs 2016-07-28 09:40:17 +02:00
Sean Kaim
203dcf714f Initial SSH.NET file transfer
Upload succeeds. UI status/etc needs work.
2016-07-27 22:56:28 -04:00
David Sparer
649f864236 Extracted some methods from the sql connection loader 2016-07-27 12:11:17 -06:00
David Sparer
292f3b03cc Refactored AddNodeFromXml to improve readability 2016-07-27 10:51:47 -06:00
David Sparer
ec8fe3c343 Extracted methods for adding connections / containers to the TreeView 2016-07-27 10:36:37 -06:00
David Sparer
823b0518ae Extracted a method for authenticating protected data 2016-07-27 09:59:41 -06:00
David Sparer
c48caf5bdc Minor cleanup of the Runtime methods that use the connections loader 2016-07-26 14:02:59 -06:00
David Sparer
20bc6d079f Extraced method for expanding folders 2016-07-26 12:45:37 -06:00
David Sparer
dccd318f60 Fixed an oversight with bool initialization 2016-07-26 12:44:24 -06:00
David Sparer
2b0f670fb7 Extracted method for opening connections from last session 2016-07-26 12:42:08 -06:00
David Sparer
b5c431dca8 Extracted more methods 2016-07-26 12:40:38 -06:00
David Sparer
57dd93f136 Extracted method for initializing the root tree node 2016-07-26 12:39:37 -06:00
David Sparer
976e02effb Extracted method to load xml data 2016-07-26 12:19:54 -06:00
David Sparer
396387340a Extracted method to validate confcon file version 2016-07-26 12:15:11 -06:00
David Sparer
d9bf021597 Use object initializer 2016-07-26 12:14:27 -06:00
David Sparer
b4e26f513b Removed unnecessary property from xml connection loader 2016-07-26 11:44:50 -06:00
David Sparer
2eef31f74d Renamed several database related properties to be more generic ("sql" -> "database") 2016-07-26 11:34:47 -06:00
David Sparer
cc96e2b3eb Removed more unused code 2016-07-26 11:30:52 -06:00
David Sparer
4526a0b875 Removed unnecessary using directives 2016-07-26 11:29:24 -06:00
David Sparer
4568bcc0ae Split Xml connection loader to its own class 2016-07-26 11:27:31 -06:00
David Sparer
cf3af14c6a Split connection loader code for Sql to its own class 2016-07-26 11:13:43 -06:00
David Sparer
d320c84bc8 Removed some more redundant code 2016-07-26 10:26:03 -06:00
David Sparer
8eff262e8f Removed redundant code 2016-07-26 10:10:41 -06:00
David Sparer
8c7d90f0c4 Use object initializers 2016-07-26 10:02:16 -06:00
David Sparer
0e189551dd Simplify conditional statements 2016-07-26 09:58:26 -06:00
David Sparer
981acd6510 Modified a few function names to adhere to style guidelines 2016-07-26 09:48:45 -06:00
David Sparer
404aae6bf3 Fixed some spacing and caught a few more place that var should have been used 2016-07-26 09:44:11 -06:00
David Sparer
57cc9b8de4 Import Messages namespace 2016-07-26 09:36:24 -06:00
David Sparer
d2def0a34d Use var for local variable declarations 2016-07-26 09:34:40 -06:00
David Sparer
f1a5e1c029 Renamed fields and properties to adhere to style guide and be more descriptive 2016-07-26 09:19:46 -06:00
David Sparer
19ae192887 Converted properties to auto-properties where possible 2016-07-26 09:16:31 -06:00
Sean Kaim
cc87227559 minor tweaks to AeadCryptographyProvider 2016-07-20 11:33:55 -04:00
Sean Kaim
9ad0c74a56 code clean up 2016-07-15 09:36:34 -04:00
Sean Kaim
55a8b743c8 Fix exception opening in Designer 2016-07-15 09:08:34 -04:00
Sean Kaim
7adb150d1c minor code clean up & logging 2016-07-14 15:33:41 -04:00
David Sparer
afdb392289 Jenkinsfile change may not be working properly. This is a test commit 2016-07-14 12:50:44 -06:00
David Sparer
1c8e24a117 Found a way to simplify the git checkout stage of the Jenkins pipeline 2016-07-14 12:46:52 -06:00
David Sparer
266e79a2c3 Fixed a merge mistake regarding the Geckofx package version 2016-07-14 10:48:15 -06:00
David Sparer
6c5d629a88 Merge branch 'MR-917_Improve_cryptographic_support' into develop
# Conflicts:
#	mRemoteV1/mRemoteV1.csproj
#	mRemoteV1/packages.config
2016-07-14 08:43:16 -06:00
David Sparer
84ed778b67 Merge pull request #131 from jamesrenaud/MR-910_RDP_Gateway_Credentials_Applied_Incorrectly
MR-910 Fixes to support Remote Desktop Gateways
2016-07-13 18:13:58 -06:00
jamesrenaud
c1d41847a2 Removed inline comment per style feedback 2016-07-13 19:07:15 -04:00
David Sparer
73c50837d8 Created class for building and using encrypted secure strings 2016-07-13 12:51:21 -06:00
David Sparer
89075aa3e9 Removed unnecessary crypto experiment 2016-07-13 10:42:44 -06:00
David Sparer
bffe4454ba Moved AeasCryptographyProvider to the mRemoteNG.Security.SymmetricEncryption namespace 2016-07-13 10:34:36 -06:00
David Sparer
69a8f50b58 Moved LegacyRijndaelCryptographyProvider to the mRemoteNG.Security.SymmetricEncryption namespace 2016-07-13 10:32:36 -06:00
David Sparer
8c6f6534b6 Added method to the crypto factory and unit test 2016-07-13 10:10:08 -06:00
David Sparer
791a78154d Fixed a decryption bug introduced while cleaning up code in the LegacyRinjdaelCryptographyProvider class 2016-07-13 09:59:57 -06:00
David Sparer
f08ce0acd5 LegacyRijndaelCryptographyProvider now implements ICryptographyProvider 2016-07-13 09:39:27 -06:00
David Sparer
757b195d5c Made the LegacyRijndaelCryptographyProvider class non-static 2016-07-13 08:41:18 -06:00
David Sparer
c6a39a9220 Rename "Crypt" class to "LegacyRijndaelCryptographyProvider" 2016-07-13 08:22:06 -06:00
David Sparer
a2054b458b Code cleanup on the legacy crypt class 2016-07-13 08:16:06 -06:00
James Renaud
6ee12d447f Fixes to support Remote Desktop Gateways 2016-07-12 22:44:27 -04:00
Hayato Iriumi
f95e3fb719 Merge branch 'develop' of https://github.com/mRemoteNG/mRemoteNG.git 2016-07-11 21:44:16 -07:00
Hayato Iriumi
aa9141505f More Japanese translation 2016-07-11 19:56:09 -07:00
David Sparer
b4f0d2f2ae Removing un-needed experiments 2016-07-11 18:12:44 -06:00
David Sparer
5bc67ab796 Changed default engine from AesFastEngine to AesEngine 2016-07-11 18:07:42 -06:00
David Sparer
4f86e0da62 Added a factory class for instantiating crypto providers 2016-07-11 18:07:22 -06:00
David Sparer
12165ac9a6 Added required property to the ICryptographyProvider interface to get the underlying crypto algorithm 2016-07-11 18:06:28 -06:00
David Sparer
dd783c2dc0 Forgot to save project 2016-07-11 15:43:42 -06:00
David Sparer
4b65086622 Some cleanup 2016-07-11 15:42:48 -06:00
David Sparer
de2542c172 Renamed AesGcm to AeadCryptographyProvider 2016-07-11 15:38:13 -06:00
David Sparer
973de3507e AesGcm does not actually benefit from generics. Removed that support 2016-07-11 15:35:13 -06:00
Sean Kaim
1945d5ac6b Update changelog.txt 2016-07-11 17:27:23 -04:00
Sean Kaim
cb3614d54c Fix LargeAddressAware test 2016-07-11 17:27:01 -04:00
David Sparer
4375f2d5d1 Some cleanup of AesGcm class 2016-07-11 15:23:02 -06:00
David Sparer
92b6cf201e Modified AesGcm to accept different string encodings (besides UTF-8) 2016-07-11 15:17:07 -06:00
David Sparer
b2b53561ba Modified AESGCM to support specifying the block cipher engine through generics 2016-07-11 15:10:43 -06:00
Sean Kaim
73a1923db6 Fix conflicts 2016-07-11 16:25:53 -04:00
David Sparer
76e290f6b7 AESGCM implements ICryptographyProvider 2016-07-11 14:24:22 -06:00
Sean Kaim
be02814021 Update GeckoFx and NUnit nuget packages 2016-07-11 16:22:33 -04:00
David Sparer
d60c007ac6 Make AESGCM non-static 2016-07-11 14:22:20 -06:00
David Sparer
e92c1eaa9d Add some tests for the AesGcm class 2016-07-11 14:17:50 -06:00
David Sparer
8d638602b9 Fix encryptor class 2016-07-11 14:17:28 -06:00
David Sparer
48161aca47 Changed the unit tests to use to Encryptor class, which is a better implementation than the AesCryptographyProvider. 2016-07-11 14:16:20 -06:00
Sean Kaim
11314972fa Merge pull request #129 from mRemoteNG/dockpanelsuite_nuget
Dockpanelsuite nuget packages
2016-07-11 16:16:07 -04:00
David Sparer
83ac202a6b The "AESThenHMAC" file is not particularly helpful. This uses .Net crypto - trying to stick with BouncyCastle 2016-07-11 14:14:29 -06:00
Sean Kaim
02c601fd3a Remove local DockPanelSuite 2016-07-11 16:13:48 -04:00
Sean Kaim
86f6f85142 DockPanelSuite 2.10 Final NuGet packages 2016-07-11 16:12:32 -04:00
David Sparer
ca4cb433a9 Testing another implementation for crypto 2016-07-11 13:41:07 -06:00
David Sparer
e5bed0afcb Testing out some encryption implementations 2016-07-11 13:39:30 -06:00
Sean Kaim
11cf85f771 Delete "old installer" files 2016-07-11 15:01:03 -04:00
Sean Kaim
18d7a9cfe9 Update to correct chat room. 2016-07-11 14:23:19 -04:00
David Sparer
b3bac32441 Moved enhancements made in the CredentialManager branch to a dedicated branch 2016-07-11 11:41:42 -06:00
Sean Kaim
0b9fb06c08 fix Gitter badge 2016-07-11 12:44:04 -04:00
Sean Kaim
c6219ff315 Gitter badge 2016-07-11 12:42:30 -04:00
Sean Kaim
2b7668aa68 Updated installer post build steps 2016-07-08 17:59:25 -04:00
Sean Kaim
c8a684e10d Add readme.txt back (no markdown syntax) 2016-07-08 17:18:29 -04:00
Sean Kaim
5a5d675f3e Update version to 1.75 2016-07-08 17:09:02 -04:00
Sean Kaim
a4acc60f1d Updated change log
Fixed some formatting issues
2016-07-08 17:02:34 -04:00
Sean Kaim
b3bc04251b Update .gitignre
.editorconfig is a user preference
2016-07-08 17:01:50 -04:00
Sean Kaim
203111eb5a Revert "Update .gitignore"
This reverts commit 472168b9e4.
2016-07-08 17:01:16 -04:00
Sean Kaim
472168b9e4 Update .gitignore 2016-07-08 17:00:53 -04:00
Sean Kaim
328ebbe3f7 Merge pull request #127 from mRemoteNG/MR-902_vncsharp_lib_updates
MR-902 vncsharp lib updates
2016-07-08 16:52:31 -04:00
Sean Kaim
999cd19d81 Updated dll including fixes from VncSharpNG.dll
Updated credits.txt

Sent changes to upstream: https://github.com/humphd/VncSharp/pull/21
2016-07-08 16:49:53 -04:00
Sean Kaim
d23f6a69e5 MR-905 - Crash at startup
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidCastException
Stack:
at
mRemoteNG.App.CompatibilityChecker.FipsPolicyEnabledForServer2008AndNewer()
at mRemoteNG.App.CompatibilityChecker.CheckFipsPolicy()
at mRemoteNG.App.CompatibilityChecker.CheckCompatibility()
at mRemoteNG.App.Startup.InitializeProgram()
at mRemoteNG.App.ProgramRoot.StartApplication()
at mRemoteNG.App.ProgramRoot.Main(System.String[])
2016-07-08 13:42:13 -04:00
Sean Kaim
38c7fe9e0a links/formatting 2016-07-06 11:32:46 -04:00
Sean Kaim
dc02f51a15 Twitter shield linking to wrong page/formatting 2016-07-06 11:30:28 -04:00
Sean Kaim
dd7ea02c9f one last time - readme formatting 2016-07-06 10:23:57 -04:00
Sean Kaim
5e0bf0da6e more readme formatting 2016-07-06 10:19:20 -04:00
Sean Kaim
f2f4b14f5e Readme formatting 2016-07-06 10:18:27 -04:00
Sean Kaim
e27b4fa2f9 Twitter Sheild 2016-07-06 10:10:15 -04:00
Sean Kaim
c71a57bd69 Fix download stats 2016-07-06 09:58:09 -04:00
Sean Kaim
8c57b271d8 Download stats shield 2016-07-06 09:54:29 -04:00
Sean Kaim
e167602a32 Update build status 2016-07-06 09:52:20 -04:00
Sean Kaim
590f4ba2c6 Build status shield 2016-07-06 09:51:01 -04:00
Sean Kaim
b2c0dc235c Basic necessary changes
Upstream VncSharp doesn't support Ctrl + C currently.
2016-07-02 14:48:16 -04:00
Sean Kaim
f357a53e0e code clean up 2016-06-30 12:00:35 -04:00
Sean Kaim
5f7d1f9f3f Merge pull request #123 from mRemoteNG/Release_v1.74
MR-874: Added work-around to installer to ignore installation prereq
2016-06-30 10:18:38 -04:00
David Sparer
5ebd255a22 MR-874: Added work-around to installer to ignore installation prerequisites 2016-06-28 08:26:25 -06:00
Sean Kaim
010c0a5061 Merge pull request #121 from mRemoteNG/Release_v1.74
Merge latest 1.74 fixes into develop
2016-06-28 10:21:36 -04:00
Sean Kaim
6ec4bdd926 Updated change log 2016-06-28 10:09:35 -04:00
Sean Kaim
fe023b798d MR-884 - Slow startup
https://blogs.technet.microsoft.com/markrussinovich/2009/05/23/the-case-of-the-slow-keynote-demo/

https://msdn.microsoft.com/en-us/library/cc656914(v=vs.100).aspx#Anchor_8
2016-06-28 10:06:48 -04:00
Sean Kaim
141c916b7b MR-884: Attempt to optimize startup 2016-06-27 11:46:41 -04:00
Sean Kaim
f160e456ae Merge pull request #120 from mRemoteNG/Release_v1.74
Merge latest 1.74 fixes into develop
2016-06-27 10:47:34 -04:00
Sean Kaim
49c6219a84 MR-854: Additional code clean up
New (.NET) method for getting file icons.
Additional ReShaper fixes
Additional null checks/protections
2016-06-25 21:34:32 -04:00
Sean Kaim
0db444e78c MR-854: Code Clean up and logging 2016-06-24 13:08:35 -04:00
Sean Kaim
57c2dc0a88 Fix log message for debugging exception 2016-06-24 12:21:40 -04:00
Sean Kaim
15ba2d3156 Fix incorrect Language Selection on Reconnect 2016-06-24 12:11:41 -04:00
David Sparer
48e2ba11bf Resolved MR-882 by removing a ProtocolType enum value that was being tested some time back. This should not have made it into the develop branch. 2016-06-24 08:21:59 -06:00
David Sparer
2a3fc01937 Merge branch 'Release_v1.74' into develop 2016-06-23 09:58:48 -06:00
David Sparer
aa3e8344fb Modified installer postbuild actions to only attempt to sign the MSI during Release builds 2016-06-23 09:58:16 -06:00
David Sparer
df5e619349 - Moved the PuTTYNG dependency file to $(SolutionDir)\Resources
- Added postbuild task to mRemoteV1 project to copy PuTTYNG file to $(TargetDir)
- Modified installer to point to the new PuTTYNG location
2016-06-23 09:57:46 -06:00
Sean Kaim
0c06983411 MR-875 - Win native compress can't extract
Removed LZMA options
Checked for file existance
2016-06-22 10:11:54 -04:00
Sean Kaim
dda9c1f1af Additional fixes for MR-872
Additional code clean up
Fixed some casting errors likely from the initial c# conversion
2016-06-22 09:35:01 -04:00
Sean Kaim
6779a02cf9 MR-872: Prevent outofbounds ex parsing args 2016-06-21 15:30:07 -04:00
David Sparer
7671328245 Merge branch 'Release_v1.74' into develop 2016-06-20 15:18:38 -06:00
David Sparer
85dc45a479 Merge branch 'Release_v1.74' into develop 2016-06-19 20:23:06 -06:00
David Sparer
eb696b49fe Merge branch 'Release_v1.74' into develop 2016-06-19 08:53:42 -06:00
157 changed files with 5074 additions and 89319 deletions

3
.gitignore vendored
View File

@@ -282,3 +282,6 @@ Installer Projects/Installer/Fragments/FilesFragment.wxs
Installer Projects/Installer/Fragments/HelpFilesFragment.wxs
InstallerProjects/Installer/Fragments/FilesFragment.wxs
InstallerProjects/Installer/Resources/License.rtf
# user preference: .editorconfig - http://editorconfig.org/
.editorconfig

View File

@@ -1,4 +1,49 @@
1.74 (2016-06-20):
1.75 Alpha 3 (2016-08-12):
Fixes:
------
MR-965, MR-871, MR-629: Error 264 on RDP Connect attempt - Added timeout value to Tools -> Options -> Connections
MR-946: Remove old/insecure SharpSSH and related components. Replace with SSH.NET for File Transfer Functionality
MR-896: Added prerequisite installer check for KB2574819. Prevents "Class not registered" errors when opening RDP connections.
PR-130: Fix Scan button width to fit russian translation
1.75 Alpha 2 (2016-08-03):
General Changes:
----------------
Updated GeckoFx pacakge
Updated DockPanelSuite library to 2.10 Final
Japanese translation updated
MR-942: Refactored code relating to loading the connections file
Features/Enhancements:
----------------------
MR-961, PR-133: Option to reconnect all currently opened connection tabs
MR-917: Improved cryptographic support
Fixes:
------
MR-910: Fixes to support Remote Desktop Gateways
MR-874: Incorrect RDP prerequisite check in installer
1.75 Alpha 1 (2016-07-08):
General Changes:
----------------
Additional code cleanup
Fixes:
------
MR-905: mRemoteNG crashes at startup (in FIPS policy check)
MR-902: mRemoteNG crashes after locking/unlocking the local system after loading a VNC connection
1.74 (2016-06-28):
Supported Platforms/Components:
-------------------------------
@@ -9,54 +54,57 @@
General Changes:
----------------
Converted source from Visual Basic to C Sharp
Lots of code refactoring/clean up/general stability changes
MR-714: Removed Keyboard shortcut functionality
- Introduced in 1.73 beta that was never officially released
- This caused stability issues
- May be re-added in a future release
- Removal does *NOT* impact the ability to send keyboard shortcuts to RDP sessions (when redirect key combinations is set to "yes")
MR-559: Removed RDP Sessions panel functionality. This required a library for which no trusted origin/source could be located
Removed a bunch of old code/libraries and replaced them accordingly
Security Updates:
-----------------
MR-775, MR-745: Updated PuTTY to 0.67
Features/Enhancements:
----------------------
Updated to latest DockPanelSuite and enabled a slick new theme!
MR-145: Installer is now MSI based
MR-255: Updated RDP Client to version 8
MR-389: Updates to IE rendering engine
- Support for latest version of IE (9-11)
- Dropped support for IE 7 & IE 8
MR-850: Replaced XULRunner with GeckoFx
- No need to manually configure to have the Gecko rendering engine available now
- Install image is now significantly larger due to the inclusion of the Gecko Engine
MR-821: Initial Japanese translation included
Port Scan is now Asynchronous (and is significantly faster)
Fixes:
------
MR-854: crashes when right clicking on connection tab
MR-852: Option "Allow only a single instance of the application" non-functional
MR-836: Trying to delete a folder of connections only deletes 2 connections at a time
MR-824, MR-706: Suppress Script Errors when using the IE rendering engine
MR-822: Improve RDP error code messages
MR-640: Fixed Inheritance not working
MR-639: RDP: Connect to console session
MR-610, MR-582, MR-451: RDP: Protocol Error 3334 or exceptions with large number of connections open
- This problem appears largely resolved by most reports and testing
- Further workarounds/problem avoidance: Disable Bitmap Caching on all RDP session configuration
MR-429: Display issue on the Options -> Advanced panel
MR-385: Inheritance settings lost when moving item to the root of the tree
Converted source from Visual Basic to C Sharp
Lots of code refactoring/clean up/general stability changes
MR-714: Removed Keyboard shortcut functionality
- Introduced in 1.73 beta that was never officially released
- This caused stability issues
- May be re-added in a future release
- Removal does *NOT* impact the ability to send keyboard shortcuts to RDP sessions (when redirect key combinations is set to "yes")
MR-559: Removed RDP Sessions panel functionality. This required a library for which no trusted origin/source could be located
Removed a bunch of old code/libraries and replaced them accordingly
Security Updates:
-----------------
MR-775, MR-745: Updated PuTTY to 0.67
Features/Enhancements:
----------------------
Updated to latest DockPanelSuite and enabled a slick new theme!
MR-145: Installer is now MSI based
MR-255: Updated RDP Client to version 8
MR-389: Updates to IE rendering engine
- Support for latest version of IE (9-11)
- Dropped support for IE 7 & IE 8
MR-850: Replaced XULRunner with GeckoFx
- No need to manually configure to have the Gecko rendering engine available now
- Install image is now significantly larger due to the inclusion of the Gecko Engine
MR-821: Initial Japanese translation included
Port Scan is now Asynchronous (and is significantly faster)
Fixes:
------
MR-874: Added work-around to installer to ignore installation prerequisites
MR-884: Slow startup in some scnearios checking authenticode certificate
MR-872: Crash in External Tools when arguments aren't quoted
MR-854: crashes when right clicking on connection tab
MR-852: Option "Allow only a single instance of the application" non-functional
MR-836: Trying to delete a folder of connections only deletes 2 connections at a time
MR-824, MR-706: Suppress Script Errors when using the IE rendering engine
MR-822: Improve RDP error code messages
MR-640: Fixed Inheritance not working
MR-639: RDP: Connect to console session
MR-610, MR-582, MR-451: RDP: Protocol Error 3334 or exceptions with large number of connections open
- This problem appears largely resolved by most reports and testing
- Further workarounds/problem avoidance: Disable Bitmap Caching on all RDP session configuration
MR-429: Display issue on the Options -> Advanced panel
MR-385: Inheritance settings lost when moving item to the root of the tree
1.73 Beta 2 (NEVER RELEASED):
Fixed issue MR-619 - Keyboard shortcuts stop working after locking the screen with Win+L
Added support for importing files from PuTTY Connection Manager.

View File

@@ -9,11 +9,10 @@ Sean Kaim (github.com/kmscode)
Felix Deimel - mRemote original developer
Riley McArdle - mRemoteNG original developer
github.com/Brandhor
Past Contributors
=================
Jason Barbier
Wiktor Beryt
Lionel Caignec
@@ -23,6 +22,8 @@ Tom Hiller
Apisitt Rattana
Andreas Rehm
David Vidmar
github.com/Brandhor
github.com/Kvarkas
Translators
@@ -69,11 +70,6 @@ Copyright
Copyright <20> 2008 Felix Deimel
http://www.codeproject.com/KB/selection/ADPickerCtrl.aspx
DiffieHellman 1.0
Copyright <20> 2003 The Mentalis.org Team
Modified New BSD License
http://www.mentalis.org/
DockPanel Suite 2.10.0.beta2
Copyright <20> 2015 @roken and @lextm (formerly Weifen Luo)
MIT License
@@ -94,28 +90,22 @@ Copyright
Freely redistributable with attribution
http://www.dotnetmagic.com/magic_download.html
Mentalis.org Security Library 1.0.13.715
Copyright <20> 2002-2005 The Mentalis.org Team
Modified New BSD License
http://www.mentalis.org/
PuTTY 0.67
Copyright <20> 1997-2016 Simon Tatham
MIT License
http://www.chiark.greenend.org.uk/~sgtatham/putty/
SharpSSH 1.1.1.13
Copyright <20> 2002-2008 Atsuhiko Yamanaka, JCraft, Inc.
Copyright <20> 2007 Tamir Gal
BSD Style License
http://www.tamirgal.com/blog/page/SharpSSH.aspx
Silk Icon Set
Copyright <20> 2005-2008 FAMFAMFAM
Creative Commons Attribution 2.5 License
http://www.famfamfam.com/
VncSharp 1.0
SSH.NET v2016.0.0
Copyright <20> 2016
MIT License
https://github.com/sshnet/SSH.NET
VncSharp 1.1
Copyright <20> 2004-2009 David Humphrey
GNU General Public License (GPL) Version 2
http://cdot.senecac.on.ca/projects/vncsharp/
https://github.com/humphd/VncSharp

View File

@@ -5,26 +5,18 @@ namespace CustomActions
public class CustomActions
{
[CustomAction]
public static ActionResult IsKBInstalled(Session session)
public static ActionResult IsMinimumRdpVersionInstalled(Session session)
{
session.Log("Begin IsKBInstalled");
string kb = session["KB"];
session.Log("Checking if '{0}' is installed", kb);
InstalledWindowsUpdateGatherer updateGatherer = new InstalledWindowsUpdateGatherer();
bool isUpdateInstalled = updateGatherer.IsUpdateInstalled(kb);
session.Log("KB is installed = '{0}'", isUpdateInstalled);
if (isUpdateInstalled)
{
session[kb] = "1";
session.Log("Set property '{0}' to '1'", kb);
}
else
{
session[kb] = "0";
session.Log("Set property '{0}' to '0'", kb);
}
var rdpVersionChecker = new InstalledKbChecker("MINIMUM_RDP_KB", "MINIMUM_RDP_VERSION_INSTALLED", session);
rdpVersionChecker.Execute();
return ActionResult.Success;
}
session.Log("End IsKBInstalled");
[CustomAction]
public static ActionResult IsRdpDtlsUpdateInstalled(Session session)
{
var rdpVersionChecker = new InstalledKbChecker("RDP_DTLS_KB", "RDP_DTLS_UPDATE_INSTALLED", session);
rdpVersionChecker.Execute();
return ActionResult.Success;
}
@@ -32,8 +24,8 @@ namespace CustomActions
public static ActionResult IsLegacyVersionInstalled(Session session)
{
session.Log("Begin IsLegacyVersionInstalled");
UninstallNSISVersions uninstaller = new UninstallNSISVersions();
if (uninstaller.IsLegacymRemoteNGInstalled())
var uninstaller = new UninstallNsisVersions();
if (uninstaller.IsLegacymRemoteNgInstalled())
{
session["LEGACYVERSIONINSTALLED"] = "1";
}
@@ -50,8 +42,8 @@ namespace CustomActions
public static ActionResult UninstallLegacyVersion(Session session)
{
session.Log("Begin UninstallLegacyVersion");
UninstallNSISVersions uninstaller = new UninstallNSISVersions();
string uninstallString = uninstaller.GetLegacyUninstallString();
var uninstaller = new UninstallNsisVersions();
uninstaller.GetLegacyUninstallString();
uninstaller.UninstallLegacyVersion(true);
session.Log("End UninstallLegacyVersion");
return ActionResult.Success;

View File

@@ -47,7 +47,8 @@
<Compile Include="CustomActions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="InstalledWindowsUpdateGatherer.cs" />
<Compile Include="UninstallNSISVersions.cs" />
<Compile Include="InstalledKbChecker.cs" />
<Compile Include="UninstallNsisVersions.cs" />
<Content Include="CustomAction.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@@ -0,0 +1,53 @@
using System;
using Microsoft.Deployment.WindowsInstaller;
namespace CustomActions
{
public class InstalledKbChecker
{
private readonly Session _session;
private readonly string _kbVariable;
private readonly string _returnVar;
public InstalledKbChecker(string kbVariable, string returnVar, Session session)
{
_kbVariable = kbVariable;
_returnVar = returnVar;
_session = session;
}
public bool Execute()
{
try
{
_session.Log("Begin InstalledKbChecker");
var minimumKb = _session[_kbVariable];
var isUpdateInstalled = IsUpdateInstalled(minimumKb);
SetReturnValue(isUpdateInstalled);
_session.Log("End InstalledKbChecker");
return true;
}
catch (Exception e)
{
_session.Log($"There was an issue executing the RdpVersionChecker. Exception: {e}");
return false;
}
}
private bool IsUpdateInstalled(string kb)
{
_session.Log($"Checking if '{kb}' is installed");
var updateGatherer = new InstalledWindowsUpdateGatherer();
var isUpdateInstalled = updateGatherer.IsUpdateInstalled(kb);
_session.Log($"KB is installed = '{isUpdateInstalled}'");
return isUpdateInstalled;
}
private void SetReturnValue(bool isUpdateInstalled)
{
var updateInstalledVal = isUpdateInstalled ? "1" : "0";
_session[_returnVar] = updateInstalledVal;
_session.Log($"Set property '{_returnVar}' to '{updateInstalledVal}'");
}
}
}

View File

@@ -6,13 +6,11 @@ namespace CustomActions
{
public class InstalledWindowsUpdateGatherer
{
private ManagementScope _managementScope;
private ManagementClass _managementClass;
private readonly ManagementScope _managementScope;
public InstalledWindowsUpdateGatherer()
{
_managementScope = Connect();
_managementClass = new ManagementClass("Win32_QuickFixEngineering");
}
@@ -24,28 +22,29 @@ namespace CustomActions
}
catch (ManagementException e)
{
Console.WriteLine("Failed to connect", e.Message);
Console.WriteLine($"Failed to connect: {e.Message}");
throw;
}
}
public ArrayList GetInstalledUpdates()
{
string query = "SELECT * FROM Win32_QuickFixEngineering";
ArrayList installedUpdates = new ArrayList();
ManagementObjectSearcher searcher = new ManagementObjectSearcher(_managementScope, new ObjectQuery(query));
foreach(ManagementObject queryObj in searcher.Get())
const string query = "SELECT * FROM Win32_QuickFixEngineering";
var installedUpdates = new ArrayList();
var searcher = new ManagementObjectSearcher(_managementScope, new ObjectQuery(query));
foreach(var o in searcher.Get())
{
var queryObj = (ManagementObject) o;
installedUpdates.Add(queryObj["HotFixID"]);
}
return installedUpdates;
}
public bool IsUpdateInstalled(string KB)
public bool IsUpdateInstalled(string kb)
{
bool updateIsInstalled = false;
string query = string.Format("SELECT HotFixID FROM Win32_QuickFixEngineering WHERE HotFixID='{0}'", KB);
ManagementObjectSearcher searcher = new ManagementObjectSearcher(_managementScope, new ObjectQuery(query));
var updateIsInstalled = false;
var query = $"SELECT HotFixID FROM Win32_QuickFixEngineering WHERE HotFixID='{kb}'";
var searcher = new ManagementObjectSearcher(_managementScope, new ObjectQuery(query));
if (searcher.Get().Count > 0)
updateIsInstalled = true;
return updateIsInstalled;

View File

@@ -1,58 +1,56 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
using System.Diagnostics;
using System.IO;
namespace CustomActions
{
public class UninstallNSISVersions
public class UninstallNsisVersions
{
private const string REGISTRY_PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
private const string REGISTRY_PATH_Wow6432 = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
private const string RegistryPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
private const string RegistryPathWow6432 = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
private RegistryKey _activeRegistryPath;
public UninstallNSISVersions()
public UninstallNsisVersions()
{
GetLegacymRemoteNGRegistryKeyPath();
GetLegacymRemoteNgRegistryKeyPath();
}
public void UninstallLegacyVersion(bool Silent = false)
public void UninstallLegacyVersion(bool silent = false)
{
if (!IsLegacymRemoteNGInstalled())
if (!IsLegacymRemoteNgInstalled())
return;
string uninstallString = GetLegacyUninstallString();
string forceNonTempUninstaller = string.Format("_?={0}", uninstallString.Replace("Uninstall.exe", "").Replace(@"""", ""));
string silentUninstall = "";
if (Silent)
var uninstallString = GetLegacyUninstallString();
var forceNonTempUninstaller = $"_?={uninstallString.Replace("Uninstall.exe", "").Replace(@"""", "")}";
var silentUninstall = "";
if (silent)
{
silentUninstall = "/S";
}
ProcessStartInfo processStartInfo = new ProcessStartInfo(uninstallString);
processStartInfo.UseShellExecute = true;
processStartInfo.Arguments = string.Format("{0} {1}", forceNonTempUninstaller, silentUninstall);
Process uninstallProcess = Process.Start(processStartInfo);
while (uninstallProcess.HasExited == false)
var processStartInfo = new ProcessStartInfo(uninstallString)
{
UseShellExecute = true,
Arguments = $"{forceNonTempUninstaller} {silentUninstall}"
};
var uninstallProcess = Process.Start(processStartInfo);
while (uninstallProcess != null && uninstallProcess.HasExited == false)
{
Debug.WriteLine("Waiting for uninstaller to exit");
}
}
public bool IsLegacymRemoteNGInstalled()
public bool IsLegacymRemoteNgInstalled()
{
return (_activeRegistryPath != null);
}
public string GetLegacyUninstallString()
{
if (IsLegacymRemoteNGInstalled())
return _activeRegistryPath.GetValue("UninstallString").ToString();
return "";
return IsLegacymRemoteNgInstalled() ? _activeRegistryPath.GetValue("UninstallString").ToString() : "";
}
private void GetLegacymRemoteNGRegistryKeyPath()
private void GetLegacymRemoteNgRegistryKeyPath()
{
GetUninstallKeyPath();
GetUninstallKeyPath6432();
@@ -62,20 +60,24 @@ namespace CustomActions
{
try
{
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(REGISTRY_PATH);
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(RegistryPath);
}
catch (Exception)
{
// ignored
}
catch (Exception ex)
{ }
}
private void GetUninstallKeyPath6432()
{
try
{
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(REGISTRY_PATH_Wow6432);
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(RegistryPathWow6432);
}
catch (Exception)
{
// ignored
}
catch (Exception ex)
{ }
}
}
}

View File

@@ -2,11 +2,9 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include $(sys.CURRENTDIR)Includes\Config.wxi?>
<Fragment>
<CustomAction Id="SetRDP80KBValue" Return="check" Execute="immediate" Property="KB" Value="$(var.RDP80KB)" />
<CustomAction Id="CheckIfRDP80Installed" Return="check" Execute="immediate" BinaryKey="CustomActions.CA.dll" DllEntry="IsKBInstalled" />
<CustomAction Id="CheckIfMinimumRdpInstalled" Return="check" Execute="immediate" BinaryKey="CustomActions.CA.dll" DllEntry="IsMinimumRdpVersionInstalled" />
</Fragment>
<Fragment>
<CustomAction Id="SetRDP81KBValue" Return="check" Execute="immediate" Property="KB" Value="$(var.RDP81KB)" />
<CustomAction Id="CheckIfRDP81Installed" Return="check" Execute="immediate" BinaryKey="CustomActions.CA.dll" DllEntry="IsKBInstalled" />
<CustomAction Id="CheckIfRdpDtlsUpdateInstalled" Return="check" Execute="immediate" BinaryKey="CustomActions.CA.dll" DllEntry="IsRdpDtlsUpdateInstalled" />
</Fragment>
</Wix>

View File

@@ -14,6 +14,7 @@ xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
<xsl:key name="service-search" match="wix:Component[contains(wix:File/@Source, 'manifest')]" use="@Id" />
<xsl:key name="service-search" match="wix:Component[contains(wix:File/@Source, '.application')]" use="@Id" />
<xsl:key name="service-search" match="wix:Component[wix:File/@Source = '$(var.HarvestPath)\mRemoteNG.exe']" use="@Id" />
<xsl:key name="service-search" match="wix:Component[wix:File/@Source = '$(var.HarvestPath)\PuTTYNG.exe']" use="@Id" />
<xsl:template match="wix:Component[key('service-search', @Id)]" />
<xsl:template match="wix:ComponentRef[key('service-search', @Id)]" />
</xsl:stylesheet>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="C.PuttyNGFile" Guid="*">
<File Id="PuttyNGFile" Name="PuTTYNG.exe" Source="Dependencies\PuTTYNG.exe" KeyPath="yes" />
<File Id="PuttyNGFile" Name="PuTTYNG.exe" Source="$(var.HarvestPath)\PuTTYNG.exe" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>

View File

@@ -16,8 +16,11 @@
<?define RequiredDotNetFrameworkMinorVersion = "0" ?>
<?define RequiredDotNetFrameworkServicePackLevel = "" ?>
<?define RequiredDotNetFrameworkVersion = "$(var.RequiredDotNetFrameworkMajorVersion).$(var.RequiredDotNetFrameworkMinorVersion)" ?>
<?define RDP80KB = "KB2592687" ?>
<?define RDP81KB = "KB2923545" ?>
<?define Rdp80Kb = "KB2592687" ?>
<?define Rdp81Kb = "KB2923545" ?>
<?define MinimumRdpKb = $(var.Rdp80Kb) ?>
<?define RdpDtlsKb = "KB2574819" ?>
<?define IGNOREPREREQUISITES = 0 ?>
<?if $(var.Platform) = x64 ?>
<?define ProductNameWithPlatform = "$(var.ProductName) (64 bit)" ?>

View File

@@ -112,18 +112,6 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release Portable|x86' ">
<DefineConstants>HarvestPath=$(SolutionDir)mRemoteV1\bin\Release Portable;HelpFilesHarvestPath=$(SolutionDir)mRemoteV1\Resources\Help</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>set /p buildenv=&lt;buildenv.tmp
REM Sign MSI
IF EXIST C:\mRemoteNG_code_signing_cert.pfx (powershell "&amp;""$(SolutionDir)Tools\signfiles.ps1""" %27%25cd%25%27)
REM Rename MSI to include version number
powershell "&amp;""$(SolutionDir)Tools\rename_installer_with_version.ps1""" %27$(SolutionDir)%27 %27!(TargetPath)%27
REM Copy MSI to Release folder
IF %25buildenv: Portable=%25==Release (powershell "&amp;""$(SolutionDir)Tools\copy_release_installer.ps1""" %27$(TargetDir)%27 %27$(SolutionDir)Release%27)</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>REM Clean the TargetDir
rmdir /S /Q "$(TargetDir)"
@@ -136,4 +124,20 @@ call "$(WIX)bin\heat.exe" dir "$(SolutionDir)mRemoteV1\bin\$(Configuration)" -ag
REM Convert the license file "COPYING.TXT" to "License.rtf" to be shown in the installer GUI
call "$(ProjectDir)Resources\Pandoc\pandoc.exe" -s -t rtf -o "$(ProjectDir)\Resources\License.rtf" "$(SolutionDir)COPYING.TXT"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>set /p buildenv=&lt;buildenv.tmp
REM Sign MSI
IF EXIST C:\mRemoteNG_code_signing_cert.pfx (
IF %25buildenv: Portable=%25==Release (
powershell "&amp;""$(SolutionDir)Tools\signfiles.ps1""" %27%25cd%25%27
)
)
REM Rename MSI to include version number
powershell -ExecutionPolicy Bypass -File "$(SolutionDir)Tools\rename_installer_with_version.ps1" $(SolutionDir)
REM Copy MSI to Release folder
IF %25buildenv: Portable=%25==Release (powershell -ExecutionPolicy Bypass -File "$(SolutionDir)Tools\copy_release_installer.ps1" $(TargetDir) $(SolutionDir)Release)</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -7,6 +7,7 @@
<String Id="Install_NeedDotNetFrameworkVersion">mRemoteNG requires Microsoft .NET Framework [REQUIREDDOTNETFRAMEWORKVERSION] or higher.</String>
<String Id="Install_OSVersionRequirement">mRemoteNG requires Windows 7 SP1 or higher to run. Please update your operating system and try again.</String>
<String Id="Install_RDP80Requirement">mRemoteNG requires RDP 8.0 or higher to run. Windows 7 users will need to install KB2592687</String>
<String Id="Install_RDPDtlsRequirement">mRemoteNG requires KB2574819 in order to create RDP connections. Windows 7 users will need to install this KB.</String>
<String Id="Install_Win7RequiresSP1">For mRemoteNG to run on Windows 7, it requires Service Pack 1 to be installed. Please install Service Pack 1 and try again.</String>
<!-- Directories and File names -->

View File

@@ -16,6 +16,10 @@
<Property Id="APPLICATIONROOTDIRECTORY">
<RegistrySearch Id='mRemoteNGRegistry' Type='raw' Root='HKLM' Key='Software\mRemoteNG' Name='InstallDir' />
</Property>
<Property Id='RDP_DTLS_KB' Value='$(var.RdpDtlsKb)' />
<Property Id='RDP_DTLS_UPDATE_INSTALLED' Value='0' Secure='yes' />
<Property Id='MINIMUM_RDP_KB' Value='$(var.MinimumRdpKb)' />
<Property Id='MINIMUM_RDP_VERSION_INSTALLED' Value='0' Secure='yes' />
<Property Id='REQUIREDDOTNETFRAMEWORKVERSION' Value='$(var.RequiredDotNetFrameworkVersion)' />
<Property Id='LEGACYVERSIONINSTALLED' Value='0' />
<PropertyRef Id="NETFRAMEWORK40FULL" />
@@ -24,8 +28,8 @@
<InstallUISequence>
<Custom Action="SetRDP80KBValue" After="AppSearch" />
<Custom Action="CheckIfRDP80Installed" After="SetRDP80KBValue">(NOT Installed) AND (VersionNT = 601 OR VersionNT64 = 601)</Custom>
<Custom Action="CheckIfRdpDtlsUpdateInstalled" After="AppSearch">(NOT Installed) AND (VersionNT = 601 OR VersionNT64 = 601)</Custom>
<Custom Action="CheckIfMinimumRdpInstalled" After="CheckIfRdpDtlsUpdateInstalled">(NOT Installed) AND (VersionNT = 601 OR VersionNT64 = 601)</Custom>
<LaunchConditions After="SetWIX_IS_NETFRAMEWORK_40_OR_LATER_INSTALLED" />
<Custom Action="CheckIfLegacyVersionInstalled" After="LaunchConditions" />
<Custom Action="UninstallLegacyVersion" After="CheckIfLegacyVersionInstalled">(NOT Installed) AND (LEGACYVERSIONINSTALLED = 1)</Custom>
@@ -38,19 +42,23 @@
</Condition>
<!-- Windows 7 or higher required -->
<Condition Message="!(loc.Install_OSVersionRequirement)">
<![CDATA[Installed OR (VersionNT >= 601) OR (VersionNT64 >= 601)]]>
<![CDATA[Installed OR (IGNOREPREREQUISITES = 1) OR (VersionNT >= 601) OR (VersionNT64 >= 601)]]>
</Condition>
<!-- If Windows 7, SP 1 is required -->
<Condition Message="!(loc.Install_Win7RequiresSP1)">
<![CDATA[Installed OR (VersionNT >= 602 OR VersionNT64 >= 602) OR ((VersionNT = 601 OR VersionNT64 = 601) AND ServicePackLevel >= 1)]]>
<![CDATA[Installed OR (IGNOREPREREQUISITES = 1) OR (VersionNT >= 602 OR VersionNT64 >= 602) OR ((VersionNT = 601 OR VersionNT64 = 601) AND ServicePackLevel >= 1)]]>
</Condition>
<!-- .Net Framework Version Condition -->
<Condition Message="!(loc.Install_NeedDotNetFrameworkVersion)">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_40_OR_LATER_INSTALLED = 1]]>
<![CDATA[Installed OR (IGNOREPREREQUISITES = 1) OR WIX_IS_NETFRAMEWORK_40_OR_LATER_INSTALLED = 1]]>
</Condition>
<!-- If Win7, require RDP DTLS update (KB2574819) -->
<Condition Message="!(loc.Install_RDPDtlsRequirement)">
<![CDATA[Installed OR (IGNOREPREREQUISITES = 1) OR (VersionNT >= 602 OR VersionNT64 >= 602) OR ((VersionNT = 601 OR VersionNT64 = 601) AND (RDP_DTLS_UPDATE_INSTALLED = 1))]]>
</Condition>
<!-- If Win7, require RDP 8.0 update (KB2592687) -->
<Condition Message="!(loc.Install_RDP80Requirement)">
<![CDATA[Installed OR (VersionNT >= 602 OR VersionNT64 >= 602) OR ((VersionNT = 601 OR VersionNT64 = 601) ]]>AND ($(var.RDP80KB) = 1 OR $(var.RDP81KB) = 1))
<![CDATA[Installed OR (IGNOREPREREQUISITES = 1) OR (VersionNT >= 602 OR VersionNT64 >= 602) OR ((VersionNT = 601 OR VersionNT64 = 601) AND (MINIMUM_RDP_VERSION_INSTALLED = 1))]]>
</Condition>
@@ -72,7 +80,6 @@
<Feature Id="F.ApplicationStartMenuShortcut" Title="!(loc.Feature_StartMenuShortcut)" Absent="allow" AllowAdvertise="no" Level="1">
<ComponentRef Id="C.ApplicationStartMenuShortcut" Primary="yes" />
</Feature>
</Feature>

32
Jenkinsfile vendored
View File

@@ -5,10 +5,11 @@ node('windows') {
def vsExtensionsDir = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow"
stage 'Checkout Branch'
def gitUrl = "https://github.com/mRemoteNG/mRemoteNG.git"
def branchName = GetBranchName()
echo "BranchName: ${branchName}"
git([url: gitUrl, branch: branchName])
checkout([
$class: 'GitSCM',
branches: scm.branches,
userRemoteConfigs: scm.userRemoteConfigs
])
stage 'Restore NuGet Packages'
def nugetPath = "C:\\nuget.exe"
@@ -24,26 +25,3 @@ node('windows') {
def nunitTestAdapterPath = "C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\VisualStudio\\14.0\\Extensions"
bat "\"${vsToolsDir}\\VsDevCmd.bat\" && VSTest.Console.exe /TestAdapterPath:${nunitTestAdapterPath} \"${jobDir}\\mRemoteNGTests\\bin\\debug\\mRemoteNGTests.dll\""
}
def GetBranchName() {
def jobDir = pwd()
echo "JobDir: ${jobDir}"
def patternToUse = GetPatternToMatchBranchNameFromDirectory()
echo "PatternToUse: ${patternToUse}"
java.util.regex.Matcher matcher = jobDir =~ patternToUse
echo "Ran the matcher"
matcher ? matcher[0][1] : null
}
def GetPatternToMatchBranchNameFromDirectory() {
def patternToUse = ""
def folderSeparator = ""
def branchNamePattern = "[a-zA-Z0-9\\-_.]*"
def jenkinsJobInfoTag = "@*[0-9]*"
echo "isUnix: ${isUnix()}"
if (isUnix()) {
folderSeparator = "/"
} else {
folderSeparator = "\\\\"
}
patternToUse = "${folderSeparator}(${branchNamePattern})(${jenkinsJobInfoTag})\$"
patternToUse
}

View File

@@ -1,296 +0,0 @@
; ---------------------
; DotNetVer.nsh
; Written by: David Grinberg
; Homepage: http://ontheperiphery.veraida.com/
; Updated By: Brandon Hansen (http://www.remotehams.com/)
; ---------------------
;
; LogicLib extensions for checking Microsoft .NET Framework versions and service packs.
;
; Latests Updates by Brandon Hansen, KG6YPI (RemoteHams.com)
; Dec 26, 2011 - .NET Framework 4.0 detection fixes - client profile not being found
; Dec 07, 2010 - .NET Framework 4.0 detection added by Brandon Hansen (KG6YPI)
;
; Usage examples:
;
; ${If} ${HasDotNet4.0}
; DetailPrint "Microsoft .NET Framework 4.0 installed."
; ${If} ${DOTNETVER_4_0} AtLeastDotNetServicePack 1
; DetailPrint "Microsoft .NET Framework 4.0 is at least SP1."
; ${Else}
; DetailPrint "Microsoft .NET Framework 4.0 SP1 not installed."
; ${EndIf}
; ${If} ${DOTNETVER_4_0} HasDotNetClientProfile 1
; DetailPrint "Microsoft .NET Framework 4.0 (Client Profile) available."
; ${EndIf}
; ${If} ${DOTNETVER_4_0} HasDotNetFullProfile 1
; DetailPrint "Microsoft .NET Framework 4.0 (Full Profile) available."
; ${EndIf}
; ${If} ${DOTNETVER_4_0} HasDotNetFullProfile 0
; DetailPrint "Microsoft .NET Framework 4.0 (Full Profile) not available."
; ${EndIf}
; ${EndIf}
!verbose push
!verbose 3
!ifndef ___DOTNETVER__NSH___
!define ___DOTNETVER__NSH___
!include LogicLib.nsh
!include Util.nsh
# constants
!define DOTNETVER_1_0 "1.0"
!define DOTNETVER_1_1 "1.1"
!define DOTNETVER_2_0 "2.0"
!define DOTNETVER_3_0 "3.0"
!define DOTNETVER_3_5 "3.5"
!define DOTNETVER_4_0 "4.0"
# variable declaration
Var /GLOBAL __DONTNET_FOUNDVER
!macro __DotNetVer_DeclareVars
!ifndef __DOTNETVER_VARS_DECLARED
!define __DOTNETVER_VARS_DECLARED
Var /GLOBAL __DOTNET_1.0
Var /GLOBAL __DOTNET_1.1
Var /GLOBAL __DOTNET_2.0
Var /GLOBAL __DOTNET_3.0
Var /GLOBAL __DOTNET_3.5
Var /GLOBAL __DOTNET_4.0
Var /GLOBAL __DOTNETVER_1.0_SP
Var /GLOBAL __DOTNETVER_1.1_SP
Var /GLOBAL __DOTNETVER_2.0_SP
Var /GLOBAL __DOTNETVER_3.0_SP
Var /GLOBAL __DOTNETVER_3.5_SP
Var /GLOBAL __DOTNETVER_4.0_SP
Var /GLOBAL __DOTNET_1.0_CLIENT
Var /GLOBAL __DOTNET_1.1_CLIENT
Var /GLOBAL __DOTNET_2.0_CLIENT
Var /GLOBAL __DOTNET_3.0_CLIENT
Var /GLOBAL __DOTNET_3.5_CLIENT
Var /GLOBAL __DOTNET_4.0_CLIENT
Var /GLOBAL __DOTNET_1.0_FULL
Var /GLOBAL __DOTNET_1.1_FULL
Var /GLOBAL __DOTNET_2.0_FULL
Var /GLOBAL __DOTNET_3.0_FULL
Var /GLOBAL __DOTNET_3.5_FULL
Var /GLOBAL __DOTNET_4.0_FULL
StrCpy $__DOTNET_1.0 0
StrCpy $__DOTNET_1.1 0
StrCpy $__DOTNET_2.0 0
StrCpy $__DOTNET_3.0 0
StrCpy $__DOTNET_3.5 0
StrCpy $__DOTNET_4.0 0
StrCpy $__DOTNETVER_1.0_SP 0
StrCpy $__DOTNETVER_1.1_SP 0
StrCpy $__DOTNETVER_2.0_SP 0
StrCpy $__DOTNETVER_3.0_SP 0
StrCpy $__DOTNETVER_3.5_SP 0
StrCpy $__DOTNETVER_4.0_SP 0
StrCpy $__DOTNET_1.0_CLIENT 0
StrCpy $__DOTNET_1.1_CLIENT 0
StrCpy $__DOTNET_2.0_CLIENT 0
StrCpy $__DOTNET_3.0_CLIENT 0
StrCpy $__DOTNET_3.5_CLIENT 0
StrCpy $__DOTNET_4.0_CLIENT 0
StrCpy $__DOTNET_1.0_FULL 0
StrCpy $__DOTNET_1.1_FULL 0
StrCpy $__DOTNET_2.0_FULL 0
StrCpy $__DOTNET_3.0_FULL 0
StrCpy $__DOTNET_3.5_FULL 0
StrCpy $__DOTNET_4.0_FULL 0
!endif
!macroend
# lazy initialization macro
!macro __DotNetVer_InitVars
# only calculate version once
StrCmp $__DONTNET_FOUNDVER "" dotnetver.noveryet
Return
dotnetver.noveryet:
!insertmacro __DotNetVer_DeclareVars
Push $0 ;registry count
Push $1 ;registry key
Push $2 ;version number
Push $3 ;installed
Push $4 ;service pack number
Push $8 ;strLen helper var
StrCpy $0 0
dotnetver.startenum:
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP" $0
StrCmp $1 "" dotnetver.done
IntOp $0 $0 + 1
StrCpy $2 $1 1 0
StrCmp $2 "v" +1 dotnetver.startenum
StrCpy $2 $1 3 1
; Check for .NET 1.0 to 3.5
ReadRegDWORD $3 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\$1" "Install"
ReadRegDWORD $4 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\$1" "SP"
IntCmp $3 1 dotnetcheck.skipalt
; Alternate check for versions that don't set the Install key
ReadRegDWORD $3 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\$1\Setup" "InstallSuccess"
dotnetcheck.skipalt:
; This is a sanity check that works on .NET 1.0 to 3.5
; if it fails check for dotnet 4
IntCmp $3 0 dotnetcheck.40
StrCmp $2 ${DOTNETVER_1_0} dotnetver.10
StrCmp $2 ${DOTNETVER_1_1} dotnetver.11
StrCmp $2 ${DOTNETVER_2_0} dotnetver.20
StrCmp $2 ${DOTNETVER_3_0} dotnetver.30
StrCmp $2 ${DOTNETVER_3_5} dotnetver.35
dotnetcheck.40:
StrCmp $2 ${DOTNETVER_4_0} dotnetver.40
StrCmp $2 "4" dotnetver.40
Goto dotnetver.startenum
dotnetver.10:
StrCpy $__DOTNET_1.0 1
StrCpy $__DOTNETVER_1.0_SP $4
StrCpy $__DOTNET_1.0_FULL 1
Goto dotnetver.startenum
dotnetver.11:
StrCpy $__DOTNET_1.1 1
StrCpy $__DOTNETVER_1.1_SP $4
StrCpy $__DOTNET_1.1_FULL 1
Goto dotnetver.startenum
dotnetver.20:
StrCpy $__DOTNET_2.0 1
StrCpy $__DOTNETVER_2.0_SP $4
StrCpy $__DOTNET_2.0_FULL 1
Goto dotnetver.startenum
dotnetver.30:
StrCpy $__DOTNET_3.0 1
StrCpy $__DOTNETVER_3.0_SP $4
StrCpy $__DOTNET_3.0_FULL 1
Goto dotnetver.startenum
dotnetver.35:
StrCpy $__DOTNET_3.5 1
StrCpy $__DOTNETVER_3.5_SP $4
StrCpy $__DOTNET_3.5_FULL 1
Goto dotnetver.startenum
dotnetver.40:
; Check for .NET 4.0 (Full Profile)
ReadRegDWORD $3 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Install"
ReadRegDWORD $4 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "SP"
StrLen $8 $3
IntCmp $8 0 dotnetcheck.40c
IntCmp $3 0 dotnetcheck.40c
StrCmp $2 ${DOTNETVER_4_0} dotnetver.40_Full
StrCmp $2 "4" dotnetver.40_Full
dotnetcheck.40c:
; Check for .NET 4.0 (Client Profile)
ReadRegDWORD $3 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client" "Install"
ReadRegDWORD $4 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client" "SP"
StrLen $8 $3
IntCmp $8 0 dotnetver.startenum
IntCmp $3 0 dotnetver.startenum
StrCmp $2 ${DOTNETVER_4_0} dotnetver.40_Client
StrCmp $2 "4" dotnetver.40_Client
Goto dotnetver.startenum
dotnetver.40_Full:
StrCpy $__DOTNET_4.0 1
StrCpy $__DOTNETVER_4.0_SP $4
StrCpy $__DOTNET_4.0_FULL 1
Goto dotnetcheck.40c ; continue looking for other profiles
dotnetver.40_Client:
StrCpy $__DOTNET_4.0 1
StrCpy $__DOTNETVER_4.0_SP $4
StrCpy $__DOTNET_4.0_CLIENT 1
Goto dotnetver.startenum
dotnetver.done:
StrCpy $__DONTNET_FOUNDVER "1"
Pop $8
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
!macroend
!macro _HasDotNet _a _b _t _f
${CallArtificialFunction} __DotNetVer_InitVars
!insertmacro _= `$__DOTNET_${_b}` `1` `${_t}` `${_f}`
!macroend
!macro __DotNetVer_DefineTest Ver
!define HasDotNet${Ver} `"" HasDotNet ${Ver}`
!macroend
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_1_0}
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_1_1}
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_2_0}
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_3_0}
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_3_5}
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_4_0}
!macro _AtLeastDotNetServicePack _a _b _t _f
${CallArtificialFunction} __DotNetVer_InitVars
!insertmacro _>= `$__DOTNETVER_${_a}_SP` `${_b}` `${_t}` `${_f}`
!macroend
!define AtLeastDotNetServicePack `AtLeastDotNetServicePack`
!macro _AtMostDotNetServicePack _a _b _t _f
${CallArtificialFunction} __DotNetVer_InitVars
!insertmacro _<= `$__DOTNETVER_${_a}_SP` `${_b}` `${_t}` `${_f}`
!macroend
!define AtMostDotNetServicePack `AtMostDotNetServicePack`
!macro _IsDotNetServicePack _a _b _t _f
${CallArtificialFunction} __DotNetVer_InitVars
!insertmacro _= `$__DOTNETVER_${_a}_SP` `${_b}` `${_t}` `${_f}`
!macroend
!define IsDotNetServicePack `IsDotNetServicePack`
!macro _HasDotNetClientProfile _a _b _t _f
${CallArtificialFunction} __DotNetVer_InitVars
!insertmacro _= `$__DOTNET_${_a}_CLIENT` `${_b}` `${_t}` `${_f}`
!macroend
!define HasDotNetClientProfile `HasDotNetClientProfile`
!macro _HasDotNetFullProfile _a _b _t _f
${CallArtificialFunction} __DotNetVer_InitVars
!insertmacro _= `$__DOTNET_${_a}_FULL` `${_b}` `${_t}` `${_f}`
!macroend
!define HasDotNetFullProfile `HasDotNetFullProfile`
# done
!endif # !___DOTNETVER__NSH___
!verbose pop

View File

@@ -1,22 +0,0 @@
; Czech installer translation
; Start mRemoteNG after installation
LangString LaunchMremoteNow ${LANG_CZECH} "mRemoteNG run CZECH message"
; Installer Language
LangString InstallerLanguage ${LANG_CZECH} "Installer Language"
; Select installer Language
LangString SelectInstallerLanguage ${LANG_CZECH} "Please select the language of the installer"
; Requires .NET Framework
LangString RequiresNetFramework ${LANG_CZECH} "mRemoteNG requires Microsoft .NET Framework 3.0."
; User needs to be Admin
LangString RequiresAdminUser ${LANG_CZECH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
; Start Menu items
LangString CreditsLinkName ${LANG_CZECH} "Credits"
LangString CopyingLinkName ${LANG_CZECH} "License"
LangString UninstallLinkName ${LANG_CZECH} "Uninstall"
LangString ChangeLogLinkName ${LANG_CZECH} "Version History"

View File

@@ -1,22 +0,0 @@
; Dutch installer translation
; Start mRemoteNG after installation
LangString LaunchMremoteNow ${LANG_DUTCH} "mRemoteNG run DUTCH message"
; Installer Language
LangString InstallerLanguage ${LANG_DUTCH} "Installer Language"
; Select installer Language
LangString SelectInstallerLanguage ${LANG_DUTCH} "Please select the language of the installer"
; Requires .NET Framework
LangString RequiresNetFramework ${LANG_DUTCH} "mRemoteNG requires Microsoft .NET Framework 3.0."
; User needs to be Admin
LangString RequiresAdminUser ${LANG_DUTCH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
; Start Menu items
LangString CreditsLinkName ${LANG_DUTCH} "Credits"
LangString CopyingLinkName ${LANG_DUTCH} "License"
LangString UninstallLinkName ${LANG_DUTCH} "Uninstall"
LangString ChangeLogLinkName ${LANG_DUTCH} "Version History"

View File

@@ -1,22 +0,0 @@
; English installer translation
; Start mRemoteNG after installation
LangString LaunchMremoteNow ${LANG_ENGLISH} "Launch mRemoteNG Now"
; Installer Language
LangString InstallerLanguage ${LANG_ENGLISH} "Installer Language"
; Select installer Language
LangString SelectInstallerLanguage ${LANG_ENGLISH} "Please select the language of the installer"
; Requires .NET Framework
LangString RequiresNetFramework ${LANG_ENGLISH} "mRemoteNG requires Microsoft .NET Framework 3.0."
; User needs to be Admin
LangString RequiresAdminUser ${LANG_ENGLISH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
; Start Menu items
LangString CreditsLinkName ${LANG_ENGLISH} "Credits"
LangString CopyingLinkName ${LANG_ENGLISH} "License"
LangString UninstallLinkName ${LANG_ENGLISH} "Uninstall"
LangString ChangeLogLinkName ${LANG_ENGLISH} "Version History"

View File

@@ -1,22 +0,0 @@
; French installer translation
; Start mRemoteNG after installation
LangString LaunchMremoteNow ${LANG_FRENCH} "mRemoteNG run FRENCH message"
; Installer Language
LangString InstallerLanguage ${LANG_FRENCH} "Installer Language"
; Select installer Language
LangString SelectInstallerLanguage ${LANG_FRENCH} "Please select the language of the installer"
; Requires .NET Framework
LangString RequiresNetFramework ${LANG_FRENCH} "mRemoteNG requires Microsoft .NET Framework 3.0."
; User needs to be Admin
LangString RequiresAdminUser ${LANG_FRENCH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
; Start Menu items
LangString CreditsLinkName ${LANG_FRENCH} "Credits"
LangString CopyingLinkName ${LANG_FRENCH} "License"
LangString UninstallLinkName ${LANG_FRENCH} "Uninstall"
LangString ChangeLogLinkName ${LANG_FRENCH} "Version History"

View File

@@ -1,22 +0,0 @@
; German installer translation
; Start mRemoteNG after installation
LangString LaunchMremoteNow ${LANG_GERMAN} "mRemoteNG jetzt Starten"
; Installer Language
LangString InstallerLanguage ${LANG_GERMAN} "Installationsprogamm Sprache"
; Select installer Language
LangString SelectInstallerLanguage ${LANG_GERMAN} "Bitte w<>hlen Sie die Sprache f<>r das Installationsprogramm"
; Requires .NET Framework
LangString RequiresNetFramework ${LANG_GERMAN} "mRemoteNG ben<65>tigt das Microsoft .NET Framework 3.0."
; User needs to be Admin
LangString RequiresAdminUser ${LANG_GERMAN} "Sie m<>ssen Mitglied der Grupper 'Power Users' or 'Administratoren' sein, damit Sie mRemoteNG installieren k<>nnen."
; Start Menu items
LangString CreditsLinkName ${LANG_GERMAN} "Credits"
LangString CopyingLinkName ${LANG_GERMAN} "License"
LangString UninstallLinkName ${LANG_GERMAN} "Uninstall"
LangString ChangeLogLinkName ${LANG_GERMAN} "Version History"

View File

@@ -1,31 +0,0 @@
!define LanguageNameEnglish "English"
!insertmacro MUI_LANGUAGE "English"
!include "Language\english.nsi"
!define LanguageNameCzech "Čeština"
!insertmacro MUI_LANGUAGE "Czech"
!include "Language\czech.nsi"
!define LanguageNameGerman "Deutsch"
!insertmacro MUI_LANGUAGE "German"
!include "Language\german.nsi"
!define LanguageNameSpanish "Español"
!insertmacro MUI_LANGUAGE "Spanish"
!include "Language\spanish.nsi"
!define LanguageNameFrench "Français"
!insertmacro MUI_LANGUAGE "French"
!include "Language\french.nsi"
!define LanguageNameDutch "Nederlands"
!insertmacro MUI_LANGUAGE "Dutch"
!include "Language\dutch.nsi"
!define LanguageNamePolish "Polski"
!insertmacro MUI_LANGUAGE "Polish"
!include "Language\polish.nsi"
!define LanguageNameThai "ภาษาไทย"
!insertmacro MUI_LANGUAGE "Thai"
!include "Language\thai.nsi"

View File

@@ -1,22 +0,0 @@
; Polish installer translation
; Start mRemoteNG after installation
LangString LaunchMremoteNow ${LANG_POLISH} "mRemoteNG run POLISH message"
; Installer Language
LangString InstallerLanguage ${LANG_POLISH} "Installer Language"
; Select installer Language
LangString SelectInstallerLanguage ${LANG_POLISH} "Please select the language of the installer"
; Requires .NET Framework
LangString RequiresNetFramework ${LANG_POLISH} "mRemoteNG requires Microsoft .NET Framework 3.0."
; User needs to be Admin
LangString RequiresAdminUser ${LANG_POLISH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
; Start Menu items
LangString CreditsLinkName ${LANG_POLISH} "Credits"
LangString CopyingLinkName ${LANG_POLISH} "License"
LangString UninstallLinkName ${LANG_POLISH} "Uninstall"
LangString ChangeLogLinkName ${LANG_POLISH} "Version History"

View File

@@ -1,22 +0,0 @@
; Spanish installer translation
; Start mRemoteNG after installation
LangString LaunchMremoteNow ${LANG_SPANISH} "Iniciando de mRemoteNG"
; Installer Language
LangString InstallerLanguage ${LANG_SPANISH} "Lenguaje de Instalación"
; Select installer Language
LangString SelectInstallerLanguage ${LANG_SPANISH} "Seleccione el lenguaje de instalación"
; Requires .NET Framework
LangString RequiresNetFramework ${LANG_SPANISH} "mRemoteNG requiere Microsoft .NET Framework 3.0."
; User needs to be Admin
LangString RequiresAdminUser ${LANG_SPANISH} "Debe ser miembro del grupo 'Administradores' para poder instalar mRemoteNG."
; Start Menu items
LangString CreditsLinkName ${LANG_SPANISH} "Créditos"
LangString CopyingLinkName ${LANG_SPANISH} "Licencia"
LangString UninstallLinkName ${LANG_SPANISH} "Desinstalar"
LangString ChangeLogLinkName ${LANG_SPANISH} "Historial de Versiones"

View File

@@ -1,23 +0,0 @@
; Thai installer translation
; Contributed by Apisitt Rattana
; Start mRemoteNG after installation
LangString LaunchMremoteNow ${LANG_THAI} "ขณะนี้กำลังติดตั้ง mRemoteNG"
; Installer Language
LangString InstallerLanguage ${LANG_THAI} "ภาษาสำหรับการติดตั้ง"
; Select installer Language
LangString SelectInstallerLanguage ${LANG_THAI} "กรุณาเลือกภาษาสำหรับการติดตั้ง"
; Requires .NET Framework
LangString RequiresNetFramework ${LANG_THAI} "mRemoteNG มีความต้องการ Microsoft .NET Framework 3.0. เป็นพื้นฐาน"
; User needs to be Admin
LangString RequiresAdminUser ${LANG_THAI} "คุณต้องเป็นสมาชิกในกลุ่มของ 'Power Users' หรือ 'Administrators' เพื่อการติดตั้ง mRemoteNG"
; Start Menu items
LangString CreditsLinkName ${LANG_THAI} "Credits"
LangString CopyingLinkName ${LANG_THAI} "License"
LangString UninstallLinkName ${LANG_THAI} "Uninstall"
LangString ChangeLogLinkName ${LANG_THAI} "Version History"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

View File

@@ -1,197 +0,0 @@
!include "MUI.nsh"
!include "WordFunc.nsh"
!insertmacro VersionCompare
!include "DotNetVer.nsh"
!include "..\Release\Version.nsh"
; This will be passed in using the /D switch by BUILD.CMD
!ifdef PRODUCT_VERSION_TAG
!define PRODUCT_VERSION_FRIENDLY "${PRODUCT_VERSION_SHORT}"
!define PRODUCT_VERSION_TAGGED "${PRODUCT_VERSION_SHORT}-${PRODUCT_VERSION_TAG}"
!else
!define PRODUCT_VERSION_FRIENDLY "${PRODUCT_VERSION_SHORT}"
!define PRODUCT_VERSION_TAGGED "${PRODUCT_VERSION_SHORT}"
!endif
; Basic Config
Name "mRemoteNG ${PRODUCT_VERSION_FRIENDLY}"
OutFile "..\Release\mRemoteNG-Installer-${PRODUCT_VERSION_TAGGED}.exe"
SetCompressor /SOLID lzma
InstallDir "$PROGRAMFILES\mRemoteNG"
InstallDirRegKey HKLM "Software\mRemoteNG" "InstallPath"
RequestExecutionLevel admin
; Version Information
VIProductVersion ${PRODUCT_VERSION}
VIAddVersionKey "CompanyName" "Next Generation Software"
VIAddVersionKey "ProductName" "mRemoteNG"
VIAddVersionKey "ProductVersion" ${PRODUCT_VERSION}
VIAddVersionKey "LegalCopyright" "Copyright © 2007-2009 Felix Deimel, 2010-2013 Riley McArdle"
VIAddVersionKey "FileDescription" "mRemoteNG ${PRODUCT_VERSION_FRIENDLY} Installer"
VIAddVersionKey "FileVersion" ${PRODUCT_VERSION}
; Design
!define MUI_ICON "Setup_Install.ico"
!define MUI_UNICON "RecycleBin.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "header.bmp" ; optional
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_UNBITMAP "header.bmp" ; optional
!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH
!define MUI_HEADER_TRANSPARENT_TEXT
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcomefinish.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "welcomefinish.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH
; Install Pages
!insertmacro MUI_PAGE_LICENSE "..\COPYING.TXT"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
; Finish Page
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN "$INSTDIR\mRemoteNG.exe"
!insertmacro MUI_PAGE_FINISH
; Uninstall Pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Get Languages
!include "Language\languages.nsi"
; Set finish page text
!define MUI_FINISHPAGE_RUN_Text "$(LaunchMremoteNow)"
Function .onInit
ClearErrors
UserInfo::GetName
IfErrors Win9x
Pop $0
UserInfo::GetAccountType
Pop $1
# GetOriginalAccountType will check the tokens of the original user of the
# current thread/process. If the user tokens were elevated or limited for
# this process, GetOriginalAccountType will return the non-restricted
# account type.
# On Vista with UAC, for example, this is not the same value when running
# with `RequestExecutionLevel user`. GetOriginalAccountType will return
# "admin" while GetAccountType will return "user".
StrCmp $1 "Admin" 0 +3
Goto doit
StrCmp $1 "Power" 0 +3
Goto doit
StrCmp $1 "User" 0 +3
Goto noop
StrCmp $1 "Guest" 0 +3
Goto noop
MessageBox MB_OK "Unknown error"
Goto doit
Win9x:
doit:
# We can install
IfSilent +2
Call SelectLanguage
Goto end
noop:
MessageBox MB_OK "$(RequiresAdminUser)"
Quit
end:
FunctionEnd
Function SelectLanguage
;Language selection dialog
Push ""
Push ${LANG_ENGLISH}
Push ${LanguageNameEnglish}
Push ${LANG_GERMAN}
Push ${LanguageNameGerman}
Push ${LANG_DUTCH}
Push ${LanguageNameDutch}
Push ${LANG_FRENCH}
Push ${LanguageNameFrench}
Push ${LANG_POLISH}
Push ${LanguageNamePolish}
Push ${LANG_SPANISH}
Push ${LanguageNameSpanish}
Push ${LANG_CZECH}
Push ${LanguageNameCzech}
Push ${LANG_THAI}
Push ${LanguageNameThai}
Push A ; A means auto count languages
; for the auto count to work the first empty push (Push "") must remain
LangDLL::LangDialog "$(InstallerLanguage)" "$(SelectInstallerLanguage)"
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
; Check .NET version
${IfNot} ${HasDotNet3.0}
MessageBox MB_OK|MB_ICONEXCLAMATION "$(RequiresNetFramework)"
Quit
${EndIf}
FunctionEnd
Section "" ; Install
SetOutPath $INSTDIR
SetShellVarContext all
; AddFiles
File /r /x "mRemoteNG.vshost.*" "..\mRemoteV1\bin\Release\*.*"
File /r "Dependencies\*.*"
File "..\*.txt"
; Uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
; Register ActiveX components
RegDLL "$INSTDIR\eolwtscom.dll"
; Start Menu
CreateDirectory "$SMPROGRAMS\mRemoteNG"
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(CreditsLinkName).lnk" "$INSTDIR\CREDITS.TXT"
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(CopyingLinkName).lnk" "$INSTDIR\COPYING.TXT"
CreateShortCut "$SMPROGRAMS\mRemoteNG\mRemoteNG.lnk" "$INSTDIR\mRemoteNG.exe"
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(UninstallLinkName).lnk" "$INSTDIR\Uninstall.exe"
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(ChangeLogLinkName).lnk" "$INSTDIR\CHANGELOG.TXT"
; Registry
WriteRegStr HKLM "Software\mRemoteNG" "InstallPath" $INSTDIR
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "DisplayName" "mRemoteNG"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "Publisher" "Next Generation Software"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "DisplayIcon" "$INSTDIR\mRemoteNG.exe"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "EstimatedSize" 7080
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "DisplayVersion" ${PRODUCT_VERSION}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "VersionMajor" ${PRODUCT_VERSION_MAJOR}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "VersionMinor" ${PRODUCT_VERSION_MINOR}
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "NoRepair" 1
SectionEnd
Section "un.Uninstall"
; Unregister ActiveX components
UnregDLL "$INSTDIR\eolwtscom.dll"
; Delete Files
RMDIR /r $INSTDIR
; Start Menu
SetShellVarContext all
RMDir /r "$SMPROGRAMS\mRemoteNG"
SetShellVarContext current
RMDir /r "$SMPROGRAMS\mRemoteNG"
; Registry
DeleteRegValue HKLM "Software\mRemoteNG" "InstallPath"
DeleteRegKey /ifempty HKLM "Software\mRemoteNG"
DeleteRegKey /ifempty HKCU "Software\mRemoteNG"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG"
SectionEnd

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

34
README.MD Normal file
View File

@@ -0,0 +1,34 @@
[![Twitter Follow](https://img.shields.io/twitter/follow/mRemoteNG.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=mRemoteNG)
[![Join the chat at https://gitter.im/mRemoteNG/PublicChat/](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mRemoteNG/PublicChat)
[![Build Status](http://ec2-52-39-111-114.us-west-2.compute.amazonaws.com:8080/buildStatus/icon?job=mRemoteNG/mRemoteNG/develop)](http://ec2-52-39-111-114.us-west-2.compute.amazonaws.com:8080/job/mRemoteNG/job/mRemoteNG/job/develop/)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/mRemoteNG/mRemoteNG/v1.74/total.svg)](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.74)
mRemoteNG is the next generation of mRemote, a full-featured, multi-tab remote connections manager.
It allows you to store all your remote connections in a simple yet powerful interface.
Currently these protocols are supported:
* RDP (Remote Desktop)
* VNC (Virtual Network Computing)
* ICA (Independent Computing Architecture)
* SSH (Secure Shell)
* Telnet (TELecommunication NETwork)
* HTTP/S (Hypertext Transfer Protocol)
* Rlogin (Rlogin)
* RAW
mRemoteNG can be installed on Windows 7 or later.
Windows 7 systems require RDP version 8:
https://support.microsoft.com/en-us/kb/2592687
OR
https://support.microsoft.com/en-us/kb/2923545
Windows 8+ support RDP version 8+ out of the box.
RDP versions are backwards compatible, so an mRemoteNG client running on Windows 10 can connection successfully to a Windows 2003 host (for example).

View File

@@ -12,15 +12,14 @@ Currently these protocols are supported:
* HTTP/S (Hypertext Transfer Protocol)
* Rlogin (Rlogin)
* RAW
mRemoteNG can be installed on Windows 7 or later.
Windows 7 systems require RDP version 8:
https://support.microsoft.com/en-us/kb/2592687
OR
https://support.microsoft.com/en-us/kb/2923545
Windows 7 systems require RDP version 8:
https://support.microsoft.com/en-us/kb/2592687
OR
https://support.microsoft.com/en-us/kb/2923545
Windows 8+ support RDP version 8+ out of the box.
RDP versions are backwards compatible, so an mRemoteNG client running on Windows 10 can
connection successfully to a Windows 2003 host (for example).
RDP versions are backwards compatible, so an mRemoteNG client running on Windows 10 can connection successfully to a Windows 2003 host (for example).

View File

@@ -16,6 +16,7 @@ echo Building...
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" "%SOLUTIONDIR%\mRemoteV1.sln" /Rebuild "Release Portable"
:skipbuild
IF NOT EXIST "%SOLUTIONDIR%\mRemoteV1\bin\Release Portable\mRemoteNG.exe" echo Did you forget to build? && goto end
set SIGCHECK=!SIGCHECK:"=^"!
set SIGCHECK=!SIGCHECK: =^^ !
set SIGCHECK=!SIGCHECK:(=^^(!
@@ -38,5 +39,7 @@ xcopy /S /Y "%SOLUTIONDIR%\mRemoteV1\bin\Release Portable" "%SOLUTIONDIR%\mRemot
echo Creating portable ZIP file...
echo %PORTABLEZIP%
del /f /q %PORTABLEZIP% > nul 2>&1
%SEVENZIP% a -bt -mx=9 -mm=LZMA -tzip -y -r %PORTABLEZIP% "%SOLUTIONDIR%\mRemoteV1\bin\package\*.*"
%SEVENZIP% a -bt -mx=9 -mm=LZMA -tzip -y %PORTABLEZIP% "%SOLUTIONDIR%\*.TXT"
%SEVENZIP% a -bt -mx=9 -tzip -y -r %PORTABLEZIP% "%SOLUTIONDIR%\mRemoteV1\bin\package\*.*"
%SEVENZIP% a -bt -mx=9 -tzip -y %PORTABLEZIP% "%SOLUTIONDIR%\*.TXT"
:end

View File

@@ -1,6 +1,9 @@
$sourcePath = $args[0]
$destinationDir = $args[1]
Write-Host $sourcePath
Write-Host $destinationDir
if (!(Test-Path -Path $destinationDir))
{
New-Item -Path $destinationDir -ItemType "directory"

View File

@@ -1,7 +1,9 @@
#$solutionDir = $args[0] -replace "\\$"
$solutionDir = "C:\Users\vsparda\Documents\Repositories\mRemoteNG Project\mRemoteNG\"
#$renameTarget = $args[1]
$renameTarget = "C:\Users\vsparda\Documents\Repositories\mRemoteNG Project\mRemoteNG\InstallerProjects\Installer\bin\Release\en-US\mRemoteNG-Installer.msi"
$solutionDir = $args[0]
$renameTarget = $solutionDir + "InstallerProjects\Installer\bin\Release\en-US\mRemoteNG-Installer.msi"
Write-Host $solutionDir
Write-Host $renameTarget
$targetVersionedFile = "$solutionDir\mRemoteV1\bin\Release\mRemoteNG.exe"
$version = &"$solutionDir\Tools\sigcheck.exe" /accepteula -q -n $targetVersionedFile
@@ -12,6 +14,8 @@ if ($renameTargetFileObject)
# Build the new file name
$oldFileName = $renameTargetFileObject.Name
$newFileName = $oldFileName -replace "$("\"+$renameTargetFileObject.Extension)",$("-"+$version+$renameTargetFileObject.Extension)
Write-Host $oldFileName
Write-Host $newFileName
# Delete any items that already exist with the new name (effectively an overwrite)
Remove-Item -Path "$($renameTargetFileObject.Directory.FullName)\$newFileName" -ErrorAction SilentlyContinue

View File

@@ -13,7 +13,7 @@ namespace mRemoteNGTests
Assert.That(IsLargeAware(exePath), Is.True);
}
static string GetTargetPath()
static string GetTargetPath([System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "")
{
string debugOrRelease = "";
string normalOrPortable = "";
@@ -27,8 +27,9 @@ namespace mRemoteNGTests
#else
normalOrPortable = "";
#endif
string path = string.Format(".\\mRemoteV1\\bin\\{0}{1}\\mRemoteNG.exe", debugOrRelease, normalOrPortable);
return path;
var path = Path.GetDirectoryName(sourceFilePath);
string FilePath = $"{path}\\..\\mRemoteV1\\bin\\{debugOrRelease}{normalOrPortable}\\mRemoteNG.exe";
return FilePath;
}
static bool IsLargeAware(string file)

View File

@@ -2,6 +2,7 @@
using NUnit.Framework;
using System.Reflection;
using System.Collections;
using System.Linq;
namespace mRemoteNGTests.Connection
{
@@ -59,10 +60,23 @@ namespace mRemoteNGTests.Connection
Assert.That(_inheritance.Username, Is.True);
}
[Test]
public void GetPropertiesReturnsListOfSettableProperties()
{
var hasIconProperty = _inheritance.GetProperties().Contains(typeof(ConnectionInfoInheritance).GetProperty("Icon"));
Assert.That(hasIconProperty, Is.True);
}
[Test]
public void GetPropertiesExludesPropertiesThatShouldNotBeSet()
{
var hasEverythingInheritedProperty = _inheritance.GetProperties().Contains(typeof(ConnectionInfoInheritance).GetProperty("EverythingInherited"));
Assert.That(hasEverythingInheritedProperty, Is.False);
}
private bool AllInheritancePropertiesAreTrue()
{
bool allPropertiesTrue = true;
var allPropertiesTrue = true;
foreach (var property in _inheritanceProperties)
{
if (PropertyIsBoolean(property) && PropertyIsChangedWhenSettingInheritAll(property) && BooleanPropertyIsSetToFalse(property))
@@ -73,7 +87,7 @@ namespace mRemoteNGTests.Connection
private bool AllInheritancePropertiesAreFalse()
{
bool allPropertiesFalse = true;
var allPropertiesFalse = true;
foreach (var property in _inheritanceProperties)
{
if (PropertyIsBoolean(property) && PropertyIsChangedWhenSettingInheritAll(property) && BooleanPropertyIsSetToTrue(property))
@@ -84,8 +98,7 @@ namespace mRemoteNGTests.Connection
private bool PropertyIsChangedWhenSettingInheritAll(PropertyInfo property)
{
ArrayList propertiesIgnoredByInheritAll = new ArrayList();
propertiesIgnoredByInheritAll.Add("IsDefault");
var propertiesIgnoredByInheritAll = new ArrayList {"IsDefault"};
return propertiesIgnoredByInheritAll.Contains(property);
}
@@ -101,7 +114,7 @@ namespace mRemoteNGTests.Connection
private bool BooleanPropertyIsSetToTrue(PropertyInfo property)
{
return (bool)property.GetValue(_inheritance) == true;
return (bool)property.GetValue(_inheritance);
}
}
}

View File

@@ -0,0 +1,49 @@
using mRemoteNG.Connection;
using NUnit.Framework;
namespace mRemoteNGTests.Connection
{
public class DefaultConnectionInheritanceTests
{
[SetUp]
public void Setup()
{
DefaultConnectionInheritance.Instance.TurnOffInheritanceCompletely();
}
[Test]
public void LoadingDefaultInheritanceUpdatesAllProperties()
{
var inheritanceSource = new ConnectionInfoInheritance(new object(), true);
inheritanceSource.TurnOnInheritanceCompletely();
DefaultConnectionInheritance.Instance.LoadFrom(inheritanceSource);
Assert.That(DefaultConnectionInheritance.Instance.EverythingInherited, Is.True);
}
[Test]
public void SavingDefaultInheritanceExportsAllProperties()
{
var inheritanceDestination = new ConnectionInfoInheritance(new object(), true);
DefaultConnectionInheritance.Instance.AutomaticResize = true;
DefaultConnectionInheritance.Instance.SaveTo(inheritanceDestination);
Assert.That(inheritanceDestination.AutomaticResize, Is.True);
}
[Test]
public void NewInheritanceInstancesCreatedWithDefaultInheritanceValues()
{
DefaultConnectionInheritance.Instance.Domain = true;
var inheritanceInstance = new ConnectionInfoInheritance(new object());
Assert.That(inheritanceInstance.Domain, Is.True);
}
[Test]
public void NewInheritanceInstancesCreatedWithAllDefaultInheritanceValues()
{
DefaultConnectionInheritance.Instance.TurnOnInheritanceCompletely();
var inheritanceInstance = new ConnectionInfoInheritance(new object());
Assert.That(inheritanceInstance.EverythingInherited, Is.True);
}
}
}

View File

@@ -0,0 +1,58 @@
using System.Security;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using NUnit.Framework;
namespace mRemoteNGTests.Security
{
public class AeadCryptographyProviderTests
{
private ICryptographyProvider _cryptographyProvider;
private SecureString _encryptionKey;
private string _plainText;
[SetUp]
public void Setup()
{
_cryptographyProvider = new AeadCryptographyProvider();
_encryptionKey = "mypassword111111".ConvertToSecureString();
_plainText = "MySecret!";
}
[TearDown]
public void TearDown()
{
_cryptographyProvider = null;
}
[Test]
public void GetBlockSizeReturnsProperValueForAes()
{
Assert.That(_cryptographyProvider.BlockSizeInBytes, Is.EqualTo(16));
}
[Test]
public void EncryptionOutputsBase64String()
{
var cipherText = _cryptographyProvider.Encrypt(_plainText, _encryptionKey);
Assert.That(cipherText.IsBase64String, Is.True);
}
[Test]
public void DecryptedTextIsEqualToOriginalPlainText()
{
var cipherText = _cryptographyProvider.Encrypt(_plainText, _encryptionKey);
var decryptedCipherText = _cryptographyProvider.Decrypt(cipherText, _encryptionKey);
Assert.That(decryptedCipherText, Is.EqualTo(_plainText));
}
[Test]
public void EncryptingTheSameValueReturnsNewCipherTextEachTime()
{
var cipherText1 = _cryptographyProvider.Encrypt(_plainText, _encryptionKey);
var cipherText2 = _cryptographyProvider.Encrypt(_plainText, _encryptionKey);
Assert.That(cipherText1, Is.Not.EqualTo(cipherText2));
}
}
}

View File

@@ -0,0 +1,112 @@
using mRemoteNG.Security;
using NUnit.Framework;
namespace mRemoteNGTests.Security
{
[TestFixture]
public class CryptographyProviderFactoryTests
{
private CryptographyProviderFactory _cryptographyProviderFactory;
[SetUp]
public void SetUp()
{
_cryptographyProviderFactory = new CryptographyProviderFactory();
}
[TearDown]
public void TearDown()
{
_cryptographyProviderFactory = null;
}
[Test]
public void CanCreateAesGcm()
{
var engine = BlockCipherEngines.AES;
var mode = BlockCipherModes.GCM;
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
}
[Test]
public void CanCreateAesCcm()
{
var engine = BlockCipherEngines.AES;
var mode = BlockCipherModes.CCM;
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
}
[Test]
public void CanCreateAesEax()
{
var engine = BlockCipherEngines.AES;
var mode = BlockCipherModes.EAX;
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
}
[Test]
public void CanCreateSerpentGcm()
{
var engine = BlockCipherEngines.Serpent;
var mode = BlockCipherModes.GCM;
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
}
[Test]
public void CanCreateSerpentCcm()
{
var engine = BlockCipherEngines.Serpent;
var mode = BlockCipherModes.CCM;
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
}
[Test]
public void CanCreateSerpentEax()
{
var engine = BlockCipherEngines.Serpent;
var mode = BlockCipherModes.EAX;
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
}
[Test]
public void CanCreateTwofishCcm()
{
var engine = BlockCipherEngines.Twofish;
var mode = BlockCipherModes.CCM;
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
}
[Test]
public void CanCreateTwofishEax()
{
var engine = BlockCipherEngines.Twofish;
var mode = BlockCipherModes.EAX;
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
}
[Test]
public void CanCreateTwofishGcm()
{
var engine = BlockCipherEngines.Twofish;
var mode = BlockCipherModes.GCM;
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
}
[Test]
public void CanCreateLegacyRijndael()
{
var cryptoProvider = _cryptographyProviderFactory.CreateLegacyRijndaelCryptographyProvider();
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo("Rijndael"));
}
}
}

View File

@@ -0,0 +1,45 @@
using mRemoteNG.Security;
using NUnit.Framework;
namespace mRemoteNGTests.Security
{
[TestFixture()]
public class EncryptedSecureStringTests
{
private readonly string _clearTextData = "MySecureData";
[Test]
public void CanCreateEncryptedSecureString()
{
Assert.That(new EncryptedSecureString(), Is.InstanceOf<EncryptedSecureString>());
}
[Test]
public void CanAssignStringValue()
{
var encryptedSecString = new EncryptedSecureString();
TestDelegate testDelegate = () => encryptedSecString.SetValue(_clearTextData);
Assert.DoesNotThrow(testDelegate);
}
[Test]
public void EncryptedValueIsSameAsOriginalValue()
{
var encryptedSecString = new EncryptedSecureString();
encryptedSecString.SetValue(_clearTextData);
var decryptedData = encryptedSecString.GetClearTextValue();
Assert.That(decryptedData, Is.EqualTo(_clearTextData));
}
[Test]
public void CreatingMultipleEncryptedSecureStrings()
{
var encString1 = new EncryptedSecureString();
encString1.SetValue(_clearTextData);
var encString2 = new EncryptedSecureString();
encString2.SetValue("somevalue");
var decryptedString = encString1.GetClearTextValue();
Assert.That(decryptedString, Is.EqualTo(_clearTextData));
}
}
}

View File

@@ -0,0 +1,59 @@
using System.Security;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using NUnit.Framework;
namespace mRemoteNGTests.Security
{
[TestFixture()]
public class LegacyRijndaelCryptographyProviderTests
{
private ICryptographyProvider _rijndaelCryptographyProvider;
private SecureString _encryptionKey;
private string _plainText;
[SetUp]
public void SetUp()
{
_rijndaelCryptographyProvider = new LegacyRijndaelCryptographyProvider();
_encryptionKey = "mR3m".ConvertToSecureString();
_plainText = "MySecret!";
}
[TearDown]
public void Teardown()
{
_rijndaelCryptographyProvider = null;
}
[Test]
public void GetBlockSizeReturnsProperValueForRijndael()
{
Assert.That(_rijndaelCryptographyProvider.BlockSizeInBytes, Is.EqualTo(16));
}
[Test]
public void EncryptionOutputsBase64String()
{
var cipherText = _rijndaelCryptographyProvider.Encrypt(_plainText, _encryptionKey);
Assert.That(cipherText.IsBase64String, Is.True);
}
[Test]
public void DecryptedTextIsEqualToOriginalPlainText()
{
var cipherText = _rijndaelCryptographyProvider.Encrypt(_plainText, _encryptionKey);
var decryptedCipherText = _rijndaelCryptographyProvider.Decrypt(cipherText, _encryptionKey);
Assert.That(decryptedCipherText, Is.EqualTo(_plainText));
}
[Test]
public void EncryptingTheSameValueReturnsNewCipherTextEachTime()
{
var cipherText1 = _rijndaelCryptographyProvider.Encrypt(_plainText, _encryptionKey);
var cipherText2 = _rijndaelCryptographyProvider.Encrypt(_plainText, _encryptionKey);
Assert.That(cipherText1, Is.Not.EqualTo(cipherText2));
}
}
}

View File

@@ -54,6 +54,10 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.1\lib\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\mRemoteV1\References\log4net.dll</HintPath>
@@ -62,8 +66,8 @@
<HintPath>..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.2.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NUnitForms">
@@ -74,9 +78,13 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WeifenLuo.WinFormsUI.Docking, Version=2.5.0.15095, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\mRemoteV1\References\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
<Reference Include="WeifenLuo.WinFormsUI.Docking, Version=2.9.0.0, Culture=neutral, PublicKeyToken=5cded1a1a0a7b481, processorArchitecture=MSIL">
<HintPath>..\packages\DockPanelSuite.2.10.0\lib\net40\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="WeifenLuo.WinFormsUI.Docking.ThemeVS2012Light, Version=2.9.0.0, Culture=neutral, PublicKeyToken=5cded1a1a0a7b481, processorArchitecture=MSIL">
<HintPath>..\packages\DockPanelSuite.ThemeVS2012Light.2.10.0\lib\net40\WeifenLuo.WinFormsUI.Docking.ThemeVS2012Light.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<Choose>
@@ -95,11 +103,16 @@
<Compile Include="App\LoggerTests.cs" />
<Compile Include="BinaryFileTests.cs" />
<Compile Include="Connection\ConnectionInfoInheritanceTests.cs" />
<Compile Include="Connection\DefaultConnectionInheritanceTests.cs" />
<Compile Include="ListViewTester.cs" />
<Compile Include="Config\Connections\SqlConnectionUpdateCheckerTests.cs" />
<Compile Include="Config\Connections\SqlUpdateQueryBuilderTest.cs" />
<Compile Include="Config\Connections\SqlUpdateTimerTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Security\AeadCryptographyProviderTests.cs" />
<Compile Include="Security\CryptographyProviderFactoryTests.cs" />
<Compile Include="Security\EncryptedSecureStringTests.cs" />
<Compile Include="Security\LegacyRijndaelCryptographyProviderTests.cs" />
<Compile Include="UI\Controls\CustomListViewTests.cs" />
<Compile Include="UI\Controls\TestForm.cs">
<SubType>Form</SubType>

View File

@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.1" targetFramework="net45" />
<package id="DockPanelSuite" version="2.10.0" targetFramework="net45" />
<package id="DockPanelSuite.ThemeVS2012Light" version="2.10.0" targetFramework="net45" />
<package id="NSubstitute" version="1.10.0.0" targetFramework="net45" />
<package id="NUnit" version="3.2.0" targetFramework="net45" />
<package id="NUnit" version="3.4.1" targetFramework="net45" />
</packages>

View File

@@ -42,8 +42,10 @@ Global
{1453B37F-8621-499E-B0B2-6091F76DC0BB}.Release|x86.Build.0 = Release|x86
{5423D985-CB48-4344-B47F-E8C6D60C8B04}.Debug Portable|x86.ActiveCfg = Debug|x86
{5423D985-CB48-4344-B47F-E8C6D60C8B04}.Debug|x86.ActiveCfg = Debug|x86
{5423D985-CB48-4344-B47F-E8C6D60C8B04}.Debug|x86.Build.0 = Debug|x86
{5423D985-CB48-4344-B47F-E8C6D60C8B04}.Release Portable|x86.ActiveCfg = Release|x86
{5423D985-CB48-4344-B47F-E8C6D60C8B04}.Release|x86.ActiveCfg = Release|x86
{5423D985-CB48-4344-B47F-E8C6D60C8B04}.Release|x86.Build.0 = Release|x86
{F0168B9F-6815-40DF-BA53-46CEE7683B68}.Debug Portable|x86.ActiveCfg = Debug Portable|x86
{F0168B9F-6815-40DF-BA53-46CEE7683B68}.Debug|x86.ActiveCfg = Debug|x86
{F0168B9F-6815-40DF-BA53-46CEE7683B68}.Release Portable|x86.ActiveCfg = Release Portable|x86

View File

@@ -10,11 +10,6 @@ namespace mRemoteNG.App
{
public class CompatibilityChecker
{
public CompatibilityChecker()
{
}
public void CheckCompatibility()
{
CheckFipsPolicy();
@@ -34,20 +29,18 @@ namespace mRemoteNG.App
{
var regKey = Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa");
var fipsPolicy = regKey?.GetValue("FIPSAlgorithmPolicy");
if (fipsPolicy != null && (int)fipsPolicy != 0)
return true;
else
return false;
if (fipsPolicy == null) return false;
fipsPolicy = Convert.ToInt32(fipsPolicy);
return (int)fipsPolicy != 0;
}
private bool FipsPolicyEnabledForServer2008AndNewer()
{
var regKey = Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy");
var fipsPolicy = regKey?.GetValue("Enabled");
if (fipsPolicy != null && (int)fipsPolicy != 0)
return true;
else
return false;
if (fipsPolicy == null) return false;
fipsPolicy = Convert.ToInt32(fipsPolicy);
return (int)fipsPolicy != 0;
}
private void CheckLenovoAutoScrollUtility()
@@ -65,7 +58,7 @@ namespace mRemoteNG.App
Runtime.MessageCollector.AddExceptionMessage("Error in CheckLenovoAutoScrollUtility", ex);
}
if (proccesses?.Length > 0)
if (proccesses.Length > 0)
{
CTaskDialog.MessageBox(Application.ProductName, Language.strCompatibilityProblemDetected, string.Format(Language.strCompatibilityLenovoAutoScrollUtilityDetected, Application.ProductName), "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.Ok, ESysIcons.Warning, ESysIcons.Warning);
if (CTaskDialog.VerificationChecked)

View File

@@ -2,8 +2,10 @@ using System.Collections.Generic;
using System;
using System.IO;
using System.Reflection;
using System.Security;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.Security;
using static System.Environment;
@@ -19,7 +21,7 @@ namespace mRemoteNG.App.Info
public static readonly string ProdName = Application.ProductName;
public static readonly string copyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute), false)).Copyright;
public static readonly string HomePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
public static readonly string EncryptionKey = "mR3m";
public static readonly SecureString EncryptionKey = "mR3m".ConvertToSecureString();
public static string ReportingFilePath = "";
public static readonly string PuttyPath = HomePath + "\\PuTTYNG.exe";
public static string UserAgent

View File

@@ -17,6 +17,7 @@ using System.IO;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.Forms.Input;
using mRemoteNG.UI.TaskDialog;
@@ -98,7 +99,7 @@ namespace mRemoteNG.App
Settings.Default.ConDefaultDomain = DefaultConnection.Domain;
Settings.Default.ConDefaultProtocol = DefaultConnection.Protocol.ToString();
Settings.Default.ConDefaultPuttySession = DefaultConnection.PuttySession;
Settings.Default.ConDefaultICAEncryptionStrength = DefaultConnection.ICAEncryption.ToString();
Settings.Default.ConDefaultICAEncryptionStrength = DefaultConnection.ICAEncryptionStrength.ToString();
Settings.Default.ConDefaultRDPAuthenticationLevel = DefaultConnection.RDPAuthenticationLevel.ToString();
Settings.Default.ConDefaultLoadBalanceInfo = DefaultConnection.LoadBalanceInfo;
Settings.Default.ConDefaultUseConsoleSession = DefaultConnection.UseConsoleSession;
@@ -143,73 +144,6 @@ namespace mRemoteNG.App
}
#endregion
#region Default Inheritance
public static ConnectionInfoInheritance DefaultInheritanceFromSettings()
{
DefaultInheritance = new ConnectionInfoInheritance(null);
DefaultInheritance.IsDefault = true;
return DefaultInheritance;
}
public static void DefaultInheritanceToSettings()
{
Settings.Default.InhDefaultDescription = DefaultInheritance.Description;
Settings.Default.InhDefaultIcon = DefaultInheritance.Icon;
Settings.Default.InhDefaultPanel = DefaultInheritance.Panel;
Settings.Default.InhDefaultUsername = DefaultInheritance.Username;
Settings.Default.InhDefaultPassword = DefaultInheritance.Password;
Settings.Default.InhDefaultDomain = DefaultInheritance.Domain;
Settings.Default.InhDefaultProtocol = DefaultInheritance.Protocol;
Settings.Default.InhDefaultPort = DefaultInheritance.Port;
Settings.Default.InhDefaultPuttySession = DefaultInheritance.PuttySession;
Settings.Default.InhDefaultUseConsoleSession = DefaultInheritance.UseConsoleSession;
Settings.Default.InhDefaultUseCredSsp = DefaultInheritance.UseCredSsp;
Settings.Default.InhDefaultRenderingEngine = DefaultInheritance.RenderingEngine;
Settings.Default.InhDefaultICAEncryptionStrength = DefaultInheritance.ICAEncryption;
Settings.Default.InhDefaultRDPAuthenticationLevel = DefaultInheritance.RDPAuthenticationLevel;
Settings.Default.InhDefaultLoadBalanceInfo = DefaultInheritance.LoadBalanceInfo;
Settings.Default.InhDefaultResolution = DefaultInheritance.Resolution;
Settings.Default.InhDefaultAutomaticResize = DefaultInheritance.AutomaticResize;
Settings.Default.InhDefaultColors = DefaultInheritance.Colors;
Settings.Default.InhDefaultCacheBitmaps = DefaultInheritance.CacheBitmaps;
Settings.Default.InhDefaultDisplayWallpaper = DefaultInheritance.DisplayWallpaper;
Settings.Default.InhDefaultDisplayThemes = DefaultInheritance.DisplayThemes;
Settings.Default.InhDefaultEnableFontSmoothing = DefaultInheritance.EnableFontSmoothing;
Settings.Default.InhDefaultEnableDesktopComposition = DefaultInheritance.EnableDesktopComposition;
Settings.Default.InhDefaultRedirectKeys = DefaultInheritance.RedirectKeys;
Settings.Default.InhDefaultRedirectDiskDrives = DefaultInheritance.RedirectDiskDrives;
Settings.Default.InhDefaultRedirectPrinters = DefaultInheritance.RedirectPrinters;
Settings.Default.InhDefaultRedirectPorts = DefaultInheritance.RedirectPorts;
Settings.Default.InhDefaultRedirectSmartCards = DefaultInheritance.RedirectSmartCards;
Settings.Default.InhDefaultRedirectSound = DefaultInheritance.RedirectSound;
Settings.Default.InhDefaultPreExtApp = DefaultInheritance.PreExtApp;
Settings.Default.InhDefaultPostExtApp = DefaultInheritance.PostExtApp;
Settings.Default.InhDefaultMacAddress = DefaultInheritance.MacAddress;
Settings.Default.InhDefaultUserField = DefaultInheritance.UserField;
// VNC inheritance
Settings.Default.InhDefaultVNCAuthMode = DefaultInheritance.VNCAuthMode;
Settings.Default.InhDefaultVNCColors = DefaultInheritance.VNCColors;
Settings.Default.InhDefaultVNCCompression = DefaultInheritance.VNCCompression;
Settings.Default.InhDefaultVNCEncoding = DefaultInheritance.VNCEncoding;
Settings.Default.InhDefaultVNCProxyIP = DefaultInheritance.VNCProxyIP;
Settings.Default.InhDefaultVNCProxyPassword = DefaultInheritance.VNCProxyPassword;
Settings.Default.InhDefaultVNCProxyPort = DefaultInheritance.VNCProxyPort;
Settings.Default.InhDefaultVNCProxyType = DefaultInheritance.VNCProxyType;
Settings.Default.InhDefaultVNCProxyUsername = DefaultInheritance.VNCProxyUsername;
Settings.Default.InhDefaultVNCSmartSizeMode = DefaultInheritance.VNCSmartSizeMode;
Settings.Default.InhDefaultVNCViewOnly = DefaultInheritance.VNCViewOnly;
// Ext. App inheritance
Settings.Default.InhDefaultExtApp = DefaultInheritance.ExtApp;
// RDP gateway inheritance
Settings.Default.InhDefaultRDGatewayUsageMethod = DefaultInheritance.RDGatewayUsageMethod;
Settings.Default.InhDefaultRDGatewayHostname = DefaultInheritance.RDGatewayHostname;
Settings.Default.InhDefaultRDGatewayUsername = DefaultInheritance.RDGatewayUsername;
Settings.Default.InhDefaultRDGatewayPassword = DefaultInheritance.RDGatewayPassword;
Settings.Default.InhDefaultRDGatewayDomain = DefaultInheritance.RDGatewayDomain;
Settings.Default.InhDefaultRDGatewayUseConnectionCredentials = DefaultInheritance.RDGatewayUseConnectionCredentials;
}
#endregion
#region Panels
public static Form AddPanel(string title = "", bool noTabber = false)
{
@@ -411,12 +345,12 @@ namespace mRemoteNG.App
}
}
public static void LoadConnectionsBG(bool WithDialog = false, bool Update = false)
public static void LoadConnectionsBG(bool withDialog = false, bool update = false)
{
_withDialog = false;
_loadUpdate = true;
Thread t = new Thread(LoadConnectionsBGd);
var t = new Thread(LoadConnectionsBGd);
t.SetApartmentState(ApartmentState.STA);
t.Start();
}
@@ -430,12 +364,11 @@ namespace mRemoteNG.App
public static void LoadConnections(bool withDialog = false, bool update = false)
{
ConnectionsLoader connectionsLoader = new ConnectionsLoader();
var connectionsLoader = new ConnectionsLoader();
try
{
// disable sql update checking while we are loading updates
if (SQLConnProvider != null)
SQLConnProvider.Disable();
SQLConnProvider?.Disable();
if (ConnectionList != null && ContainerList != null)
{
@@ -450,15 +383,9 @@ namespace mRemoteNG.App
{
if (withDialog)
{
OpenFileDialog loadDialog = Tools.Controls.ConnectionsLoadDialog();
if (loadDialog.ShowDialog() == DialogResult.OK)
{
connectionsLoader.ConnectionFileName = loadDialog.FileName;
}
else
{
return;
}
var loadDialog = Tools.Controls.ConnectionsLoadDialog();
if (loadDialog.ShowDialog() != DialogResult.OK) return;
connectionsLoader.ConnectionFileName = loadDialog.FileName;
}
else
{
@@ -485,12 +412,13 @@ namespace mRemoteNG.App
ConnectionTree.ResetTree();
connectionsLoader.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0];
connectionsLoader.UseSQL = Settings.Default.UseSQLServer;
connectionsLoader.SQLHost = Settings.Default.SQLHost;
connectionsLoader.SQLDatabaseName = Settings.Default.SQLDatabaseName;
connectionsLoader.SQLUsername = Settings.Default.SQLUser;
connectionsLoader.SQLPassword = Security.Crypt.Decrypt(Convert.ToString(Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey);
connectionsLoader.SQLUpdate = update;
connectionsLoader.UseDatabase = Settings.Default.UseSQLServer;
connectionsLoader.DatabaseHost = Settings.Default.SQLHost;
connectionsLoader.DatabaseName = Settings.Default.SQLDatabaseName;
connectionsLoader.DatabaseUsername = Settings.Default.SQLUser;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
connectionsLoader.DatabasePassword = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey);
connectionsLoader.DatabaseUpdate = update;
connectionsLoader.LoadConnections(false);
if (Settings.Default.UseSQLServer)
@@ -511,17 +439,14 @@ namespace mRemoteNG.App
}
// re-enable sql update checking after updates are loaded
if (Settings.Default.UseSQLServer && SQLConnProvider != null)
{
SQLConnProvider.Enable();
}
SQLConnProvider?.Enable();
}
catch (Exception ex)
{
if (Settings.Default.UseSQLServer)
{
MessageCollector.AddExceptionMessage(Language.strLoadFromSqlFailed, ex);
string commandButtons = string.Join("|", new[] { Language.strCommandTryAgain, Language.strCommandOpenConnectionFile, string.Format(Language.strCommandExitProgram, Application.ProductName) });
var commandButtons = string.Join("|", Language.strCommandTryAgain, Language.strCommandOpenConnectionFile, string.Format(Language.strCommandExitProgram, Application.ProductName));
CTaskDialog.ShowCommandBox(Application.ProductName, Language.strLoadFromSqlFailed, Language.strLoadFromSqlFailedContent, MiscTools.GetExceptionMessageRecursive(ex), "", "", commandButtons, false, ESysIcons.Error, ESysIcons.Error);
switch (CTaskDialog.CommandButtonResult)
{
@@ -537,29 +462,24 @@ namespace mRemoteNG.App
return;
}
}
if (ex is FileNotFoundException && !withDialog)
{
MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoadedNew, connectionsLoader.ConnectionFileName), ex, MessageClass.InformationMsg);
NewConnections(Convert.ToString(connectionsLoader.ConnectionFileName));
return;
}
MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoaded, connectionsLoader.ConnectionFileName), ex);
if (connectionsLoader.ConnectionFileName != GetStartupConnectionFileName())
{
LoadConnections(withDialog, update);
}
else
{
if (ex is FileNotFoundException && !withDialog)
{
MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoadedNew, connectionsLoader.ConnectionFileName), ex, MessageClass.InformationMsg);
NewConnections(Convert.ToString(connectionsLoader.ConnectionFileName));
return;
}
MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoaded, connectionsLoader.ConnectionFileName), ex);
if (connectionsLoader.ConnectionFileName != GetStartupConnectionFileName())
{
LoadConnections(withDialog, update);
return;
}
else
{
MessageBox.Show(frmMain.Default,
string.Format(Language.strErrorStartupConnectionFileLoad, Environment.NewLine, Application.ProductName, GetStartupConnectionFileName(), MiscTools.GetExceptionMessageRecursive(ex)),
"Could not load startup file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
return;
}
MessageBox.Show(frmMain.Default,
string.Format(Language.strErrorStartupConnectionFileLoad, Environment.NewLine, Application.ProductName, GetStartupConnectionFileName(), MiscTools.GetExceptionMessageRecursive(ex)),
"Could not load startup file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
}
}
@@ -692,7 +612,8 @@ namespace mRemoteNG.App
conS.SQLHost = Convert.ToString(Settings.Default.SQLHost);
conS.SQLDatabaseName = Convert.ToString(Settings.Default.SQLDatabaseName);
conS.SQLUsername = Convert.ToString(Settings.Default.SQLUser);
conS.SQLPassword = Security.Crypt.Decrypt(Convert.ToString(Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey);
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
conS.SQLPassword = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey);
}
conS.SaveConnections();

View File

@@ -48,6 +48,7 @@ namespace mRemoteNG.App
ParseCommandLineArgs();
IeBrowserEmulation.Register();
GetConnectionIcons();
DefaultConnectionInheritance.Instance.LoadFrom(Settings.Default, (a)=>"InhDefault"+a);
}
@@ -102,7 +103,7 @@ namespace mRemoteNG.App
{
string osData = GetOperatingSystemData();
string architecture = GetArchitectureData();
Logger.Instance.InfoFormat(string.Join(" ", Array.FindAll(new string[] { osData, architecture }, s => !string.IsNullOrEmpty(Convert.ToString(s)))));
Logger.Instance.InfoFormat(string.Join(" ", Array.FindAll(new[] { osData, architecture }, s => !string.IsNullOrEmpty(Convert.ToString(s)))));
}
private string GetOperatingSystemData()
@@ -112,32 +113,27 @@ namespace mRemoteNG.App
try
{
foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem WHERE Primary=True").Get())
foreach (var o in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem WHERE Primary=True").Get())
{
osVersion = GetOSVersion(osVersion, managementObject);
var managementObject = (ManagementObject) o;
osVersion = Convert.ToString(managementObject.GetPropertyValue("Caption")).Trim();
servicePack = GetOSServicePack(servicePack, managementObject);
}
}
catch (Exception ex)
{
Logger.Instance.WarnFormat("Error retrieving operating system information from WMI. {0}", ex.Message);
Logger.Instance.WarnFormat($"Error retrieving operating system information from WMI. {ex.Message}");
}
string osData = string.Join(" ", new string[] { osVersion, servicePack });
return osData;
}
private string GetOSVersion(string osVersion, ManagementObject managementObject)
{
osVersion = Convert.ToString(managementObject.GetPropertyValue("Caption")).Trim();
return osVersion;
}
private string GetOSServicePack(string servicePack, ManagementObject managementObject)
{
int servicePackNumber = Convert.ToInt32(managementObject.GetPropertyValue("ServicePackMajorVersion"));
if (!(servicePackNumber == 0))
if (servicePackNumber != 0)
{
servicePack = string.Format("Service Pack {0}", servicePackNumber);
servicePack = $"Service Pack {servicePackNumber}";
}
return servicePack;
}
@@ -147,15 +143,16 @@ namespace mRemoteNG.App
string architecture = string.Empty;
try
{
foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_Processor WHERE DeviceID=\'CPU0\'").Get())
foreach (var o in new ManagementObjectSearcher("SELECT * FROM Win32_Processor WHERE DeviceID=\'CPU0\'").Get())
{
var managementObject = (ManagementObject) o;
int addressWidth = Convert.ToInt32(managementObject.GetPropertyValue("AddressWidth"));
architecture = string.Format("{0}-bit", addressWidth);
architecture = $"{addressWidth}-bit";
}
}
catch (Exception ex)
{
Logger.Instance.WarnFormat("Error retrieving operating system address width from WMI. {0}", ex.Message);
Logger.Instance.WarnFormat($"Error retrieving operating system address width from WMI. {ex.Message}");
}
return architecture;
}
@@ -163,25 +160,27 @@ namespace mRemoteNG.App
private void LogApplicationData()
{
#if !PORTABLE
Logger.Instance.InfoFormat("{0} {1} starting.", Application.ProductName, Application.ProductVersion);
Logger.Instance.InfoFormat($"{Application.ProductName} {Application.ProductVersion} starting.");
#else
Logger.Instance.InfoFormat("{0} {1} {2} starting.", Application.ProductName, Application.ProductVersion, Language.strLabelPortableEdition);
Logger.Instance.InfoFormat(
$"{Application.ProductName} {Application.ProductVersion} {Language.strLabelPortableEdition} starting.");
#endif
}
private void LogCmdLineArgs()
{
Logger.Instance.InfoFormat("Command Line: {0}", Environment.GetCommandLineArgs());
Logger.Instance.InfoFormat($"Command Line: {Environment.GetCommandLineArgs()}");
}
private void LogCLRData()
{
Logger.Instance.InfoFormat("Microsoft .NET CLR {0}", Environment.Version);
Logger.Instance.InfoFormat($"Microsoft .NET CLR {Environment.Version}");
}
private void LogCultureData()
{
Logger.Instance.InfoFormat("System Culture: {0}/{1}", Thread.CurrentThread.CurrentUICulture.Name, Thread.CurrentThread.CurrentUICulture.NativeName);
Logger.Instance.InfoFormat(
$"System Culture: {Thread.CurrentThread.CurrentUICulture.Name}/{Thread.CurrentThread.CurrentUICulture.NativeName}");
}

View File

@@ -6,6 +6,8 @@ using System.Threading;
using mRemoteNG.Tools;
using System.Reflection;
using mRemoteNG.App.Info;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
namespace mRemoteNG.App.Update
@@ -107,7 +109,15 @@ namespace mRemoteNG.App.Update
public void SetProxySettings()
{
SetProxySettings(Convert.ToBoolean(Settings.Default.UpdateUseProxy), Convert.ToString(Settings.Default.UpdateProxyAddress), Convert.ToInt32(Settings.Default.UpdateProxyPort), Convert.ToBoolean(Settings.Default.UpdateProxyUseAuthentication), Convert.ToString(Settings.Default.UpdateProxyAuthUser), Security.Crypt.Decrypt(Convert.ToString(Settings.Default.UpdateProxyAuthPass), GeneralAppInfo.EncryptionKey));
var shouldWeUseProxy = Settings.Default.UpdateUseProxy;
var proxyAddress = Settings.Default.UpdateProxyAddress;
var port = Settings.Default.UpdateProxyPort;
var useAuthentication = Settings.Default.UpdateProxyUseAuthentication;
var username = Settings.Default.UpdateProxyAuthUser;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
var password = cryptographyProvider.Decrypt(Settings.Default.UpdateProxyAuthPass, GeneralAppInfo.EncryptionKey);
SetProxySettings(shouldWeUseProxy, proxyAddress, port, useAuthentication, username, password);
}
public void SetProxySettings(bool useProxy, string address, int port, bool useAuthentication, string username, string password)

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,7 @@ using System.Data.SqlClient;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Security;
using System.Text;
using System.Windows.Forms;
using System.Xml;
@@ -14,6 +15,7 @@ using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Container;
using mRemoteNG.Messages;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
@@ -37,7 +39,7 @@ namespace mRemoteNG.Config.Connections
#region Private Properties
private XmlTextWriter _xmlTextWriter;
private string _password = "mR3m";
private SecureString _password = GeneralAppInfo.EncryptionKey;
private SqlConnection _sqlConnection;
private SqlCommand _sqlQuery;
@@ -99,8 +101,7 @@ namespace mRemoteNG.Config.Connections
{
bool isVerified = false;
SqlDataReader sqlDataReader = null;
Version databaseVersion = null;
try
try
{
SqlCommand sqlCommand = new SqlCommand("SELECT * FROM tblRoot", sqlConnection);
sqlDataReader = sqlCommand.ExecuteReader();
@@ -110,7 +111,7 @@ namespace mRemoteNG.Config.Connections
}
sqlDataReader.Read();
databaseVersion = new Version(Convert.ToString(sqlDataReader["confVersion"], CultureInfo.InvariantCulture));
var databaseVersion = new Version(Convert.ToString(sqlDataReader["confVersion"], CultureInfo.InvariantCulture));
sqlDataReader.Close();
@@ -175,8 +176,9 @@ namespace mRemoteNG.Config.Connections
{
_sqlConnection = new SqlConnection("Data Source=" + SQLHost + ";Initial Catalog=" + SQLDatabaseName + ";Integrated Security=True");
}
_sqlConnection.Open();
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
_sqlConnection.Open();
if (!VerifyDatabaseVersion(_sqlConnection))
{
@@ -191,17 +193,17 @@ namespace mRemoteNG.Config.Connections
{
if (((RootNodeInfo) tN.Tag).Password)
{
_password = Convert.ToString(((RootNodeInfo) tN.Tag).PasswordString);
strProtected = Crypt.Encrypt("ThisIsProtected", _password);
_password = Convert.ToString(((RootNodeInfo) tN.Tag).PasswordString).ConvertToSecureString();
strProtected = cryptographyProvider.Encrypt("ThisIsProtected", _password);
}
else
{
strProtected = Crypt.Encrypt("ThisIsNotProtected", _password);
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", _password);
}
}
else
{
strProtected = Crypt.Encrypt("ThisIsNotProtected", _password);
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", _password);
}
_sqlQuery = new SqlCommand("DELETE FROM tblRoot", _sqlConnection);
@@ -231,7 +233,7 @@ namespace mRemoteNG.Config.Connections
{
_currentNodeIndex++;
ConnectionInfo curConI = default(ConnectionInfo);
ConnectionInfo curConI;
_sqlQuery = new SqlCommand("INSERT INTO tblCons (Name, Type, Expanded, Description, Icon, Panel, Username, " + "DomainName, Password, Hostname, Protocol, PuttySession, " + "Port, ConnectToConsole, RenderingEngine, ICAEncryptionStrength, RDPAuthenticationLevel, LoadBalanceInfo, Colors, Resolution, AutomaticResize, DisplayWallpaper, " + "DisplayThemes, EnableFontSmoothing, EnableDesktopComposition, CacheBitmaps, RedirectDiskDrives, RedirectPorts, " + "RedirectPrinters, RedirectSmartCards, RedirectSound, RedirectKeys, " + "Connected, PreExtApp, PostExtApp, MacAddress, UserField, ExtApp, VNCCompression, VNCEncoding, VNCAuthMode, " + "VNCProxyType, VNCProxyIP, VNCProxyPort, VNCProxyUsername, VNCProxyPassword, " + "VNCColors, VNCSmartSizeMode, VNCViewOnly, " + "RDGatewayUsageMethod, RDGatewayHostname, RDGatewayUseConnectionCredentials, RDGatewayUsername, RDGatewayPassword, RDGatewayDomain, " + "UseCredSsp, " + "InheritCacheBitmaps, InheritColors, " + "InheritDescription, InheritDisplayThemes, InheritDisplayWallpaper, InheritEnableFontSmoothing, InheritEnableDesktopComposition, InheritDomain, " + "InheritIcon, InheritPanel, InheritPassword, InheritPort, " + "InheritProtocol, InheritPuttySession, InheritRedirectDiskDrives, " + "InheritRedirectKeys, InheritRedirectPorts, InheritRedirectPrinters, " + "InheritRedirectSmartCards, InheritRedirectSound, InheritResolution, InheritAutomaticResize, " + "InheritUseConsoleSession, InheritRenderingEngine, InheritUsername, InheritICAEncryptionStrength, InheritRDPAuthenticationLevel, InheritLoadBalanceInfo, " + "InheritPreExtApp, InheritPostExtApp, InheritMacAddress, InheritUserField, InheritExtApp, InheritVNCCompression, InheritVNCEncoding, " + "InheritVNCAuthMode, InheritVNCProxyType, InheritVNCProxyIP, InheritVNCProxyPort, " + "InheritVNCProxyUsername, InheritVNCProxyPassword, InheritVNCColors, " + "InheritVNCSmartSizeMode, InheritVNCViewOnly, " + "InheritRDGatewayUsageMethod, InheritRDGatewayHostname, InheritRDGatewayUseConnectionCredentials, InheritRDGatewayUsername, InheritRDGatewayPassword, InheritRDGatewayDomain, "
+ "InheritUseCredSsp, " + "PositionID, ParentID, ConstantID, LastChange)" + "VALUES (", _sqlConnection
);
@@ -272,7 +274,8 @@ namespace mRemoteNG.Config.Connections
private void SaveConnectionFieldsSQL(ConnectionInfo curConI)
{
ConnectionInfo with_1 = curConI;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
ConnectionInfo with_1 = curConI;
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Description) + "\',";
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Icon) + "\',";
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Panel) + "\',";
@@ -297,7 +300,7 @@ namespace mRemoteNG.Config.Connections
if (SaveSecurity.Password)
{
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(Crypt.Encrypt(with_1.Password, _password)) + "\',";
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(cryptographyProvider.Encrypt(with_1.Password, _password)) + "\',";
}
else
{
@@ -310,7 +313,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Port) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.UseConsoleSession) + "\',";
_sqlQuery.CommandText += "\'" + with_1.RenderingEngine + "\',";
_sqlQuery.CommandText += "\'" + with_1.ICAEncryption + "\',";
_sqlQuery.CommandText += "\'" + with_1.ICAEncryptionStrength + "\',";
_sqlQuery.CommandText += "\'" + with_1.RDPAuthenticationLevel + "\',";
_sqlQuery.CommandText += "\'" + with_1.LoadBalanceInfo + "\',";
_sqlQuery.CommandText += "\'" + with_1.Colors + "\',";
@@ -350,7 +353,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + with_1.VNCProxyIP + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCProxyPort) + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCProxyUsername + "\',";
_sqlQuery.CommandText += "\'" + Crypt.Encrypt(with_1.VNCProxyPassword, _password) + "\',";
_sqlQuery.CommandText += "\'" + cryptographyProvider.Encrypt(with_1.VNCProxyPassword, _password) + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCColors + "\',";
_sqlQuery.CommandText += "\'" + with_1.VNCSmartSizeMode + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCViewOnly) + "\',";
@@ -370,7 +373,7 @@ namespace mRemoteNG.Config.Connections
if (SaveSecurity.Password)
{
_sqlQuery.CommandText += "\'" + Crypt.Encrypt(with_1.RDGatewayPassword, _password) + "\',";
_sqlQuery.CommandText += "\'" + cryptographyProvider.Encrypt(with_1.RDGatewayPassword, _password) + "\',";
}
else
{
@@ -415,7 +418,7 @@ namespace mRemoteNG.Config.Connections
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.UseConsoleSession) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.RenderingEngine) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.Username) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.ICAEncryption) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.ICAEncryptionStrength) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.RDPAuthenticationLevel) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.LoadBalanceInfo) + "\',";
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inheritance.PreExtApp) + "\',";
@@ -536,15 +539,16 @@ namespace mRemoteNG.Config.Connections
private void EncryptCompleteFile()
{
StreamReader streamReader = new StreamReader(ConnectionFileName);
string fileContents;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
string fileContents;
fileContents = streamReader.ReadToEnd();
streamReader.Close();
if (!string.IsNullOrEmpty(fileContents))
{
StreamWriter streamWriter = new StreamWriter(ConnectionFileName);
streamWriter.Write(Crypt.Encrypt(fileContents, _password));
streamWriter.Write(cryptographyProvider.Encrypt(fileContents, _password));
streamWriter.Close();
}
}
@@ -557,8 +561,8 @@ namespace mRemoteNG.Config.Connections
{
return;
}
TreeNode treeNode = default(TreeNode);
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
TreeNode treeNode;
if (ConnectionTreeNode.GetNodeType(RootTreeNode) == TreeNodeType.Root)
{
@@ -584,25 +588,24 @@ namespace mRemoteNG.Config.Connections
if (Export)
{
_xmlTextWriter.WriteAttributeString("Protected", "", Crypt.Encrypt("ThisIsNotProtected", _password));
_xmlTextWriter.WriteAttributeString("Protected", "", cryptographyProvider.Encrypt("ThisIsNotProtected", _password));
}
else
{
if (((RootNodeInfo) treeNode.Tag).Password)
{
_password = Convert.ToString(((RootNodeInfo) treeNode.Tag).PasswordString);
_xmlTextWriter.WriteAttributeString("Protected", "", Crypt.Encrypt("ThisIsProtected", _password));
_password = Convert.ToString(((RootNodeInfo) treeNode.Tag).PasswordString).ConvertToSecureString();
_xmlTextWriter.WriteAttributeString("Protected", "", cryptographyProvider.Encrypt("ThisIsProtected", _password));
}
else
{
_xmlTextWriter.WriteAttributeString("Protected", "", Crypt.Encrypt("ThisIsNotProtected", _password));
_xmlTextWriter.WriteAttributeString("Protected", "", cryptographyProvider.Encrypt("ThisIsNotProtected", _password));
}
}
_xmlTextWriter.WriteAttributeString("ConfVersion", "", ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture));
TreeNodeCollection treeNodeCollection = default(TreeNodeCollection);
treeNodeCollection = treeNode.Nodes;
var treeNodeCollection = treeNode.Nodes;
SaveNode(treeNodeCollection);
@@ -626,8 +629,9 @@ namespace mRemoteNG.Config.Connections
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SaveToXml failed" + Environment.NewLine + ex.Message, false);
}
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SaveToXml failed" + Environment.NewLine + ex.Message);
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SaveToXml failed" + Environment.NewLine + ex.StackTrace, true);
}
}
private void SaveNode(TreeNodeCollection tNC)
@@ -636,7 +640,7 @@ namespace mRemoteNG.Config.Connections
{
foreach (TreeNode node in tNC)
{
ConnectionInfo curConI = default(ConnectionInfo);
ConnectionInfo curConI;
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection | ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container)
{
@@ -672,7 +676,8 @@ namespace mRemoteNG.Config.Connections
{
try
{
_xmlTextWriter.WriteAttributeString("Descr", "", curConI.Description);
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
_xmlTextWriter.WriteAttributeString("Descr", "", curConI.Description);
_xmlTextWriter.WriteAttributeString("Icon", "", curConI.Icon);
@@ -698,7 +703,7 @@ namespace mRemoteNG.Config.Connections
if (SaveSecurity.Password)
{
_xmlTextWriter.WriteAttributeString("Password", "", Crypt.Encrypt(curConI.Password, _password));
_xmlTextWriter.WriteAttributeString("Password", "", cryptographyProvider.Encrypt(curConI.Password, _password));
}
else
{
@@ -719,7 +724,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("RenderingEngine", "", curConI.RenderingEngine.ToString());
_xmlTextWriter.WriteAttributeString("ICAEncryptionStrength", "", curConI.ICAEncryption.ToString());
_xmlTextWriter.WriteAttributeString("ICAEncryptionStrength", "", curConI.ICAEncryptionStrength.ToString());
_xmlTextWriter.WriteAttributeString("RDPAuthenticationLevel", "", curConI.RDPAuthenticationLevel.ToString());
@@ -775,7 +780,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("VNCProxyIP", "", curConI.VNCProxyIP);
_xmlTextWriter.WriteAttributeString("VNCProxyPort", "", Convert.ToString(curConI.VNCProxyPort));
_xmlTextWriter.WriteAttributeString("VNCProxyUsername", "", curConI.VNCProxyUsername);
_xmlTextWriter.WriteAttributeString("VNCProxyPassword", "", Crypt.Encrypt(curConI.VNCProxyPassword, _password));
_xmlTextWriter.WriteAttributeString("VNCProxyPassword", "", cryptographyProvider.Encrypt(curConI.VNCProxyPassword, _password));
_xmlTextWriter.WriteAttributeString("VNCColors", "", curConI.VNCColors.ToString());
_xmlTextWriter.WriteAttributeString("VNCSmartSizeMode", "", curConI.VNCSmartSizeMode.ToString());
_xmlTextWriter.WriteAttributeString("VNCViewOnly", "", Convert.ToString(curConI.VNCViewOnly));
@@ -796,7 +801,7 @@ namespace mRemoteNG.Config.Connections
if (SaveSecurity.Password)
{
_xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", Crypt.Encrypt(curConI.RDGatewayPassword, _password));
_xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", cryptographyProvider.Encrypt(curConI.RDGatewayPassword, _password));
}
else
{
@@ -840,7 +845,7 @@ namespace mRemoteNG.Config.Connections
_xmlTextWriter.WriteAttributeString("InheritUseCredSsp", "", Convert.ToString(curConI.Inheritance.UseCredSsp));
_xmlTextWriter.WriteAttributeString("InheritRenderingEngine", "", Convert.ToString(curConI.Inheritance.RenderingEngine));
_xmlTextWriter.WriteAttributeString("InheritUsername", "", Convert.ToString(curConI.Inheritance.Username));
_xmlTextWriter.WriteAttributeString("InheritICAEncryptionStrength", "", Convert.ToString(curConI.Inheritance.ICAEncryption));
_xmlTextWriter.WriteAttributeString("InheritICAEncryptionStrength", "", Convert.ToString(curConI.Inheritance.ICAEncryptionStrength));
_xmlTextWriter.WriteAttributeString("InheritRDPAuthenticationLevel", "", Convert.ToString(curConI.Inheritance.RDPAuthenticationLevel));
_xmlTextWriter.WriteAttributeString("InheritLoadBalanceInfo", "", Convert.ToString(curConI.Inheritance.LoadBalanceInfo));
_xmlTextWriter.WriteAttributeString("InheritPreExtApp", "", Convert.ToString(curConI.Inheritance.PreExtApp));
@@ -936,12 +941,10 @@ namespace mRemoteNG.Config.Connections
{
return;
}
TreeNode tN = default(TreeNode);
tN = (TreeNode)RootTreeNode.Clone();
TreeNodeCollection tNC = default(TreeNodeCollection);
tNC = tN.Nodes;
var tN = (TreeNode)RootTreeNode.Clone();
var tNC = tN.Nodes;
csvWr = new StreamWriter(ConnectionFileName);
@@ -1000,9 +1003,9 @@ namespace mRemoteNG.Config.Connections
{
string nodePath = con.TreeNode.FullPath;
int firstSlash = nodePath.IndexOf("\\");
int firstSlash = nodePath.IndexOf("\\", StringComparison.Ordinal);
nodePath = nodePath.Remove(0, firstSlash + 1);
int lastSlash = nodePath.LastIndexOf("\\");
int lastSlash = nodePath.LastIndexOf("\\", StringComparison.Ordinal);
if (lastSlash > 0)
{
@@ -1032,11 +1035,11 @@ namespace mRemoteNG.Config.Connections
csvLn += con.Domain + ";";
}
csvLn += con.Hostname + ";" + con.Protocol + ";" + con.PuttySession + ";" + Convert.ToString(con.Port) + ";" + Convert.ToString(con.UseConsoleSession) + ";" + Convert.ToString(con.UseCredSsp) + ";" + con.RenderingEngine + ";" + con.ICAEncryption + ";" + con.RDPAuthenticationLevel + ";" + con.LoadBalanceInfo + ";" + con.Colors + ";" + con.Resolution + ";" + Convert.ToString(con.AutomaticResize) + ";" + Convert.ToString(con.DisplayWallpaper) + ";" + Convert.ToString(con.DisplayThemes) + ";" + Convert.ToString(con.EnableFontSmoothing) + ";" + Convert.ToString(con.EnableDesktopComposition) + ";" + Convert.ToString(con.CacheBitmaps) + ";" + Convert.ToString(con.RedirectDiskDrives) + ";" + Convert.ToString(con.RedirectPorts) + ";" + Convert.ToString(con.RedirectPrinters) + ";" + Convert.ToString(con.RedirectSmartCards) + ";" + con.RedirectSound + ";" + Convert.ToString(con.RedirectKeys) + ";" + con.PreExtApp + ";" + con.PostExtApp + ";" + con.MacAddress + ";" + con.UserField + ";" + con.ExtApp + ";" + con.VNCCompression + ";" + con.VNCEncoding + ";" + con.VNCAuthMode + ";" + con.VNCProxyType + ";" + con.VNCProxyIP + ";" + Convert.ToString(con.VNCProxyPort) + ";" + con.VNCProxyUsername + ";" + con.VNCProxyPassword + ";" + con.VNCColors + ";" + con.VNCSmartSizeMode + ";" + Convert.ToString(con.VNCViewOnly) + ";";
csvLn += con.Hostname + ";" + con.Protocol + ";" + con.PuttySession + ";" + Convert.ToString(con.Port) + ";" + Convert.ToString(con.UseConsoleSession) + ";" + Convert.ToString(con.UseCredSsp) + ";" + con.RenderingEngine + ";" + con.ICAEncryptionStrength + ";" + con.RDPAuthenticationLevel + ";" + con.LoadBalanceInfo + ";" + con.Colors + ";" + con.Resolution + ";" + Convert.ToString(con.AutomaticResize) + ";" + Convert.ToString(con.DisplayWallpaper) + ";" + Convert.ToString(con.DisplayThemes) + ";" + Convert.ToString(con.EnableFontSmoothing) + ";" + Convert.ToString(con.EnableDesktopComposition) + ";" + Convert.ToString(con.CacheBitmaps) + ";" + Convert.ToString(con.RedirectDiskDrives) + ";" + Convert.ToString(con.RedirectPorts) + ";" + Convert.ToString(con.RedirectPrinters) + ";" + Convert.ToString(con.RedirectSmartCards) + ";" + con.RedirectSound + ";" + Convert.ToString(con.RedirectKeys) + ";" + con.PreExtApp + ";" + con.PostExtApp + ";" + con.MacAddress + ";" + con.UserField + ";" + con.ExtApp + ";" + con.VNCCompression + ";" + con.VNCEncoding + ";" + con.VNCAuthMode + ";" + con.VNCProxyType + ";" + con.VNCProxyIP + ";" + Convert.ToString(con.VNCProxyPort) + ";" + con.VNCProxyUsername + ";" + con.VNCProxyPassword + ";" + con.VNCColors + ";" + con.VNCSmartSizeMode + ";" + Convert.ToString(con.VNCViewOnly) + ";";
if (SaveSecurity.Inheritance)
{
csvLn += con.Inheritance.CacheBitmaps + ";" + Convert.ToString(con.Inheritance.Colors) + ";" + Convert.ToString(con.Inheritance.Description) + ";" + Convert.ToString(con.Inheritance.DisplayThemes) + ";" + Convert.ToString(con.Inheritance.DisplayWallpaper) + ";" + Convert.ToString(con.Inheritance.EnableFontSmoothing) + ";" + Convert.ToString(con.Inheritance.EnableDesktopComposition) + ";" + Convert.ToString(con.Inheritance.Domain) + ";" + Convert.ToString(con.Inheritance.Icon) + ";" + Convert.ToString(con.Inheritance.Panel) + ";" + Convert.ToString(con.Inheritance.Password) + ";" + Convert.ToString(con.Inheritance.Port) + ";" + Convert.ToString(con.Inheritance.Protocol) + ";" + Convert.ToString(con.Inheritance.PuttySession) + ";" + Convert.ToString(con.Inheritance.RedirectDiskDrives) + ";" + Convert.ToString(con.Inheritance.RedirectKeys) + ";" + Convert.ToString(con.Inheritance.RedirectPorts) + ";" + Convert.ToString(con.Inheritance.RedirectPrinters) + ";" + Convert.ToString(con.Inheritance.RedirectSmartCards) + ";" + Convert.ToString(con.Inheritance.RedirectSound) + ";" + Convert.ToString(con.Inheritance.Resolution) + ";" + Convert.ToString(con.Inheritance.AutomaticResize) + ";" + Convert.ToString(con.Inheritance.UseConsoleSession) + ";" + Convert.ToString(con.Inheritance.UseCredSsp) + ";" + Convert.ToString(con.Inheritance.RenderingEngine) + ";" + Convert.ToString(con.Inheritance.Username) + ";" + Convert.ToString(con.Inheritance.ICAEncryption) + ";" + Convert.ToString(con.Inheritance.RDPAuthenticationLevel) + ";" + Convert.ToString(con.Inheritance.LoadBalanceInfo) + ";" + Convert.ToString(con.Inheritance.PreExtApp) + ";" + Convert.ToString(con.Inheritance.PostExtApp) + ";" + Convert.ToString(con.Inheritance.MacAddress) + ";" + Convert.ToString(con.Inheritance.UserField) + ";" + Convert.ToString(con.Inheritance.ExtApp) + ";" + Convert.ToString(con.Inheritance.VNCCompression) + ";"
csvLn += con.Inheritance.CacheBitmaps + ";" + Convert.ToString(con.Inheritance.Colors) + ";" + Convert.ToString(con.Inheritance.Description) + ";" + Convert.ToString(con.Inheritance.DisplayThemes) + ";" + Convert.ToString(con.Inheritance.DisplayWallpaper) + ";" + Convert.ToString(con.Inheritance.EnableFontSmoothing) + ";" + Convert.ToString(con.Inheritance.EnableDesktopComposition) + ";" + Convert.ToString(con.Inheritance.Domain) + ";" + Convert.ToString(con.Inheritance.Icon) + ";" + Convert.ToString(con.Inheritance.Panel) + ";" + Convert.ToString(con.Inheritance.Password) + ";" + Convert.ToString(con.Inheritance.Port) + ";" + Convert.ToString(con.Inheritance.Protocol) + ";" + Convert.ToString(con.Inheritance.PuttySession) + ";" + Convert.ToString(con.Inheritance.RedirectDiskDrives) + ";" + Convert.ToString(con.Inheritance.RedirectKeys) + ";" + Convert.ToString(con.Inheritance.RedirectPorts) + ";" + Convert.ToString(con.Inheritance.RedirectPrinters) + ";" + Convert.ToString(con.Inheritance.RedirectSmartCards) + ";" + Convert.ToString(con.Inheritance.RedirectSound) + ";" + Convert.ToString(con.Inheritance.Resolution) + ";" + Convert.ToString(con.Inheritance.AutomaticResize) + ";" + Convert.ToString(con.Inheritance.UseConsoleSession) + ";" + Convert.ToString(con.Inheritance.UseCredSsp) + ";" + Convert.ToString(con.Inheritance.RenderingEngine) + ";" + Convert.ToString(con.Inheritance.Username) + ";" + Convert.ToString(con.Inheritance.ICAEncryptionStrength) + ";" + Convert.ToString(con.Inheritance.RDPAuthenticationLevel) + ";" + Convert.ToString(con.Inheritance.LoadBalanceInfo) + ";" + Convert.ToString(con.Inheritance.PreExtApp) + ";" + Convert.ToString(con.Inheritance.PostExtApp) + ";" + Convert.ToString(con.Inheritance.MacAddress) + ";" + Convert.ToString(con.Inheritance.UserField) + ";" + Convert.ToString(con.Inheritance.ExtApp) + ";" + Convert.ToString(con.Inheritance.VNCCompression) + ";"
+ Convert.ToString(con.Inheritance.VNCEncoding) + ";" + Convert.ToString(con.Inheritance.VNCAuthMode) + ";" + Convert.ToString(con.Inheritance.VNCProxyType) + ";" + Convert.ToString(con.Inheritance.VNCProxyIP) + ";" + Convert.ToString(con.Inheritance.VNCProxyPort) + ";" + Convert.ToString(con.Inheritance.VNCProxyUsername) + ";" + Convert.ToString(con.Inheritance.VNCProxyPassword) + ";" + Convert.ToString(con.Inheritance.VNCColors) + ";" + Convert.ToString(con.Inheritance.VNCSmartSizeMode) + ";" + Convert.ToString(con.Inheritance.VNCViewOnly);
}
@@ -1051,12 +1054,10 @@ namespace mRemoteNG.Config.Connections
{
return;
}
TreeNode tN = default(TreeNode);
tN = (TreeNode)RootTreeNode.Clone();
TreeNodeCollection tNC = default(TreeNodeCollection);
tNC = tN.Nodes;
var tN = (TreeNode)RootTreeNode.Clone();
var tNC = tN.Nodes;
csvWr = new StreamWriter(ConnectionFileName);
@@ -1089,9 +1090,9 @@ namespace mRemoteNG.Config.Connections
{
string nodePath = con.TreeNode.FullPath;
int firstSlash = nodePath.IndexOf("\\");
int firstSlash = nodePath.IndexOf("\\", StringComparison.Ordinal);
nodePath = nodePath.Remove(0, firstSlash + 1);
int lastSlash = nodePath.LastIndexOf("\\");
int lastSlash = nodePath.LastIndexOf("\\", StringComparison.Ordinal);
if (lastSlash > 0)
{
@@ -1113,12 +1114,10 @@ namespace mRemoteNG.Config.Connections
{
return;
}
TreeNode tN = default(TreeNode);
tN = (TreeNode)RootTreeNode.Clone();
TreeNodeCollection tNC = default(TreeNodeCollection);
tNC = tN.Nodes;
var tN = (TreeNode)RootTreeNode.Clone();
var tNC = tN.Nodes;
_xmlTextWriter = new XmlTextWriter(ConnectionFileName, Encoding.UTF8);
_xmlTextWriter.Formatting = Formatting.Indented;

View File

@@ -0,0 +1,510 @@
using System;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Security;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.Http;
using mRemoteNG.Connection.Protocol.ICA;
using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Connection.Protocol.VNC;
using mRemoteNG.Container;
using mRemoteNG.Messages;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.TaskDialog;
namespace mRemoteNG.Config.Connections
{
public class SqlConnectionsLoader
{
private SqlConnection _sqlConnection;
private SqlCommand _sqlQuery;
private SqlDataReader _sqlDataReader;
private TreeNode _selectedTreeNode;
private double _confVersion;
private SecureString _pW = GeneralAppInfo.EncryptionKey;
public string DatabaseHost { get; set; }
public string DatabaseName { get; set; }
public string DatabaseUsername { get; set; }
public string DatabasePassword { get; set; }
public bool DatabaseUpdate { get; set; }
public string PreviousSelected { get; set; }
public TreeNode RootTreeNode { get; set; }
public ConnectionList ConnectionList { get; set; }
public ContainerList ContainerList { get; set; }
public ConnectionList PreviousConnectionList { get; set; }
public ContainerList PreviousContainerList { get; set; }
private delegate void LoadFromSqlDelegate();
public void LoadFromSql()
{
if (Windows.treeForm == null || Windows.treeForm.tvConnections == null)
return;
if (Windows.treeForm.tvConnections.InvokeRequired)
{
Windows.treeForm.tvConnections.Invoke(new LoadFromSqlDelegate(LoadFromSql));
return;
}
try
{
Runtime.IsConnectionsFileLoaded = false;
_sqlConnection = !string.IsNullOrEmpty(DatabaseUsername) ? new SqlConnection("Data Source=" + DatabaseHost + ";Initial Catalog=" + DatabaseName + ";User Id=" + DatabaseUsername + ";Password=" + DatabasePassword) : new SqlConnection("Data Source=" + DatabaseHost + ";Initial Catalog=" + DatabaseName + ";Integrated Security=True");
_sqlConnection.Open();
_sqlQuery = new SqlCommand("SELECT * FROM tblRoot", _sqlConnection);
_sqlDataReader = _sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
_sqlDataReader.Read();
if (_sqlDataReader.HasRows == false)
{
Runtime.SaveConnections();
_sqlQuery = new SqlCommand("SELECT * FROM tblRoot", _sqlConnection);
_sqlDataReader = _sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
_sqlDataReader.Read();
}
_confVersion = Convert.ToDouble(_sqlDataReader["confVersion"], CultureInfo.InvariantCulture);
const double maxSupportedSchemaVersion = 2.5;
if (_confVersion > maxSupportedSchemaVersion)
{
CTaskDialog.ShowTaskDialogBox(
frmMain.Default,
Application.ProductName,
"Incompatible database schema",
$"The database schema on the server is not supported. Please upgrade to a newer version of {Application.ProductName}.",
string.Format("Schema Version: {1}{0}Highest Supported Version: {2}", Environment.NewLine, _confVersion, maxSupportedSchemaVersion),
"",
"",
"",
"",
ETaskDialogButtons.Ok,
ESysIcons.Error,
ESysIcons.Error
);
throw (new Exception($"Incompatible database schema (schema version {_confVersion})."));
}
RootTreeNode.Name = Convert.ToString(_sqlDataReader["Name"]);
var rootInfo = new RootNodeInfo(RootNodeType.Connection)
{
Name = RootTreeNode.Name,
TreeNode = RootTreeNode
};
RootTreeNode.Tag = rootInfo;
RootTreeNode.ImageIndex = (int)TreeImageType.Root;
RootTreeNode.SelectedImageIndex = (int)TreeImageType.Root;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
if (cryptographyProvider.Decrypt(Convert.ToString(_sqlDataReader["Protected"]), _pW) != "ThisIsNotProtected")
{
if (Authenticate(Convert.ToString(_sqlDataReader["Protected"]), false, rootInfo) == false)
{
mRemoteNG.Settings.Default.LoadConsFromCustomLocation = false;
mRemoteNG.Settings.Default.CustomConsPath = "";
RootTreeNode.Remove();
return;
}
}
_sqlDataReader.Close();
Windows.treeForm.tvConnections.BeginUpdate();
// SECTION 3. Populate the TreeView with the DOM nodes.
AddNodesFromSql(RootTreeNode);
RootTreeNode.Expand();
//expand containers
foreach (ContainerInfo contI in ContainerList)
{
if (contI.IsExpanded)
contI.TreeNode.Expand();
}
Windows.treeForm.tvConnections.EndUpdate();
//open connections from last mremote session
if (mRemoteNG.Settings.Default.OpenConsFromLastSession && !mRemoteNG.Settings.Default.NoReconnect)
{
foreach (ConnectionInfo conI in ConnectionList)
{
if (conI.PleaseConnect)
Runtime.OpenConnection(conI);
}
}
Runtime.IsConnectionsFileLoaded = true;
Windows.treeForm.InitialRefresh();
SetSelectedNode(_selectedTreeNode);
}
finally
{
_sqlConnection?.Close();
}
}
private void AddNodesFromSql(TreeNode baseNode)
{
try
{
_sqlConnection.Open();
_sqlQuery = new SqlCommand("SELECT * FROM tblCons ORDER BY PositionID ASC", _sqlConnection);
_sqlDataReader = _sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
if (_sqlDataReader.HasRows == false)
return;
while (_sqlDataReader.Read())
{
var tNode = new TreeNode(Convert.ToString(_sqlDataReader["Name"]));
var nodeType = ConnectionTreeNode.GetNodeTypeFromString(Convert.ToString(_sqlDataReader["Type"]));
if (nodeType == TreeNodeType.Connection)
AddConnectionToList(tNode);
else if (nodeType == TreeNodeType.Container)
AddContainerToList(tNode);
var parentId = Convert.ToString(_sqlDataReader["ParentID"].ToString().Trim());
if (string.IsNullOrEmpty(parentId) || parentId == "0")
{
baseNode.Nodes.Add(tNode);
}
else
{
var pNode = ConnectionTreeNode.GetNodeFromConstantID(Convert.ToString(_sqlDataReader["ParentID"]));
if (pNode != null)
{
pNode.Nodes.Add(tNode);
switch (ConnectionTreeNode.GetNodeType(tNode))
{
case TreeNodeType.Connection:
((ConnectionInfo) tNode.Tag).Parent = (ContainerInfo)pNode.Tag;
break;
case TreeNodeType.Container:
((ContainerInfo) tNode.Tag).Parent = (ContainerInfo)pNode.Tag;
break;
}
}
else
{
baseNode.Nodes.Add(tNode);
}
}
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strAddNodesFromSqlFailed + Environment.NewLine + ex.Message, true);
}
}
private void AddConnectionToList(TreeNode tNode)
{
var conI = GetConnectionInfoFromSql();
conI.TreeNode = tNode;
ConnectionList.Add(conI);
tNode.Tag = conI;
if (DatabaseUpdate)
{
var prevCon = PreviousConnectionList.FindByConstantID(conI.ConstantID);
if (prevCon != null)
{
foreach (ProtocolBase prot in prevCon.OpenConnections)
{
prot.InterfaceControl.Info = conI;
conI.OpenConnections.Add(prot);
}
if (conI.OpenConnections.Count > 0)
{
tNode.ImageIndex = (int) TreeImageType.ConnectionOpen;
tNode.SelectedImageIndex = (int) TreeImageType.ConnectionOpen;
}
else
{
tNode.ImageIndex = (int) TreeImageType.ConnectionClosed;
tNode.SelectedImageIndex = (int) TreeImageType.ConnectionClosed;
}
}
else
{
tNode.ImageIndex = (int) TreeImageType.ConnectionClosed;
tNode.SelectedImageIndex = (int) TreeImageType.ConnectionClosed;
}
if (conI.ConstantID == PreviousSelected)
_selectedTreeNode = tNode;
}
else
{
tNode.ImageIndex = (int) TreeImageType.ConnectionClosed;
tNode.SelectedImageIndex = (int) TreeImageType.ConnectionClosed;
}
}
private void AddContainerToList(TreeNode tNode)
{
var contI = new ContainerInfo
{
TreeNode = tNode,
Name = Convert.ToString(_sqlDataReader["Name"])
};
var conI = GetConnectionInfoFromSql();
conI.Parent = contI;
conI.IsContainer = true;
contI.ConnectionInfo = conI;
if (DatabaseUpdate)
{
var prevCont = PreviousContainerList.FindByConstantID(conI.ConstantID);
if (prevCont != null)
contI.IsExpanded = prevCont.IsExpanded;
if (conI.ConstantID == PreviousSelected)
_selectedTreeNode = tNode;
}
else
{
contI.IsExpanded = Convert.ToBoolean(_sqlDataReader["Expanded"]);
}
ContainerList.Add(contI);
ConnectionList.Add(conI);
tNode.Tag = contI;
tNode.ImageIndex = (int)TreeImageType.Container;
tNode.SelectedImageIndex = (int)TreeImageType.Container;
}
private ConnectionInfo GetConnectionInfoFromSql()
{
try
{
var connectionInfo = new ConnectionInfo
{
PositionID = Convert.ToInt32(_sqlDataReader["PositionID"]),
ConstantID = Convert.ToString(_sqlDataReader["ConstantID"]),
Name = Convert.ToString(_sqlDataReader["Name"]),
Description = Convert.ToString(_sqlDataReader["Description"]),
Hostname = Convert.ToString(_sqlDataReader["Hostname"]),
Username = Convert.ToString(_sqlDataReader["Username"])
};
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
connectionInfo.Password = cryptographyProvider.Decrypt(Convert.ToString(_sqlDataReader["Password"]), _pW);
connectionInfo.Domain = Convert.ToString(_sqlDataReader["DomainName"]);
connectionInfo.DisplayWallpaper = Convert.ToBoolean(_sqlDataReader["DisplayWallpaper"]);
connectionInfo.DisplayThemes = Convert.ToBoolean(_sqlDataReader["DisplayThemes"]);
connectionInfo.CacheBitmaps = Convert.ToBoolean(_sqlDataReader["CacheBitmaps"]);
connectionInfo.UseConsoleSession = Convert.ToBoolean(_sqlDataReader["ConnectToConsole"]);
connectionInfo.RedirectDiskDrives = Convert.ToBoolean(_sqlDataReader["RedirectDiskDrives"]);
connectionInfo.RedirectPrinters = Convert.ToBoolean(_sqlDataReader["RedirectPrinters"]);
connectionInfo.RedirectPorts = Convert.ToBoolean(_sqlDataReader["RedirectPorts"]);
connectionInfo.RedirectSmartCards = Convert.ToBoolean(_sqlDataReader["RedirectSmartCards"]);
connectionInfo.RedirectKeys = Convert.ToBoolean(_sqlDataReader["RedirectKeys"]);
connectionInfo.RedirectSound = (ProtocolRDP.RDPSounds)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPSounds), Convert.ToString(_sqlDataReader["RedirectSound"]));
connectionInfo.Protocol = (ProtocolType)Tools.MiscTools.StringToEnum(typeof(ProtocolType), Convert.ToString(_sqlDataReader["Protocol"]));
connectionInfo.Port = Convert.ToInt32(_sqlDataReader["Port"]);
connectionInfo.PuttySession = Convert.ToString(_sqlDataReader["PuttySession"]);
connectionInfo.Colors = (ProtocolRDP.RDPColors)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPColors), Convert.ToString(_sqlDataReader["Colors"]));
connectionInfo.Resolution = (ProtocolRDP.RDPResolutions)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPResolutions), Convert.ToString(_sqlDataReader["Resolution"]));
connectionInfo.Icon = Convert.ToString(_sqlDataReader["Icon"]);
connectionInfo.Panel = Convert.ToString(_sqlDataReader["Panel"]);
connectionInfo.Inheritance = new ConnectionInfoInheritance(connectionInfo)
{
CacheBitmaps = Convert.ToBoolean(_sqlDataReader["InheritCacheBitmaps"]),
Colors = Convert.ToBoolean(_sqlDataReader["InheritColors"]),
Description = Convert.ToBoolean(_sqlDataReader["InheritDescription"]),
DisplayThemes = Convert.ToBoolean(_sqlDataReader["InheritDisplayThemes"]),
DisplayWallpaper = Convert.ToBoolean(_sqlDataReader["InheritDisplayWallpaper"]),
Domain = Convert.ToBoolean(_sqlDataReader["InheritDomain"]),
Icon = Convert.ToBoolean(_sqlDataReader["InheritIcon"]),
Panel = Convert.ToBoolean(_sqlDataReader["InheritPanel"]),
Password = Convert.ToBoolean(_sqlDataReader["InheritPassword"]),
Port = Convert.ToBoolean(_sqlDataReader["InheritPort"]),
Protocol = Convert.ToBoolean(_sqlDataReader["InheritProtocol"]),
PuttySession = Convert.ToBoolean(_sqlDataReader["InheritPuttySession"]),
RedirectDiskDrives = Convert.ToBoolean(_sqlDataReader["InheritRedirectDiskDrives"]),
RedirectKeys = Convert.ToBoolean(_sqlDataReader["InheritRedirectKeys"]),
RedirectPorts = Convert.ToBoolean(_sqlDataReader["InheritRedirectPorts"]),
RedirectPrinters = Convert.ToBoolean(_sqlDataReader["InheritRedirectPrinters"]),
RedirectSmartCards = Convert.ToBoolean(_sqlDataReader["InheritRedirectSmartCards"]),
RedirectSound = Convert.ToBoolean(_sqlDataReader["InheritRedirectSound"]),
Resolution = Convert.ToBoolean(_sqlDataReader["InheritResolution"]),
UseConsoleSession = Convert.ToBoolean(_sqlDataReader["InheritUseConsoleSession"]),
Username = Convert.ToBoolean(_sqlDataReader["InheritUsername"])
};
if (_confVersion > 1.5) //1.6
{
connectionInfo.ICAEncryptionStrength = (ProtocolICA.EncryptionStrength)Tools.MiscTools.StringToEnum(typeof(ProtocolICA.EncryptionStrength), Convert.ToString(_sqlDataReader["ICAEncryptionStrength"]));
connectionInfo.Inheritance.ICAEncryptionStrength = Convert.ToBoolean(_sqlDataReader["InheritICAEncryptionStrength"]);
connectionInfo.PreExtApp = Convert.ToString(_sqlDataReader["PreExtApp"]);
connectionInfo.PostExtApp = Convert.ToString(_sqlDataReader["PostExtApp"]);
connectionInfo.Inheritance.PreExtApp = Convert.ToBoolean(_sqlDataReader["InheritPreExtApp"]);
connectionInfo.Inheritance.PostExtApp = Convert.ToBoolean(_sqlDataReader["InheritPostExtApp"]);
}
if (_confVersion > 1.6) //1.7
{
connectionInfo.VNCCompression = (ProtocolVNC.Compression)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Compression), Convert.ToString(_sqlDataReader["VNCCompression"]));
connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Encoding), Convert.ToString(_sqlDataReader["VNCEncoding"]));
connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.AuthMode), Convert.ToString(_sqlDataReader["VNCAuthMode"]));
connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.ProxyType), Convert.ToString(_sqlDataReader["VNCProxyType"]));
connectionInfo.VNCProxyIP = Convert.ToString(_sqlDataReader["VNCProxyIP"]);
connectionInfo.VNCProxyPort = Convert.ToInt32(_sqlDataReader["VNCProxyPort"]);
connectionInfo.VNCProxyUsername = Convert.ToString(_sqlDataReader["VNCProxyUsername"]);
connectionInfo.VNCProxyPassword = cryptographyProvider.Decrypt(Convert.ToString(_sqlDataReader["VNCProxyPassword"]), _pW);
connectionInfo.VNCColors = (ProtocolVNC.Colors)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Colors), Convert.ToString(_sqlDataReader["VNCColors"]));
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.SmartSizeMode), Convert.ToString(_sqlDataReader["VNCSmartSizeMode"]));
connectionInfo.VNCViewOnly = Convert.ToBoolean(_sqlDataReader["VNCViewOnly"]);
connectionInfo.Inheritance.VNCCompression = Convert.ToBoolean(_sqlDataReader["InheritVNCCompression"]);
connectionInfo.Inheritance.VNCEncoding = Convert.ToBoolean(_sqlDataReader["InheritVNCEncoding"]);
connectionInfo.Inheritance.VNCAuthMode = Convert.ToBoolean(_sqlDataReader["InheritVNCAuthMode"]);
connectionInfo.Inheritance.VNCProxyType = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyType"]);
connectionInfo.Inheritance.VNCProxyIP = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyIP"]);
connectionInfo.Inheritance.VNCProxyPort = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyPort"]);
connectionInfo.Inheritance.VNCProxyUsername = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyUsername"]);
connectionInfo.Inheritance.VNCProxyPassword = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyPassword"]);
connectionInfo.Inheritance.VNCColors = Convert.ToBoolean(_sqlDataReader["InheritVNCColors"]);
connectionInfo.Inheritance.VNCSmartSizeMode = Convert.ToBoolean(_sqlDataReader["InheritVNCSmartSizeMode"]);
connectionInfo.Inheritance.VNCViewOnly = Convert.ToBoolean(_sqlDataReader["InheritVNCViewOnly"]);
}
if (_confVersion > 1.7) //1.8
{
connectionInfo.RDPAuthenticationLevel = (ProtocolRDP.AuthenticationLevel)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.AuthenticationLevel), Convert.ToString(_sqlDataReader["RDPAuthenticationLevel"]));
connectionInfo.Inheritance.RDPAuthenticationLevel = Convert.ToBoolean(_sqlDataReader["InheritRDPAuthenticationLevel"]);
}
if (_confVersion > 1.8) //1.9
{
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Tools.MiscTools.StringToEnum(typeof(HTTPBase.RenderingEngine), Convert.ToString(_sqlDataReader["RenderingEngine"]));
connectionInfo.MacAddress = Convert.ToString(_sqlDataReader["MacAddress"]);
connectionInfo.Inheritance.RenderingEngine = Convert.ToBoolean(_sqlDataReader["InheritRenderingEngine"]);
connectionInfo.Inheritance.MacAddress = Convert.ToBoolean(_sqlDataReader["InheritMacAddress"]);
}
if (_confVersion > 1.9) //2.0
{
connectionInfo.UserField = Convert.ToString(_sqlDataReader["UserField"]);
connectionInfo.Inheritance.UserField = Convert.ToBoolean(_sqlDataReader["InheritUserField"]);
}
if (_confVersion > 2.0) //2.1
{
connectionInfo.ExtApp = Convert.ToString(_sqlDataReader["ExtApp"]);
connectionInfo.Inheritance.ExtApp = Convert.ToBoolean(_sqlDataReader["InheritExtApp"]);
}
if (_confVersion >= 2.2)
{
connectionInfo.RDGatewayUsageMethod = (ProtocolRDP.RDGatewayUsageMethod)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUsageMethod), Convert.ToString(_sqlDataReader["RDGatewayUsageMethod"]));
connectionInfo.RDGatewayHostname = Convert.ToString(_sqlDataReader["RDGatewayHostname"]);
connectionInfo.RDGatewayUseConnectionCredentials = (ProtocolRDP.RDGatewayUseConnectionCredentials)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUseConnectionCredentials), Convert.ToString(_sqlDataReader["RDGatewayUseConnectionCredentials"]));
connectionInfo.RDGatewayUsername = Convert.ToString(_sqlDataReader["RDGatewayUsername"]);
connectionInfo.RDGatewayPassword = cryptographyProvider.Decrypt(Convert.ToString(_sqlDataReader["RDGatewayPassword"]), _pW);
connectionInfo.RDGatewayDomain = Convert.ToString(_sqlDataReader["RDGatewayDomain"]);
connectionInfo.Inheritance.RDGatewayUsageMethod = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayUsageMethod"]);
connectionInfo.Inheritance.RDGatewayHostname = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayHostname"]);
connectionInfo.Inheritance.RDGatewayUsername = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayUsername"]);
connectionInfo.Inheritance.RDGatewayPassword = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayPassword"]);
connectionInfo.Inheritance.RDGatewayDomain = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayDomain"]);
}
if (_confVersion >= 2.3)
{
connectionInfo.EnableFontSmoothing = Convert.ToBoolean(_sqlDataReader["EnableFontSmoothing"]);
connectionInfo.EnableDesktopComposition = Convert.ToBoolean(_sqlDataReader["EnableDesktopComposition"]);
connectionInfo.Inheritance.EnableFontSmoothing = Convert.ToBoolean(_sqlDataReader["InheritEnableFontSmoothing"]);
connectionInfo.Inheritance.EnableDesktopComposition = Convert.ToBoolean(_sqlDataReader["InheritEnableDesktopComposition"]);
}
if (_confVersion >= 2.4)
{
connectionInfo.UseCredSsp = Convert.ToBoolean(_sqlDataReader["UseCredSsp"]);
connectionInfo.Inheritance.UseCredSsp = Convert.ToBoolean(_sqlDataReader["InheritUseCredSsp"]);
}
if (_confVersion >= 2.5)
{
connectionInfo.LoadBalanceInfo = Convert.ToString(_sqlDataReader["LoadBalanceInfo"]);
connectionInfo.AutomaticResize = Convert.ToBoolean(_sqlDataReader["AutomaticResize"]);
connectionInfo.Inheritance.LoadBalanceInfo = Convert.ToBoolean(_sqlDataReader["InheritLoadBalanceInfo"]);
connectionInfo.Inheritance.AutomaticResize = Convert.ToBoolean(_sqlDataReader["InheritAutomaticResize"]);
}
if (DatabaseUpdate)
connectionInfo.PleaseConnect = Convert.ToBoolean(_sqlDataReader["Connected"]);
return connectionInfo;
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strGetConnectionInfoFromSqlFailed + Environment.NewLine + ex.Message, true);
}
return null;
}
private delegate void SetSelectedNodeDelegate(TreeNode treeNode);
private static void SetSelectedNode(TreeNode treeNode)
{
if (ConnectionTree.TreeView != null && ConnectionTree.TreeView.InvokeRequired)
{
Windows.treeForm.Invoke(new SetSelectedNodeDelegate(SetSelectedNode), treeNode);
return;
}
Windows.treeForm.tvConnections.SelectedNode = treeNode;
}
private bool Authenticate(string value, bool compareToOriginalValue, RootNodeInfo rootInfo = null)
{
var passwordName = "";
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
passwordName = Language.strSQLServer.TrimEnd(':');
if (compareToOriginalValue)
{
while (cryptographyProvider.Decrypt(value, _pW) == value)
{
_pW = Tools.MiscTools.PasswordDialog(passwordName, false);
if (_pW.Length == 0)
return false;
}
}
else
{
while (cryptographyProvider.Decrypt(value, _pW) != "ThisIsProtected")
{
_pW = Tools.MiscTools.PasswordDialog(passwordName, false);
if (_pW.Length == 0)
return false;
}
if (rootInfo == null) return true;
rootInfo.Password = true;
rootInfo.PasswordString = _pW.ConvertToUnsecureString();
}
return true;
}
}
}

View File

@@ -0,0 +1,650 @@
using System;
using System.Globalization;
using System.IO;
using System.Security;
using System.Windows.Forms;
using System.Xml;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Connection.Protocol.Http;
using mRemoteNG.Connection.Protocol.ICA;
using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Connection.Protocol.VNC;
using mRemoteNG.Container;
using mRemoteNG.Messages;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.TaskDialog;
namespace mRemoteNG.Config.Connections
{
public class XmlConnectionsLoader
{
private XmlDocument _xmlDocument;
private double _confVersion;
private SecureString _pW = GeneralAppInfo.EncryptionKey;
private ContainerInfo _previousContainer;
public string ConnectionFileName { get; set; }
public TreeNode RootTreeNode { get; set; }
public ConnectionList ConnectionList { get; set; }
public ContainerList ContainerList { get; set; }
public void LoadFromXml(bool import)
{
try
{
if (!import)
Runtime.IsConnectionsFileLoaded = false;
// SECTION 1. Create a DOM Document and load the XML data into it.
LoadXmlConnectionData();
ValidateConnectionFileVersion();
// SECTION 2. Initialize the treeview control.
var rootInfo = InitializeRootNode();
if (!ConnectionsFileIsAuthentic(rootInfo)) return;
if (import && !IsExportFile())
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strCannotImportNormalSessionFile);
return;
}
if (!IsExportFile())
{
RootTreeNode.ImageIndex = (int)TreeImageType.Root;
RootTreeNode.SelectedImageIndex = (int)TreeImageType.Root;
}
// SECTION 3. Populate the TreeView with the DOM nodes.
PopulateTreeview();
RootTreeNode.EnsureVisible();
Windows.treeForm.InitialRefresh();
SetSelectedNode(RootTreeNode);
//open connections from last mremote session
OpenConnectionsFromLastSession();
if (!import)
Runtime.IsConnectionsFileLoaded = true;
}
catch (Exception ex)
{
Runtime.IsConnectionsFileLoaded = false;
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strLoadFromXmlFailed + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace, true);
throw;
}
}
private bool ConnectionsFileIsAuthentic(RootNodeInfo rootInfo)
{
if (!(_confVersion > 1.3)) return true;
var protectedString = _xmlDocument.DocumentElement.Attributes["Protected"].Value;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
var connectionsFileIsNotEncrypted = cryptographyProvider.Decrypt(protectedString, _pW) == "ThisIsNotProtected";
if (connectionsFileIsNotEncrypted) return true;
if (Authenticate(protectedString, false, rootInfo)) return true;
mRemoteNG.Settings.Default.LoadConsFromCustomLocation = false;
mRemoteNG.Settings.Default.CustomConsPath = "";
RootTreeNode.Remove();
return false;
}
private void OpenConnectionsFromLastSession()
{
if (!mRemoteNG.Settings.Default.OpenConsFromLastSession || mRemoteNG.Settings.Default.NoReconnect) return;
foreach (ConnectionInfo conI in ConnectionList)
{
if (conI.PleaseConnect)
Runtime.OpenConnection(conI);
}
}
private void PopulateTreeview()
{
Windows.treeForm.tvConnections.BeginUpdate();
AddNodeFromXml(_xmlDocument.DocumentElement, RootTreeNode);
RootTreeNode.Expand();
ExpandPreviouslyOpenedFolders();
Windows.treeForm.tvConnections.EndUpdate();
}
private void AddNodeFromXml(XmlNode parentXmlNode, TreeNode parentTreeNode)
{
try
{
// Loop through the XML nodes until the leaf is reached.
// Add the nodes to the TreeView during the looping process.
if (parentXmlNode.HasChildNodes)
{
foreach (XmlNode xmlNode in parentXmlNode.ChildNodes)
{
var treeNode = new TreeNode(xmlNode.Attributes?["Name"].Value);
parentTreeNode.Nodes.Add(treeNode);
var nodeType = ConnectionTreeNode.GetNodeTypeFromString(xmlNode.Attributes?["Type"].Value);
if (nodeType == TreeNodeType.Connection)
AddConnectionToList(xmlNode, treeNode);
else if (nodeType == TreeNodeType.Container)
AddContainerToList(xmlNode, treeNode);
AddNodeFromXml(xmlNode, treeNode);
}
}
else
{
var nameAttribute = parentXmlNode.Attributes?["Name"];
var nodeName = nameAttribute?.Value.Trim();
parentTreeNode.Text = !string.IsNullOrEmpty(nodeName) ? nodeName : parentXmlNode.Name;
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strAddNodeFromXmlFailed + Environment.NewLine + ex.Message + ex.StackTrace, true);
throw;
}
}
private void AddConnectionToList(XmlNode xmlNode, TreeNode treeNode)
{
var connectionInfo = GetConnectionInfoFromXml(xmlNode);
connectionInfo.TreeNode = treeNode;
connectionInfo.Parent = _previousContainer; //NEW
ConnectionList.Add(connectionInfo);
treeNode.Tag = connectionInfo;
treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed;
treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed;
}
private void AddContainerToList(XmlNode xmlNode, TreeNode treeNode)
{
var containerInfo = new ContainerInfo();
if (treeNode.Parent != null)
{
if (ConnectionTreeNode.GetNodeType(treeNode.Parent) == TreeNodeType.Container)
containerInfo.Parent = (ContainerInfo) treeNode.Parent.Tag;
}
_previousContainer = containerInfo; //NEW
containerInfo.TreeNode = treeNode;
containerInfo.Name = xmlNode.Attributes["Name"].Value;
if (_confVersion >= 0.8)
{
containerInfo.IsExpanded = xmlNode.Attributes["Expanded"].Value == "True";
}
var connectionInfo = _confVersion >= 0.9 ? GetConnectionInfoFromXml(xmlNode) : new ConnectionInfo();
connectionInfo.Parent = containerInfo;
connectionInfo.IsContainer = true;
containerInfo.ConnectionInfo = connectionInfo;
ContainerList.Add(containerInfo);
treeNode.Tag = containerInfo;
treeNode.ImageIndex = (int) TreeImageType.Container;
treeNode.SelectedImageIndex = (int) TreeImageType.Container;
}
private ConnectionInfo GetConnectionInfoFromXml(XmlNode xxNode)
{
var connectionInfo = new ConnectionInfo();
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
try
{
var xmlnode = xxNode;
if (_confVersion > 0.1) //0.2
{
connectionInfo.Name = xmlnode.Attributes["Name"].Value;
connectionInfo.Description = xmlnode.Attributes["Descr"].Value;
connectionInfo.Hostname = xmlnode.Attributes["Hostname"].Value;
connectionInfo.Username = xmlnode.Attributes["Username"].Value;
connectionInfo.Password = cryptographyProvider.Decrypt(xmlnode.Attributes["Password"].Value, _pW);
connectionInfo.Domain = xmlnode.Attributes["Domain"].Value;
connectionInfo.DisplayWallpaper = bool.Parse(xmlnode.Attributes["DisplayWallpaper"].Value);
connectionInfo.DisplayThemes = bool.Parse(xmlnode.Attributes["DisplayThemes"].Value);
connectionInfo.CacheBitmaps = bool.Parse(xmlnode.Attributes["CacheBitmaps"].Value);
if (_confVersion < 1.1) //1.0 - 0.1
{
connectionInfo.Resolution = Convert.ToBoolean(xmlnode.Attributes["Fullscreen"].Value) ? ProtocolRDP.RDPResolutions.Fullscreen : ProtocolRDP.RDPResolutions.FitToWindow;
}
}
if (_confVersion > 0.2) //0.3
{
if (_confVersion < 0.7)
{
if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value))
{
connectionInfo.Protocol = ProtocolType.VNC;
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value);
}
else
{
connectionInfo.Protocol = ProtocolType.RDP;
}
}
}
else
{
connectionInfo.Port = (int)ProtocolRDP.Defaults.Port;
connectionInfo.Protocol = ProtocolType.RDP;
}
if (_confVersion > 0.3) //0.4
{
if (_confVersion < 0.7)
{
if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value))
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value);
else
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["RDPPort"].Value);
}
connectionInfo.UseConsoleSession = bool.Parse(xmlnode.Attributes["ConnectToConsole"].Value);
}
else
{
if (_confVersion < 0.7)
{
if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value))
connectionInfo.Port = (int)ProtocolVNC.Defaults.Port;
else
connectionInfo.Port = (int)ProtocolRDP.Defaults.Port;
}
connectionInfo.UseConsoleSession = false;
}
if (_confVersion > 0.4) //0.5 and 0.6
{
connectionInfo.RedirectDiskDrives = bool.Parse(xmlnode.Attributes["RedirectDiskDrives"].Value);
connectionInfo.RedirectPrinters = bool.Parse(xmlnode.Attributes["RedirectPrinters"].Value);
connectionInfo.RedirectPorts = bool.Parse(xmlnode.Attributes["RedirectPorts"].Value);
connectionInfo.RedirectSmartCards = bool.Parse(xmlnode.Attributes["RedirectSmartCards"].Value);
}
else
{
connectionInfo.RedirectDiskDrives = false;
connectionInfo.RedirectPrinters = false;
connectionInfo.RedirectPorts = false;
connectionInfo.RedirectSmartCards = false;
}
if (_confVersion > 0.6) //0.7
{
connectionInfo.Protocol = (ProtocolType)Tools.MiscTools.StringToEnum(typeof(ProtocolType), xmlnode.Attributes["Protocol"].Value);
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["Port"].Value);
}
if (_confVersion > 0.9) //1.0
{
connectionInfo.RedirectKeys = bool.Parse(xmlnode.Attributes["RedirectKeys"].Value);
}
if (_confVersion > 1.1) //1.2
{
connectionInfo.PuttySession = xmlnode.Attributes["PuttySession"].Value;
}
if (_confVersion > 1.2) //1.3
{
connectionInfo.Colors = (ProtocolRDP.RDPColors)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPColors), xmlnode.Attributes["Colors"].Value);
connectionInfo.Resolution = (ProtocolRDP.RDPResolutions)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPResolutions), Convert.ToString(xmlnode.Attributes["Resolution"].Value));
connectionInfo.RedirectSound = (ProtocolRDP.RDPSounds)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPSounds), Convert.ToString(xmlnode.Attributes["RedirectSound"].Value));
}
else
{
switch (Convert.ToInt32(xmlnode.Attributes["Colors"].Value))
{
case 0:
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors256;
break;
case 1:
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors16Bit;
break;
case 2:
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors24Bit;
break;
case 3:
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors32Bit;
break;
case 4:
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors15Bit;
break;
}
connectionInfo.RedirectSound = (ProtocolRDP.RDPSounds)Convert.ToInt32(xmlnode.Attributes["RedirectSound"].Value);
}
if (_confVersion > 1.2) //1.3
{
connectionInfo.Inheritance = new ConnectionInfoInheritance(connectionInfo)
{
CacheBitmaps = bool.Parse(xmlnode.Attributes["InheritCacheBitmaps"].Value),
Colors = bool.Parse(xmlnode.Attributes["InheritColors"].Value),
Description = bool.Parse(xmlnode.Attributes["InheritDescription"].Value),
DisplayThemes = bool.Parse(xmlnode.Attributes["InheritDisplayThemes"].Value),
DisplayWallpaper = bool.Parse(xmlnode.Attributes["InheritDisplayWallpaper"].Value),
Domain = bool.Parse(xmlnode.Attributes["InheritDomain"].Value),
Icon = bool.Parse(xmlnode.Attributes["InheritIcon"].Value),
Panel = bool.Parse(xmlnode.Attributes["InheritPanel"].Value),
Password = bool.Parse(xmlnode.Attributes["InheritPassword"].Value),
Port = bool.Parse(xmlnode.Attributes["InheritPort"].Value),
Protocol = bool.Parse(xmlnode.Attributes["InheritProtocol"].Value),
PuttySession = bool.Parse(xmlnode.Attributes["InheritPuttySession"].Value),
RedirectDiskDrives = bool.Parse(xmlnode.Attributes["InheritRedirectDiskDrives"].Value),
RedirectKeys = bool.Parse(xmlnode.Attributes["InheritRedirectKeys"].Value),
RedirectPorts = bool.Parse(xmlnode.Attributes["InheritRedirectPorts"].Value),
RedirectPrinters = bool.Parse(xmlnode.Attributes["InheritRedirectPrinters"].Value),
RedirectSmartCards = bool.Parse(xmlnode.Attributes["InheritRedirectSmartCards"].Value),
RedirectSound = bool.Parse(xmlnode.Attributes["InheritRedirectSound"].Value),
Resolution = bool.Parse(xmlnode.Attributes["InheritResolution"].Value),
UseConsoleSession = bool.Parse(xmlnode.Attributes["InheritUseConsoleSession"].Value),
Username = bool.Parse(xmlnode.Attributes["InheritUsername"].Value)
};
connectionInfo.Icon = xmlnode.Attributes["Icon"].Value;
connectionInfo.Panel = xmlnode.Attributes["Panel"].Value;
}
else
{
connectionInfo.Inheritance = new ConnectionInfoInheritance(connectionInfo);
if (Convert.ToBoolean(xmlnode.Attributes["Inherit"].Value))
connectionInfo.Inheritance.TurnOnInheritanceCompletely();
connectionInfo.Icon = Convert.ToString(xmlnode.Attributes["Icon"].Value.Replace(".ico", ""));
connectionInfo.Panel = Language.strGeneral;
}
if (_confVersion > 1.4) //1.5
{
connectionInfo.PleaseConnect = bool.Parse(xmlnode.Attributes["Connected"].Value);
}
if (_confVersion > 1.5) //1.6
{
connectionInfo.ICAEncryptionStrength = (ProtocolICA.EncryptionStrength)Tools.MiscTools.StringToEnum(typeof(ProtocolICA.EncryptionStrength), xmlnode.Attributes["ICAEncryptionStrength"].Value);
connectionInfo.Inheritance.ICAEncryptionStrength = bool.Parse(xmlnode.Attributes["InheritICAEncryptionStrength"].Value);
connectionInfo.PreExtApp = xmlnode.Attributes["PreExtApp"].Value;
connectionInfo.PostExtApp = xmlnode.Attributes["PostExtApp"].Value;
connectionInfo.Inheritance.PreExtApp = bool.Parse(xmlnode.Attributes["InheritPreExtApp"].Value);
connectionInfo.Inheritance.PostExtApp = bool.Parse(xmlnode.Attributes["InheritPostExtApp"].Value);
}
if (_confVersion > 1.6) //1.7
{
connectionInfo.VNCCompression = (ProtocolVNC.Compression)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Compression), xmlnode.Attributes["VNCCompression"].Value);
connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Encoding), Convert.ToString(xmlnode.Attributes["VNCEncoding"].Value));
connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.AuthMode), xmlnode.Attributes["VNCAuthMode"].Value);
connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.ProxyType), xmlnode.Attributes["VNCProxyType"].Value);
connectionInfo.VNCProxyIP = xmlnode.Attributes["VNCProxyIP"].Value;
connectionInfo.VNCProxyPort = Convert.ToInt32(xmlnode.Attributes["VNCProxyPort"].Value);
connectionInfo.VNCProxyUsername = xmlnode.Attributes["VNCProxyUsername"].Value;
connectionInfo.VNCProxyPassword = cryptographyProvider.Decrypt(xmlnode.Attributes["VNCProxyPassword"].Value, _pW);
connectionInfo.VNCColors = (ProtocolVNC.Colors)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Colors), xmlnode.Attributes["VNCColors"].Value);
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.SmartSizeMode), xmlnode.Attributes["VNCSmartSizeMode"].Value);
connectionInfo.VNCViewOnly = bool.Parse(xmlnode.Attributes["VNCViewOnly"].Value);
connectionInfo.Inheritance.VNCCompression = bool.Parse(xmlnode.Attributes["InheritVNCCompression"].Value);
connectionInfo.Inheritance.VNCEncoding = bool.Parse(xmlnode.Attributes["InheritVNCEncoding"].Value);
connectionInfo.Inheritance.VNCAuthMode = bool.Parse(xmlnode.Attributes["InheritVNCAuthMode"].Value);
connectionInfo.Inheritance.VNCProxyType = bool.Parse(xmlnode.Attributes["InheritVNCProxyType"].Value);
connectionInfo.Inheritance.VNCProxyIP = bool.Parse(xmlnode.Attributes["InheritVNCProxyIP"].Value);
connectionInfo.Inheritance.VNCProxyPort = bool.Parse(xmlnode.Attributes["InheritVNCProxyPort"].Value);
connectionInfo.Inheritance.VNCProxyUsername = bool.Parse(xmlnode.Attributes["InheritVNCProxyUsername"].Value);
connectionInfo.Inheritance.VNCProxyPassword = bool.Parse(xmlnode.Attributes["InheritVNCProxyPassword"].Value);
connectionInfo.Inheritance.VNCColors = bool.Parse(xmlnode.Attributes["InheritVNCColors"].Value);
connectionInfo.Inheritance.VNCSmartSizeMode = bool.Parse(xmlnode.Attributes["InheritVNCSmartSizeMode"].Value);
connectionInfo.Inheritance.VNCViewOnly = bool.Parse(xmlnode.Attributes["InheritVNCViewOnly"].Value);
}
if (_confVersion > 1.7) //1.8
{
connectionInfo.RDPAuthenticationLevel = (ProtocolRDP.AuthenticationLevel)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.AuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value);
connectionInfo.Inheritance.RDPAuthenticationLevel = bool.Parse(xmlnode.Attributes["InheritRDPAuthenticationLevel"].Value);
}
if (_confVersion > 1.8) //1.9
{
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Tools.MiscTools.StringToEnum(typeof(HTTPBase.RenderingEngine), xmlnode.Attributes["RenderingEngine"].Value);
connectionInfo.MacAddress = xmlnode.Attributes["MacAddress"].Value;
connectionInfo.Inheritance.RenderingEngine = bool.Parse(xmlnode.Attributes["InheritRenderingEngine"].Value);
connectionInfo.Inheritance.MacAddress = bool.Parse(xmlnode.Attributes["InheritMacAddress"].Value);
}
if (_confVersion > 1.9) //2.0
{
connectionInfo.UserField = xmlnode.Attributes["UserField"].Value;
connectionInfo.Inheritance.UserField = bool.Parse(xmlnode.Attributes["InheritUserField"].Value);
}
if (_confVersion > 2.0) //2.1
{
connectionInfo.ExtApp = xmlnode.Attributes["ExtApp"].Value;
connectionInfo.Inheritance.ExtApp = bool.Parse(xmlnode.Attributes["InheritExtApp"].Value);
}
if (_confVersion > 2.1) //2.2
{
// Get settings
connectionInfo.RDGatewayUsageMethod = (ProtocolRDP.RDGatewayUsageMethod)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUsageMethod), Convert.ToString(xmlnode.Attributes["RDGatewayUsageMethod"].Value));
connectionInfo.RDGatewayHostname = xmlnode.Attributes["RDGatewayHostname"].Value;
connectionInfo.RDGatewayUseConnectionCredentials = (ProtocolRDP.RDGatewayUseConnectionCredentials)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUseConnectionCredentials), Convert.ToString(xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value));
connectionInfo.RDGatewayUsername = xmlnode.Attributes["RDGatewayUsername"].Value;
connectionInfo.RDGatewayPassword = cryptographyProvider.Decrypt(Convert.ToString(xmlnode.Attributes["RDGatewayPassword"].Value), _pW);
connectionInfo.RDGatewayDomain = xmlnode.Attributes["RDGatewayDomain"].Value;
// Get inheritance settings
connectionInfo.Inheritance.RDGatewayUsageMethod = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsageMethod"].Value);
connectionInfo.Inheritance.RDGatewayHostname = bool.Parse(xmlnode.Attributes["InheritRDGatewayHostname"].Value);
connectionInfo.Inheritance.RDGatewayUseConnectionCredentials = bool.Parse(xmlnode.Attributes["InheritRDGatewayUseConnectionCredentials"].Value);
connectionInfo.Inheritance.RDGatewayUsername = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsername"].Value);
connectionInfo.Inheritance.RDGatewayPassword = bool.Parse(xmlnode.Attributes["InheritRDGatewayPassword"].Value);
connectionInfo.Inheritance.RDGatewayDomain = bool.Parse(xmlnode.Attributes["InheritRDGatewayDomain"].Value);
}
if (_confVersion > 2.2) //2.3
{
// Get settings
connectionInfo.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["EnableFontSmoothing"].Value);
connectionInfo.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["EnableDesktopComposition"].Value);
// Get inheritance settings
connectionInfo.Inheritance.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["InheritEnableFontSmoothing"].Value);
connectionInfo.Inheritance.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["InheritEnableDesktopComposition"].Value);
}
if (_confVersion >= 2.4)
{
connectionInfo.UseCredSsp = bool.Parse(xmlnode.Attributes["UseCredSsp"].Value);
connectionInfo.Inheritance.UseCredSsp = bool.Parse(xmlnode.Attributes["InheritUseCredSsp"].Value);
}
if (_confVersion >= 2.5)
{
connectionInfo.LoadBalanceInfo = xmlnode.Attributes["LoadBalanceInfo"].Value;
connectionInfo.AutomaticResize = bool.Parse(xmlnode.Attributes["AutomaticResize"].Value);
connectionInfo.Inheritance.LoadBalanceInfo = bool.Parse(xmlnode.Attributes["InheritLoadBalanceInfo"].Value);
connectionInfo.Inheritance.AutomaticResize = bool.Parse(xmlnode.Attributes["InheritAutomaticResize"].Value);
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, string.Format(Language.strGetConnectionInfoFromXmlFailed, connectionInfo.Name, ConnectionFileName, ex.Message));
}
return connectionInfo;
}
private void ExpandPreviouslyOpenedFolders()
{
foreach (ContainerInfo contI in ContainerList)
{
if (contI.IsExpanded)
contI.TreeNode.Expand();
}
}
private bool IsExportFile()
{
var isExportFile = false;
if (!(_confVersion >= 1.0)) return isExportFile;
if (Convert.ToBoolean(_xmlDocument.DocumentElement.Attributes["Export"].Value))
isExportFile = true;
return isExportFile;
}
private RootNodeInfo InitializeRootNode()
{
var rootNodeName = "";
if (_xmlDocument.DocumentElement.HasAttribute("Name"))
rootNodeName = Convert.ToString(_xmlDocument.DocumentElement.Attributes["Name"].Value.Trim());
RootTreeNode.Name = !string.IsNullOrEmpty(rootNodeName) ? rootNodeName : _xmlDocument.DocumentElement.Name;
RootTreeNode.Text = RootTreeNode.Name;
var rootInfo = new RootNodeInfo(RootNodeType.Connection)
{
Name = RootTreeNode.Name,
TreeNode = RootTreeNode
};
RootTreeNode.Tag = rootInfo;
return rootInfo;
}
private void LoadXmlConnectionData()
{
var connections = DecryptCompleteFile();
_xmlDocument = new XmlDocument();
if (connections != "")
_xmlDocument.LoadXml(connections);
else
_xmlDocument.Load(ConnectionFileName);
}
private void ValidateConnectionFileVersion()
{
if (_xmlDocument.DocumentElement.HasAttribute("ConfVersion"))
_confVersion = Convert.ToDouble(_xmlDocument.DocumentElement.Attributes["ConfVersion"].Value.Replace(",", "."),
CultureInfo.InvariantCulture);
else
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, Language.strOldConffile);
const double maxSupportedConfVersion = 2.5;
if (!(_confVersion > maxSupportedConfVersion)) return;
CTaskDialog.ShowTaskDialogBox(
frmMain.Default,
Application.ProductName,
"Incompatible connection file format",
$"The format of this connection file is not supported. Please upgrade to a newer version of {Application.ProductName}.",
string.Format("{1}{0}File Format Version: {2}{0}Highest Supported Version: {3}", Environment.NewLine,
ConnectionFileName, _confVersion, maxSupportedConfVersion),
"",
"",
"",
"",
ETaskDialogButtons.Ok,
ESysIcons.Error,
ESysIcons.Error
);
throw (new Exception($"Incompatible connection file format (file format version {_confVersion})."));
}
private delegate void SetSelectedNodeDelegate(TreeNode treeNode);
private static void SetSelectedNode(TreeNode treeNode)
{
if (ConnectionTree.TreeView != null && ConnectionTree.TreeView.InvokeRequired)
{
Windows.treeForm.Invoke(new SetSelectedNodeDelegate(SetSelectedNode), treeNode);
return;
}
Windows.treeForm.tvConnections.SelectedNode = treeNode;
}
private string DecryptCompleteFile()
{
var sRd = new StreamReader(ConnectionFileName);
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
var strCons = "";
strCons = sRd.ReadToEnd();
sRd.Close();
if (string.IsNullOrEmpty(strCons)) return "";
var strDecr = "";
bool notDecr;
if (strCons.Contains("<?xml version=\"1.0\" encoding=\"utf-8\"?>"))
{
strDecr = strCons;
return strDecr;
}
try
{
strDecr = cryptographyProvider.Decrypt(strCons, _pW);
notDecr = strDecr == strCons;
}
catch (Exception)
{
notDecr = true;
}
if (notDecr)
{
if (Authenticate(strCons, true))
{
strDecr = cryptographyProvider.Decrypt(strCons, _pW);
notDecr = false;
}
if (notDecr == false)
return strDecr;
}
else
{
return strDecr;
}
return "";
}
private bool Authenticate(string value, bool compareToOriginalValue, RootNodeInfo rootInfo = null)
{
var passwordName = "";
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
passwordName = Path.GetFileName(ConnectionFileName);
if (compareToOriginalValue)
{
while (cryptographyProvider.Decrypt(value, _pW) == value)
{
_pW = Tools.MiscTools.PasswordDialog(passwordName, false);
if (_pW.Length == 0)
return false;
}
}
else
{
while (cryptographyProvider.Decrypt(value, _pW) != "ThisIsProtected")
{
_pW = Tools.MiscTools.PasswordDialog(passwordName, false);
if (_pW.Length == 0)
return false;
}
if (rootInfo == null) return true;
rootInfo.Password = true;
rootInfo.PasswordString = _pW.ConvertToUnsecureString();
}
return true;
}
}
}

View File

@@ -87,7 +87,8 @@ namespace mRemoteNG.Config.Import
var treeNode = ConnectionTreeNode.AddNode(TreeNodeType.Connection, displayName);
var connectionInfo = new ConnectionInfo();
var inheritanceInfo = new ConnectionInfoInheritance(connectionInfo, true);
var inheritanceInfo = new ConnectionInfoInheritance(connectionInfo);
inheritanceInfo.TurnOnInheritanceCompletely();
inheritanceInfo.Description = false;
if (parentTreeNode.Tag is ContainerInfo)
{

View File

@@ -77,7 +77,7 @@ namespace mRemoteNG.Config.Putty
sessionInfo.RootPuttySessionsInfo = provider.RootInfo;
sessionInfo.TreeNode = treeNode;
//sessionInfo.Inheritance.TurnOffInheritanceCompletely();
//sessionInfo.IInheritable.TurnOffInheritanceCompletely();
treeNode.Tag = sessionInfo;

View File

@@ -8,6 +8,8 @@ using System.Globalization;
using mRemoteNG.Themes;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.App.Info;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.UI.Forms;
@@ -67,7 +69,8 @@ namespace mRemoteNG.Config.Settings
private static void SetConDefaultPassword()
{
mRemoteNG.Settings.Default.ConDefaultPassword = Security.Crypt.Decrypt(mRemoteNG.Settings.Default.ConDefaultPassword, GeneralAppInfo.EncryptionKey);
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
mRemoteNG.Settings.Default.ConDefaultPassword = cryptographyProvider.Decrypt(mRemoteNG.Settings.Default.ConDefaultPassword, GeneralAppInfo.EncryptionKey);
}
private static void SetAlwaysShowPanelTabs()

View File

@@ -7,6 +7,7 @@ using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Messages;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
@@ -62,8 +63,9 @@ namespace mRemoteNG.Config.Settings
}
mRemoteNG.Settings.Default.QuickyTBVisible = with1.tsQuickConnect.Visible;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
mRemoteNG.Settings.Default.ConDefaultPassword =
Crypt.Encrypt(Convert.ToString(mRemoteNG.Settings.Default.ConDefaultPassword), GeneralAppInfo.EncryptionKey);
cryptographyProvider.Encrypt(Convert.ToString(mRemoteNG.Settings.Default.ConDefaultPassword), GeneralAppInfo.EncryptionKey);
mRemoteNG.Settings.Default.Save();

View File

@@ -1,6 +1,8 @@
using mRemoteNG.App.Info;
using System;
using System.Data.SqlClient;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
namespace mRemoteNG.Config
{
@@ -54,7 +56,8 @@ namespace mRemoteNG.Config
_sqlHost = mRemoteNG.Settings.Default.SQLHost;
_sqlCatalog = mRemoteNG.Settings.Default.SQLDatabaseName;
_sqlUsername = mRemoteNG.Settings.Default.SQLUser;
_sqlPassword = Security.Crypt.Decrypt(mRemoteNG.Settings.Default.SQLPass, GeneralAppInfo.EncryptionKey);
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
_sqlPassword = cryptographyProvider.Decrypt(mRemoteNG.Settings.Default.SQLPass, GeneralAppInfo.EncryptionKey);
}
public void Connect()

View File

@@ -15,13 +15,12 @@ using mRemoteNG.Connection.Protocol.Rlogin;
using mRemoteNG.Container;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Messages;
using mRemoteNG.My;
namespace mRemoteNG.Connection
{
[DefaultProperty("Name")]
public partial class ConnectionInfo : Parent,Inheritance
public class ConnectionInfo : Parent,IInheritable
{
#region Private Properties
// Private properties with public get/set
@@ -71,22 +70,15 @@ namespace mRemoteNG.Connection
private ProtocolVNC.Encoding _vncEncoding;
private ProtocolVNC.AuthMode _vncAuthMode;
private ProtocolVNC.ProxyType _vncProxyType;
private string _vncProxyIP;
private string _vncProxyIp;
private int _vncProxyPort;
private string _vncProxyUsername;
private string _vncProxyPassword;
private ProtocolVNC.Colors _vncColors;
private ProtocolVNC.SmartSizeMode _vncSmartSizeMode;
private bool _vncViewOnly;
private ConnectionInfoInheritance _Inheritance;
private ProtocolList _OpenConnections;
private bool _IsContainer;
private bool _IsDefault;
private int _PositionID;
private bool _IsQuickConnect;
private bool _PleaseConnect;
private string _constantId;
#endregion
#endregion
#region Public Properties
#region Display
@@ -134,16 +126,8 @@ namespace mRemoteNG.Connection
public virtual string Hostname
{
get { return _hostname.Trim(); }
set
{
if (string.IsNullOrEmpty(value))
{
_hostname = string.Empty;
}
else
{
_hostname = value.Trim();
}
set {
_hostname = string.IsNullOrEmpty(value) ? string.Empty : value.Trim();
}
}
@@ -179,7 +163,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameProtocol"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionProtocol"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public virtual ProtocolType Protocol
{
get { return GetPropertyValue("Protocol", _protocol); }
@@ -189,7 +173,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalTool"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalTool"),
TypeConverter(typeof(Tools.ExternalToolsTypeConverter))]
TypeConverter(typeof(ExternalToolsTypeConverter))]
public string ExtApp
{
get { return GetPropertyValue("ExtApp", _extApp); }
@@ -218,17 +202,17 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameEncryptionStrength"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEncryptionStrength"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
public ProtocolICA.EncryptionStrength ICAEncryption
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolICA.EncryptionStrength ICAEncryptionStrength
{
get { return GetPropertyValue("ICAEncryption", _icaEncryption); }
get { return GetPropertyValue("ICAEncryptionStrength", _icaEncryption); }
set { _icaEncryption = value; }
}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameUseConsoleSession"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUseConsoleSession"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool UseConsoleSession
{
get { return GetPropertyValue("UseConsoleSession", _useConsoleSession); }
@@ -238,7 +222,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationLevel"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationLevel"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolRDP.AuthenticationLevel RDPAuthenticationLevel
{
get { return GetPropertyValue("RDPAuthenticationLevel", _rdpAuthenticationLevel); }
@@ -257,7 +241,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRenderingEngine"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRenderingEngine"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public HTTPBase.RenderingEngine RenderingEngine
{
get { return GetPropertyValue("RenderingEngine", _renderingEngine); }
@@ -267,7 +251,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameUseCredSsp"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUseCredSsp"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool UseCredSsp
{
get { return GetPropertyValue("UseCredSsp", _useCredSsp); }
@@ -278,7 +262,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUsageMethod"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUsageMethod"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolRDP.RDGatewayUsageMethod RDGatewayUsageMethod
{
get { return GetPropertyValue("RDGatewayUsageMethod", _rdGatewayUsageMethod); }
@@ -297,7 +281,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUseConnectionCredentials"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUseConnectionCredentials"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolRDP.RDGatewayUseConnectionCredentials RDGatewayUseConnectionCredentials
{
get { return GetPropertyValue("RDGatewayUseConnectionCredentials", _rdGatewayUseConnectionCredentials); }
@@ -336,7 +320,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameResolution"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionResolution"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolRDP.RDPResolutions Resolution
{
get { return GetPropertyValue("Resolution", _resolution); }
@@ -346,7 +330,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameAutomaticResize"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAutomaticResize"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool AutomaticResize
{
get { return GetPropertyValue("AutomaticResize", _automaticResize); }
@@ -356,7 +340,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolRDP.RDPColors Colors
{
get { return GetPropertyValue("Colors", _colors); }
@@ -366,7 +350,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameCacheBitmaps"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionCacheBitmaps"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool CacheBitmaps
{
get { return GetPropertyValue("CacheBitmaps", _cacheBitmaps); }
@@ -376,7 +360,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameDisplayWallpaper"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDisplayWallpaper"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool DisplayWallpaper
{
get { return GetPropertyValue("DisplayWallpaper", _displayWallpaper); }
@@ -386,7 +370,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameDisplayThemes"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDisplayThemes"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool DisplayThemes
{
get { return GetPropertyValue("DisplayThemes", _displayThemes); }
@@ -396,7 +380,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameEnableFontSmoothing"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEnableFontSmoothing"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool EnableFontSmoothing
{
get { return GetPropertyValue("EnableFontSmoothing", _enableFontSmoothing); }
@@ -406,7 +390,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameEnableDesktopComposition"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEnableDesktopComposition"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool EnableDesktopComposition
{
get { return GetPropertyValue("EnableDesktopComposition", _enableDesktopComposition); }
@@ -417,7 +401,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectKeys"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectKeys"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectKeys
{
get { return GetPropertyValue("RedirectKeys", _redirectKeys); }
@@ -427,7 +411,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectDrives"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectDrives"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectDiskDrives
{
get { return GetPropertyValue("RedirectDiskDrives", _redirectDiskDrives); }
@@ -437,7 +421,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectPrinters"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectPrinters"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectPrinters
{
get { return GetPropertyValue("RedirectPrinters", _redirectPrinters); }
@@ -447,7 +431,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectPorts"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectPorts"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectPorts
{
get { return GetPropertyValue("RedirectPorts", _redirectPorts); }
@@ -457,7 +441,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSmartCards"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSmartCards"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RedirectSmartCards
{
get { return GetPropertyValue("RedirectSmartCards", _redirectSmartCards); }
@@ -467,7 +451,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSounds"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSounds"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolRDP.RDPSounds RedirectSound
{
get { return GetPropertyValue("RedirectSound", _redirectSound); }
@@ -478,7 +462,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolBefore"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolBefore"),
TypeConverter(typeof(Tools.ExternalToolsTypeConverter))]
TypeConverter(typeof(ExternalToolsTypeConverter))]
public virtual string PreExtApp
{
get { return GetPropertyValue("PreExtApp", _preExtApp); }
@@ -488,7 +472,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolAfter"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolAfter"),
TypeConverter(typeof(Tools.ExternalToolsTypeConverter))]
TypeConverter(typeof(ExternalToolsTypeConverter))]
public virtual string PostExtApp
{
get { return GetPropertyValue("PostExtApp", _postExtApp); }
@@ -518,7 +502,7 @@ namespace mRemoteNG.Connection
Browsable(false),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameCompression"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionCompression"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.Compression VNCCompression
{
get { return GetPropertyValue("VNCCompression", _vncCompression); }
@@ -529,7 +513,7 @@ namespace mRemoteNG.Connection
Browsable(false),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameEncoding"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEncoding"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.Encoding VNCEncoding
{
get { return GetPropertyValue("VNCEncoding", _vncEncoding); }
@@ -540,7 +524,7 @@ namespace mRemoteNG.Connection
Browsable(false),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationMode"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationMode"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.AuthMode VNCAuthMode
{
get { return GetPropertyValue("VNCAuthMode", _vncAuthMode); }
@@ -551,7 +535,7 @@ namespace mRemoteNG.Connection
Browsable(false),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyType"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyType"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.ProxyType VNCProxyType
{
get { return GetPropertyValue("VNCProxyType", _vncProxyType); }
@@ -564,8 +548,8 @@ namespace mRemoteNG.Connection
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyAddress")]
public string VNCProxyIP
{
get { return GetPropertyValue("VNCProxyIP", _vncProxyIP); }
set { _vncProxyIP = value; }
get { return GetPropertyValue("VNCProxyIP", _vncProxyIp); }
set { _vncProxyIp = value; }
}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
@@ -603,7 +587,7 @@ namespace mRemoteNG.Connection
Browsable(false),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.Colors VNCColors
{
get { return GetPropertyValue("VNCColors", _vncColors); }
@@ -613,7 +597,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameSmartSizeMode"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionSmartSizeMode"),
TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))]
TypeConverter(typeof(MiscTools.EnumTypeConverter))]
public ProtocolVNC.SmartSizeMode VNCSmartSizeMode
{
get { return GetPropertyValue("VNCSmartSizeMode", _vncSmartSizeMode); }
@@ -623,7 +607,7 @@ namespace mRemoteNG.Connection
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5),
LocalizedAttributes.LocalizedDisplayName("strPropertyNameViewOnly"),
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionViewOnly"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool VNCViewOnly
{
get { return GetPropertyValue("VNCViewOnly", _vncViewOnly); }
@@ -632,67 +616,36 @@ namespace mRemoteNG.Connection
#endregion
#region Non-browsable public properties
[Browsable(false)]
public ConnectionInfoInheritance Inheritance
{
get { return _Inheritance; }
set { _Inheritance = value; }
}
[Browsable(false)]
public ProtocolList OpenConnections
{
get { return _OpenConnections; }
set { _OpenConnections = value; }
}
public ConnectionInfoInheritance Inheritance { get; set; }
[Browsable(false)]
public bool IsContainer
{
get { return _IsContainer; }
set { _IsContainer = value; }
}
[Browsable(false)]
public ProtocolList OpenConnections { get; set; }
[Browsable(false)]
public bool IsDefault
{
get { return _IsDefault; }
set { _IsDefault = value; }
}
[Browsable(false)]
public bool IsContainer { get; set; }
[Browsable(false)]
[Browsable(false)]
public bool IsDefault { get; set; }
[Browsable(false)]
public ContainerInfo Parent { get; set; }
[Browsable(false)]
public int PositionID
{
get { return _PositionID; }
set { _PositionID = value; }
}
public int PositionID { get; set; }
[Browsable(false)]
public string ConstantID
{
get { return _constantId; }
set { _constantId = value; }
}
[Browsable(false)]
public string ConstantID { get; set; }
[Browsable(false)]
[Browsable(false)]
public TreeNode TreeNode { get; set; }
[Browsable(false)]
public bool IsQuickConnect
{
get { return _IsQuickConnect; }
set { _IsQuickConnect = value; }
}
public bool IsQuickConnect { get; set; }
[Browsable(false)]
public bool PleaseConnect
{
get { return _PleaseConnect; }
set { _PleaseConnect = value; }
}
#endregion
[Browsable(false)]
public bool PleaseConnect { get; set; }
#endregion
#endregion
#region Constructors
@@ -702,11 +655,11 @@ namespace mRemoteNG.Connection
SetTreeDisplayDefaults();
SetConnectionDefaults();
SetProtocolDefaults();
SetRDGatewayDefaults();
SetRdGatewayDefaults();
SetAppearanceDefaults();
SetRedirectDefaults();
SetMiscDefaults();
SetVNCDefaults();
SetVncDefaults();
SetNonBrowsablePropertiesDefaults();
SetDefaults();
}
@@ -714,22 +667,22 @@ namespace mRemoteNG.Connection
public ConnectionInfo(ContainerInfo parent) : this()
{
IsContainer = true;
this.Parent = parent;
Parent = parent;
}
#endregion
#region Public Methods
public ConnectionInfo Copy()
{
ConnectionInfo newConnectionInfo = (ConnectionInfo)MemberwiseClone();
var newConnectionInfo = (ConnectionInfo)MemberwiseClone();
newConnectionInfo.ConstantID = MiscTools.CreateConstantID();
newConnectionInfo._OpenConnections = new ProtocolList();
newConnectionInfo.OpenConnections = new ProtocolList();
return newConnectionInfo;
}
public void SetDefaults()
{
if (this.Port == 0)
if (Port == 0)
{
SetDefaultPort();
}
@@ -742,7 +695,7 @@ namespace mRemoteNG.Connection
public void SetDefaultPort()
{
this.Port = GetDefaultPort();
Port = GetDefaultPort();
}
#endregion
@@ -763,13 +716,10 @@ namespace mRemoteNG.Connection
#region Private Methods
private TPropertyType GetPropertyValue<TPropertyType>(string propertyName, TPropertyType value)
{
if (ShouldThisPropertyBeInherited(propertyName))
return GetInheritedPropertyValue(propertyName, value);
else
return value;
return ShouldThisPropertyBeInherited(propertyName) ? GetInheritedPropertyValue<TPropertyType>(propertyName) : value;
}
private bool ShouldThisPropertyBeInherited(string propertyName)
private bool ShouldThisPropertyBeInherited(string propertyName)
{
return (ParentIsValidInheritanceTarget() && IsInheritanceTurnedOnForThisProperty(propertyName));
}
@@ -781,24 +731,18 @@ namespace mRemoteNG.Connection
private bool IsInheritanceTurnedOnForThisProperty(string propertyName)
{
bool inheritPropertyValue = false;
Type inheritType = _Inheritance.GetType();
PropertyInfo inheritPropertyInfo = inheritType.GetProperty(propertyName);
inheritPropertyValue = Convert.ToBoolean(inheritPropertyInfo.GetValue(Inheritance, BindingFlags.GetProperty, null, null, null));
var inheritType = Inheritance.GetType();
var inheritPropertyInfo = inheritType.GetProperty(propertyName);
var inheritPropertyValue = Convert.ToBoolean(inheritPropertyInfo.GetValue(Inheritance, null));
return inheritPropertyValue;
}
private TPropertyType GetInheritedPropertyValue<TPropertyType>(string propertyName, TPropertyType value)
private TPropertyType GetInheritedPropertyValue<TPropertyType>(string propertyName)
{
var parentConnectionInfo = default(ConnectionInfo);
if (IsContainer)
parentConnectionInfo = ((ContainerInfo)Parent.Parent).ConnectionInfo;
else
parentConnectionInfo = Parent.ConnectionInfo;
Type connectionInfoType = parentConnectionInfo.GetType();
PropertyInfo parentPropertyInfo = connectionInfoType.GetProperty(propertyName);
TPropertyType parentPropertyValue = (TPropertyType)parentPropertyInfo.GetValue(parentConnectionInfo, BindingFlags.GetProperty, null, null, null);
var parentConnectionInfo = IsContainer ? Parent.Parent.ConnectionInfo : Parent.ConnectionInfo;
var connectionInfoType = parentConnectionInfo.GetType();
var parentPropertyInfo = connectionInfoType.GetProperty(propertyName);
var parentPropertyValue = (TPropertyType)parentPropertyInfo.GetValue(parentConnectionInfo, null);
return parentPropertyValue;
}
@@ -844,98 +788,98 @@ namespace mRemoteNG.Connection
private void SetTreeDisplayDefaults()
{
_name = Language.strNewConnection;
_description = mRemoteNG.Settings.Default.ConDefaultDescription;
_icon = mRemoteNG.Settings.Default.ConDefaultIcon;
_description = Settings.Default.ConDefaultDescription;
_icon = Settings.Default.ConDefaultIcon;
_panel = Language.strGeneral;
}
private void SetConnectionDefaults()
{
_hostname = string.Empty;
_username = mRemoteNG.Settings.Default.ConDefaultUsername;
_password = mRemoteNG.Settings.Default.ConDefaultPassword;
_domain = mRemoteNG.Settings.Default.ConDefaultDomain;
_username = Settings.Default.ConDefaultUsername;
_password = Settings.Default.ConDefaultPassword;
_domain = Settings.Default.ConDefaultDomain;
}
private void SetProtocolDefaults()
{
_protocol = (ProtocolType)System.Enum.Parse(typeof(ProtocolType), mRemoteNG.Settings.Default.ConDefaultProtocol);
_extApp = mRemoteNG.Settings.Default.ConDefaultExtApp;
_protocol = (ProtocolType)Enum.Parse(typeof(ProtocolType), Settings.Default.ConDefaultProtocol);
_extApp = Settings.Default.ConDefaultExtApp;
_port = 0;
_puttySession = mRemoteNG.Settings.Default.ConDefaultPuttySession;
_icaEncryption = (ProtocolICA.EncryptionStrength) Enum.Parse(typeof(ProtocolICA.EncryptionStrength), mRemoteNG.Settings.Default.ConDefaultICAEncryptionStrength);
_useConsoleSession = mRemoteNG.Settings.Default.ConDefaultUseConsoleSession;
_rdpAuthenticationLevel = (ProtocolRDP.AuthenticationLevel) Enum.Parse(typeof(ProtocolRDP.AuthenticationLevel), mRemoteNG.Settings.Default.ConDefaultRDPAuthenticationLevel);
_loadBalanceInfo = mRemoteNG.Settings.Default.ConDefaultLoadBalanceInfo;
_renderingEngine = (HTTPBase.RenderingEngine) Enum.Parse(typeof(HTTPBase.RenderingEngine), mRemoteNG.Settings.Default.ConDefaultRenderingEngine);
_useCredSsp = mRemoteNG.Settings.Default.ConDefaultUseCredSsp;
_puttySession = Settings.Default.ConDefaultPuttySession;
_icaEncryption = (ProtocolICA.EncryptionStrength) Enum.Parse(typeof(ProtocolICA.EncryptionStrength), Settings.Default.ConDefaultICAEncryptionStrength);
_useConsoleSession = Settings.Default.ConDefaultUseConsoleSession;
_rdpAuthenticationLevel = (ProtocolRDP.AuthenticationLevel) Enum.Parse(typeof(ProtocolRDP.AuthenticationLevel), Settings.Default.ConDefaultRDPAuthenticationLevel);
_loadBalanceInfo = Settings.Default.ConDefaultLoadBalanceInfo;
_renderingEngine = (HTTPBase.RenderingEngine) Enum.Parse(typeof(HTTPBase.RenderingEngine), Settings.Default.ConDefaultRenderingEngine);
_useCredSsp = Settings.Default.ConDefaultUseCredSsp;
}
private void SetRDGatewayDefaults()
private void SetRdGatewayDefaults()
{
_rdGatewayUsageMethod = (ProtocolRDP.RDGatewayUsageMethod) Enum.Parse(typeof(ProtocolRDP.RDGatewayUsageMethod), mRemoteNG.Settings.Default.ConDefaultRDGatewayUsageMethod);
_rdGatewayHostname = mRemoteNG.Settings.Default.ConDefaultRDGatewayHostname;
_rdGatewayUseConnectionCredentials = (ProtocolRDP.RDGatewayUseConnectionCredentials) Enum.Parse(typeof(ProtocolRDP.RDGatewayUseConnectionCredentials), mRemoteNG.Settings.Default.ConDefaultRDGatewayUseConnectionCredentials); ;
_rdGatewayUsername = mRemoteNG.Settings.Default.ConDefaultRDGatewayUsername;
_rdGatewayPassword = mRemoteNG.Settings.Default.ConDefaultRDGatewayPassword;
_rdGatewayDomain = mRemoteNG.Settings.Default.ConDefaultRDGatewayDomain;
_rdGatewayUsageMethod = (ProtocolRDP.RDGatewayUsageMethod) Enum.Parse(typeof(ProtocolRDP.RDGatewayUsageMethod), Settings.Default.ConDefaultRDGatewayUsageMethod);
_rdGatewayHostname = Settings.Default.ConDefaultRDGatewayHostname;
_rdGatewayUseConnectionCredentials = (ProtocolRDP.RDGatewayUseConnectionCredentials) Enum.Parse(typeof(ProtocolRDP.RDGatewayUseConnectionCredentials), Settings.Default.ConDefaultRDGatewayUseConnectionCredentials); ;
_rdGatewayUsername = Settings.Default.ConDefaultRDGatewayUsername;
_rdGatewayPassword = Settings.Default.ConDefaultRDGatewayPassword;
_rdGatewayDomain = Settings.Default.ConDefaultRDGatewayDomain;
}
private void SetAppearanceDefaults()
{
_resolution = (ProtocolRDP.RDPResolutions) Enum.Parse(typeof(ProtocolRDP.RDPResolutions), mRemoteNG.Settings.Default.ConDefaultResolution);
_automaticResize = mRemoteNG.Settings.Default.ConDefaultAutomaticResize;
_colors = (ProtocolRDP.RDPColors) Enum.Parse(typeof(ProtocolRDP.RDPColors), mRemoteNG.Settings.Default.ConDefaultColors);
_cacheBitmaps = mRemoteNG.Settings.Default.ConDefaultCacheBitmaps;
_displayWallpaper = mRemoteNG.Settings.Default.ConDefaultDisplayWallpaper;
_displayThemes = mRemoteNG.Settings.Default.ConDefaultDisplayThemes;
_enableFontSmoothing = mRemoteNG.Settings.Default.ConDefaultEnableFontSmoothing;
_enableDesktopComposition = mRemoteNG.Settings.Default.ConDefaultEnableDesktopComposition;
_resolution = (ProtocolRDP.RDPResolutions) Enum.Parse(typeof(ProtocolRDP.RDPResolutions), Settings.Default.ConDefaultResolution);
_automaticResize = Settings.Default.ConDefaultAutomaticResize;
_colors = (ProtocolRDP.RDPColors) Enum.Parse(typeof(ProtocolRDP.RDPColors), Settings.Default.ConDefaultColors);
_cacheBitmaps = Settings.Default.ConDefaultCacheBitmaps;
_displayWallpaper = Settings.Default.ConDefaultDisplayWallpaper;
_displayThemes = Settings.Default.ConDefaultDisplayThemes;
_enableFontSmoothing = Settings.Default.ConDefaultEnableFontSmoothing;
_enableDesktopComposition = Settings.Default.ConDefaultEnableDesktopComposition;
}
private void SetRedirectDefaults()
{
_redirectKeys = mRemoteNG.Settings.Default.ConDefaultRedirectKeys;
_redirectDiskDrives = mRemoteNG.Settings.Default.ConDefaultRedirectDiskDrives;
_redirectPrinters = mRemoteNG.Settings.Default.ConDefaultRedirectPrinters;
_redirectPorts = mRemoteNG.Settings.Default.ConDefaultRedirectPorts;
_redirectSmartCards = mRemoteNG.Settings.Default.ConDefaultRedirectSmartCards;
_redirectSound = (ProtocolRDP.RDPSounds) Enum.Parse(typeof(ProtocolRDP.RDPSounds), mRemoteNG.Settings.Default.ConDefaultRedirectSound);
_redirectKeys = Settings.Default.ConDefaultRedirectKeys;
_redirectDiskDrives = Settings.Default.ConDefaultRedirectDiskDrives;
_redirectPrinters = Settings.Default.ConDefaultRedirectPrinters;
_redirectPorts = Settings.Default.ConDefaultRedirectPorts;
_redirectSmartCards = Settings.Default.ConDefaultRedirectSmartCards;
_redirectSound = (ProtocolRDP.RDPSounds) Enum.Parse(typeof(ProtocolRDP.RDPSounds), Settings.Default.ConDefaultRedirectSound);
}
private void SetMiscDefaults()
{
_constantId = MiscTools.CreateConstantID();
_preExtApp = mRemoteNG.Settings.Default.ConDefaultPreExtApp;
_postExtApp = mRemoteNG.Settings.Default.ConDefaultPostExtApp;
_macAddress = mRemoteNG.Settings.Default.ConDefaultMacAddress;
_userField = mRemoteNG.Settings.Default.ConDefaultUserField;
ConstantID = MiscTools.CreateConstantID();
_preExtApp = Settings.Default.ConDefaultPreExtApp;
_postExtApp = Settings.Default.ConDefaultPostExtApp;
_macAddress = Settings.Default.ConDefaultMacAddress;
_userField = Settings.Default.ConDefaultUserField;
}
private void SetVNCDefaults()
private void SetVncDefaults()
{
_vncCompression = (ProtocolVNC.Compression) Enum.Parse(typeof(ProtocolVNC.Compression), mRemoteNG.Settings.Default.ConDefaultVNCCompression);
_vncEncoding = (ProtocolVNC.Encoding) Enum.Parse(typeof(ProtocolVNC.Encoding), mRemoteNG.Settings.Default.ConDefaultVNCEncoding);
_vncAuthMode = (ProtocolVNC.AuthMode) Enum.Parse(typeof(ProtocolVNC.AuthMode), mRemoteNG.Settings.Default.ConDefaultVNCAuthMode);
_vncProxyType = (ProtocolVNC.ProxyType) Enum.Parse(typeof(ProtocolVNC.ProxyType), mRemoteNG.Settings.Default.ConDefaultVNCProxyType);
_vncProxyIP = mRemoteNG.Settings.Default.ConDefaultVNCProxyIP;
_vncProxyPort = mRemoteNG.Settings.Default.ConDefaultVNCProxyPort;
_vncProxyUsername = mRemoteNG.Settings.Default.ConDefaultVNCProxyUsername;
_vncProxyPassword = mRemoteNG.Settings.Default.ConDefaultVNCProxyPassword;
_vncColors = (ProtocolVNC.Colors) Enum.Parse(typeof(ProtocolVNC.Colors), mRemoteNG.Settings.Default.ConDefaultVNCColors);
_vncSmartSizeMode = (ProtocolVNC.SmartSizeMode) Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), mRemoteNG.Settings.Default.ConDefaultVNCSmartSizeMode);
_vncViewOnly = mRemoteNG.Settings.Default.ConDefaultVNCViewOnly;
_vncCompression = (ProtocolVNC.Compression) Enum.Parse(typeof(ProtocolVNC.Compression), Settings.Default.ConDefaultVNCCompression);
_vncEncoding = (ProtocolVNC.Encoding) Enum.Parse(typeof(ProtocolVNC.Encoding), Settings.Default.ConDefaultVNCEncoding);
_vncAuthMode = (ProtocolVNC.AuthMode) Enum.Parse(typeof(ProtocolVNC.AuthMode), Settings.Default.ConDefaultVNCAuthMode);
_vncProxyType = (ProtocolVNC.ProxyType) Enum.Parse(typeof(ProtocolVNC.ProxyType), Settings.Default.ConDefaultVNCProxyType);
_vncProxyIp = Settings.Default.ConDefaultVNCProxyIP;
_vncProxyPort = Settings.Default.ConDefaultVNCProxyPort;
_vncProxyUsername = Settings.Default.ConDefaultVNCProxyUsername;
_vncProxyPassword = Settings.Default.ConDefaultVNCProxyPassword;
_vncColors = (ProtocolVNC.Colors) Enum.Parse(typeof(ProtocolVNC.Colors), Settings.Default.ConDefaultVNCColors);
_vncSmartSizeMode = (ProtocolVNC.SmartSizeMode) Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), Settings.Default.ConDefaultVNCSmartSizeMode);
_vncViewOnly = Settings.Default.ConDefaultVNCViewOnly;
}
private void SetNonBrowsablePropertiesDefaults()
{
_Inheritance = new ConnectionInfoInheritance(this);
_OpenConnections = new ProtocolList();
_IsContainer = false;
_IsDefault = false;
_PositionID = 0;
_IsQuickConnect = false;
_PleaseConnect = false;
Inheritance = new ConnectionInfoInheritance(this);
OpenConnections = new ProtocolList();
IsContainer = false;
IsDefault = false;
PositionID = 0;
IsQuickConnect = false;
PleaseConnect = false;
}
#endregion
}

View File

@@ -1,333 +1,310 @@
using System.Collections.Generic;
using mRemoteNG.Tools;
using System;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace mRemoteNG.Connection
{
public class ConnectionInfoInheritance
{
private ConnectionInfoInheritance _tempInheritanceStorage = null;
private ConnectionInfoInheritance _tempInheritanceStorage;
#region Public Properties
#region General
[LocalizedAttributes.LocalizedCategory("strCategoryGeneral", 1),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAll"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAll"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool EverythingInherited
{
get
{
if (CacheBitmaps && Colors && Description && DisplayThemes && DisplayWallpaper
&& EnableFontSmoothing && EnableDesktopComposition && Domain && Icon && Password
&& Port && Protocol && PuttySession && RedirectDiskDrives && RedirectKeys
&& RedirectPorts && RedirectPrinters && RedirectSmartCards && RedirectSound && Resolution
&& AutomaticResize && UseConsoleSession && UseCredSsp && RenderingEngine && UserField
&& ExtApp && Username && Panel && ICAEncryption && RDPAuthenticationLevel
&& LoadBalanceInfo && PreExtApp && PostExtApp && MacAddress && VNCAuthMode
&& VNCColors && VNCCompression && VNCEncoding && VNCProxyIP && VNCProxyPassword
&& VNCProxyPort && VNCProxyType && VNCProxyUsername)
{
return true;
}
else
{
return false;
}
}
set
{
SetAllValues(value);
}
get { return EverythingIsInherited(); }
set { SetAllValues(value); }
}
#endregion
#region Display
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDescription"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDescription"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Description {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Description {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameIcon"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionIcon"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Icon {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Icon {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePanel"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPanel"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Panel {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Panel {get; set;}
#endregion
#region Connection
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUsername"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUsername"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Username {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Username {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePassword"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPassword"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Password {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Password {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDomain"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDomain"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Domain {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Domain {get; set;}
#endregion
#region Protocol
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameProtocol"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionProtocol"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Protocol {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Protocol {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalTool"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalTool"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool ExtApp {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool ExtApp {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePort"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPort"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Port {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Port {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePuttySession"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPuttySession"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool PuttySession {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool PuttySession {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncryptionStrength"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncryptionStrength"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool ICAEncryption {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool ICAEncryptionStrength {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationLevel"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationLevel"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RDPAuthenticationLevel {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RDPAuthenticationLevel {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameLoadBalanceInfo"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionLoadBalanceInfo"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool LoadBalanceInfo {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool LoadBalanceInfo {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRenderingEngine"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRenderingEngine"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RenderingEngine {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RenderingEngine {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseConsoleSession"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseConsoleSession"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool UseConsoleSession {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool UseConsoleSession {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseCredSsp"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseCredSsp"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool UseCredSsp {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool UseCredSsp {get; set;}
#endregion
#region RD Gateway
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsageMethod"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsageMethod"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RDGatewayUsageMethod {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayHostname"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayHostname"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RDGatewayHostname {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUseConnectionCredentials"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUseConnectionCredentials"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RDGatewayUseConnectionCredentials {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsername"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsername"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RDGatewayUsername {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayPassword"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayPassword"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RDGatewayPassword {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayDomain"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayDomain"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool RDGatewayDomain {get; set;}
#endregion
#region Appearance
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameResolution"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionResolution"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Resolution {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Resolution {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAutomaticResize"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAutomaticResize"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool AutomaticResize {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool AutomaticResize {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Colors {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool Colors {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCacheBitmaps"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCacheBitmaps"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool CacheBitmaps {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool CacheBitmaps {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayWallpaper"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayWallpaper"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool DisplayWallpaper {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool DisplayWallpaper {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayThemes"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayThemes"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool DisplayThemes {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool DisplayThemes {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableFontSmoothing"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableFontSmoothing"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool EnableFontSmoothing {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool EnableFontSmoothing {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableDesktopComposition"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableEnableDesktopComposition"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool EnableDesktopComposition {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool EnableDesktopComposition {get; set;}
#endregion
#region Redirect
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectKeys"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectKeys"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectKeys {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectKeys {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectDrives"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectDrives"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectDiskDrives {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectDiskDrives {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPrinters"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPrinters"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectPrinters {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectPrinters {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPorts"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPorts"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectPorts {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectPorts {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSmartCards"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSmartCards"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectSmartCards {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectSmartCards {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSounds"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSounds"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectSound {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool RedirectSound {get; set;}
#endregion
#region Misc
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolBefore"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolBefore"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool PreExtApp {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool PreExtApp {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolAfter"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolAfter"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool PostExtApp {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool PostExtApp {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameMACAddress"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionMACAddress"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool MacAddress {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool MacAddress {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUser1"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUser1"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool UserField {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool UserField {get; set;}
#endregion
#region VNC
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCompression"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCompression"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCCompression {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCCompression {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncoding"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncoding"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCEncoding {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCEncoding {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryConnection", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationMode"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationMode"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCAuthMode {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCAuthMode {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyType"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyType"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyType {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyType {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyAddress"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyAddress"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyIP {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyIP {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPort"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPort"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyPort {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyPort {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyUsername"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyUsername"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyUsername {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyUsername {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPassword"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPassword"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyPassword {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCProxyPassword {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCColors {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCColors {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameSmartSizeMode"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionSmartSizeMode"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCSmartSizeMode {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCSmartSizeMode {get; set;}
[LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9),
LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameViewOnly"),
LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionViewOnly"),
TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCViewOnly {get; set;}
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]public bool VNCViewOnly {get; set;}
#endregion
[Browsable(false)]
public object Parent {get; set;}
[Browsable(false)]
public bool IsDefault {get; set;}
#endregion
public ConnectionInfoInheritance(object parent, bool inheritEverything = false)
public ConnectionInfoInheritance(object parent, bool ignoreDefaultInheritance = false)
{
Parent = parent;
if (inheritEverything)
TurnOnInheritanceCompletely();
if (!ignoreDefaultInheritance)
SetAllValues(DefaultConnectionInheritance.Instance);
}
public ConnectionInfoInheritance Copy()
{
return (ConnectionInfoInheritance)MemberwiseClone();
@@ -366,26 +343,44 @@ namespace mRemoteNG.Connection
SetAllValues(false);
}
private bool EverythingIsInherited()
{
var inheritanceProperties = GetProperties();
var everythingInherited = inheritanceProperties.All((p) => (bool)p.GetValue(this, null));
return everythingInherited;
}
public IEnumerable<PropertyInfo> GetProperties()
{
var properties = typeof(ConnectionInfoInheritance).GetProperties();
var filteredProperties = properties.Where(FilterProperty);
return filteredProperties;
}
private bool FilterProperty(PropertyInfo propertyInfo)
{
var exclusions = new[] { "EverythingInherited", "Parent" };
var valueShouldNotBeFiltered = !exclusions.Contains(propertyInfo.Name);
return valueShouldNotBeFiltered;
}
private void SetAllValues(bool value)
{
var properties = typeof(ConnectionInfoInheritance).GetProperties();
var properties = GetProperties();
foreach (var property in properties)
{
if (property.PropertyType.Name == typeof(Boolean).Name && property.Name != "EverythingInherited" && property.Name != "IsDefault")
if (property.PropertyType.Name == typeof(bool).Name)
property.SetValue(this, value, null);
}
}
private void SetAllValues(ConnectionInfoInheritance otherInheritanceObject)
protected void SetAllValues(ConnectionInfoInheritance otherInheritanceObject)
{
var properties = typeof(ConnectionInfoInheritance).GetProperties();
var properties = GetProperties();
foreach (var property in properties)
{
if (property.Name != "EverythingInherited")
{
var newPropertyValue = property.GetValue(otherInheritanceObject, null);
property.SetValue(this, newPropertyValue, null);
}
var newPropertyValue = property.GetValue(otherInheritanceObject, null);
property.SetValue(this, newPropertyValue, null);
}
}
}

View File

@@ -0,0 +1,42 @@
using System;
namespace mRemoteNG.Connection
{
public class DefaultConnectionInheritance : ConnectionInfoInheritance
{
public static DefaultConnectionInheritance Instance { get; } = new DefaultConnectionInheritance();
private DefaultConnectionInheritance() : base(null, true)
{
}
static DefaultConnectionInheritance()
{ }
public void LoadFrom<TSource>(TSource sourceInstance, Func<string,string> propertyNameMutator = null)
{
if (propertyNameMutator == null) propertyNameMutator = (a) => a;
var inheritanceProperties = GetProperties();
foreach (var property in inheritanceProperties)
{
var propertyFromSettings = typeof(TSource).GetProperty(propertyNameMutator(property.Name));
var valueFromSettings = propertyFromSettings.GetValue(sourceInstance, null);
property.SetValue(Instance, valueFromSettings, null);
}
}
public void SaveTo<TDestination>(TDestination destinationInstance, Func<string, string> propertyNameMutator = null)
{
if (propertyNameMutator == null) propertyNameMutator = (a) => a;
var inheritanceProperties = GetProperties();
foreach (var property in inheritanceProperties)
{
var propertyFromSettings = typeof(TDestination).GetProperty(propertyNameMutator(property.Name));
var localValue = property.GetValue(Instance, null);
propertyFromSettings.SetValue(destinationInstance, localValue, null);
}
}
}
}

View File

@@ -1,6 +1,6 @@
namespace mRemoteNG.Connection
{
public interface Inheritance
public interface IInheritable
{
ConnectionInfoInheritance Inheritance { get; set; }
}

View File

@@ -4,8 +4,11 @@ using System.Drawing;
using System.Windows.Forms;
using mRemoteNG.App;
using System.Threading;
using mRemoteNG.App.Info;
using mRemoteNG.Tools;
using mRemoteNG.Connection.Protocol.RDP;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.UI.Forms;
@@ -172,7 +175,8 @@ namespace mRemoteNG.Connection.Protocol.ICA
{
if (mRemoteNG.Settings.Default.DefaultPassword != "")
{
_ICAClient.SetProp("ClearPassword", Security.Crypt.Decrypt(Convert.ToString(mRemoteNG.Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey));
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
_ICAClient.SetProp("ClearPassword", cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, GeneralAppInfo.EncryptionKey));
}
}
}
@@ -261,7 +265,7 @@ namespace mRemoteNG.Connection.Protocol.ICA
private void SetSecurity()
{
switch (_Info.ICAEncryption)
switch (_Info.ICAEncryptionStrength)
{
case EncryptionStrength.Encr128BitLogonOnly:
_ICAClient.Encrypt = true;

View File

@@ -2,7 +2,6 @@ using System;
using System.Windows.Forms;
using System.Threading;
using mRemoteNG.App;
using mRemoteNG.Connection;
namespace mRemoteNG.Connection.Protocol
@@ -10,12 +9,10 @@ namespace mRemoteNG.Connection.Protocol
public abstract class ProtocolBase
{
#region Private Variables
private string _Name;
private UI.Window.ConnectionWindow _connectionWindow;
private UI.Window.ConnectionWindow _connectionWindow;
private InterfaceControl _interfaceControl;
private Control _Control;
private ConnectionInfo.Force _Force;
private ConnectingEventHandler ConnectingEvent;
private ConnectingEventHandler ConnectingEvent;
private ConnectedEventHandler ConnectedEvent;
private DisconnectedEventHandler DisconnectedEvent;
private ErrorOccuredEventHandler ErrorOccuredEvent;
@@ -25,13 +22,9 @@ namespace mRemoteNG.Connection.Protocol
#region Public Properties
#region Control
public string Name
{
get { return this._Name; }
set { this._Name = value; }
}
public UI.Window.ConnectionWindow ConnectionWindow
public string Name { get; set; }
protected UI.Window.ConnectionWindow ConnectionWindow
{
get { return _connectionWindow; }
set
@@ -52,22 +45,15 @@ namespace mRemoteNG.Connection.Protocol
ConnectionWindow = _interfaceControl.GetContainerControl() as UI.Window.ConnectionWindow;
}
}
public Control Control
{
get { return this._Control; }
set { this._Control = value; }
}
#endregion
public ConnectionInfo.Force Force
{
get { return this._Force; }
set { this._Force = value; }
}
public System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
public ReconnectGroup ReconnectGroup;
protected Control Control { get; set; }
#endregion
public ConnectionInfo.Force Force { get; set; }
public readonly System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
protected ReconnectGroup ReconnectGroup;
#endregion
#region Methods
@@ -77,23 +63,23 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
this._Control.Focus();
Control.Focus();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t focus Control (Connection.Protocol.Base)" + Environment.NewLine + ex.Message, true);
}
}
public virtual void ResizeBegin(System.Object sender, EventArgs e)
public virtual void ResizeBegin(object sender, EventArgs e)
{
}
public virtual void Resize(System.Object sender, EventArgs e)
public virtual void Resize(object sender, EventArgs e)
{
}
public virtual void ResizeEnd(System.Object sender, EventArgs e)
public virtual void ResizeEnd(object sender, EventArgs e)
{
}
@@ -101,19 +87,17 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
this._interfaceControl.Parent.Tag = this._interfaceControl;
this._interfaceControl.Show();
if (this._Control != null)
{
this._Control.Name = this._Name;
this._Control.Parent = this._interfaceControl;
this._Control.Location = this._interfaceControl.Location;
this._Control.Size = this.InterfaceControl.Size;
this._Control.Anchor = this._interfaceControl.Anchor;
}
return true;
_interfaceControl.Parent.Tag = _interfaceControl;
_interfaceControl.Show();
if (Control == null) return true;
Control.Name = Name;
Control.Parent = _interfaceControl;
Control.Location = _interfaceControl.Location;
Control.Size = InterfaceControl.Size;
Control.Anchor = _interfaceControl.Anchor;
return true;
}
catch (Exception ex)
{
@@ -124,45 +108,37 @@ namespace mRemoteNG.Connection.Protocol
public virtual bool Connect()
{
if (InterfaceControl.Info.Protocol != ProtocolType.RDP)
{
if (ConnectedEvent != null)
{
ConnectedEvent(this);
return true;
}
}
return false;
if (InterfaceControl.Info.Protocol == ProtocolType.RDP) return false;
if (ConnectedEvent == null) return false;
ConnectedEvent(this);
return true;
}
public virtual void Disconnect()
{
this.Close();
Close();
}
public virtual void Close()
{
Thread t = new Thread(new System.Threading.ThreadStart(CloseBG));
t.SetApartmentState(System.Threading.ApartmentState.STA);
Thread t = new Thread(CloseBG);
t.SetApartmentState(ApartmentState.STA);
t.IsBackground = true;
t.Start();
}
private void CloseBG()
{
if (ClosedEvent != null)
{
ClosedEvent(this);
}
try
ClosedEvent?.Invoke(this);
try
{
tmrReconnect.Enabled = false;
if (this._Control != null)
if (Control != null)
{
try
{
this.DisposeControl();
DisposeControl();
}
catch (Exception ex)
{
@@ -170,19 +146,17 @@ namespace mRemoteNG.Connection.Protocol
}
}
if (this._interfaceControl != null)
if (_interfaceControl != null)
{
try
{
if (this._interfaceControl.Parent != null)
{
if (this._interfaceControl.Parent.Tag != null)
{
this.SetTagToNothing();
}
if (_interfaceControl.Parent == null) return;
if (_interfaceControl.Parent.Tag != null)
{
SetTagToNothing();
}
this.DisposeInterface();
}
DisposeInterface();
}
catch (Exception ex)
{
@@ -199,42 +173,42 @@ namespace mRemoteNG.Connection.Protocol
private delegate void DisposeInterfaceCB();
private void DisposeInterface()
{
if (this._interfaceControl.InvokeRequired)
if (_interfaceControl.InvokeRequired)
{
DisposeInterfaceCB s = new DisposeInterfaceCB(DisposeInterface);
this._interfaceControl.Invoke(s);
_interfaceControl.Invoke(s);
}
else
{
this._interfaceControl.Dispose();
_interfaceControl.Dispose();
}
}
private delegate void SetTagToNothingCB();
private void SetTagToNothing()
{
if (this._interfaceControl.Parent.InvokeRequired)
if (_interfaceControl.Parent.InvokeRequired)
{
SetTagToNothingCB s = new SetTagToNothingCB(SetTagToNothing);
this._interfaceControl.Parent.Invoke(s);
_interfaceControl.Parent.Invoke(s);
}
else
{
this._interfaceControl.Parent.Tag = null;
_interfaceControl.Parent.Tag = null;
}
}
private delegate void DisposeControlCB();
private void DisposeControl()
{
if (this._Control.InvokeRequired)
if (Control.InvokeRequired)
{
DisposeControlCB s = new DisposeControlCB(DisposeControl);
this._Control.Invoke(s);
Control.Invoke(s);
}
else
{
this._Control.Dispose();
Control.Dispose();
}
}
#endregion
@@ -243,83 +217,77 @@ namespace mRemoteNG.Connection.Protocol
public delegate void ConnectingEventHandler(object sender);
public event ConnectingEventHandler Connecting
{
add { ConnectingEvent = (ConnectingEventHandler) System.Delegate.Combine(ConnectingEvent, value); }
remove { ConnectingEvent = (ConnectingEventHandler) System.Delegate.Remove(ConnectingEvent, value); }
add { ConnectingEvent = (ConnectingEventHandler) Delegate.Combine(ConnectingEvent, value); }
remove { ConnectingEvent = (ConnectingEventHandler) Delegate.Remove(ConnectingEvent, value); }
}
public delegate void ConnectedEventHandler(object sender);
public event ConnectedEventHandler Connected
{
add { ConnectedEvent = (ConnectedEventHandler) System.Delegate.Combine(ConnectedEvent, value); }
remove { ConnectedEvent = (ConnectedEventHandler) System.Delegate.Remove(ConnectedEvent, value); }
add { ConnectedEvent = (ConnectedEventHandler) Delegate.Combine(ConnectedEvent, value); }
remove { ConnectedEvent = (ConnectedEventHandler) Delegate.Remove(ConnectedEvent, value); }
}
public delegate void DisconnectedEventHandler(object sender, string DisconnectedMessage);
public event DisconnectedEventHandler Disconnected
{
add { DisconnectedEvent = (DisconnectedEventHandler) System.Delegate.Combine(DisconnectedEvent, value); }
remove { DisconnectedEvent = (DisconnectedEventHandler) System.Delegate.Remove(DisconnectedEvent, value); }
add { DisconnectedEvent = (DisconnectedEventHandler) Delegate.Combine(DisconnectedEvent, value); }
remove { DisconnectedEvent = (DisconnectedEventHandler) Delegate.Remove(DisconnectedEvent, value); }
}
public delegate void ErrorOccuredEventHandler(object sender, string ErrorMessage);
public event ErrorOccuredEventHandler ErrorOccured
{
add { ErrorOccuredEvent = (ErrorOccuredEventHandler) System.Delegate.Combine(ErrorOccuredEvent, value); }
remove { ErrorOccuredEvent = (ErrorOccuredEventHandler) System.Delegate.Remove(ErrorOccuredEvent, value); }
add { ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Combine(ErrorOccuredEvent, value); }
remove { ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Remove(ErrorOccuredEvent, value); }
}
public delegate void ClosingEventHandler(object sender);
public event ClosingEventHandler Closing
{
add { ClosingEvent = (ClosingEventHandler) System.Delegate.Combine(ClosingEvent, value); }
remove { ClosingEvent = (ClosingEventHandler) System.Delegate.Remove(ClosingEvent, value); }
add { ClosingEvent = (ClosingEventHandler) Delegate.Combine(ClosingEvent, value); }
remove { ClosingEvent = (ClosingEventHandler) Delegate.Remove(ClosingEvent, value); }
}
public delegate void ClosedEventHandler(object sender);
public event ClosedEventHandler Closed
{
add { ClosedEvent = (ClosedEventHandler) System.Delegate.Combine(ClosedEvent, value); }
remove { ClosedEvent = (ClosedEventHandler) System.Delegate.Remove(ClosedEvent, value); }
add { ClosedEvent = (ClosedEventHandler) Delegate.Combine(ClosedEvent, value); }
remove { ClosedEvent = (ClosedEventHandler) Delegate.Remove(ClosedEvent, value); }
}
public void Event_Closing(object sender)
{
if (ClosingEvent != null)
ClosingEvent(sender);
ClosingEvent?.Invoke(sender);
}
public void Event_Closed(object sender)
{
if (ClosedEvent != null)
ClosedEvent(sender);
}
public void Event_Connecting(object sender)
{
if (ConnectingEvent != null)
ConnectingEvent(sender);
}
public void Event_Connected(object sender)
{
if (ConnectedEvent != null)
ConnectedEvent(sender);
}
public void Event_Disconnected(object sender, string DisconnectedMessage)
{
if (DisconnectedEvent != null)
DisconnectedEvent(sender, DisconnectedMessage);
}
public void Event_ErrorOccured(object sender, string ErrorMsg)
{
if (ErrorOccuredEvent != null)
ErrorOccuredEvent(sender, ErrorMsg);
}
public void Event_ReconnectGroupCloseClicked()
protected void Event_Closed(object sender)
{
ClosedEvent?.Invoke(sender);
}
protected void Event_Connecting(object sender)
{
ConnectingEvent?.Invoke(sender);
}
protected void Event_Connected(object sender)
{
ConnectedEvent?.Invoke(sender);
}
protected void Event_Disconnected(object sender, string DisconnectedMessage)
{
DisconnectedEvent?.Invoke(sender, DisconnectedMessage);
}
protected void Event_ErrorOccured(object sender, string ErrorMsg)
{
ErrorOccuredEvent?.Invoke(sender, ErrorMsg);
}
protected void Event_ReconnectGroupCloseClicked()
{
Close();
}

View File

@@ -25,7 +25,6 @@ namespace mRemoteNG.Connection.Protocol
[LocalizedAttributes.LocalizedDescription("strICA")]
ICA = 9,
[LocalizedAttributes.LocalizedDescription("strExtApp")]
IntApp = 20,
SSH = 10
IntApp = 20
}
}

View File

@@ -6,6 +6,9 @@ using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.App.Info;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
namespace mRemoteNG.Connection.Protocol
@@ -98,7 +101,8 @@ namespace mRemoteNG.Connection.Protocol
{
if (Settings.Default.EmptyCredentials == "custom")
{
password = Security.Crypt.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey);
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
password = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), GeneralAppInfo.EncryptionKey);
}
}

View File

@@ -8,6 +8,8 @@ using System.Threading;
using System.ComponentModel;
using mRemoteNG.Messages;
using mRemoteNG.App;
using mRemoteNG.Security;
using mRemoteNG.Security.SymmetricEncryption;
using MSTSCLib;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
@@ -131,12 +133,12 @@ namespace mRemoteNG.Connection.Protocol.RDP
//not user changeable
_rdpClient.AdvancedSettings2.GrabFocusOnConnect = true;
_rdpClient.AdvancedSettings3.EnableAutoReconnect = true;
_rdpClient.AdvancedSettings3.MaxReconnectAttempts = Convert.ToInt32(Settings.Default.RdpReconnectionCount);
_rdpClient.AdvancedSettings3.MaxReconnectAttempts = Settings.Default.RdpReconnectionCount;
_rdpClient.AdvancedSettings2.keepAliveInterval = 60000; //in milliseconds (10.000 = 10 seconds)
_rdpClient.AdvancedSettings5.AuthenticationLevel = 0;
_rdpClient.AdvancedSettings2.EncryptionEnabled = 1;
_rdpClient.AdvancedSettings2.overallConnectionTimeout = 20;
_rdpClient.AdvancedSettings2.overallConnectionTimeout = Settings.Default.ConRDPOverallConnectionTimeout;
_rdpClient.AdvancedSettings2.BitmapPeristence = Convert.ToInt32(_connectionInfo.CacheBitmaps);
if (_rdpVersion >= Versions.RDC61)
@@ -341,21 +343,21 @@ namespace mRemoteNG.Connection.Protocol.RDP
{
if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes)
{
//_rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.Username;
//_rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.Password;
//_rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.Domain;
_rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.Username;
_rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.Password;
_rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.Domain;
}
else if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard)
{
//_rdpClient.TransportSettings2.GatewayCredSharing = 0;
_rdpClient.TransportSettings2.GatewayCredSharing = 0;
}
else
{
//_rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.RDGatewayUsername;
//_rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.RDGatewayPassword;
//_rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.RDGatewayDomain;
//_rdpClient.TransportSettings2.GatewayCredSharing = 0;
}
_rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.RDGatewayUsername;
_rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.RDGatewayPassword;
_rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.RDGatewayDomain;
_rdpClient.TransportSettings2.GatewayCredSharing = 0;
}
}
}
}
@@ -438,7 +440,8 @@ namespace mRemoteNG.Connection.Protocol.RDP
{
if (Settings.Default.DefaultPassword != "")
{
_rdpClient.AdvancedSettings2.ClearTextPassword = Security.Crypt.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey);
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
_rdpClient.AdvancedSettings2.ClearTextPassword = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey);
}
}
}
@@ -882,4 +885,4 @@ namespace mRemoteNG.Connection.Protocol.RDP
}
#endregion
}
}
}

View File

@@ -6,7 +6,7 @@ using System.Windows.Forms;
namespace mRemoteNG.Container
{
[DefaultProperty("Name")]
public class ContainerInfo : Parent,Inheritance
public class ContainerInfo : Parent,IInheritable
{
private TreeNode _TreeNode;
private ContainerInfo _Parent;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// <Assembly: AssemblyVersion("1.0.*")>
[assembly:AssemblyVersion("1.74.*")]
[assembly: AssemblyVersion("1.75.*")]
[assembly:NeutralResourcesLanguageAttribute("en")]

View File

@@ -2295,5 +2295,17 @@ namespace mRemoteNG {
this["ShowCompleteConsPathInTitle"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("20")]
public int ConRDPOverallConnectionTimeout {
get {
return ((int)(this["ConRDPOverallConnectionTimeout"]));
}
set {
this["ConRDPOverallConnectionTimeout"] = value;
}
}
}
}

View File

@@ -572,5 +572,8 @@
<Setting Name="ShowCompleteConsPathInTitle" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="ConRDPOverallConnectionTimeout" Type="System.Int32" Scope="User">
<Value Profile="(Default)">20</Value>
</Setting>
</Settings>
</SettingsFile>

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More