diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..23f9037
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+################################################################################
+# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
+################################################################################
+
+/.vs
+/obj
\ No newline at end of file
diff --git a/ClassDiagram1.cd b/ClassDiagram1.cd
new file mode 100644
index 0000000..9179d9b
--- /dev/null
+++ b/ClassDiagram1.cd
@@ -0,0 +1,1719 @@
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAA=
+ RdcMan\About.cs
+
+
+
+
+
+ EAQQAAAAAAACAAAAAIAAAAAAAAAAAAAAIAAAAAAAEAA=
+ RdcMan\AddCredentialsDialog.cs
+
+
+
+
+
+ QgAgAAAACBAAAAAAIAAAAAAAAIAQAAAAAAAAAAACAAA=
+ RdcMan\AddNodeDialogHelper.cs
+
+
+
+
+
+ AAAgAAAAAAAAGAAAAIQAAAAAAAQAAAAAAAAAAAAABAA=
+ RdcMan\ArgumentParser.cs
+
+
+
+
+
+ ABAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAA=
+ RdcMan\CheckedMenuItem.cs
+
+
+
+
+
+ EAAAAAwAAQRECYSACTAEAIAIAKAICixAAYIIEAgCCAA=
+ RdcMan\ClientPanel.cs
+
+
+
+
+
+ ABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAA=
+ RdcMan\ClientSizeCheckedMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAEAAAAAAACAgAAAAAAAAAggAAAAAA=
+ RdcMan\ConfigForm\BaseSetting.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAA=
+ RdcMan\ConfigForm\BoolSetting.cs
+
+
+
+
+
+ AAAAAGACQAIAAgEIEAIAACCCAAAAAJAAAECAgABKDAA=
+ RdcMan\ConfigForm\BuiltInVirtualGroup.cs
+
+
+
+
+
+
+ ABQAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAA=
+ RdcMan\ConfigForm\BuiltInVirtualGroupCheckedMenuItem.cs
+
+
+
+
+
+ BAAAAAAAAAAIAAAAAAAAAAAAAkAAAAAAAAAAAAAACAA=
+ RdcMan\ConfigForm\CommonDisplaySettings.cs
+
+
+
+
+
+ AAAAAAAEAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAE=
+ RdcMan\ConfigForm\CommonNodeSettings.cs
+
+
+
+
+
+ BAAAAAAAAQgAAAIAAAAAIAAAKgAAAAAAAAAAAACACAA=
+ RdcMan\ConfigForm\ConnectionSettings.cs
+
+
+
+
+
+ AAAAAggIAAAAgAAAAAAAAEAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\ConfigForm\ConnectionSettingsTabPage.cs
+
+
+
+
+
+ UAQAAIAAgAAAAAAUAgAAEAAIAgAAAAACAQIAAAAAAAA=
+ RdcMan\ConfigForm\CredentialsProfile.cs
+
+
+
+
+
+
+ CAAAAAAAAACAAgAACAAABAACAACAAACAAAAAgAAQAAA=
+ RdcMan\ConfigForm\CredentialsStore.cs
+
+
+
+
+
+ AAAAAhAIAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA=
+ RdcMan\ConfigForm\CredentialsTabPage.cs
+
+
+
+
+
+
+ AAAAAhAEAAIQIAAEAQSEhBAgAABQAAgIABEABRAREBA=
+ RdcMan\ConfigForm\CredentialsUI.cs
+
+
+
+
+
+ ABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAA=
+ RdcMan\ConfigForm\CustomClientSizeCheckedMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAYEAAAEAACAgAAAAQAAAAAEAAAAiAAAgAAA=
+ RdcMan\ConfigForm\CustomSizeDialog.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAIAAQAAAQCAAAAAAACQAAAgAAAAAA=
+ RdcMan\ConfigForm\DefaultSettingsGroup.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAA=
+ RdcMan\ConfigForm\DisplaySettingsTabPage.cs
+
+
+
+
+
+ GAAAAgAIAAAAAAAAAAAAUAAAAAAAIEAAAAAQAAJAAAA=
+ RdcMan\ConfigForm\EncryptionSettingsTabPage.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAEAAAAAAAA=
+ RdcMan\ConfigForm\FileGroupPropertiesDialog.cs
+
+
+
+
+
+ AAAAAAAIAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAA=
+ RdcMan\ConfigForm\FileGroupPropertiesTabPage.cs
+
+
+
+
+
+ gAABAAAAAAAAAAIAAAAAIEAAIgAAAAAAAQAAEEAACAA=
+ RdcMan\ConfigForm\GatewaySettings.cs
+
+
+
+
+
+ CAAAABAIAAABQAACAAAICAAAACAAAAAAQAAAAAAAAAA=
+ RdcMan\ConfigForm\GatewaySettingsTabPage.cs
+
+
+
+
+
+ gIRAgCCAIFEEACoAQlIAgiATAYEAQAkAAABAQiAAAJg=
+ RdcMan\ConfigForm\GlobalOptionsDialog.cs
+
+
+
+
+
+ BgCAAEEUMQSBAgYKAEIAcqCgIwiCYAFIQCBMKAggGAQ=
+ RdcMan\ConfigForm\GlobalSettings.cs
+
+
+
+
+
+ AAAAAAAAAAIAAgAIAAAAAAAAAAAAAEAAAEAAgABAAAA=
+ RdcMan\ConfigForm\Group.cs
+
+
+
+
+
+ BESEgiBAAgIEAgJQECQAAIADAAhNAJAAIADggCRCBAA=
+ RdcMan\ConfigForm\GroupBase.cs
+
+
+
+
+
+ AAAACIADAQAAQAAAIAAAAQAECAAAACAAAEAAAICCAAA=
+ RdcMan\ConfigForm\GroupBasePropertiesDialog.cs
+
+
+
+
+
+ AAAAAAgAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAA=
+ RdcMan\ConfigForm\GroupBasePropertiesTabPage.cs
+
+
+
+
+
+ EgAAAACQAAAAQQIAAAAAIgAAIhAAAAACAQAAgBQACAA=
+ RdcMan\ConfigForm\LogonCredentials.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAA=
+ RdcMan\ConfigForm\LogonCredentialsTabPage.cs
+
+
+
+
+
+ EAQAAAAAAAAEAAAEAAAAAAAAAgAAAAICAQCAAAAAEAA=
+ RdcMan\ConfigForm\LogonSettingsDialog.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAACAAAAAAAA=
+ RdcMan\ConfigForm\PluginContext.cs
+
+
+
+
+
+
+ AAAgAAAAAAAAAAIAAAAAAAAAAAAAABAAAAAAAAAAAAA=
+ RdcMan\ConfigForm\PointHelper.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAEAAAAAAACAAAAAAAAAAAAgAAAAAA=
+ RdcMan\ConfigForm\PointSetting.cs
+
+
+
+
+
+ AAAAAAAABAAAAAAIAAAAAAAgAAAAAAAAAAAAAAAAAAA=
+ RdcMan\ConfigForm\Policies.cs
+
+
+
+
+
+ AADAgMEUEQXBAAQICEYAUqCgAQiCYAFYgCBEKAxAECQ=
+ RdcMan\ConfigForm\Preferences.cs
+
+
+
+
+
+ CAAAAAAAAAAADCAEAAAAAAACAgAAAAAAAAAAgAAAAAA=
+ RdcMan\ConfigForm\ProfileSetting.cs
+
+
+
+
+
+ IABAAAAAAAAEAQAAAAAAAgAAAABAAAAAACAAAAAAAAA=
+ RdcMan\ConfigForm\RdcSettingsProvider.cs
+
+
+
+
+
+ AgAAAIAAAAAAAAIAAAAwIAAAIgAAAAAAAAQAAAAACAA=
+ RdcMan\ConfigForm\RemoteDesktopSettings.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAA=
+ RdcMan\ConfigForm\Setting.cs
+
+
+
+
+
+ CAAAAgAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAA=
+ RdcMan\ConfigForm\SettingAttribute.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgA=
+ RdcMan\ConfigForm\SettingExtensions.cs
+
+
+
+
+
+ AgAAAAAAAAAAAgAEAAAAIAQCIgAABAAAEAAAgAAAAAA=
+ RdcMan\ConfigForm\SettingsGroup.cs
+
+
+
+
+
+ AAAAAgAKAAAAgAAACAgAAAAAAAAAACAAABAAAAAAgBA=
+ RdcMan\ConfigForm\SettingsTabPage.cs
+
+
+
+
+
+
+ AAAAAgAIAAAAAAAAAAAAIAAAAAAAAAIAkBAAAAAAgBA=
+ RdcMan\ConfigForm\SettingsTabPage.cs
+
+
+
+
+
+
+ AAAgAAAAgAAAAAIAEAAAAAAAAAAAABAAAAAAAAAAAgA=
+ RdcMan\ConfigForm\SizeHelper.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAEAAAAAAACAAAAAAAAAAAAgAAAAAA=
+ RdcMan\ConfigForm\SizeSetting.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAgAAAAAA=
+ RdcMan\ConfigForm\XmlSetting.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAIAAAAEIgAAIgAAAAAAEAAAAAAACAA=
+ RdcMan\Configuration\EncryptionSettings.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAgAAAAAA=
+ RdcMan\Configuration\EnumSetting.cs
+
+
+
+
+
+ AAAAAAAAAAQAAAAAAAAAAAAAAAgAAAAAAAAAAACAAAA=
+ RdcMan\ConnectAsDialog.cs
+
+
+
+
+
+ AAQAAAAAABAAAgAAAAYAAAAAAABAAEAAQAAAAAAIAAA=
+ RdcMan\ConnectedGroup.cs
+
+
+
+
+
+
+ AAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\ConnectedServerRef.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAA=
+ RdcMan\ConnectServersDialog.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAgAAAAA=
+ RdcMan\ConnectToDialog.cs
+
+
+
+
+
+ AAAAAEAAAAAAAAAAEAAAAAAAAAAAAEAAQACAAAAAAAA=
+ RdcMan\ConnectToGroup.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\ControlExtensions.cs
+
+
+
+
+
+ AACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Ctrl\RdpCtrl.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAEAAAAAAAA=
+ RdcMan\DefaultGroupPropertiesDialog.cs
+
+
+
+
+
+ ABQAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAA=
+ RdcMan\DelegateCheckedMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\DelegateMenuItem.cs
+
+
+
+
+
+ CAABAAAAAAACAgAEIAAAAAAAIAAgQAQEACAIIAAAAAA=
+ RdcMan\Encryption.cs
+
+
+
+
+
+ AAQAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAgAAAAAAA=
+ RdcMan\EnumMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAA=
+ RdcMan\FavoriteServerRef.cs
+
+
+
+
+
+ AAAAAEAAAAAAAgAQAAAAAAAAAAAAAEAAQAAAAAAIBAA=
+ RdcMan\FavoritesGroup.cs
+
+
+
+
+
+
+ AACACCAAAQIAAgAIACAAAAACAAgAAIACEAAAiAAAQBA=
+ RdcMan\FileGroup.cs
+
+
+
+
+
+ AgAAAAAAAAAAAAIAAAAAIAAAIgAAAAAAAAAAAAAACAA=
+ RdcMan\FileGroupSettings.cs
+
+
+
+
+
+ AAQAAAAAAAAAAAAAAAAAAAACAAAAAAEAAAAAAAAAAAA=
+ RdcMan\FileRequiredMenuItem.cs
+
+
+
+
+
+ AAAABCAAAAAFAAAAAIAAIAggAAAAAAAAgAAAAAAAAAA=
+ RdcMan\FindServersDialog.cs
+
+
+
+
+
+ AAQEBBAgAAQMAABKMAQEEAEKg4IVLYABmAEgAERCIAA=
+ RdcMan\FormTools.cs
+
+
+
+
+
+ AAAAAEAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\GroupChangedEventArgs.cs
+
+
+
+
+
+ CAAAAAAAAAAAAAIAAAAAIBAAIAAAAAAAAAAAAAAgAAA=
+ RdcMan\GroupDisplaySettings.cs
+
+
+
+
+
+ AAAAAAAIAAABAAAAAAABAAIAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\GroupDisplaySettingsTabPage.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAEAAAAQAAA=
+ RdcMan\GroupPropertiesDialog.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\GroupPropertiesTabPage.cs
+
+
+
+
+
+ AgAAAAAAAAAAAAIAAAAAIAAAIgAAAAAAAACAAAAACAE=
+ RdcMan\GroupSettings.cs
+
+
+
+
+
+ AAAAAAAAACAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\HeaderColumnClickEventArgs.cs
+
+
+
+
+
+ AAIQDAAAAAAAECAAAAAAAAACAAAAAAAAQAQAMAAEDAE=
+ RdcMan\Helpers.cs
+
+
+
+
+
+ ACAAAAAAAAQAQAAAAAAAAAAKAgAAAAAAAAAAAABAABA=
+ RdcMan\HotKeyBox.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAACAABIEAA=
+ RdcMan\ImportServersPropertiesPage.cs
+
+
+
+
+
+ AAIAIAAkCEAgABAAAAQACAoAEAAgAEAQAAAAAwAAAAA=
+ RdcMan\Interface\InheritanceControl.cs
+
+
+
+
+
+ AAAAAAAAAIAAAAAAAAAAAAAAAAACAAAAAAAAgAAAAAA=
+ RdcMan\Interface\InheritSettingsType.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Interface\IntSetting.cs
+
+
+
+
+
+ AAEACQAAACADBCBEAKCAEAACgABAEgEQIAhBAQABAAA=
+ RdcMan\ListSessionsForm.cs
+
+
+
+
+
+ AAAAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAAAgAAAAAA=
+ RdcMan\ListSetting.cs
+
+
+
+
+
+ AAAgAAAABAAABAIAAABAoCAAIgAAABAAAEABAGAACAA=
+ RdcMan\LocalResourcesSettings.cs
+
+
+
+
+
+ AAIQAgA4AAAAAAAAAAAAQIAAAAAgAAAAAAEAAAAAAAA=
+ RdcMan\LocalResourcesTabPage.cs
+
+
+
+
+
+ AAAAAAAAAAAEAIAAAAACAAACAAAAAAAAAAACABEAAAA=
+ RdcMan\Log.cs
+
+
+
+
+
+ AABEAAAFIAACAAAAAAABAAAABAAAAQAAQAIQAAAAAAA=
+ RdcMan\LongRunningActionForm.cs
+
+
+
+
+
+ AoG2sQg0CYQZoS8QCDGB0SYQRAAsE0ogISKEWggkmgA=
+ RdcMan\MainForm.cs
+
+
+
+
+
+
+ AAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\MenuExtensions.cs
+
+
+
+
+
+ gAAAAAAAAQkAAAAAACAQAAAAgCAAAAAAAAAQAAAAAAA=
+ RdcMan\MenuHelper.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAA=
+ RdcMan\Models\ConnectionStateChangedEventArgs.cs
+
+
+
+
+
+ AAAAAAAQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAEAAAA=
+ RdcMan\Models\DeferDecryptionItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAIIAAAAAAAAAAAAAAAAAAAAAAQAAAAA=
+ RdcMan\Models\EnableTabsEventArgs.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAgAAAAA=
+ RdcMan\Models\ServerChangedEventArgs.cs
+
+
+
+
+
+ AAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAA=
+ RdcMan\Models\SettingProperty.cs
+
+
+
+
+
+ AAAAAABAAQAAAACAgAQACAgAAAAAADIAAQAAAABAAEA=
+ RdcMan\NodeHelper.cs
+
+
+
+
+
+ AAAAAAAAIAAQAAAAAAEAAAAAACAAAAAQAAAAAAAAAAA=
+ RdcMan\NodePropertiesDialog.cs
+
+
+
+
+
+ ACJAAAAIAAAAAAAAEAQAAAAAAAAAAQAAAAAAAABCAAA=
+ RdcMan\NodePropertiesPage.cs
+
+
+
+
+
+
+ ACAAAAAAAAQAQAAAAAAAAAAAAAAAAAAAEEBAAABAABA=
+ RdcMan\NumericTextBox.cs
+
+
+
+
+
+
+ QgQQAAQFZBhaCYgMQLoEmAIoADACAAAEeAYEiBAQuEA=
+ RdcMan\OcxClient\RdpClient.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAA=
+ RdcMan\OcxClient\RdpClient5.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAA=
+ RdcMan\OcxClient\RdpClient6.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAA=
+ RdcMan\OcxClient\RdpClient7.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\OcxClient\RdpClient8.cs
+
+
+
+
+
+
+ QAAAAAAAAAAAAAAQAAAAAAACEgAABAAAAAAAgAAAAAA=
+ RdcMan\PasswordSetting.cs
+
+
+
+
+
+
+ CCLAAAAAAAAAQQBAoBAAAAAOAAAihUAACgEEFAAABEA=
+ RdcMan\Program.cs
+
+
+
+
+
+ AAAAAAAAAAAAAEAAAAAAAAAAACAAAAIAAAAAAAAAAAA=
+ RdcMan\QuickConnectDialog.cs
+
+
+
+
+
+ AAAAAAABAAABAAAAAAAAAAAAACAAAAAAAAAAAAAAAAA=
+ RdcMan\QuickConnectTabPage.cs
+
+
+
+
+
+ AAACIAAAAAAAAAABGAAAQBAwAAAgAQAAAACCQAAAGAQ=
+ RdcMan\RdcBaseForm.cs
+
+
+
+
+
+ ACAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAABA=
+ RdcMan\RdcCheckBox.cs
+
+
+
+
+
+
+ ABAAAAAAQAAQAIAAAAEQAgAAAIAABAIAAAABAACAAAA=
+ RdcMan\RdcDialog.cs
+
+
+
+
+
+ ACAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAYAAA=
+ RdcMan\RdcListView.cs
+
+
+
+
+
+ AAQAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAA=
+ RdcMan\RdcMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\RdcMenuStrip.cs
+
+
+
+
+
+ ACAAAAAAAACAQAAAAAAAAAAAAAAAAAAAAAAAAABAABA=
+ RdcMan\RdcNumericUpDown.cs
+
+
+
+
+
+
+ ACAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAABA=
+ RdcMan\RdcRadioButton.cs
+
+
+
+
+
+
+ ACAAAAAAAACAQAAAAAAAAAAAAAAAAAAAAAAAAABAABA=
+ RdcMan\RdcTextBox.cs
+
+
+
+
+
+
+ NQZIAiDABEYMAAAYEIAAIJACAgAGQVACEUCAoAbSAAA=
+ RdcMan\RdcTreeNode.cs
+
+
+
+
+
+
+ IIAEAAABAAAwAQAJAAAQAAAKAQIAAEAABBAAAAAQAAA=
+ RdcMan\RdgFile.cs
+
+
+
+
+
+ QAAAAEAAABIAAgAIAAYAAAAAAABBAFAAQAAAAAAIBAA=
+ RdcMan\RecentlyUsedGroup.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\RecentlyUsedServerRef.cs
+
+
+
+
+
+ AACAAAAAAAAAAAAQAAAAAAAAAAAAAEAAQAAAAAAIBAA=
+ RdcMan\ReconnectGroup.cs
+
+
+
+
+
+
+ BAQAIAIAACAAgAAAAAQAAAAAAAAQAAIAAEAAAAYAAAA=
+ RdcMan\ReconnectServerRef.cs
+
+
+
+
+
+ AAQAAgAAAAAAAAAAAYAAAAACAAAgAAAAAAAAAAAAAAA=
+ RdcMan\RemoteDesktopsMenuItem.cs
+
+
+
+
+
+ AAAAAgAIAAAgAAAAAAAAAEAAAAAAAAAAAAAAAAACAAg=
+ RdcMan\RemoteDesktopTabPage.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAQQAABAAAAAA=
+ RdcMan\RemoteSessionInfo.cs
+
+
+
+
+
+ IAAAAAAQAAAAAABAQAACAAAAAAAAEAAAAAAAAAABAAA=
+ RdcMan\RemoteSessions.cs
+
+
+
+
+
+ AAAAAAAAAAAAAgAEAAAAAgACAAAEAEAAAAKggQAAIAA=
+ RdcMan\Rule.cs
+
+
+
+
+
+ AgAAAAAAAAAABgAAAAAAQgACAAAAAMAAAAAAgAAAIAA=
+ RdcMan\RuleGroup.cs
+
+
+
+
+
+ AAAAAAAAIAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAA=
+ RdcMan\RuleProperty.cs
+
+
+
+
+
+ EAQQAAAAAAACAAAAgAAAAAACAAAAAAAAAAAAAAAAEAA=
+ RdcMan\SaveCredentialsDialog.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAIAAAACIAAAIgAAAAAAAAAAAAAACAA=
+ RdcMan\SecuritySettings.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\SecuritySettingsTabPage.cs
+
+
+
+
+
+ AAAAAAAAAACAAAAAAAAAAAEAAAAAAAAACAAAAYAAAAI=
+ RdcMan\SelectActiveServerForm.cs
+
+
+
+
+
+ AAQAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAgAAAAAA=
+ RdcMan\SelectedNodeMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\SelectedNodeMenuItem.cs
+
+
+
+
+
+ AAAAAAACBACEEAAEAAEAAIACgAIAAAAAgAgKIAAAAAE=
+ RdcMan\SelectServersDialogBase.cs
+
+
+
+
+
+ AAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\SendKeys.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAA=
+ RdcMan\SendKeysMenuItem.cs
+
+
+
+
+
+ hnQ8kiYJgYJG0kjNUsYAEJECWAAEecIkk2SsxqRSAoc=
+ RdcMan\Server.cs
+
+
+
+
+
+ gjAAECBAAAAAwBDAAAIAABAAEAAAAAAgAQAIAiACAAA=
+ RdcMan\ServerBase.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAQIAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\ServerBox.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAIAAAAAIAAAIAAAAAAAAAAAAAAAAAA=
+ RdcMan\ServerDisplaySettings.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\ServerDisplaySettingsTabPage.cs
+
+
+
+
+
+ ABEAIAAkgQQBARAAQCACAAxQhICAEAAAAACEAAAAEAQ=
+ RdcMan\ServerForm.cs
+
+
+
+
+
+
+ IABAAAIABAAAAAAgAAAAAAAAAABAAAAQIAAAAiAAAAA=
+ RdcMan\ServerLabel.cs
+
+
+
+
+
+ AAQAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAA=
+ RdcMan\ServerMenuItem.cs
+
+
+
+
+
+ AAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAQUAAA=
+ RdcMan\ServerPropertiesDialog.cs
+
+
+
+
+
+ AAAAAgAJAAAAAAAAAAEQAAAAAVAACAQAQAIAAgBAAAg=
+ RdcMan\ServerPropertiesTabPage.cs
+
+
+
+
+
+ hjQIEAAAAAIEwQBMUAIAAJAAEAAGQAAgAUAIgiRCAAA=
+ RdcMan\ServerRef.cs
+
+
+
+
+
+ AgAAEAAAAAACAAKAAAAAIAAIIgAAAAAAAAAAAAAACAA=
+ RdcMan\ServerSettings.cs
+
+
+
+
+
+ IMBQCiAQjQAAmQGAgipRAACAALAgMIAA8AGDEQAPGkA=
+ RdcMan\ServerTree.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAA=
+ RdcMan\ServerTreeLocationMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAA=
+ RdcMan\ServerTreeVisibilityMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAABAAAAAAAA=
+ RdcMan\SessionListSortComparer.cs
+
+
+
+
+
+
+ AAAAAQAAAQJAAgAIACAAAQACACJAAMAAAEgAgAECBAA=
+ RdcMan\SmartGroup.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAEAAAAQAAA=
+ RdcMan\SmartGroupPropertiesDialog.cs
+
+
+
+
+
+ AABkCgBMEAAAAAAgAAgAAAAAAAAAAQAAAAAAAgAIACA=
+ RdcMan\SmartGroupPropertiesTabPage.cs
+
+
+
+
+
+ AgAAAAAAAAAAAAIAAAAAIAAAIgAAAAAAAAAAAAAACAA=
+ RdcMan\SmartGroupSettings.cs
+
+
+
+
+
+ AAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\SmartServerRef.cs
+
+
+
+
+
+ AAAgAAAEAAAAAEAAAEAAAAAAAAgAAAAAAAMAAAAAAAA=
+ RdcMan\SortExtensions.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAA=
+ RdcMan\SortGroupsCheckedMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAA=
+ RdcMan\SortServersCheckedMenuItem.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAA=
+ RdcMan\StringSetting.cs
+
+
+
+
+
+ AAACAAAAAAAAAAAAAQAAAAAAAhAAAAAAIAIAAIQgSAA=
+ RdcMan\StringUtilities.cs
+
+
+
+
+
+ AQAAAgBIAAAAAAAAAAAAAgAAAAAAAAIACAQAAABAAAA=
+ RdcMan\TabbedSettingsDialog.cs
+
+
+
+
+
+ AAAAAAAAEAAAAAAAAAAAAAAAAAAAAEAAAAAAAABAAAA=
+ RdcMan\TemporaryServer.cs
+
+
+
+
+
+ AAQAAAAAADAEACQAAAAAAAAAAAAAAHACgAABgAAAAAA=
+ RdcMan\ThrottledAction.cs
+
+
+
+
+
+
+ AAIAAAAAACAEAAQAAAAAAAQAAAAAAAAAAAAEABAAIAA=
+ RdcMan\ThrottledOperation.cs
+
+
+
+
+
+
+ AEAAAEg4ACAEAJIEpAAAAAAmAAQEACAgAAAAAEAAAAA=
+ RdcMan\ThumbnailLayout.cs
+
+
+
+
+
+
+ ACAAAAECAEAAXAAAAAAAAAAAwAAAAAAAAAAACABAABA=
+ RdcMan\ValueComboBox.cs
+
+
+
+
+
+
+ AAAAgAAAAAIAAAJAAgAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\VirtualGroup.cs
+
+
+
+
+
+ AAAAAACABAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Configuration\Current.cs
+
+
+
+
+
+ AAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Configuration\DisplaySizeElement.cs
+
+
+
+
+
+ AAACAAAAAAAAIAAAAAAAAAAAAAABAAAAAAAQAAAAAAA=
+ RdcMan\Configuration\DisplaySizeElementCollection.cs
+
+
+
+
+
+ AAAAAAAAAAAAAIIAAQAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Configuration\LoggingElement.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAACAAAA=
+ RdcMan\Configuration\ProgramUpdateElement.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAQAAAAAAAAAAAQAAIAAIAAAAAAA=
+ RdcMan\Configuration\RdcManSection.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Configuration\WarningThresholdsElement.cs
+
+
+
+
+
+ BAAAAEAAAAAAAgAQAAAAAAIAAAAAAEAAQAAQAAAIBAA=
+ RdcMan\Ctrl\InternalGroup.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Ctrl\InternalServerRef.cs
+
+
+
+
+
+ AAAADCQIAAAAggABgYAgAAAQAIAABAAAABACACAiAHA=
+ Win32\Constants.cs
+
+
+
+
+
+ AAEAAAAAAAAABAAAAAAAAAACAAAAAAAAAAAAAAAAAAA=
+ Win32\Crypto.cs
+
+
+
+
+
+ AAAAgAAAAAQAAAAAIAAAAAAAAEAAgAAAAAAAAAAAAAA=
+ Win32\Kernel.cs
+
+
+
+
+
+ gABAAABAAAAAQBAAAAgACAAAAAAAiAAACCAABgAAAKA=
+ Win32\Messages.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ Win32\Structs.cs
+
+
+
+
+
+ AAAAAABAAAAAAAACKCAAAAAAAACAAAAAAQAAgASgiAA=
+ Win32\User.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAgAAAQAAAAAAAAAAAAAAAAAAAA=
+ Win32\Util.cs
+
+
+
+
+
+ AAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAgAAAAAEAAQ=
+ Win32\WinTrust.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAACAAEQAAEAAIQAABEgQAAAEAAAABA=
+ Win32\WinTrustData.cs
+
+
+
+
+
+ AgAAAAAAAAAAABAAAAAACAAAAAAAAAAAAAAAEAAAAAA=
+ Win32\WinTrustFileInfo.cs
+
+
+
+
+
+ AAAACAAQAAgAAAAAAAACBAAAAAAAEAAAAgAAAAABAAA=
+ Win32\Wts.cs
+
+
+
+
+
+ AAgAAAAAQAAAAgAAEAIAAAACAAAAAAAAAAAAiAAAAAA=
+ RdcMan\Interface\IBuiltInVirtualGroup.cs
+
+
+
+
+
+ AAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA=
+ RdcMan\Interface\ICredentialsTabPage.cs
+
+
+
+
+
+ QAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Interface\IDeferDecryption.cs
+
+
+
+
+
+ EAQAAAAAAAAAAAAAAAAAAAAAAgAAAAACAQAAAAAAAAA=
+ RdcMan\Interface\ILogonCredentials.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAQAAAAQAAAAAAAAAAAAAA=
+ RdcMan\Interface\IMainForm.cs
+
+
+
+
+
+ ACBAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAACAAA=
+ RdcMan\Interface\INodePropertiesPage.cs
+
+
+
+
+
+ AAQAACAAAAAAAAAgAAAAAQAAAAAAAAABAAAhAAAAAAA=
+ RdcMan\Interface\IPlugin.cs
+
+
+
+
+
+ AAAAAAAAAACCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Interface\IPluginContext.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Interface\IRdpClient.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAA=
+ RdcMan\Interface\IServerRefFactory.cs
+
+
+
+
+
+ AAAQAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAIAAA=
+ RdcMan\Interface\IServerTree.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAACAgAAAAAAAAAAgAAAAAA=
+ RdcMan\Interface\ISetting.cs
+
+
+
+
+
+ AAAAAAAAAACAAEAAAAAAAAAAAAAAAAQAAAAAAAAAAAA=
+ RdcMan\Interface\ISettingControl.cs
+
+
+
+
+
+ AAAAAgAIAACAAAAACAAAAAAAAAAAAAIAAAAAAAAAAAA=
+ RdcMan\Interface\ISettingsTabPage.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAgAAAAA=
+ RdcMan\Interface\IUndockedServerForm.cs
+
+
+
+
+
+ AAAAAEAAAAAAAAIAAACAAAAAQAAECAAIABQAAAAAAAA=
+ RdcMan\Interface\ImageConstants.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAQAAACAAAAAAAAAAAAAAAAAAAEAAAA=
+ RdcMan\Interface\InheritanceMode.cs
+
+
+
+
+
+ AIIgIBGAgBAZAUQaAEABCIpAQABlBkADwAQEAIEBIhA=
+ RdcMan\MenuNames.cs
+
+
+
+
+
+ AAAAAAAAAAAACAAAAAAAAAAAgAAAAAAAQAAAAAAAAAA=
+ RdcMan\Models\ChangeType.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAQAAA=
+ RdcMan\Models\ConnectionType.cs
+
+
+
+
+
+ AAAAEAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAEAAAA=
+ RdcMan\Models\ControlVisibility.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAECAAAA=
+ RdcMan\Models\EncryptionMethod.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAIAAAQEAAAA=
+ RdcMan\Models\LogonCredentialsDialogOptions.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAABAAA=
+ RdcMan\Models\ProfileScope.cs
+
+
+
+
+
+ IABAAIAAQAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\Models\SaveResult.cs
+
+
+
+
+
+ AAAACAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAA=
+ RdcMan\NodeVisitorResult.cs
+
+
+
+
+
+ AAAAAAAQgAAAAAABAABAAAAAAAAABAAAAAAAAAEAAAA=
+ RdcMan\OperationBehavior.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAEAAAA=
+ RdcMan\ReconnectServerOptions.cs
+
+
+
+
+
+ IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAA=
+ RdcMan\RuleGroupOperator.cs
+
+
+
+
+
+ ABAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAA=
+ RdcMan\RuleOperator.cs
+
+
+
+
+
+ AAAAEAAEAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAA=
+ RdcMan\ServerProperty.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAEAg=
+ RdcMan\SortOrder.cs
+
+
+
+
+
+ AEAAAAAAAAAAAAAAAAAAAAABAAAEAAAAAAAAAEAAAAg=
+ Win32\WinTrustDataChoice.cs
+
+
+
+
+
+ AEgAIAQAAABAAQAAIABAABAABAAAAACEAAAAAAACAAA=
+ Win32\WinTrustDataProvFlags.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAEAAAA=
+ Win32\WinTrustDataRevocationChecks.cs
+
+
+
+
+
+ AAAAAAAACAAAAQAAAAAAAAAAAAAAAAABAAACAACAAAA=
+ Win32\WinTrustDataStateAction.cs
+
+
+
+
+
+ CAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAIAAAAEAAAA=
+ Win32\WinTrustDataUIChoice.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+ Win32\WinTrustDataUIContext.cs
+
+
+
+
+
+ AQAAAAAAAAAAAgAQAAAAACgIAgAAEAAAAAAAIIAAAAA=
+ Win32\WinVerifyTrustResult.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAABAAQAAAAAAAAAAAAAAAAAAA=
+ RdcMan\HeaderColumnClickEventHandler.cs
+
+
+
+
\ No newline at end of file
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 3baa6fd..12eed09 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -12,4 +12,4 @@
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: ComVisible(false)]
-[assembly: AssemblyVersion("2.90.1420.0")]
+[assembly: AssemblyVersion("2.92.1430.0")]
diff --git a/RDCMan.csproj b/RDCMan.csproj
index fb24acc..30885db 100644
--- a/RDCMan.csproj
+++ b/RDCMan.csproj
@@ -5,6 +5,7 @@
WinExe
True
net48
+ AnyCPU;x64
9.0
@@ -14,31 +15,42 @@
Resources\app.ico
app.manifest
+
+ x64
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+ RdcLib\AxInterop.MSTSCLib.dll
+
+
+
+ RdcLib\Interop.MSTSCLib.dll
+
+
-
- RdcLib\AxMSTSCLib.dll
-
-
- RdcLib\MSTSCLib.dll
-
\ No newline at end of file
diff --git a/RDCMan.csproj.user b/RDCMan.csproj.user
new file mode 100644
index 0000000..e73f123
--- /dev/null
+++ b/RDCMan.csproj.user
@@ -0,0 +1,255 @@
+
+
+
+
+
+ Form
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Form
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Form
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Form
+
+
+ Form
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Form
+
+
+ Component
+
+
+
\ No newline at end of file
diff --git a/RDCMan.sln b/RDCMan.sln
index 8084781..fde9f55 100644
--- a/RDCMan.sln
+++ b/RDCMan.sln
@@ -1,24 +1,31 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.32407.337
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33103.184
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RDCMan", "RDCMan.csproj", "{C862011B-2A9C-4F7F-BE06-2E7C3F5A2E04}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RDCMan", "RDCMan.csproj", "{E4F06803-E397-4AD5-A013-9B2E0935CF65}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {C862011B-2A9C-4F7F-BE06-2E7C3F5A2E04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C862011B-2A9C-4F7F-BE06-2E7C3F5A2E04}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C862011B-2A9C-4F7F-BE06-2E7C3F5A2E04}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C862011B-2A9C-4F7F-BE06-2E7C3F5A2E04}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E4F06803-E397-4AD5-A013-9B2E0935CF65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E4F06803-E397-4AD5-A013-9B2E0935CF65}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E4F06803-E397-4AD5-A013-9B2E0935CF65}.Debug|x64.ActiveCfg = Debug|x64
+ {E4F06803-E397-4AD5-A013-9B2E0935CF65}.Debug|x64.Build.0 = Debug|x64
+ {E4F06803-E397-4AD5-A013-9B2E0935CF65}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E4F06803-E397-4AD5-A013-9B2E0935CF65}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E4F06803-E397-4AD5-A013-9B2E0935CF65}.Release|x64.ActiveCfg = Release|x64
+ {E4F06803-E397-4AD5-A013-9B2E0935CF65}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {FE1A1A73-2A1D-4B02-88BD-C4B2A4BF9A5A}
+ SolutionGuid = {B47E664F-6F1E-4053-8FCF-4A2DDB9B143B}
EndGlobalSection
EndGlobal
diff --git a/README.md b/README.md
index f0d7064..29effae 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,21 @@
-# RDCMan v2.90.1420.0
+# RDCMan v2.92.1430.0
微软远程桌面管理工具
Remote Desktop Connection Manager
-reflect base on v2.90.1420.0
-[Official download link 发布时间: 2022 年 1 月 27 日](https://docs.microsoft.com/zh-cn/sysinternals/downloads/rdcman)
+reflect base on v2.92.1430.0
+[Official download link 发布时间: 2023 年 1 月 25 日](https://docs.microsoft.com/zh-cn/sysinternals/downloads/rdcman)
-汉化,及本土优化
+汉化,及本土优化
+
+Use .Net Framework 4.8
+
+## 控件版本说明
+需要 System32\mstscax.dll
+产生 AxInterop.MSTSCLib.dll 和 Interop.MSTSCLib.dll
+新的包含最新的 rdp client 10~11,
+然后 引用程序集;
+也可以使用 之前的 AxMSTSCLib.dll 和 MSTSCLib.dll
-Use .Net Framework 4.8
## 个性化更改的记录
没找到 支持 RdpClient10 的 lib , 注销掉了此部分支持代码
@@ -21,7 +29,7 @@ Use .Net Framework 4.8
影响文件:
CredentialsUI.cs::InitPassword line:121 并 注释常量 DummyPassword
-2. 增加汉化说明
+2. 增加汉化说明
影响文件:
About.cs::InitializeComponent line:20/35/42
@@ -51,6 +59,22 @@ Use .Net Framework 4.8
影响文件:
GlobalOptionsDialog.cs::CreateServerTreePage line:352/367/373/385
+8. `查找服务器` 界面和功能优化
+影响文件:
+ SelectServersDialogBase.cs line:10,27,35,46,53,63-66,89,92
+ FindServersDialog.cs line:22,59,77
+
+9. 未停靠时双击激活远程桌面显示
+影响文件:
+ SeverBox.cs::OnMouseDown line:23 新增
+
+10. 双点击缩略图激活远程桌面显示
+影响文件:
+ SeverBox.cs::DbClickShow line:35 新增
+ CiientPanel.cs::OnMouseDown line:459 新增
+
+
+
999. 内置组 (配置完成,功能未完成)
影响文件:
GlobalSettings.cs<>ShowBuiltInGroup line:437
diff --git a/RdcLib/AxInterop.MSTSCLib.dll b/RdcLib/AxInterop.MSTSCLib.dll
new file mode 100644
index 0000000..55ff0c4
Binary files /dev/null and b/RdcLib/AxInterop.MSTSCLib.dll differ
diff --git a/RdcLib/AxMSTSCLib.dll b/RdcLib/AxMSTSCLib.dll
deleted file mode 100644
index 0ceefd7..0000000
Binary files a/RdcLib/AxMSTSCLib.dll and /dev/null differ
diff --git a/RdcLib/Interop.MSTSCLib.dll b/RdcLib/Interop.MSTSCLib.dll
new file mode 100644
index 0000000..b141c7c
Binary files /dev/null and b/RdcLib/Interop.MSTSCLib.dll differ
diff --git a/RdcLib/MSTSCLib.dll b/RdcLib/MSTSCLib.dll
deleted file mode 100644
index 63813a0..0000000
Binary files a/RdcLib/MSTSCLib.dll and /dev/null differ
diff --git a/RdcMan/About.cs b/RdcMan/About.cs
index 3be3fb0..5066efc 100644
--- a/RdcMan/About.cs
+++ b/RdcMan/About.cs
@@ -17,7 +17,7 @@ private void InitializeComponent(bool isLarge) {
Location = new Point(53, 31),
Width = num2 - FormTools.LabelWidth,
AutoSize = true,
- Text = "Copyright © 2022 Microsoft. By Julian Burger, lzp 汉化"
+ Text = "Copyright © 2023 Microsoft. By Julian Burger"
};
LinkLabel linkLabel = new LinkLabel {
Location = new Point(53, 48),
diff --git a/RdcMan/AddNodeDialogHelper.cs b/RdcMan/AddNodeDialogHelper.cs
index 9588436..4c9f9a7 100644
--- a/RdcMan/AddNodeDialogHelper.cs
+++ b/RdcMan/AddNodeDialogHelper.cs
@@ -161,4 +161,4 @@ private static void NotifyUserFileNeeded() {
FormTools.InformationDialog("ӷ/֮ǰһеķֻļ (File->Open) һļ (File->New)");
}
}
-}
\ No newline at end of file
+}
diff --git a/RdcMan/ArgumentParser.cs b/RdcMan/ArgumentParser.cs
index dd94bd5..0e83d7f 100644
--- a/RdcMan/ArgumentParser.cs
+++ b/RdcMan/ArgumentParser.cs
@@ -1,49 +1,62 @@
using System;
using System.Collections.Generic;
-namespace RdcMan {
- public class ArgumentParser {
+namespace RdcMan
+{
+ public class ArgumentParser
+ {
public Dictionary Switches = new Dictionary(StringComparer.OrdinalIgnoreCase);
public Dictionary SwitchValues = new Dictionary(StringComparer.OrdinalIgnoreCase);
public List PlainArgs = new List();
- public void AddSwitch(string name, bool requiresValue) {
+ public void AddSwitch(string name, bool requiresValue)
+ {
Switches[name] = requiresValue;
}
- public void Parse() {
+ public void Parse()
+ {
string[] commandLineArgs = Environment.GetCommandLineArgs();
- for (int i = 1; i < commandLineArgs.Length; i++) {
- if (IsSwitch(commandLineArgs[i])) {
+ for (int i = 1; i < commandLineArgs.Length; i++)
+ {
+ if (IsSwitch(commandLineArgs[i]))
+ {
string key = commandLineArgs[i].Substring(1);
- if (!Switches.TryGetValue(key, out var value)) {
+ if (!Switches.TryGetValue(key, out var value))
+ {
throw new ArgumentException("Unexpected switch: " + commandLineArgs[i]);
}
string value2 = string.Empty;
- if (value) {
- if (i >= commandLineArgs.Length - 1) {
+ if (value)
+ {
+ if (i >= commandLineArgs.Length - 1)
+ {
throw new ArgumentException("Switch " + commandLineArgs[i] + " requires an argument");
}
value2 = commandLineArgs[++i];
}
SwitchValues[key] = value2;
}
- else {
+ else
+ {
PlainArgs.Add(commandLineArgs[i]);
}
}
}
- public bool HasSwitch(string name) {
+ public bool HasSwitch(string name)
+ {
string value;
return SwitchValues.TryGetValue(name, out value);
}
- private bool IsSwitch(string arg) {
+ private bool IsSwitch(string arg)
+ {
char c = arg[0];
- if (c != '/') {
+ if (c != '/')
+ {
return c == '-';
}
return true;
diff --git a/RdcMan/BaseSetting.cs b/RdcMan/BaseSetting.cs
index c2b1bde..4fdff89 100644
--- a/RdcMan/BaseSetting.cs
+++ b/RdcMan/BaseSetting.cs
@@ -1,24 +1,30 @@
using System.Xml;
-namespace RdcMan {
- public abstract class BaseSetting : ISetting {
+namespace RdcMan
+{
+ public abstract class BaseSetting : ISetting
+ {
internal T Value;
- protected BaseSetting(object o) {
+ protected BaseSetting(object o)
+ {
Value = ((o != null) ? ((T)o) : default(T));
}
public abstract void ReadXml(XmlNode xmlNode, RdcTreeNode node);
- public virtual void WriteXml(XmlTextWriter tw, RdcTreeNode node) {
+ public virtual void WriteXml(XmlTextWriter tw, RdcTreeNode node)
+ {
tw.WriteString(Value.ToString());
}
- public virtual void Copy(ISetting source) {
+ public virtual void Copy(ISetting source)
+ {
Value = ((BaseSetting)source).Value;
}
- public override string ToString() {
+ public override string ToString()
+ {
return Value.ToString();
}
}
diff --git a/RdcMan/BoolSetting.cs b/RdcMan/BoolSetting.cs
index b77050f..134dc53 100644
--- a/RdcMan/BoolSetting.cs
+++ b/RdcMan/BoolSetting.cs
@@ -1,12 +1,16 @@
using System.Xml;
-namespace RdcMan {
- public class BoolSetting : Setting {
+namespace RdcMan
+{
+ public class BoolSetting : Setting
+ {
public BoolSetting(object o)
- : base(o) {
+ : base(o)
+ {
}
- public override void ReadXml(XmlNode xmlNode, RdcTreeNode node) {
+ public override void ReadXml(XmlNode xmlNode, RdcTreeNode node)
+ {
base.Value = bool.Parse(xmlNode.FirstChild.InnerText);
}
}
diff --git a/RdcMan/BuiltInVirtualGroup.cs b/RdcMan/BuiltInVirtualGroup.cs
index 54ceb29..3de9fbc 100644
--- a/RdcMan/BuiltInVirtualGroup.cs
+++ b/RdcMan/BuiltInVirtualGroup.cs
@@ -3,8 +3,10 @@
using System.Windows.Forms;
using System.Xml;
-namespace RdcMan {
- internal abstract class BuiltInVirtualGroup : VirtualGroup, IBuiltInVirtualGroup where TServerRef : ServerRef {
+namespace RdcMan
+{
+ internal abstract class BuiltInVirtualGroup : VirtualGroup, IBuiltInVirtualGroup where TServerRef : ServerRef
+ {
protected new static Dictionary NodeActions;
string IBuiltInVirtualGroup.Text => base.Text;
@@ -33,115 +35,152 @@ public bool IsInTree {
protected virtual bool IsVisibilityConfigurable => true;
- void IBuiltInVirtualGroup.ReadXml(XmlNode xmlNode, FileGroup fileGroup, ICollection errors) {
+ void IBuiltInVirtualGroup.ReadXml(XmlNode xmlNode, FileGroup fileGroup, ICollection errors)
+ {
ReadXml(xmlNode, fileGroup, errors);
}
- void IBuiltInVirtualGroup.WriteXml(XmlTextWriter tw, FileGroup fileGroup) {
+ void IBuiltInVirtualGroup.WriteXml(XmlTextWriter tw, FileGroup fileGroup)
+ {
WriteXml(tw, fileGroup);
}
- bool IBuiltInVirtualGroup.ShouldWriteNode(ServerRef serverRef, FileGroup file) {
+ bool IBuiltInVirtualGroup.ShouldWriteNode(ServerRef serverRef, FileGroup file)
+ {
return ShouldWriteNode(serverRef, file);
}
- static BuiltInVirtualGroup() {
+ static BuiltInVirtualGroup()
+ {
NodeActions = new Dictionary(GroupBase.NodeActions);
- NodeActions["server"] = delegate (XmlNode childNode, RdcTreeNode parent, ICollection errors) {
+ NodeActions["server"] = delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors)
+ {
TreeNode treeNode = ServerTree.Instance.FindNodeByName(childNode.InnerText);
if (treeNode != null && treeNode is Server serverBase)
+ {
(parent as BuiltInVirtualGroup).AddReference(serverBase);
+ }
};
}
- public override void OnRemoving() {
+ public override void OnRemoving()
+ {
Hide();
}
- public sealed override bool ConfirmRemove(bool askUser) {
- FormTools.InformationDialog("Use the View menu to hide the " + base.Text + " group");
+ public sealed override bool ConfirmRemove(bool askUser)
+ {
+ FormTools.InformationDialog("ʹáͼ˵ " + base.Text + " ");
return false;
}
- public sealed override bool CanDropOnTarget(RdcTreeNode targetNode) {
+ public sealed override bool CanDropOnTarget(RdcTreeNode targetNode)
+ {
return false;
}
- public override bool CanDropServers() {
+ public override bool CanDropServers()
+ {
return false;
}
- public sealed override bool CanRemove(bool popUI) {
+ public sealed override bool CanRemove(bool popUI)
+ {
return false;
}
- public override void DoPropertiesDialog(Form parentForm, string activeTabName) {
+ public override void DoPropertiesDialog(Form parentForm, string activeTabName)
+ {
throw new NotImplementedException();
}
- internal override void ReadXml(XmlNode xmlNode, ICollection errors) {
+ internal override void ReadXml(XmlNode xmlNode, ICollection errors)
+ {
throw new NotImplementedException();
}
- internal override void WriteXml(XmlTextWriter tw) {
+ internal override void WriteXml(XmlTextWriter tw)
+ {
throw new NotImplementedException();
}
- protected virtual void ReadXml(XmlNode xmlNode, FileGroup fileGroup, ICollection errors) {
- if (!string.IsNullOrEmpty(XmlNodeName)) {
+ protected virtual void ReadXml(XmlNode xmlNode, FileGroup fileGroup, ICollection errors)
+ {
+ if (!string.IsNullOrEmpty(XmlNodeName))
+ {
ReadXml(NodeActions, xmlNode, errors);
if (base.Properties.Expanded.Value)
+ {
Expand();
+ }
}
}
- protected virtual void WriteXml(XmlTextWriter tw, FileGroup file) {
+ protected virtual void WriteXml(XmlTextWriter tw, FileGroup file)
+ {
if (string.IsNullOrEmpty(XmlNodeName))
+ {
return;
-
+ }
tw.WriteStartElement(XmlNodeName);
if (file == null)
+ {
WriteXmlSettingsGroups(tw);
-
- foreach (TreeNode node in base.Nodes) {
+ }
+ foreach (TreeNode node in base.Nodes)
+ {
TServerRef val = node as TServerRef;
if (ShouldWriteNode(val, file))
+ {
tw.WriteElementString("server", val.ServerNode.FullPath);
+ }
}
tw.WriteEndElement();
}
- protected virtual bool ShouldWriteNode(RdcTreeNode node, FileGroup file) {
+ protected virtual bool ShouldWriteNode(RdcTreeNode node, FileGroup file)
+ {
return node.FileGroup == file;
}
- public virtual TServerRef AddReference(ServerBase serverBase) {
+ public virtual TServerRef AddReference(ServerBase serverBase)
+ {
if (serverBase == null)
+ {
return null;
-
+ }
Server serverNode = serverBase.ServerNode;
TServerRef val = serverNode.FindServerRef();
- if (val == null) {
+ if (val == null)
+ {
val = base.ServerRefFactory.Create(serverNode) as TServerRef;
ServerTree.Instance.AddNode(val, this);
}
return val;
}
- protected void UpdateVisibleInTree(bool isVisible) {
- if (isVisible) {
- if (base.TreeView == null) {
+ protected void UpdateVisibleInTree(bool isVisible)
+ {
+ if (isVisible)
+ {
+ if (base.TreeView == null)
+ {
ServerTree.Instance.AddNode(this, ServerTree.Instance.RootNode);
Expand();
- ServerTree.Instance.Operation(OperationBehavior.RestoreSelected, delegate {
+ ServerTree.Instance.Operation(OperationBehavior.RestoreSelected, delegate
+ {
ServerTree.Instance.SortBuiltinGroups();
});
}
}
else if (base.TreeView != null)
+ {
ServerTree.Instance.RemoveNode(this);
+ }
if (IsVisibilityConfigurable)
+ {
Program.Preferences.SetBuiltInGroupVisibility(this, isVisible);
+ }
}
}
}
diff --git a/RdcMan/BuiltInVirtualGroupCheckedMenu.cs b/RdcMan/BuiltInVirtualGroupCheckedMenu.cs
index 95b40d9..9601edf 100644
--- a/RdcMan/BuiltInVirtualGroupCheckedMenu.cs
+++ b/RdcMan/BuiltInVirtualGroupCheckedMenu.cs
@@ -1,17 +1,22 @@
-namespace RdcMan {
- internal class BuiltInVirtualGroupCheckedMenuItem : CheckedMenuItem {
+namespace RdcMan
+{
+ internal class BuiltInVirtualGroupCheckedMenuItem : CheckedMenuItem
+ {
private IBuiltInVirtualGroup _group;
public BuiltInVirtualGroupCheckedMenuItem(IBuiltInVirtualGroup group)
- : base(group.Text) {
+ : base(group.Text)
+ {
_group = group;
}
- protected override void CheckChanged(bool isChecked) {
+ protected override void CheckChanged(bool isChecked)
+ {
_group.IsInTree = isChecked;
}
- public override void Update() {
+ public override void Update()
+ {
base.Checked = _group.IsInTree;
}
}
diff --git a/RdcMan/ChangeType.cs b/RdcMan/ChangeType.cs
index 5e07717..bf59cb1 100644
--- a/RdcMan/ChangeType.cs
+++ b/RdcMan/ChangeType.cs
@@ -1,8 +1,10 @@
using System;
-namespace RdcMan {
+namespace RdcMan
+{
[Flags]
- public enum ChangeType {
+ public enum ChangeType
+ {
InvalidateUI = 1,
TreeChanged = 3,
PropertyChanged = 5
diff --git a/RdcMan/CheckedMenuItem.cs b/RdcMan/CheckedMenuItem.cs
index 277ffd9..8e9b939 100644
--- a/RdcMan/CheckedMenuItem.cs
+++ b/RdcMan/CheckedMenuItem.cs
@@ -1,10 +1,14 @@
-namespace RdcMan {
- internal abstract class CheckedMenuItem : RdcMenuItem {
- protected CheckedMenuItem(string text) {
+namespace RdcMan
+{
+ internal abstract class CheckedMenuItem : RdcMenuItem
+ {
+ protected CheckedMenuItem(string text)
+ {
Text = text;
}
- protected sealed override void OnClick() {
+ protected sealed override void OnClick()
+ {
CheckChanged(!base.Checked);
}
diff --git a/RdcMan/ClientPanel.cs b/RdcMan/ClientPanel.cs
index de86705..0361895 100644
--- a/RdcMan/ClientPanel.cs
+++ b/RdcMan/ClientPanel.cs
@@ -6,15 +6,17 @@
using System.Windows.Forms;
using Win32;
-namespace RdcMan {
- internal class ClientPanel : Control {
+namespace RdcMan
+{
+ internal class ClientPanel : Control
+ {
private static readonly int ThumbnailLabelHeight;
private const int ThumbnailHorzSpace = 8;
private const int ThumbnailVertSpace = 6;
- private readonly Dictionary _layoutHash;
+ private Dictionary _layoutHash;
private readonly Dictionary _groupScrollPosition;
@@ -22,6 +24,8 @@ internal class ClientPanel : Control {
private Size _savedSize;
+ private Size _savedBeforeSize;
+
private int _thumbnailUnitWidth;
private int _thumbnailUnitHeight;
@@ -30,15 +34,40 @@ internal class ClientPanel : Control {
private readonly VScrollBar _verticalScrollBar;
+ private bool _resizing;
+
+ public bool Resizing
+ {
+ get
+ {
+ return _resizing;
+ }
+ set
+ {
+ _resizing = value;
+ if (_resizing)
+ {
+ _savedBeforeSize = base.ClientSize;
+ }
+ else
+ {
+ OnClientSizeChanged(null);
+ }
+ }
+ }
+
private int UnitHeight => Math.Max(_thumbnailUnitHeight + ThumbnailLabelHeight + ThumbnailVertSpace, 1);
- static ClientPanel() {
+ static ClientPanel()
+ {
ThumbnailLabelHeight = ServerLabel.Height;
}
- public ClientPanel() {
+ public ClientPanel()
+ {
base.TabStop = false;
- _verticalScrollBar = new VScrollBar {
+ _verticalScrollBar = new VScrollBar
+ {
Dock = DockStyle.Right,
TabStop = false,
Visible = false
@@ -53,22 +82,27 @@ public ClientPanel() {
_layoutHash = new Dictionary();
}
- private void OnGroupChanged(GroupChangedEventArgs obj) {
+ private void OnGroupChanged(GroupChangedEventArgs obj)
+ {
if ((obj.Group == ServerTree.Instance.RootNode && !obj.ChangeType.HasFlag(ChangeType.PropertyChanged))
|| (obj.Group != ServerTree.Instance.RootNode && !obj.ChangeType.HasFlag(ChangeType.InvalidateUI)))
+ {
return;
-
+ }
ThumbnailLayout layout = _layout;
GroupBase groupBase = layout?.Group;
bool flag = false;
- if (layout != null) {
+ if (layout != null)
+ {
ThumbnailLayout thumbnailLayout = CreateThumbnailLayout(groupBase);
- if (!obj.ChangeType.HasFlag(ChangeType.PropertyChanged) && thumbnailLayout.Equals(layout)) {
+ if (!obj.ChangeType.HasFlag(ChangeType.PropertyChanged) && thumbnailLayout.Equals(layout))
+ {
Log.Write("ֲ䣬ػ");
thumbnailLayout.Dispose();
UpdateNonLayoutSettings(layout);
}
- else {
+ else
+ {
HideGroup(groupBase);
layout.Dispose();
_layoutHash[groupBase] = thumbnailLayout;
@@ -77,13 +111,19 @@ private void OnGroupChanged(GroupChangedEventArgs obj) {
}
}
TreeNode group = obj.Group;
- if (group != ServerTree.Instance.RootNode) {
- while (group != null) {
- if (group == groupBase) {
+ if (group != ServerTree.Instance.RootNode)
+ {
+ while (group != null)
+ {
+ if (group == groupBase)
+ {
if (!flag)
+ {
break;
+ }
}
- else if (_layoutHash.TryGetValue(group, out ThumbnailLayout value)) {
+ else if (_layoutHash.TryGetValue(group, out ThumbnailLayout value))
+ {
_layoutHash.Remove(group);
value.Dispose();
}
@@ -91,87 +131,118 @@ private void OnGroupChanged(GroupChangedEventArgs obj) {
}
}
else
+ {
ResetLayout();
-
+ }
if (layout == null && ServerTree.Instance.SelectedNode is ServerBase serverBase)
+ {
UpdateNonLayoutSettings(serverBase.ServerNode);
+ }
}
- private void UpdateNonLayoutSettings(ThumbnailLayout shownLayout) {
- shownLayout.LabelArray.ForEach(delegate (ServerLabel l) {
+ private void UpdateNonLayoutSettings(ThumbnailLayout shownLayout)
+ {
+ shownLayout.LabelArray.ForEach(delegate(ServerLabel l)
+ {
UpdateNonLayoutSettings(l.Server);
});
}
- private void UpdateNonLayoutSettings(Server server) {
+ private void UpdateNonLayoutSettings(Server server)
+ {
server.SetClientSizeProperties();
server.EnableDisableClient();
}
- private void OnServerChanged(ServerChangedEventArgs obj) {
+ private void OnServerChanged(ServerChangedEventArgs obj)
+ {
if (!obj.ChangeType.HasFlag(ChangeType.PropertyChanged))
+ {
return;
-
- using (Helpers.Timer("thumbnail ServerChanged handler")) {
+ }
+ using (Helpers.Timer("thumbnail ServerChanged handler"))
+ {
Server serverNode = obj.Server.ServerNode;
- foreach (ThumbnailLayout value in _layoutHash.Values) {
+ foreach (ThumbnailLayout value in _layoutHash.Values)
+ {
ServerLabel[] labelArray = value.LabelArray;
- foreach (ServerLabel serverLabel in labelArray) {
+ foreach (ServerLabel serverLabel in labelArray)
+ {
if (serverLabel.Server == serverNode)
+ {
serverLabel.CopyServerData();
+ }
}
}
}
}
- public RdcTreeNode GetSelectedNode(Control active) {
+ public RdcTreeNode GetSelectedNode(Control active)
+ {
if (active is ServerLabel serverLabel)
+ {
return serverLabel.AssociatedNode;
+ }
return null;
}
- private void ResetLayout() {
- foreach (ThumbnailLayout item in _layoutHash.Values.Where((ThumbnailLayout l) => l != _layout).ToList()) {
+ private void ResetLayout()
+ {
+ foreach (ThumbnailLayout item in _layoutHash.Values.Where((ThumbnailLayout l) => l != _layout).ToList())
+ {
item.Dispose();
_layoutHash.Remove(item.Group);
}
}
[Conditional("DEBUG")]
- private void AssertValid() {
- foreach (Control control in base.Controls) { }
+ private void AssertValid()
+ {
+ foreach (Control control in base.Controls)
+ {
+ }
}
- public void ShowGroup(GroupBase group) {
+ public void ShowGroup(GroupBase group)
+ {
bool flag = true;
if (_layout != null && _layout.Group == group)
+ {
flag = false;
-
- if (!_layoutHash.TryGetValue(group, out _layout)) {
+ }
+ if (!_layoutHash.TryGetValue(group, out _layout))
+ {
_layout = CreateThumbnailLayout(group);
_layoutHash.Add(group, _layout);
}
ComputeScrollBarLimits();
- if (flag) {
+ if (flag)
+ {
if (!_groupScrollPosition.TryGetValue(group, out var value))
+ {
value = 0;
+ }
SetScrollPosition(value);
}
_thumbnailDrawn = new bool[_layout.NodeCount];
DrawThumbnails(group);
}
- private ThumbnailLayout CreateThumbnailLayout(GroupBase group) {
- using (Helpers.Timer("creating thumbnail layout for {0}", group.Text)) {
+ private ThumbnailLayout CreateThumbnailLayout(GroupBase group)
+ {
+ using (Helpers.Timer("creating thumbnail layout for {0}", group.Text))
+ {
ThumbnailLayout thumbnailLayout = new ThumbnailLayout(group);
int num;
- if (Program.Preferences.ThumbnailSizeIsInPixels) {
+ if (Program.Preferences.ThumbnailSizeIsInPixels)
+ {
Size thumbnailSize = Program.Preferences.ThumbnailSize;
_thumbnailUnitWidth = thumbnailSize.Width;
_thumbnailUnitHeight = thumbnailSize.Height;
num = ComputeNumAcross(base.ClientSize.Width, _thumbnailUnitWidth);
}
- else {
+ else
+ {
num = 100 / Program.Preferences.ThumbnailPercentage;
_thumbnailUnitWidth = (base.ClientSize.Width - _verticalScrollBar.Width - ThumbnailHorzSpace) / num - ThumbnailHorzSpace;
_thumbnailUnitHeight = (base.ClientSize.Height - ThumbnailVertSpace) / num - ThumbnailLabelHeight - ThumbnailVertSpace;
@@ -182,39 +253,49 @@ private ThumbnailLayout CreateThumbnailLayout(GroupBase group) {
}
}
- public void HideGroup(GroupBase group) {
- if (_layout != null) {
+ public void HideGroup(GroupBase group)
+ {
+ if (_layout != null)
+ {
if (_layout.Group != group)
+ {
return;
-
+ }
_groupScrollPosition[group] = _verticalScrollBar.Value;
- try {
+ try
+ {
ServerLabel serverLabel = Program.TheForm.ActiveControl as ServerLabel;
ServerLabel[] labelArray = _layout.LabelArray;
- foreach (ServerLabel serverLabel2 in labelArray) {
+ foreach (ServerLabel serverLabel2 in labelArray)
+ {
if (serverLabel == serverLabel2)
+ {
Program.TheForm.ActiveControl = this;
-
+ }
serverLabel2.Server.Hide();
base.Controls.Remove(serverLabel2);
}
}
- finally {
+ finally
+ {
_layout = null;
}
}
_verticalScrollBar.Hide();
}
- public void ScrollServerIntoView(ServerLabel label) {
+ public void ScrollServerIntoView(ServerLabel label)
+ {
int thumbnailIndex = label.ThumbnailIndex;
if (!_layout.IsServerPositionComputed(thumbnailIndex))
+ {
ComputeThumbnailPosition(label);
-
+ }
Rectangle thumbnailAbsoluteBounds = _layout.GetThumbnailAbsoluteBounds(thumbnailIndex);
int num = thumbnailAbsoluteBounds.Bottom + ServerLabel.Height;
int num2 = base.ClientSize.Height;
- if (thumbnailAbsoluteBounds.Top < _verticalScrollBar.Value || num > _verticalScrollBar.Value + num2 - 1) {
+ if (thumbnailAbsoluteBounds.Top < _verticalScrollBar.Value || num > _verticalScrollBar.Value + num2 - 1)
+ {
int value = _verticalScrollBar.Value;
int scrollPosition = ((value >= thumbnailAbsoluteBounds.Top) ? thumbnailAbsoluteBounds.Top : (num - num2 + 1));
SetScrollPosition(scrollPosition);
@@ -222,12 +303,14 @@ public void ScrollServerIntoView(ServerLabel label) {
}
}
- private void ComputeScrollBarLimits() {
+ private void ComputeScrollBarLimits()
+ {
int unitHeight = UnitHeight;
int num = (_layout.LowestTileY + 1) * unitHeight;
int num2 = base.ClientSize.Height;
int num3 = num - num2;
- if (_verticalScrollBar.Visible = num3 > 0) {
+ if (_verticalScrollBar.Visible = num3 > 0)
+ {
_verticalScrollBar.LargeChange = num2;
_verticalScrollBar.SmallChange = unitHeight;
_verticalScrollBar.Maximum = num;
@@ -235,35 +318,44 @@ private void ComputeScrollBarLimits() {
}
}
- private int GetServerHeight(int serverScale) {
+ private int GetServerHeight(int serverScale)
+ {
return _thumbnailUnitHeight * serverScale + (ThumbnailLabelHeight + ThumbnailVertSpace) * (serverScale - 1);
}
- private void SetScrollPosition(int value) {
+ private void SetScrollPosition(int value)
+ {
_verticalScrollBar.Value = Math.Min(value, _verticalScrollBar.Maximum - _verticalScrollBar.LargeChange + 1);
}
- private void DrawThumbnails(GroupBase group) {
+ private void DrawThumbnails(GroupBase group)
+ {
if (_layout.NodeCount == 0)
+ {
return;
-
- using (Helpers.Timer("drawing {0} ({1} thumbnails)", group.Text, _layout.NodeCount)) {
+ }
+ using (Helpers.Timer("drawing {0} ({1} thumbnails)", group.Text, _layout.NodeCount))
+ {
DrawThumbnails(_verticalScrollBar.Value, _verticalScrollBar.Value, base.ClientSize.Height);
}
}
- private void DrawThumbnails(int oldValue, int newValue, int height) {
- foreach (int item in GetUndrawnServersInViewport(newValue, height)) {
+ private void DrawThumbnails(int oldValue, int newValue, int height)
+ {
+ foreach (int item in GetUndrawnServersInViewport(newValue, height))
+ {
_thumbnailDrawn[item - 1] = true;
ServerLabel label = _layout.LabelArray[item - 1];
if (!_layout.IsServerPositionComputed(item))
+ {
ComputeThumbnailPosition(label);
-
+ }
DrawThumbnail(label, oldValue);
}
}
- private void DrawThumbnail(ServerLabel label, int windowTop) {
+ private void DrawThumbnail(ServerLabel label, int windowTop)
+ {
Rectangle thumbnailAbsoluteBounds = _layout.GetThumbnailAbsoluteBounds(label.ThumbnailIndex);
int num = thumbnailAbsoluteBounds.Top - windowTop;
int top = num + ThumbnailLabelHeight - 1;
@@ -274,28 +366,32 @@ private void DrawThumbnail(ServerLabel label, int windowTop) {
base.Controls.Add(label);
label.Show();
server.Show();
- if (Program.TheForm.ActiveControl == this && label.ThumbnailIndex == _layout.FocusedServerIndex) {
+ if (Program.TheForm.ActiveControl == this && label.ThumbnailIndex == _layout.FocusedServerIndex)
+ {
label.Focus();
_layout.FocusedServerIndex = 0;
}
}
- private unsafe void DrawAndScroll(int oldValue, int newValue) {
- using (Helpers.Timer("scrolling thumbnails {0} => {1}", oldValue, newValue)) {
+ private unsafe void DrawAndScroll(int oldValue, int newValue)
+ {
+ using (Helpers.Timer("scrolling thumbnails {0} => {1}", oldValue, newValue))
+ {
Size clientSize = base.ClientSize;
int num = clientSize.Height;
DrawThumbnails(oldValue, newValue, num);
- if (oldValue != newValue) {
+ if (oldValue != newValue)
+ {
Structs.RECT rECT = default(Structs.RECT);
rECT.top = 0;
rECT.bottom = clientSize.Height;
rECT.left = 0;
rECT.right = _verticalScrollBar.Left - 1;
Structs.RECT rECT2 = default(Structs.RECT);
- rECT.top = -oldValue;
- rECT.bottom = _verticalScrollBar.Maximum - oldValue;
- rECT.left = 0;
- rECT.right = _verticalScrollBar.Left - 1;
+ rECT2.top = -oldValue;
+ rECT2.bottom = _verticalScrollBar.Maximum - oldValue;
+ rECT2.left = 0;
+ rECT2.right = _verticalScrollBar.Left - 1;
Structs.RECT* ptr = &rECT;
Structs.RECT* ptr2 = &rECT2;
User.ScrollWindowEx(base.Handle, 0, oldValue - newValue, (IntPtr)ptr2, (IntPtr)ptr, (IntPtr)(void*)null, (IntPtr)(void*)null, 7u);
@@ -303,32 +399,45 @@ private unsafe void DrawAndScroll(int oldValue, int newValue) {
}
}
- protected override void OnClientSizeChanged(EventArgs e) {
+ protected override void OnClientSizeChanged(EventArgs e)
+ {
if (Program.TheForm.IsFullScreen)
+ {
return;
-
+ }
Size clientSize = base.ClientSize;
- try {
+ try
+ {
TreeNode selectedNode = ServerTree.Instance.SelectedNode;
- if (!(selectedNode is GroupBase groupBase)) {
- if (selectedNode is ServerBase serverBase) {
+ if (!(selectedNode is GroupBase groupBase))
+ {
+ if (selectedNode is ServerBase serverBase)
+ {
if (serverBase.IsThumbnail)
+ {
throw new InvalidOperationException("ѡͼ");
-
+ }
serverBase.ServerNode.SetNormalView();
- if (clientSize.Width != _savedSize.Width || clientSize.Height != _savedSize.Height)
+ if (!Resizing && (_savedBeforeSize.Width != _savedSize.Width || _savedBeforeSize.Height != _savedSize.Height))
+ {
serverBase.ServerNode.Resize();
+ }
}
ResetLayout();
}
- else {
- if (_layout == null || _layout.Group != groupBase) {
+ else
+ {
+ if (_layout == null || _layout.Group != groupBase)
+ {
return;
}
- if (Program.Preferences.ThumbnailSizeIsInPixels) {
+ if (Program.Preferences.ThumbnailSizeIsInPixels)
+ {
int unitWidth = Program.Preferences.ThumbnailSize.Width;
- if (ComputeNumAcross(clientSize.Width, unitWidth) == ComputeNumAcross(_savedSize.Width, unitWidth)) {
- if (_savedSize.Height != clientSize.Height) {
+ if (ComputeNumAcross(clientSize.Width, unitWidth) == ComputeNumAcross(_savedSize.Width, unitWidth))
+ {
+ if (_savedSize.Height != clientSize.Height)
+ {
int value = _verticalScrollBar.Value;
ComputeScrollBarLimits();
DrawAndScroll(value, _verticalScrollBar.Value);
@@ -341,13 +450,37 @@ protected override void OnClientSizeChanged(EventArgs e) {
ShowGroup(groupBase);
}
}
- finally {
+ finally
+ {
_savedSize = clientSize;
}
}
- protected override void OnMouseWheel(MouseEventArgs e) {
- if (ServerTree.Instance.SelectedNode is GroupBase) {
+ protected override void OnMouseDown(MouseEventArgs e) {
+ if (e.Button == MouseButtons.Left && e.Clicks == 2) {
+ ServerBox box = null;
+
+ foreach (var c in Controls) {
+ if (c.GetType() == typeof(ServerBox)) {
+ Point l = ((ServerBox)c).Location;
+ Size s = ((ServerBox)c).ClientSize;
+ if ((l.X <= e.X && (l.X + s.Width) >= e.X) && (l.Y <= e.Y && (l.Y + s.Height) >= e.Y)) {
+ box = (ServerBox)c;
+ break;
+ }
+ }
+ }
+ if (box != null)
+ box.DbClickShow();
+ }
+ else
+ base.OnMouseDown(e);
+ }
+
+ protected override void OnMouseWheel(MouseEventArgs e)
+ {
+ if (ServerTree.Instance.SelectedNode is GroupBase)
+ {
int value = _verticalScrollBar.Value;
int val = value - Math.Sign(e.Delta) * _verticalScrollBar.SmallChange;
SetScrollPosition(Math.Max(0, val));
@@ -355,13 +488,15 @@ protected override void OnMouseWheel(MouseEventArgs e) {
}
}
- private int ComputeNumAcross(int totalWidth, int unitWidth) {
+ private int ComputeNumAcross(int totalWidth, int unitWidth)
+ {
totalWidth -= _verticalScrollBar.Width;
totalWidth -= ThumbnailHorzSpace;
return totalWidth / (unitWidth + ThumbnailHorzSpace);
}
- private void ComputeThumbnailPosition(ServerLabel label) {
+ private void ComputeThumbnailPosition(ServerLabel label)
+ {
int value = label.Server.DisplaySettings.ThumbnailScale.Value;
int num = _thumbnailUnitWidth * value + ThumbnailHorzSpace * (value - 1);
int serverHeight = GetServerHeight(value);
@@ -373,67 +508,84 @@ private void ComputeThumbnailPosition(ServerLabel label) {
_layout.SetThumbnailAbsoluteBounds(thumbnailIndex, num4, num5, num, serverHeight);
}
- private IEnumerable GetUndrawnServersInViewport(int position, int height) {
+ private IEnumerable GetUndrawnServersInViewport(int position, int height)
+ {
HashSet hashSet = new HashSet();
if (_layout.NodeCount == 0)
+ {
return hashSet;
-
+ }
int upperBound = _layout.ServerLayoutToIndex.GetUpperBound(1);
int unitHeight = UnitHeight;
int num = position / unitHeight;
int val = (position + height - 1) / unitHeight;
val = Math.Min(val, _layout.ServerLayoutToIndex.GetUpperBound(0));
- for (int i = num; i <= val; i++) {
+ for (int i = num; i <= val; i++)
+ {
ServerLabel serverLabel;
- for (int j = 0; j <= upperBound; j += serverLabel.Server.DisplaySettings.ThumbnailScale.Value) {
+ for (int j = 0; j <= upperBound; j += serverLabel.Server.DisplaySettings.ThumbnailScale.Value)
+ {
int num2 = _layout.ServerLayoutToIndex[i, j];
if (num2 == 0)
+ {
break;
-
+ }
if (!_thumbnailDrawn[num2 - 1])
+ {
hashSet.Add(num2);
-
+ }
serverLabel = _layout.LabelArray[num2 - 1];
}
}
return hashSet;
}
- private void OnScroll(object sender, ScrollEventArgs e) {
+ private void OnScroll(object sender, ScrollEventArgs e)
+ {
DrawAndScroll(e.OldValue, e.NewValue);
}
- public void RecordLastFocusedServerLabel(ServerLabel label) {
+ public void RecordLastFocusedServerLabel(ServerLabel label)
+ {
_layout.FocusedServerIndex = label.ThumbnailIndex;
}
- protected override void OnEnter(EventArgs e) {
+ protected override void OnEnter(EventArgs e)
+ {
bool flag = true;
base.OnEnter(e);
- if (_layout != null) {
- if (_layout.NodeCount > 0) {
+ if (_layout != null)
+ {
+ if (_layout.NodeCount > 0)
+ {
ServerLabel serverLabel = _layout.LabelArray[_layout.FocusedServerIndex - 1];
- if (serverLabel.Parent == this) {
+ if (serverLabel.Parent == this)
+ {
serverLabel.Focus();
flag = false;
}
}
}
- else if (ServerTree.Instance.SelectedNode is ServerBase serverBase) {
+ else if (ServerTree.Instance.SelectedNode is ServerBase serverBase)
+ {
serverBase.Focus();
flag = false;
}
- if (flag) {
+ if (flag)
+ {
Focus();
}
}
- protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
+ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
+ {
ServerLabel serverLabel = Program.TheForm.ActiveControl as ServerLabel;
- if (serverLabel == null) {
+ if (serverLabel == null)
+ {
if (_layout == null || Program.TheForm.ActiveControl != this)
+ {
return base.ProcessCmdKey(ref msg, keyData);
-
+ }
serverLabel = _layout.LabelArray[_layout.FocusedServerIndex - 1];
}
_layout.EnsureTabIndex();
@@ -442,71 +594,85 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
int num = _layout.ServerTileX[thumbnailIndex];
int num2 = _layout.ServerTileY[thumbnailIndex];
int num3 = serverLabel.TabIndex;
- switch (keyData) {
- case Keys.Tab:
- case Keys.Tab | Keys.Shift:
- ServerTree.Instance.Focus();
+ switch (keyData)
+ {
+ case Keys.Tab:
+ case Keys.Tab | Keys.Shift:
+ ServerTree.Instance.Focus();
+ return true;
+ case Keys.Left:
+ if (--num3 == 0)
+ {
return true;
- case Keys.Left:
- if (--num3 == 0)
- return true;
-
- thumbnailIndex = _layout.TabIndexToServerIndex[num3];
- num = _layout.ServerTileX[thumbnailIndex];
- num2 = _layout.ServerTileY[thumbnailIndex];
- break;
- case Keys.Right:
- if (++num3 > _layout.NodeCount)
- return true;
-
- thumbnailIndex = _layout.TabIndexToServerIndex[num3];
- num = _layout.ServerTileX[thumbnailIndex];
- num2 = _layout.ServerTileY[thumbnailIndex];
- break;
- case Keys.Up:
- if (--num2 < 0)
- return true;
- break;
- case Keys.Down:
- num2 += value;
- if (num2 > _layout.LowestTileY)
- return true;
- break;
- case Keys.Home:
- num = 0;
- num2 = 0;
- break;
- case Keys.End:
- num = _layout.ServerLayoutToIndex.GetUpperBound(1);
- num2 = _layout.LowestTileY;
- break;
- case Keys.Prior:
- if (num2 == 0)
- return true;
-
- int val3 = (int)Math.Floor((double)serverLabel.Top / (double)UnitHeight);
- int val4 = base.Height / UnitHeight;
- int num5 = Math.Max(val3, val4);
- num2 = Math.Max(0, num2 - num5);
- break;
- case Keys.Next:
- if (num2 == _layout.LowestTileY)
- return true;
-
- int val = (int)Math.Floor((double)(serverLabel.Top + GetServerHeight(value)) / (double)UnitHeight);
- int val2 = base.Height / UnitHeight;
- int num4 = Math.Max(val, val2);
- num2 = Math.Min(_layout.LowestTileY, num2 + num4);
- break;
-
- default:
- return base.ProcessCmdKey(ref msg, keyData);
+ }
+ thumbnailIndex = _layout.TabIndexToServerIndex[num3];
+ num = _layout.ServerTileX[thumbnailIndex];
+ num2 = _layout.ServerTileY[thumbnailIndex];
+ break;
+ case Keys.Right:
+ if (++num3 > _layout.NodeCount)
+ {
+ return true;
+ }
+ thumbnailIndex = _layout.TabIndexToServerIndex[num3];
+ num = _layout.ServerTileX[thumbnailIndex];
+ num2 = _layout.ServerTileY[thumbnailIndex];
+ break;
+ case Keys.Up:
+ if (--num2 < 0)
+ {
+ return true;
+ }
+ break;
+ case Keys.Down:
+ num2 += value;
+ if (num2 > _layout.LowestTileY)
+ {
+ return true;
+ }
+ break;
+ case Keys.Home:
+ num = 0;
+ num2 = 0;
+ break;
+ case Keys.End:
+ num = _layout.ServerLayoutToIndex.GetUpperBound(1);
+ num2 = _layout.LowestTileY;
+ break;
+ case Keys.Prior:
+ {
+ if (num2 == 0)
+ {
+ return true;
+ }
+ int val3 = (int)Math.Floor((double)serverLabel.Top / (double)UnitHeight);
+ int val4 = base.Height / UnitHeight;
+ int num5 = Math.Max(val3, val4);
+ num2 = Math.Max(0, num2 - num5);
+ break;
+ }
+ case Keys.Next:
+ {
+ if (num2 == _layout.LowestTileY)
+ {
+ return true;
+ }
+ int val = (int)Math.Floor((double)(serverLabel.Top + GetServerHeight(value)) / (double)UnitHeight);
+ int val2 = base.Height / UnitHeight;
+ int num4 = Math.Max(val, val2);
+ num2 = Math.Min(_layout.LowestTileY, num2 + num4);
+ break;
+ }
+ default:
+ return base.ProcessCmdKey(ref msg, keyData);
}
- while (true) {
+ while (true)
+ {
thumbnailIndex = _layout.ServerLayoutToIndex[num2, num];
if (thumbnailIndex != 0)
+ {
break;
-
+ }
num--;
}
serverLabel = _layout.LabelArray[thumbnailIndex - 1];
diff --git a/RdcMan/ClientSizeCheckedMenuItem.cs b/RdcMan/ClientSizeCheckedMenuItem.cs
index d877dde..75bc942 100644
--- a/RdcMan/ClientSizeCheckedMenuItem.cs
+++ b/RdcMan/ClientSizeCheckedMenuItem.cs
@@ -1,21 +1,26 @@
using System.Drawing;
-namespace RdcMan {
- internal class ClientSizeCheckedMenuItem : CheckedMenuItem {
- private readonly RdcBaseForm _form;
+namespace RdcMan
+{
+ internal class ClientSizeCheckedMenuItem : CheckedMenuItem
+ {
+ private RdcBaseForm _form;
public ClientSizeCheckedMenuItem(RdcBaseForm form, Size size)
- : base(size.ToFormattedString()) {
+ : base(size.ToFormattedString())
+ {
base.Tag = size;
_form = form;
}
- protected override void CheckChanged(bool isChecked) {
+ protected override void CheckChanged(bool isChecked)
+ {
Size clientSize = (Size)base.Tag;
_form.SetClientSize(clientSize);
}
- public override void Update() {
+ public override void Update()
+ {
Size size = (Size)base.Tag;
Size clientSize = _form.GetClientSize();
base.Checked = clientSize == size;
diff --git a/RdcMan/CommonDisplaySettings.cs b/RdcMan/CommonDisplaySettings.cs
index 3835437..9c44b86 100644
--- a/RdcMan/CommonDisplaySettings.cs
+++ b/RdcMan/CommonDisplaySettings.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public abstract class CommonDisplaySettings : SettingsGroup {
+namespace RdcMan
+{
+ public abstract class CommonDisplaySettings : SettingsGroup
+ {
//public const string TabName = "ʾ";
[Setting("thumbnailScale", DefaultValue = 1)]
@@ -12,10 +14,12 @@ public abstract class CommonDisplaySettings : SettingsGroup {
public EnumSetting SmartSizeUndockedWindow { get; protected set; }
protected CommonDisplaySettings()
- : base("ʾ", "displaySettings") {
+ : base("ʾ", "displaySettings")
+ {
}
- protected override void Copy(RdcTreeNode node) {
+ protected override void Copy(RdcTreeNode node)
+ {
Copy(node.DisplaySettings);
}
}
diff --git a/RdcMan/CommonNodeSettings.cs b/RdcMan/CommonNodeSettings.cs
index cf552a7..fe91364 100644
--- a/RdcMan/CommonNodeSettings.cs
+++ b/RdcMan/CommonNodeSettings.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public abstract class CommonNodeSettings : SettingsGroup {
+namespace RdcMan
+{
+ public abstract class CommonNodeSettings : SettingsGroup
+ {
[Setting("name")]
protected StringSetting NodeName { get; set; }
@@ -7,11 +9,13 @@ public abstract class CommonNodeSettings : SettingsGroup {
public StringSetting Comment { get; protected set; }
protected CommonNodeSettings(string name)
- : base(name, "properties") {
+ : base(name, "properties")
+ {
base.InheritSettingsType.Mode = InheritanceMode.Disabled;
}
- protected override void Copy(RdcTreeNode node) {
+ protected override void Copy(RdcTreeNode node)
+ {
Copy(node.Properties);
}
}
diff --git a/RdcMan/ConnectAsDialog.cs b/RdcMan/ConnectAsDialog.cs
index f6058ed..4012f8c 100644
--- a/RdcMan/ConnectAsDialog.cs
+++ b/RdcMan/ConnectAsDialog.cs
@@ -19,11 +19,13 @@ public static ConnectAsDialog NewConnectAsDialog(RdcTreeNode node, Form parentFo
connectAsDialog.LogonCredentials = new LogonCredentials();
connectAsDialog.ConnectionSettings = new ConnectionSettings();
if (node.LogonCredentials != null)
+ {
connectAsDialog.LogonCredentials.Copy(node.LogonCredentials);
-
+ }
if (node.ConnectionSettings != null)
+ {
connectAsDialog.ConnectionSettings.Copy(node.ConnectionSettings);
-
+ }
connectAsDialog.CreateControls(inputServerName: false, connectAsDialog.LogonCredentials, connectAsDialog.ConnectionSettings, node.FileGroup);
return connectAsDialog;
}
diff --git a/RdcMan/ConnectServersDialog.cs b/RdcMan/ConnectServersDialog.cs
index 40b879a..a29bcca 100644
--- a/RdcMan/ConnectServersDialog.cs
+++ b/RdcMan/ConnectServersDialog.cs
@@ -1,24 +1,29 @@
using System.Collections.Generic;
using System.Windows.Forms;
-namespace RdcMan {
- internal class ConnectServersDialog : SelectServersDialogBase {
+namespace RdcMan
+{
+ internal class ConnectServersDialog : SelectServersDialogBase
+ {
public ConnectServersDialog(IEnumerable servers)
- : base("ӷ", "(&C)") {
+ : base("ӷ", "(&C)")
+ {
int rowIndex = 0;
int num = 0;
AddLabel("ѡҪӵķ", ref rowIndex, ref num);
AddListView(ref rowIndex, ref num);
InitButtons();
this.ScaleAndLayout();
- servers.ForEach(delegate (ServerBase server) {
+ servers.ForEach(delegate(ServerBase server)
+ {
base.ListView.Items.Add(CreateListViewItem(server));
});
base.ListView.ItemChecked += ListView_ItemChecked;
_acceptButton.Enabled = false;
}
- private void ListView_ItemChecked(object sender, ItemCheckedEventArgs e) {
+ private void ListView_ItemChecked(object sender, ItemCheckedEventArgs e)
+ {
_acceptButton.Enabled = base.ListView.CheckedItems.Count > 0;
}
}
diff --git a/RdcMan/ConnectToDialog.cs b/RdcMan/ConnectToDialog.cs
index 6a0aff9..6405743 100644
--- a/RdcMan/ConnectToDialog.cs
+++ b/RdcMan/ConnectToDialog.cs
@@ -1,14 +1,18 @@
using System.Windows.Forms;
-namespace RdcMan {
- public class ConnectToDialog : QuickConnectDialog {
+namespace RdcMan
+{
+ public class ConnectToDialog : QuickConnectDialog
+ {
public TemporaryServer Server { get; private set; }
private ConnectToDialog(string title, string buttonText, Form parentForm)
- : base(title, buttonText, parentForm) {
+ : base(title, buttonText, parentForm)
+ {
}
- public static ConnectToDialog NewConnectToDialog(Form parentForm) {
+ public static ConnectToDialog NewConnectToDialog(Form parentForm)
+ {
ConnectToDialog connectToDialog = new ConnectToDialog("ӵ", "(&C)", parentForm);
connectToDialog.Server = TemporaryServer.CreateForQuickConnect();
connectToDialog.CreateControls(inputServerName: true, connectToDialog.Server.LogonCredentials, connectToDialog.Server.ConnectionSettings, null);
diff --git a/RdcMan/ConnectToGroup.cs b/RdcMan/ConnectToGroup.cs
index f9d5411..94f9f1b 100644
--- a/RdcMan/ConnectToGroup.cs
+++ b/RdcMan/ConnectToGroup.cs
@@ -1,29 +1,37 @@
using System;
using System.ComponentModel.Composition;
-namespace RdcMan {
+namespace RdcMan
+{
[Export(typeof(IBuiltInVirtualGroup))]
- internal class ConnectToGroup : BuiltInVirtualGroup, IServerRefFactory {
+ internal class ConnectToGroup : BuiltInVirtualGroup, IServerRefFactory
+ {
public static ConnectToGroup Instance { get; private set; }
protected override bool IsVisibilityConfigurable => false;
- private ConnectToGroup() {
+ private ConnectToGroup()
+ {
base.Text = "ӵ";
Instance = this;
}
- public override ServerRef AddReference(ServerBase serverBase) {
+ public override ServerRef AddReference(ServerBase serverBase)
+ {
throw new InvalidOperationException();
}
- public override void InvalidateNode() {
+ public override void InvalidateNode()
+ {
base.InvalidateNode();
if (base.Nodes.Count == 0)
+ {
base.IsInTree = false;
+ }
}
- public ServerRef Create(Server server) {
+ public ServerRef Create(Server server)
+ {
throw new NotImplementedException("ӵ");
}
}
diff --git a/RdcMan/ConnectedGroup.cs b/RdcMan/ConnectedGroup.cs
index 493d2a0..a9577c7 100644
--- a/RdcMan/ConnectedGroup.cs
+++ b/RdcMan/ConnectedGroup.cs
@@ -1,42 +1,56 @@
using System;
using System.ComponentModel.Composition;
-namespace RdcMan {
+namespace RdcMan
+{
[Export(typeof(IBuiltInVirtualGroup))]
- internal class ConnectedGroup : BuiltInVirtualGroup, IServerRefFactory {
+ internal class ConnectedGroup : BuiltInVirtualGroup, IServerRefFactory
+ {
public static ConnectedGroup Instance { get; private set; }
protected override string XmlNodeName => "connected";
- static ConnectedGroup() {
+ static ConnectedGroup()
+ {
Server.ConnectionStateChanged += Server_ConnectionStateChanged;
Server.FocusReceived += Server_FocusReceived;
}
- private ConnectedGroup() {
+ private ConnectedGroup()
+ {
base.Text = "";
Instance = this;
}
- private static void Server_FocusReceived(Server server) {
+ private static void Server_FocusReceived(Server server)
+ {
ConnectedServerRef connectedServerRef = server.FindServerRef();
- if (connectedServerRef != null) {
+ if (connectedServerRef != null)
+ {
connectedServerRef.LastFocusTime = DateTime.Now;
if (ServerTree.Instance.SortGroup(Instance))
+ {
ServerTree.Instance.OnGroupChanged(Instance, ChangeType.InvalidateUI);
+ }
}
}
- private static void Server_ConnectionStateChanged(ConnectionStateChangedEventArgs args) {
- switch (args.State) {
- case RdpClient.ConnectionState.Connected:
- Instance.AddReference(args.Server);
- break;
- case RdpClient.ConnectionState.Disconnected:
- RdcTreeNode rdcTreeNode = args.Server.FindServerRef();
- if (rdcTreeNode != null)
- ServerTree.Instance.RemoveNode(rdcTreeNode);
- break;
+ private static void Server_ConnectionStateChanged(ConnectionStateChangedEventArgs args)
+ {
+ switch (args.State)
+ {
+ case RdpClient.ConnectionState.Connected:
+ Instance.AddReference(args.Server);
+ break;
+ case RdpClient.ConnectionState.Disconnected:
+ {
+ RdcTreeNode rdcTreeNode = args.Server.FindServerRef();
+ if (rdcTreeNode != null)
+ {
+ ServerTree.Instance.RemoveNode(rdcTreeNode);
+ }
+ break;
+ }
}
}
@@ -44,7 +58,8 @@ private static void Server_ConnectionStateChanged(ConnectionStateChangedEventArg
public override bool CanRemoveChildren() => false;
- public override void Disconnect() {
+ public override void Disconnect()
+ {
Hide();
base.Disconnect();
}
diff --git a/RdcMan/ConnectedServerRef.cs b/RdcMan/ConnectedServerRef.cs
index 6c3bd95..a0bb327 100644
--- a/RdcMan/ConnectedServerRef.cs
+++ b/RdcMan/ConnectedServerRef.cs
@@ -1,14 +1,18 @@
using System;
-namespace RdcMan {
- internal class ConnectedServerRef : ServerRef {
+namespace RdcMan
+{
+ internal class ConnectedServerRef : ServerRef
+ {
public DateTime LastFocusTime { get; set; }
public ConnectedServerRef(Server server)
- : base(server) {
+ : base(server)
+ {
}
- public override bool ConfirmRemove(bool askUser) {
+ public override bool ConfirmRemove(bool askUser)
+ {
FormTools.InformationDialog("ϿԽ ɾ");
return false;
}
diff --git a/RdcMan/ConnectionSettings.cs b/RdcMan/ConnectionSettings.cs
index c6910c3..0472722 100644
--- a/RdcMan/ConnectionSettings.cs
+++ b/RdcMan/ConnectionSettings.cs
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Windows.Forms;
-namespace RdcMan {
- public class ConnectionSettings : SettingsGroup {
+namespace RdcMan
+{
+ public class ConnectionSettings : SettingsGroup
+ {
//internal const string TabName = "";
private static Dictionary _settingProperties;
@@ -24,12 +26,14 @@ public class ConnectionSettings : SettingsGroup {
[Setting("loadBalanceInfo")]
public StringSetting LoadBalanceInfo { get; private set; }
- static ConnectionSettings() {
+ static ConnectionSettings()
+ {
typeof(ConnectionSettings).GetSettingProperties(out _settingProperties);
}
public ConnectionSettings()
- : base("", "connectionSettings") {
+ : base("", "connectionSettings")
+ {
}
public override TabPage CreateTabPage(TabbedSettingsDialog dialog) => new ConnectionSettingsTabPage(dialog, this);
diff --git a/RdcMan/ConnectionSettingsTabPage.cs b/RdcMan/ConnectionSettingsTabPage.cs
index 0657c76..3a2609e 100644
--- a/RdcMan/ConnectionSettingsTabPage.cs
+++ b/RdcMan/ConnectionSettingsTabPage.cs
@@ -2,32 +2,37 @@
using System.Drawing;
using System.Windows.Forms;
-namespace RdcMan {
- public class ConnectionSettingsTabPage : SettingsTabPage {
+namespace RdcMan
+{
+ public class ConnectionSettingsTabPage : SettingsTabPage
+ {
private Label _portDefaultLabel;
private NumericUpDown _portUpDown;
public ConnectionSettingsTabPage(TabbedSettingsDialog dialog, ConnectionSettings settings)
- : base(dialog, settings) {
- int num = 0;
+ : base(dialog, settings)
+ {
+ int tabIndex = 0;
int rowIndex = 0;
- CreateInheritanceControl(ref rowIndex, ref num);
- FormTools.AddCheckBox(this, "ӵ̨(&C)", settings.ConnectToConsole, 1, ref rowIndex, ref num);
- FormTools.AddLabeledTextBox(this, "(&S)", settings.StartProgram, ref rowIndex, ref num);
- FormTools.AddLabeledTextBox(this, "Ŀ¼(&W)", settings.WorkingDir, ref rowIndex, ref num);
+ CreateInheritanceControl(ref rowIndex, ref tabIndex);
+ FormTools.AddCheckBox(this, "ӵ̨(&C)", settings.ConnectToConsole, 1, ref rowIndex, ref tabIndex);
+ FormTools.AddLabeledTextBox(this, "(&S)", settings.StartProgram, ref rowIndex, ref tabIndex);
+ FormTools.AddLabeledTextBox(this, "Ŀ¼(&W)", settings.WorkingDir, ref rowIndex, ref tabIndex);
Label label = FormTools.NewLabel("˿(&P)", 0, rowIndex);
_portUpDown = new NumericUpDown {
Location = FormTools.NewLocation(1, rowIndex++),
Size = new Size(160, FormTools.ControlHeight),
- Minimum = 1m,
- Maximum = 65535m,
- TabIndex = num++
+ Minimum = 1,
+ Maximum = 65535,
+ TabIndex = tabIndex++
};
- _portUpDown.KeyUp += delegate {
+ _portUpDown.KeyUp += delegate
+ {
UpdatePortDefaultLabel();
};
- _portUpDown.ValueChanged += delegate {
+ _portUpDown.ValueChanged += delegate
+ {
UpdatePortDefaultLabel();
};
((ISupportInitialize)_portUpDown).EndInit();
@@ -36,22 +41,24 @@ public ConnectionSettingsTabPage(TabbedSettingsDialog dialog, ConnectionSettings
Size = new Size(FormTools.LabelWidth, FormTools.ControlHeight),
TextAlign = ContentAlignment.MiddleLeft
};
- FormTools.AddLabeledTextBox(this, "ؾ(&L)", settings.LoadBalanceInfo, ref rowIndex, ref num);
+ FormTools.AddLabeledTextBox(this, "ؾ(&L)", settings.LoadBalanceInfo, ref rowIndex, ref tabIndex);
base.Controls.Add(label, _portUpDown, _portDefaultLabel);
}
- protected override void UpdateControls() {
+ protected override void UpdateControls()
+ {
base.UpdateControls();
_portUpDown.Text = base.Settings.Port.Value.ToString();
}
- protected override void UpdateSettings() {
+ protected override void UpdateSettings()
+ {
base.UpdateSettings();
base.Settings.Port.Value = (int)_portUpDown.Value;
}
private void UpdatePortDefaultLabel() {
- _portDefaultLabel.Text = ((_portUpDown.Value == 3389m) ? "(default)" : string.Empty);
+ _portDefaultLabel.Text = ((_portUpDown.Value == 3389) ? "(Ĭ)" : string.Empty);
}
}
}
diff --git a/RdcMan/ConnectionStateChangedEventArg.cs b/RdcMan/ConnectionStateChangedEventArg.cs
index 7ff906a..c48e79c 100644
--- a/RdcMan/ConnectionStateChangedEventArg.cs
+++ b/RdcMan/ConnectionStateChangedEventArg.cs
@@ -1,12 +1,15 @@
using System;
-namespace RdcMan {
- public class ConnectionStateChangedEventArgs : EventArgs {
+namespace RdcMan
+{
+ public class ConnectionStateChangedEventArgs : EventArgs
+ {
public Server Server { get; private set; }
public RdpClient.ConnectionState State { get; private set; }
- public ConnectionStateChangedEventArgs(Server server, RdpClient.ConnectionState state) {
+ public ConnectionStateChangedEventArgs(Server server, RdpClient.ConnectionState state)
+ {
Server = server;
State = state;
}
diff --git a/RdcMan/ConnectionType.cs b/RdcMan/ConnectionType.cs
index 053e70e..6d0aef2 100644
--- a/RdcMan/ConnectionType.cs
+++ b/RdcMan/ConnectionType.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public enum ConnectionType {
+namespace RdcMan
+{
+ public enum ConnectionType
+ {
Normal,
VirtualMachineConsoleConnect
}
diff --git a/RdcMan/ControlExtensions.cs b/RdcMan/ControlExtensions.cs
index 98cb1d8..16ce3ed 100644
--- a/RdcMan/ControlExtensions.cs
+++ b/RdcMan/ControlExtensions.cs
@@ -1,15 +1,21 @@
using System.Collections.Generic;
using System.Windows.Forms;
-namespace RdcMan {
- public static class ControlExtensions {
- public static IEnumerable FlattenControls(this Control.ControlCollection controls) {
- foreach (Control c in controls) {
+namespace RdcMan
+{
+ public static class ControlExtensions
+ {
+ public static IEnumerable FlattenControls(this Control.ControlCollection controls)
+ {
+ foreach (Control c in controls)
+ {
yield return c;
if (c.Controls.Count <= 0)
+ {
continue;
-
- foreach (Control item in c.Controls.FlattenControls()) {
+ }
+ foreach (Control item in c.Controls.FlattenControls())
+ {
yield return item;
}
}
diff --git a/RdcMan/ControlVisibility.cs b/RdcMan/ControlVisibility.cs
index f26ec47..84da7a8 100644
--- a/RdcMan/ControlVisibility.cs
+++ b/RdcMan/ControlVisibility.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public enum ControlVisibility {
+namespace RdcMan
+{
+ public enum ControlVisibility
+ {
Dock,
AutoHide,
Hide
diff --git a/RdcMan/CredentialsProfile.cs b/RdcMan/CredentialsProfile.cs
index 5b03c10..aa58418 100644
--- a/RdcMan/CredentialsProfile.cs
+++ b/RdcMan/CredentialsProfile.cs
@@ -1,16 +1,18 @@
-namespace RdcMan {
- public class CredentialsProfile : ILogonCredentials, IDeferDecryption {
+namespace RdcMan
+{
+ public class CredentialsProfile : ILogonCredentials, IDeferDecryption
+ {
public const string CustomProfileName = "Custom";
private readonly string _profileName;
private readonly ProfileScope _profileScope;
- private readonly string _userName;
+ private string _userName;
- private readonly PasswordSetting _password;
+ private PasswordSetting _password;
- private readonly string _domain;
+ private string _domain;
public string ProfileName => _profileName;
@@ -22,24 +24,34 @@ public class CredentialsProfile : ILogonCredentials, IDeferDecryption {
public string Domain => _domain;
- public bool IsDecrypted {
- get => _password.IsDecrypted;
- set => _password.IsDecrypted = value;
+ public bool IsDecrypted
+ {
+ get
+ {
+ return _password.IsDecrypted;
+ }
+ set
+ {
+ _password.IsDecrypted = value;
+ }
}
public string QualifiedName => LogonCredentials.ConstructQualifiedName(this);
- public CredentialsProfile(string profileName, ProfileScope profileScope, string userName, string password, string domain) {
+ public CredentialsProfile(string profileName, ProfileScope profileScope, string userName, string password, string domain)
+ {
_profileName = profileName;
_profileScope = profileScope;
_userName = userName;
- _password = new PasswordSetting(password) {
+ _password = new PasswordSetting(password)
+ {
IsDecrypted = true
};
_domain = domain;
}
- public CredentialsProfile(string profileName, ProfileScope profileScope, string userName, PasswordSetting password, string domain) {
+ public CredentialsProfile(string profileName, ProfileScope profileScope, string userName, PasswordSetting password, string domain)
+ {
_profileName = profileName;
_profileScope = profileScope;
_userName = userName;
@@ -47,11 +59,13 @@ public CredentialsProfile(string profileName, ProfileScope profileScope, string
_domain = domain;
}
- public void Decrypt(EncryptionSettings settings) {
+ public void Decrypt(EncryptionSettings settings)
+ {
_password.Decrypt(settings);
}
- public override string ToString() {
+ public override string ToString()
+ {
return ProfileName;
}
}
diff --git a/RdcMan/CredentialsStore.cs b/RdcMan/CredentialsStore.cs
index f7fd91e..19f640c 100644
--- a/RdcMan/CredentialsStore.cs
+++ b/RdcMan/CredentialsStore.cs
@@ -2,8 +2,10 @@
using System.Collections.Generic;
using System.Xml;
-namespace RdcMan {
- public class CredentialsStore {
+namespace RdcMan
+{
+ public class CredentialsStore
+ {
public const string XmlNodeName = "credentialsProfiles";
public const string ProfileXmlNodeName = "credentialsProfile";
@@ -12,9 +14,11 @@ public class CredentialsStore {
public int ChangeId { get; private set; }
- public CredentialsProfile this[string name] {
+ public CredentialsProfile this[string name]
+ {
get => _profiles[name];
- set {
+ set
+ {
_profiles[name] = value;
ChangeId++;
}
@@ -22,12 +26,15 @@ public CredentialsProfile this[string name] {
public IEnumerable Profiles => _profiles.Values;
- public CredentialsStore() {
+ public CredentialsStore()
+ {
_profiles = new Dictionary(StringComparer.OrdinalIgnoreCase);
}
- public void ReadXml(XmlNode xmlNode, ProfileScope scope, RdcTreeNode node, ICollection errors) {
- foreach (XmlNode childNode in xmlNode.ChildNodes) {
+ public void ReadXml(XmlNode xmlNode, ProfileScope scope, RdcTreeNode node, ICollection errors)
+ {
+ foreach (XmlNode childNode in xmlNode.ChildNodes)
+ {
LogonCredentials logonCredentials = new LogonCredentials("", "credentialsProfile");
logonCredentials.ReadXml(childNode, node, errors);
ILogonCredentials logonCredentials2 = logonCredentials;
@@ -37,9 +44,11 @@ public void ReadXml(XmlNode xmlNode, ProfileScope scope, RdcTreeNode node, IColl
}
}
- public void WriteXml(XmlTextWriter tw, RdcTreeNode node) {
+ public void WriteXml(XmlTextWriter tw, RdcTreeNode node)
+ {
tw.WriteStartElement("credentialsProfiles");
- foreach (CredentialsProfile profile in Profiles) {
+ foreach (CredentialsProfile profile in Profiles)
+ {
LogonCredentials logonCredentials = new LogonCredentials("", "credentialsProfile");
logonCredentials.InheritSettingsType.Mode = InheritanceMode.None;
logonCredentials.ProfileName.Value = ((ILogonCredentials)profile).ProfileName;
@@ -51,16 +60,19 @@ public void WriteXml(XmlTextWriter tw, RdcTreeNode node) {
tw.WriteEndElement();
}
- public bool TryGetValue(string name, out CredentialsProfile profile) {
+ public bool TryGetValue(string name, out CredentialsProfile profile)
+ {
return _profiles.TryGetValue(name, out profile);
}
- public void Remove(string name) {
+ public void Remove(string name)
+ {
_profiles.Remove(name);
ChangeId++;
}
- public bool Contains(string name) {
+ public bool Contains(string name)
+ {
return _profiles.ContainsKey(name);
}
}
diff --git a/RdcMan/CredentialsTabPage.cs b/RdcMan/CredentialsTabPage.cs
index 79b3bf2..3fc79f4 100644
--- a/RdcMan/CredentialsTabPage.cs
+++ b/RdcMan/CredentialsTabPage.cs
@@ -1,32 +1,44 @@
-namespace RdcMan {
- public abstract class CredentialsTabPage : SettingsTabPage, ICredentialsTabPage where TSettingGroup : LogonCredentials {
+namespace RdcMan
+{
+ public abstract class CredentialsTabPage : SettingsTabPage, ICredentialsTabPage where TSettingGroup : LogonCredentials
+ {
protected CredentialsUI _credentialsUI;
public CredentialsProfile Credentials => _credentialsUI.ProfileComboBox.SelectedValue;
protected CredentialsTabPage(TabbedSettingsDialog dialog, TSettingGroup settings)
- : base(dialog, settings) {
+ : base(dialog, settings)
+ {
}
- public void PopulateCredentialsProfiles(FileGroup file) {
+ public void PopulateCredentialsProfiles(FileGroup file)
+ {
if (_credentialsUI != null)
+ {
_credentialsUI.PopulateCredentialsProfiles(file);
+ }
}
- protected override void UpdateControls() {
+ protected override void UpdateControls()
+ {
base.UpdateControls();
if (_credentialsUI != null)
+ {
_credentialsUI.InitFromCredentials(base.Settings);
+ }
}
- protected override void UpdateSettings() {
+ protected override void UpdateSettings()
+ {
base.UpdateSettings();
- if (_credentialsUI != null) {
+ if (_credentialsUI != null)
+ {
base.Settings.ProfileName.UpdateValue(_credentialsUI.ProfileComboBox.SelectedValue.ProfileName, _credentialsUI.ProfileComboBox.SelectedValue.ProfileScope);
base.Settings.UserName.Value = _credentialsUI.UserNameTextBox.Text;
if (_credentialsUI.PasswordChanged)
+ {
base.Settings.Password.SetPlainText(_credentialsUI.PasswordTextBox.Text);
-
+ }
base.Settings.Domain.Value = _credentialsUI.DomainTextBox.Text;
}
}
diff --git a/RdcMan/CredentialsUI.cs b/RdcMan/CredentialsUI.cs
index 0ad4481..782eb88 100644
--- a/RdcMan/CredentialsUI.cs
+++ b/RdcMan/CredentialsUI.cs
@@ -2,8 +2,10 @@
using System.Drawing;
using System.Windows.Forms;
-namespace RdcMan {
- public class CredentialsUI {
+namespace RdcMan
+{
+ public class CredentialsUI
+ {
public const char DomainSeparator = '\\';
//private const string DummyPassword = "Placeholder1234567890";
@@ -30,37 +32,46 @@ public class CredentialsUI {
public bool PasswordChanged { get; private set; }
- private static bool HasDomainUser(string userName) {
+ private static bool HasDomainUser(string userName)
+ {
return userName.IndexOf('\\') != -1;
}
- public static string GetUserName(string userName) {
+ public static string GetUserName(string userName)
+ {
int num = userName.IndexOf('\\');
- if (num == -1) {
+ if (num == -1)
+ {
return userName;
}
return userName.Substring(num + 1);
}
- public static string GetQualifiedUserName(string userName, string domain) {
+ public static string GetQualifiedUserName(string userName, string domain)
+ {
string text = userName;
- if (!HasDomainUser(text) && !string.IsNullOrEmpty(domain)) {
+ if (!HasDomainUser(text) && !string.IsNullOrEmpty(domain))
+ {
text = domain + "\\" + text;
}
return text;
}
- public static string GetLoggedInUser() {
+ public static string GetLoggedInUser()
+ {
return GetQualifiedUserName(Environment.UserName, Environment.UserDomainName);
}
- public CredentialsUI(InheritanceControl inheritSettings) {
+ public CredentialsUI(InheritanceControl inheritSettings)
+ {
_inheritSettings = inheritSettings;
PasswordChanged = true;
}
- public void AddControlsToParent(Control parent, LogonCredentialsDialogOptions options, ref int rowIndex, ref int tabIndex) {
- if ((options & LogonCredentialsDialogOptions.ShowProfiles) != 0) {
+ public void AddControlsToParent(Control parent, LogonCredentialsDialogOptions options, ref int rowIndex, ref int tabIndex)
+ {
+ if ((options & LogonCredentialsDialogOptions.ShowProfiles) != 0)
+ {
ProfileComboBox = FormTools.AddLabeledValueDropDown(parent, "配置文件:", ref rowIndex, ref tabIndex, null, null);
ProfileComboBox.SelectedIndexChanged += OnProfileChanged;
ProfileComboBox.VisibleChanged += OnProfileVisible;
@@ -81,15 +92,19 @@ public void AddControlsToParent(Control parent, LogonCredentialsDialogOptions op
DomainTextBox = FormTools.AddLabeledTextBox(parent, "域名(&D):", ref rowIndex, ref tabIndex);
}
- public void PopulateCredentialsProfiles(FileGroup file) {
- if (file == null || _file != file) {
+ public void PopulateCredentialsProfiles(FileGroup file)
+ {
+ if (file == null || _file != file)
+ {
_file = file;
PopulateCredentialsProfilesWorker();
}
}
- public void InitFromCredentials(ILogonCredentials credentials) {
- if (ProfileComboBox != null) {
+ public void InitFromCredentials(ILogonCredentials credentials)
+ {
+ if (ProfileComboBox != null)
+ {
_usingCustomCredentials = LogonCredentials.IsCustomProfile(credentials.ProfileName);
ProfileComboBox.SelectedIndex = ProfileComboBox.FindItem(LogonCredentials.ConstructQualifiedName(credentials));
}
@@ -98,34 +113,44 @@ public void InitFromCredentials(ILogonCredentials credentials) {
DomainTextBox.Text = credentials.Domain;
}
- public void InitPassword(PasswordSetting password) {
- if (password != null && password.IsDecrypted && !string.IsNullOrEmpty(password.Value)) {
+ public void InitPassword(PasswordSetting password)
+ {
+ if (password != null && password.IsDecrypted && !string.IsNullOrEmpty(password.Value))
+ {
PasswordTextBox.Text = password.Value;// DummyPassword; 直接放置原密码
PasswordChanged = false;
}
else
+ {
PasswordTextBox.Text = string.Empty;
+ }
}
- public void EnableDisableControls(bool enable) {
+ public void EnableDisableControls(bool enable)
+ {
enable &= _inheritSettings == null || !_inheritSettings.FromParentCheck.Checked;
- if (ProfileComboBox != null) {
+ if (ProfileComboBox != null)
+ {
ProfileComboBox.Enabled = enable;
enable &= _usingCustomCredentials;
}
if (_saveProfileButton != null)
+ {
_saveProfileButton.Enabled = enable;
-
+ }
UserNameTextBox.Enabled = enable;
DomainTextBox.Enabled = enable;
PasswordTextBox.Enabled = enable;
OnUserNameChanged(null, null);
}
- private void OnUserNameChanged(object sender, EventArgs e) {
- if (_inheritSettings == null || !_inheritSettings.FromParentCheck.Checked) {
+ private void OnUserNameChanged(object sender, EventArgs e)
+ {
+ if (_inheritSettings == null || !_inheritSettings.FromParentCheck.Checked)
+ {
int num = UserNameTextBox.Text.IndexOf('\\');
- if (num == -1) {
+ if (num == -1)
+ {
DomainTextBox.Enabled = UserNameTextBox.Enabled;
return;
}
@@ -134,21 +159,26 @@ private void OnUserNameChanged(object sender, EventArgs e) {
}
}
- private void OnPasswordChanged(object sender, EventArgs e) {
+ private void OnPasswordChanged(object sender, EventArgs e)
+ {
PasswordChanged = true;
}
- private void OnProfileChanged(object sender, EventArgs e) {
- if (_inheritSettings == null || !_inheritSettings.FromParentCheck.Checked) {
+ private void OnProfileChanged(object sender, EventArgs e)
+ {
+ if (_inheritSettings == null || !_inheritSettings.FromParentCheck.Checked)
+ {
ILogonCredentials selectedValue = ProfileComboBox.SelectedValue;
_usingCustomCredentials = LogonCredentials.IsCustomProfile(selectedValue.ProfileName);
EnableDisableControls(enable: true);
- if (_usingCustomCredentials) {
+ if (_usingCustomCredentials)
+ {
UserNameTextBox.Text = Environment.UserName;
InitPassword(null);
DomainTextBox.Text = Environment.UserDomainName;
}
- else {
+ else
+ {
UserNameTextBox.Text = selectedValue.UserName;
InitPassword(selectedValue.Password);
DomainTextBox.Text = selectedValue.Domain;
@@ -156,54 +186,69 @@ private void OnProfileChanged(object sender, EventArgs e) {
}
}
- private void OnProfileVisible(object sender, EventArgs e) {
+ private void OnProfileVisible(object sender, EventArgs e)
+ {
PopulateCredentialsProfilesIfChanged();
}
- private void PopulateCredentialsProfilesIfChanged() {
+ private void PopulateCredentialsProfilesIfChanged()
+ {
if (_globalStoreChangeId != Program.CredentialsProfiles.ChangeId || (_file != null && _fileStoreChangeId != _file.CredentialsProfiles.ChangeId))
+ {
PopulateCredentialsProfilesWorker();
+ }
}
- private void PopulateCredentialsProfilesWorker() {
+ private void PopulateCredentialsProfilesWorker()
+ {
CredentialsProfile selectedValue = ProfileComboBox.SelectedValue;
ProfileComboBox.ClearItems();
ProfileComboBox.AddItem("Custom", new CredentialsProfile("Custom", ProfileScope.Local, string.Empty, string.Empty, string.Empty));
ProfileComboBox.SelectedIndex = 0;
PopulateComboFromStore(Program.CredentialsProfiles);
_globalStoreChangeId = Program.CredentialsProfiles.ChangeId;
- if (_file != null) {
+ if (_file != null)
+ {
PopulateComboFromStore(_file.CredentialsProfiles);
_fileStoreChangeId = _file.CredentialsProfiles.ChangeId;
}
ProfileComboBox.SelectedValue = selectedValue;
}
- private void PopulateComboFromStore(CredentialsStore store) {
- foreach (CredentialsProfile profile in store.Profiles) {
+ private void PopulateComboFromStore(CredentialsStore store)
+ {
+ foreach (CredentialsProfile profile in store.Profiles)
+ {
string qualifiedName = profile.QualifiedName;
ProfileComboBox.AddItem(qualifiedName, profile);
}
}
- private void SaveProfileButton_Click(object sender, EventArgs e) {
+ private void SaveProfileButton_Click(object sender, EventArgs e)
+ {
string qualifiedUserName = GetQualifiedUserName(UserNameTextBox.Text, DomainTextBox.Text);
- using (SaveCredentialsDialog saveCredentialsDialog = new SaveCredentialsDialog(_file, qualifiedUserName)) {
- if (saveCredentialsDialog.ShowDialog() == DialogResult.OK) {
+ using (SaveCredentialsDialog saveCredentialsDialog = new SaveCredentialsDialog(_file, qualifiedUserName))
+ {
+ if (saveCredentialsDialog.ShowDialog() == DialogResult.OK)
+ {
ProfileScope profileScope = saveCredentialsDialog.ProfileScope;
CredentialsStore credentialsProfiles = Program.CredentialsProfiles;
if (profileScope == ProfileScope.File)
+ {
credentialsProfiles = _file.CredentialsProfiles;
-
+ }
qualifiedUserName = saveCredentialsDialog.ProfileName;
bool flag = !credentialsProfiles.Contains(qualifiedUserName);
CredentialsProfile credentialsProfile2 = (credentialsProfiles[qualifiedUserName] = new CredentialsProfile(qualifiedUserName, profileScope, UserNameTextBox.Text, PasswordTextBox.Text, DomainTextBox.Text));
string qualifiedName = credentialsProfile2.QualifiedName;
if (flag)
+ {
ProfileComboBox.AddItem(qualifiedName, credentialsProfile2);
+ }
else
+ {
ProfileComboBox.ReplaceItem(qualifiedName, credentialsProfile2);
-
+ }
ProfileComboBox.SelectedValue = credentialsProfile2;
}
}
diff --git a/RdcMan/CustomClientSizeCheckedMenuIte.cs b/RdcMan/CustomClientSizeCheckedMenuIte.cs
index 1a3e382..873f0c6 100644
--- a/RdcMan/CustomClientSizeCheckedMenuIte.cs
+++ b/RdcMan/CustomClientSizeCheckedMenuIte.cs
@@ -2,34 +2,41 @@
using System.Linq;
using System.Windows.Forms;
-namespace RdcMan {
- internal class CustomClientSizeCheckedMenuItem : CheckedMenuItem {
+namespace RdcMan
+{
+ internal class CustomClientSizeCheckedMenuItem : CheckedMenuItem
+ {
private RdcBaseForm _form;
private string _baseText;
public CustomClientSizeCheckedMenuItem(RdcBaseForm form, string text)
- : base(text) {
+ : base(text)
+ {
_baseText = Text;
_form = form;
}
- protected override void CheckChanged(bool isChecked) {
+ protected override void CheckChanged(bool isChecked)
+ {
Size clientSize = _form.GetClientSize();
using CustomSizeDialog customSizeDialog = new CustomSizeDialog(clientSize);
- if (customSizeDialog.ShowDialog() == DialogResult.OK) {
+ if (customSizeDialog.ShowDialog() == DialogResult.OK)
+ {
Size clientSize2 = SizeHelper.FromString(customSizeDialog.WidthText, customSizeDialog.HeightText);
_form.SetClientSize(clientSize2);
}
}
- public override void Update() {
+ public override void Update()
+ {
Size clientSize = _form.GetClientSize();
bool flag2 = (base.Checked = SizeHelper.StockSizes.All((Size size) => size != clientSize));
string text = _baseText;
if (flag2)
+ {
text += " ({0})".InvariantFormat(clientSize.ToFormattedString());
-
+ }
Text = text + "...";
}
}
diff --git a/RdcMan/CustomSizeDialog.cs b/RdcMan/CustomSizeDialog.cs
index afd5e4a..e695260 100644
--- a/RdcMan/CustomSizeDialog.cs
+++ b/RdcMan/CustomSizeDialog.cs
@@ -2,8 +2,10 @@
using System.Drawing;
using System.Windows.Forms;
-namespace RdcMan {
- public class CustomSizeDialog : RdcDialog {
+namespace RdcMan
+{
+ public class CustomSizeDialog : RdcDialog
+ {
private NumericTextBox _widthTextBox;
private NumericTextBox _heightTextBox;
@@ -19,23 +21,25 @@ public class CustomSizeDialog : RdcDialog {
public string HeightText => _heightTextBox.Text;
public CustomSizeDialog(Size size)
- : base("ԶС", "ȷ") {
+ : base("ԶС", "ȷ")
+ {
InitComp();
_widthTextBox.Text = size.Width.ToString();
_heightTextBox.Text = size.Height.ToString();
}
- private void InitComp() {
+ private void InitComp()
+ {
int num = 0;
Label label = new Label {
Location = new Point(8, 8),
- Size = new Size(50, 23),
+ Size = new Size(60, 23),
Text = "(&W)",
TextAlign = ContentAlignment.MiddleLeft
};
Label label2 = new Label {
Location = new Point(8, 40),
- Size = new Size(50, 23),
+ Size = new Size(60, 23),
Text = "߶(&H)",
TextAlign = ContentAlignment.MiddleLeft
};
@@ -73,19 +77,22 @@ private void InitComp() {
this.ScaleAndLayout();
}
- private void fourThreeButton_Click(object sender, EventArgs e) {
+ private void fourThreeButton_Click(object sender, EventArgs e)
+ {
int num = int.Parse(_widthTextBox.Text);
int num2 = num * 3 / 4;
_heightTextBox.Text = num2.ToString();
}
- private void sixteenNineButton_Click(object sender, EventArgs e) {
+ private void sixteenNineButton_Click(object sender, EventArgs e)
+ {
int num = int.Parse(_widthTextBox.Text);
int num2 = num * 9 / 16;
_heightTextBox.Text = num2.ToString();
}
- private void sixteenTenButton_Click(object sender, EventArgs e) {
+ private void sixteenTenButton_Click(object sender, EventArgs e)
+ {
int num = int.Parse(_widthTextBox.Text);
int num2 = num * 10 / 16;
_heightTextBox.Text = num2.ToString();
diff --git a/RdcMan/DefaultGroupPropertiesDialog.cs b/RdcMan/DefaultGroupPropertiesDialog.cs
index ed190d3..e07c118 100644
--- a/RdcMan/DefaultGroupPropertiesDialog.cs
+++ b/RdcMan/DefaultGroupPropertiesDialog.cs
@@ -1,12 +1,16 @@
using System.Windows.Forms;
-namespace RdcMan {
- internal class DefaultGroupPropertiesDialog : GroupBasePropertiesDialog {
+namespace RdcMan
+{
+ internal class DefaultGroupPropertiesDialog : GroupBasePropertiesDialog
+ {
protected DefaultGroupPropertiesDialog(GroupBase group, Form parentForm)
- : base(group, "Ĭ", "ȷ", parentForm) {
+ : base(group, "Ĭ", "ȷ", parentForm)
+ {
}
- public static DefaultGroupPropertiesDialog NewPropertiesDialog(GroupBase group, Form parentForm) {
+ public static DefaultGroupPropertiesDialog NewPropertiesDialog(GroupBase group, Form parentForm)
+ {
DefaultGroupPropertiesDialog defaultGroupPropertiesDialog = new DefaultGroupPropertiesDialog(group, parentForm);
defaultGroupPropertiesDialog.CreateControls(group);
defaultGroupPropertiesDialog.PopulateCredentialsProfiles(null);
@@ -14,7 +18,8 @@ public static DefaultGroupPropertiesDialog NewPropertiesDialog(GroupBase group,
return defaultGroupPropertiesDialog;
}
- public override void CreateControls(RdcTreeNode settingsNode) {
+ public override void CreateControls(RdcTreeNode settingsNode)
+ {
base.CreateControls(settingsNode);
AddTabPage(settingsNode.EncryptionSettings.CreateTabPage(this));
CreateProfileManagementTabPage();
diff --git a/RdcMan/DefaultSettingsGroup.cs b/RdcMan/DefaultSettingsGroup.cs
index 98ab868..587ac37 100644
--- a/RdcMan/DefaultSettingsGroup.cs
+++ b/RdcMan/DefaultSettingsGroup.cs
@@ -2,48 +2,59 @@
using System.Windows.Forms;
using System.Xml;
-namespace RdcMan {
- internal class DefaultSettingsGroup : VirtualGroup {
+namespace RdcMan
+{
+ internal class DefaultSettingsGroup : VirtualGroup
+ {
//public new const string Name = "Ĭ";
- //private const string XmlTopNode = "defaultSettings";
+ private const string XmlTopNode = "defaultSettings";
public static DefaultSettingsGroup Instance { get; private set; }
public override EncryptionSettings EncryptionSettings { get; protected set; }
- static DefaultSettingsGroup() {
+ static DefaultSettingsGroup()
+ {
Instance = new DefaultSettingsGroup();
}
- private DefaultSettingsGroup() {
+ private DefaultSettingsGroup()
+ {
EncryptionSettings = new EncryptionSettings();
base.AllSettingsGroups.Add(EncryptionSettings);
- foreach (SettingsGroup allSettingsGroup in base.AllSettingsGroups) {
+ foreach (SettingsGroup allSettingsGroup in base.AllSettingsGroups)
+ {
allSettingsGroup.InheritSettingsType.Mode = InheritanceMode.Disabled;
}
}
- internal override void ReadXml(XmlNode node, ICollection errors) {
- if (!node.Name.Equals("defaultSettings")) {
+ internal override void ReadXml(XmlNode node, ICollection errors)
+ {
+ if (!node.Name.Equals("defaultSettings"))
+ {
errors.Add("Ĭøʽ");
return;
}
- foreach (XmlNode childNode in node.ChildNodes) {
+ foreach (XmlNode childNode in node.ChildNodes)
+ {
ReadXmlSettingsGroup(childNode, errors);
}
}
- internal override void WriteXml(XmlTextWriter tw) {
+ internal override void WriteXml(XmlTextWriter tw)
+ {
tw.WriteStartElement("defaultSettings");
WriteXmlSettingsGroups(tw);
tw.WriteEndElement();
}
- public override void DoPropertiesDialog(Form parentForm, string activeTabName) {
+ public override void DoPropertiesDialog(Form parentForm, string activeTabName)
+ {
using DefaultGroupPropertiesDialog defaultGroupPropertiesDialog = DefaultGroupPropertiesDialog.NewPropertiesDialog(this, parentForm);
defaultGroupPropertiesDialog.SetActiveTab(activeTabName);
- if (defaultGroupPropertiesDialog.ShowDialog() == DialogResult.OK) {
+ if (defaultGroupPropertiesDialog.ShowDialog() == DialogResult.OK)
+ {
UpdateSettings(defaultGroupPropertiesDialog);
ServerTree.Instance.OnGroupChanged(ServerTree.Instance.RootNode, ChangeType.PropertyChanged);
Program.Preferences.NeedToSave = true;
diff --git a/RdcMan/DeferDecryptionItem.cs b/RdcMan/DeferDecryptionItem.cs
index 7c507af..ac01cf0 100644
--- a/RdcMan/DeferDecryptionItem.cs
+++ b/RdcMan/DeferDecryptionItem.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- internal class DeferDecryptionItem {
+namespace RdcMan
+{
+ internal class DeferDecryptionItem
+ {
public IDeferDecryption Object;
public RdcTreeNode Node;
diff --git a/RdcMan/DelegateCheckedMenuItem.cs b/RdcMan/DelegateCheckedMenuItem.cs
index f8e9a98..170d5cc 100644
--- a/RdcMan/DelegateCheckedMenuItem.cs
+++ b/RdcMan/DelegateCheckedMenuItem.cs
@@ -1,23 +1,28 @@
using System;
-namespace RdcMan {
- internal class DelegateCheckedMenuItem : CheckedMenuItem {
+namespace RdcMan
+{
+ internal class DelegateCheckedMenuItem : CheckedMenuItem
+ {
private readonly Func _initDelegate;
private readonly Action _changedDelegate;
public DelegateCheckedMenuItem(string text, MenuNames name, Func initDelegate, Action changedDelegate)
- : base(text) {
+ : base(text)
+ {
base.Name = name.ToString();
_initDelegate = initDelegate;
_changedDelegate = changedDelegate;
}
- protected sealed override void CheckChanged(bool isChecked) {
+ protected sealed override void CheckChanged(bool isChecked)
+ {
_changedDelegate(isChecked);
}
- public sealed override void Update() {
+ public sealed override void Update()
+ {
base.Checked = _initDelegate();
}
}
diff --git a/RdcMan/DelegateMenuItem.cs b/RdcMan/DelegateMenuItem.cs
index 900ecac..dcad90c 100644
--- a/RdcMan/DelegateMenuItem.cs
+++ b/RdcMan/DelegateMenuItem.cs
@@ -1,18 +1,23 @@
using System;
using System.Windows.Forms;
-namespace RdcMan {
- public class DelegateMenuItem : ToolStripMenuItem {
+namespace RdcMan
+{
+ public class DelegateMenuItem : ToolStripMenuItem
+ {
public DelegateMenuItem(string text, MenuNames name, Action click)
- : base(text) {
- base.Click += delegate {
+ : base(text)
+ {
+ base.Click += delegate
+ {
click();
};
base.Name = name.ToString();
}
public DelegateMenuItem(string text, MenuNames name, string shortcut, Action click)
- : this(text, name, click) {
+ : this(text, name, click)
+ {
base.ShortcutKeyDisplayString = shortcut;
}
}
diff --git a/RdcMan/DisplaySettingsTabPage.cs b/RdcMan/DisplaySettingsTabPage.cs
index a56f9c4..cece7c0 100644
--- a/RdcMan/DisplaySettingsTabPage.cs
+++ b/RdcMan/DisplaySettingsTabPage.cs
@@ -1,13 +1,17 @@
using System.Drawing;
using System.Windows.Forms;
-namespace RdcMan {
- public abstract class DisplaySettingsTabPage : SettingsTabPage where TSettingsGroup : CommonDisplaySettings {
+namespace RdcMan
+{
+ public abstract class DisplaySettingsTabPage : SettingsTabPage where TSettingsGroup : CommonDisplaySettings
+ {
protected DisplaySettingsTabPage(TabbedSettingsDialog dialog, TSettingsGroup settings)
- : base(dialog, settings) {
+ : base(dialog, settings)
+ {
}
- protected void Create(out int rowIndex, out int tabIndex) {
+ protected void Create(out int rowIndex, out int tabIndex)
+ {
tabIndex = 0;
rowIndex = 0;
CreateInheritanceControl(ref rowIndex, ref tabIndex);
@@ -15,8 +19,8 @@ protected void Create(out int rowIndex, out int tabIndex) {
label.Size = new Size(140, 20);
RdcNumericUpDown rdcNumericUpDown = new RdcNumericUpDown {
Location = FormTools.NewLocation(1, rowIndex++),
- Minimum = 1m,
- Maximum = 9m,
+ Minimum = 1,
+ Maximum = 9,
Setting = base.Settings.ThumbnailScale,
Size = new Size(40, 20),
TabIndex = tabIndex++
diff --git a/RdcMan/EnableTabsEventArgs.cs b/RdcMan/EnableTabsEventArgs.cs
index c18f0a9..a16d08d 100644
--- a/RdcMan/EnableTabsEventArgs.cs
+++ b/RdcMan/EnableTabsEventArgs.cs
@@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
-namespace RdcMan {
- public class EnableTabsEventArgs : EventArgs {
+namespace RdcMan
+{
+ public class EnableTabsEventArgs : EventArgs
+ {
public bool Enabled;
public string Reason;
diff --git a/RdcMan/Encryption.cs b/RdcMan/Encryption.cs
index 33a80ca..5553186 100644
--- a/RdcMan/Encryption.cs
+++ b/RdcMan/Encryption.cs
@@ -7,106 +7,141 @@
using System.Windows.Forms;
using Win32;
-namespace RdcMan {
- public static class Encryption {
+namespace RdcMan
+{
+ public static class Encryption
+ {
private static readonly List PendingDecryption = new List();
- public static void DeferDecryption(IDeferDecryption o, RdcTreeNode node, string errorDetail) {
- PendingDecryption.Add(new DeferDecryptionItem {
+ public static void DeferDecryption(IDeferDecryption o, RdcTreeNode node, string errorDetail)
+ {
+ PendingDecryption.Add(new DeferDecryptionItem
+ {
Object = o,
Node = node,
ErrorDetail = errorDetail
});
}
- public static void DecryptPasswords() {
+ public static void DecryptPasswords()
+ {
StringBuilder builder = new StringBuilder("ijЩƾ֤ʱ⡣").AppendLine().AppendLine("ȷϸϢƵ塣");
bool credentialsProfileFail = false;
- PendingDecryption.Where((DeferDecryptionItem d) => d.Object is CredentialsProfile).ForEach(delegate (DeferDecryptionItem item) {
+ PendingDecryption.Where((DeferDecryptionItem d) => d.Object is CredentialsProfile).ForEach(delegate(DeferDecryptionItem item)
+ {
DecryptPassword(item, builder, "ƾ֤ļ", ref credentialsProfileFail);
});
bool passwordFail = false;
- PendingDecryption.Where((DeferDecryptionItem d) => d.Object is PasswordSetting).ForEach(delegate (DeferDecryptionItem item) {
+ PendingDecryption.Where((DeferDecryptionItem d) => d.Object is PasswordSetting).ForEach(delegate(DeferDecryptionItem item)
+ {
DecryptPassword(item, builder, "Զ룺", ref passwordFail);
});
PendingDecryption.Clear();
- if (credentialsProfileFail || passwordFail) {
+ if (credentialsProfileFail || passwordFail)
+ {
DialogResult dialogResult = FormTools.ExclamationDialog(builder.ToString(), MessageBoxButtons.OKCancel);
if (dialogResult == DialogResult.OK)
+ {
Clipboard.SetText(builder.ToString());
+ }
}
}
- private static bool DecryptPassword(DeferDecryptionItem item, StringBuilder builder, string header, ref bool anyFailed) {
+ private static bool DecryptPassword(DeferDecryptionItem item, StringBuilder builder, string header, ref bool anyFailed)
+ {
IDeferDecryption @object = item.Object;
RdcTreeNode node = item.Node;
string errorDetail = item.ErrorDetail;
bool anyInherited = false;
node.EncryptionSettings.InheritSettings(node, ref anyInherited);
- try {
+ try
+ {
@object.Decrypt(node.EncryptionSettings);
}
- catch (Exception ex) {
- if (!anyFailed) {
+ catch (Exception ex)
+ {
+ if (!anyFailed)
+ {
builder.AppendLine().AppendLine(header);
anyFailed = true;
}
if (node is DefaultSettingsGroup)
+ {
builder.Append("Ĭ");
+ }
else
+ {
builder.Append(node.FullPath);
- builder.AppendFormat(" {0}", errorDetail);
+ }
+ builder.AppendFormat(": {0}", errorDetail);
if (!string.IsNullOrEmpty(ex.Message))
+ {
builder.AppendFormat(" [{0}]", ex.Message);
+ }
builder.AppendLine();
}
return anyFailed;
}
- public static string SimpleName(this X509Certificate2 cert) {
+ public static string SimpleName(this X509Certificate2 cert)
+ {
string text = cert.FriendlyName;
if (string.IsNullOrEmpty(text))
+ {
text = cert.GetNameInfo(X509NameType.SimpleName, forIssuer: false);
-
+ }
return text + ", " + cert.GetNameInfo(X509NameType.SimpleName, forIssuer: true);
}
- public static string EncryptionMethodToString(EncryptionMethod method) {
- return method switch {
+ public static string EncryptionMethodToString(EncryptionMethod method)
+ {
+ return method switch
+ {
EncryptionMethod.Certificate => "֤",
EncryptionMethod.LogonCredentials => "ʹûƾ֤¼",
_ => throw new Exception("ļܷ"),
};
}
- public static X509Certificate2 SelectCertificate() {
+ public static X509Certificate2 SelectCertificate()
+ {
X509Store x509Store = new X509Store();
X509Certificate2Collection privateCollection = new X509Certificate2Collection();
- try {
+ try
+ {
x509Store.Open(OpenFlags.OpenExistingOnly);
X509Certificate2Collection certificates = x509Store.Certificates;
X509Certificate2Collection foundCollection = certificates.Find(X509FindType.FindByTimeValid, DateTime.Now, validOnly: false);
- LongRunningActionForm.PerformOperation("Ч֤", showImmediately: true, delegate {
+ LongRunningActionForm.PerformOperation("Ч֤", showImmediately: true, delegate
+ {
X509Certificate2Enumerator enumerator = foundCollection.GetEnumerator();
- while (enumerator.MoveNext()) {
+ while (enumerator.MoveNext())
+ {
X509Certificate2 current = enumerator.Current;
- try {
+ try
+ {
if (DecryptStringUsingCertificate(current, EncryptStringUsingCertificate(current, "test")) == "test")
+ {
privateCollection.Add(current);
+ }
+ }
+ catch
+ {
}
- catch { }
LongRunningActionForm.Instance.UpdateStatus(current.SimpleName());
}
});
}
- finally {
+ finally
+ {
x509Store.Close();
}
X509Certificate2Collection x509Certificate2Collection = X509Certificate2UI.SelectFromCollection(privateCollection, "ѡ֤", "ѡڰȫ洢֤", X509SelectionFlag.SingleSelection, Program.TheForm.Handle);
return x509Certificate2Collection.Count != 1 ? null : x509Certificate2Collection[0];
}
- public static X509Certificate2 GetCertificate(string thumbprint) {
+ public static X509Certificate2 GetCertificate(string thumbprint)
+ {
X509Store x509Store = new X509Store();
x509Store.Open(OpenFlags.OpenExistingOnly);
X509Certificate2Collection certificates = x509Store.Certificates;
@@ -114,40 +149,49 @@ public static X509Certificate2 GetCertificate(string thumbprint) {
return x509Certificate2Collection.Count != 1 ? null : x509Certificate2Collection[0];
}
- public static string EncryptString(string plaintext, EncryptionSettings settings) {
- switch (settings.EncryptionMethod.Value) {
- case EncryptionMethod.LogonCredentials:
- return EncryptStringUsingLocalUser(plaintext);
- case EncryptionMethod.Certificate:
- X509Certificate2 certificate = GetCertificate(settings.CredentialData.Value);
- return EncryptStringUsingCertificate(certificate, plaintext);
- default:
- throw new NotImplementedException("ļܷ{0}".InvariantFormat(settings.EncryptionMethod.Value.ToString()));
+ public static string EncryptString(string plaintext, EncryptionSettings settings)
+ {
+ switch (settings.EncryptionMethod.Value)
+ {
+ case EncryptionMethod.LogonCredentials:
+ return EncryptStringUsingLocalUser(plaintext);
+ case EncryptionMethod.Certificate:
+ {
+ X509Certificate2 certificate = GetCertificate(settings.CredentialData.Value);
+ return EncryptStringUsingCertificate(certificate, plaintext);
+ }
+ default:
+ throw new NotImplementedException("ļܷ{0}".InvariantFormat(settings.EncryptionMethod.Value.ToString()));
}
}
- private unsafe static string EncryptStringUsingLocalUser(string plaintext) {
+ private unsafe static string EncryptStringUsingLocalUser(string plaintext)
+ {
Crypto.DataBlob optionalEntropy = default(Crypto.DataBlob);
Crypto.CryptProtectPromptStruct promptStruct = default(Crypto.CryptProtectPromptStruct);
if (string.IsNullOrEmpty(plaintext))
+ {
return null;
-
+ }
optionalEntropy.Size = 0;
promptStruct.Size = 0;
char[] array = plaintext.ToCharArray();
Crypto.DataBlob dataIn = default(Crypto.DataBlob);
dataIn.Size = array.Length * 2;
Crypto.DataBlob dataOut;
- fixed (char* ptr = array) {
+ fixed (char* ptr = array)
+ {
dataIn.Data = (IntPtr)ptr;
- if (!Crypto.CryptProtectData(ref dataIn, null, ref optionalEntropy, (IntPtr)(void*)null, ref promptStruct, 0, out dataOut)) {
+ if (!Crypto.CryptProtectData(ref dataIn, null, ref optionalEntropy, (IntPtr)(void*)null, ref promptStruct, 0, out dataOut))
+ {
FormTools.ErrorDialog("");
return null;
}
}
byte* ptr2 = (byte*)(void*)dataOut.Data;
byte[] array2 = new byte[dataOut.Size];
- for (int i = 0; i < array2.Length; i++) {
+ for (int i = 0; i < array2.Length; i++)
+ {
array2[i] = ptr2[i];
}
string result = Convert.ToBase64String(array2);
@@ -155,36 +199,45 @@ private unsafe static string EncryptStringUsingLocalUser(string plaintext) {
return result;
}
- private static string EncryptStringUsingCertificate(X509Certificate2 cert, string plaintext) {
+ private static string EncryptStringUsingCertificate(X509Certificate2 cert, string plaintext)
+ {
RSACryptoServiceProvider rSACryptoServiceProvider = (RSACryptoServiceProvider)cert.PublicKey.Key;
byte[] inArray = rSACryptoServiceProvider.Encrypt(Encoding.UTF8.GetBytes(plaintext), fOAEP: false);
return Convert.ToBase64String(inArray);
}
- public static string DecryptString(string encryptedString, EncryptionSettings settings) {
+ public static string DecryptString(string encryptedString, EncryptionSettings settings)
+ {
if (string.IsNullOrEmpty(encryptedString))
+ {
return encryptedString;
-
- switch (settings.EncryptionMethod.Value) {
- case EncryptionMethod.LogonCredentials:
- return DecryptStringUsingLocalUser(encryptedString);
- case EncryptionMethod.Certificate:
- X509Certificate2 certificate = GetCertificate(settings.CredentialData.Value);
- if (certificate == null)
- throw new Exception("δҵָơ{1}֤顰{0}".InvariantFormat(settings.CredentialName.Value, settings.CredentialData.Value));
-
- return DecryptStringUsingCertificate(certificate, encryptedString);
- default:
- throw new NotImplementedException("ļܷ{0}".InvariantFormat(settings.EncryptionMethod.Value.ToString()));
+ }
+ switch (settings.EncryptionMethod.Value)
+ {
+ case EncryptionMethod.LogonCredentials:
+ return DecryptStringUsingLocalUser(encryptedString);
+ case EncryptionMethod.Certificate:
+ {
+ X509Certificate2 certificate = GetCertificate(settings.CredentialData.Value);
+ if (certificate == null)
+ {
+ throw new Exception("δҵָơ{1}֤顰{0}".InvariantFormat(settings.CredentialName.Value, settings.CredentialData.Value));
+ }
+ return DecryptStringUsingCertificate(certificate, encryptedString);
+ }
+ default:
+ throw new NotImplementedException("ļܷ{0}".InvariantFormat(settings.EncryptionMethod.Value.ToString()));
}
}
- private unsafe static string DecryptStringUsingLocalUser(string encryptedString) {
+ private unsafe static string DecryptStringUsingLocalUser(string encryptedString)
+ {
Crypto.DataBlob optionalEntropy = default(Crypto.DataBlob);
Crypto.CryptProtectPromptStruct promptStruct = default(Crypto.CryptProtectPromptStruct);
if (string.IsNullOrEmpty(encryptedString))
+ {
return string.Empty;
-
+ }
optionalEntropy.Size = 0;
promptStruct.Size = 0;
byte[] array = Convert.FromBase64String(encryptedString);
@@ -192,14 +245,17 @@ private unsafe static string DecryptStringUsingLocalUser(string encryptedString)
dataIn.Size = array.Length;
Crypto.DataBlob dataOut;
string result;
- fixed (byte* ptr = array) {
+ fixed (byte* ptr = array)
+ {
dataIn.Data = (IntPtr)ptr;
if (!Crypto.CryptUnprotectData(ref dataIn, null, ref optionalEntropy, (IntPtr)(void*)null, ref promptStruct, 0, out dataOut))
+ {
throw new Exception("ʹ {0} ƾ֤ʧ".InvariantFormat(CredentialsUI.GetLoggedInUser()));
-
+ }
char* ptr2 = (char*)(void*)dataOut.Data;
char[] array2 = new char[dataOut.Size / 2];
- for (int i = 0; i < array2.Length; i++) {
+ for (int i = 0; i < array2.Length; i++)
+ {
array2[i] = ptr2[i];
}
result = new string(array2);
@@ -208,9 +264,12 @@ private unsafe static string DecryptStringUsingLocalUser(string encryptedString)
return result;
}
- private static string DecryptStringUsingCertificate(X509Certificate2 cert, string encryptedString) {
- if (string.IsNullOrEmpty(encryptedString) || !cert.HasPrivateKey)
+ private static string DecryptStringUsingCertificate(X509Certificate2 cert, string encryptedString)
+ {
+ if (string.IsNullOrEmpty(encryptedString))
+ {
return null;
+ }
RSACryptoServiceProvider rSACryptoServiceProvider = (RSACryptoServiceProvider)cert.PrivateKey;
byte[] bytes = rSACryptoServiceProvider.Decrypt(Convert.FromBase64String(encryptedString), fOAEP: false);
return Encoding.UTF8.GetString(bytes);
diff --git a/RdcMan/EncryptionMethod.cs b/RdcMan/EncryptionMethod.cs
index aecff94..5d1da5b 100644
--- a/RdcMan/EncryptionMethod.cs
+++ b/RdcMan/EncryptionMethod.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public enum EncryptionMethod {
+namespace RdcMan
+{
+ public enum EncryptionMethod
+ {
LogonCredentials,
Certificate
}
diff --git a/RdcMan/EncryptionSettings.cs b/RdcMan/EncryptionSettings.cs
index 6004503..cef11e3 100644
--- a/RdcMan/EncryptionSettings.cs
+++ b/RdcMan/EncryptionSettings.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Windows.Forms;
-namespace RdcMan {
- public class EncryptionSettings : SettingsGroup {
- //public const string TabName = "";
+namespace RdcMan
+{
+ public class EncryptionSettings : SettingsGroup
+ {
+ //public const string TabName = "Encryption Settings";
private static Dictionary _settingProperties;
@@ -18,20 +20,24 @@ public class EncryptionSettings : SettingsGroup {
[Setting("credentialData")]
public StringSetting CredentialData { get; private set; }
- static EncryptionSettings() {
+ static EncryptionSettings()
+ {
typeof(EncryptionSettings).GetSettingProperties(out _settingProperties);
_settingProperties["CredentialName"].Attribute.DefaultValue = CredentialsUI.GetLoggedInUser();
}
public EncryptionSettings()
- : base("", "encryptionSettings") {
+ : base("", "encryptionSettings")
+ {
}
- public override TabPage CreateTabPage(TabbedSettingsDialog dialog) {
+ public override TabPage CreateTabPage(TabbedSettingsDialog dialog)
+ {
return new EncryptionSettingsTabPage(dialog, this);
}
- protected override void Copy(RdcTreeNode node) {
+ protected override void Copy(RdcTreeNode node)
+ {
Copy(node.EncryptionSettings);
}
}
diff --git a/RdcMan/EncryptionSettingsTabPage.cs b/RdcMan/EncryptionSettingsTabPage.cs
index 0a3ce87..0efbeb8 100644
--- a/RdcMan/EncryptionSettingsTabPage.cs
+++ b/RdcMan/EncryptionSettingsTabPage.cs
@@ -3,8 +3,10 @@
using System.Security.Cryptography.X509Certificates;
using System.Windows.Forms;
-namespace RdcMan {
- public class EncryptionSettingsTabPage : SettingsTabPage {
+namespace RdcMan
+{
+ public class EncryptionSettingsTabPage : SettingsTabPage
+ {
public InheritanceControl InheritEncryptionSettings;
protected ValueComboBox _passwordEncryptionMethodCombo;
@@ -18,16 +20,19 @@ public class EncryptionSettingsTabPage : SettingsTabPage {
private EncryptionMethod _passwordEncryptionMethodPrevious;
public EncryptionSettingsTabPage(TabbedSettingsDialog dialog, EncryptionSettings settings)
- : base(dialog, settings) {
- int num = 0;
+ : base(dialog, settings)
+ {
+ int tabIndex = 0;
int rowIndex = 0;
- CreateInheritanceControl(ref rowIndex, ref num);
- if (base.InheritanceControl != null) {
- base.InheritanceControl.EnabledChanged += delegate {
+ CreateInheritanceControl(ref rowIndex, ref tabIndex);
+ if (base.InheritanceControl != null)
+ {
+ base.InheritanceControl.EnabledChanged += delegate
+ {
PasswordEncryptionMethodCombo_Changed(null, null);
};
}
- _passwordEncryptionMethodCombo = FormTools.AddLabeledEnumDropDown(this, "ܣ", base.Settings.EncryptionMethod, ref rowIndex, ref num, Encryption.EncryptionMethodToString);
+ _passwordEncryptionMethodCombo = FormTools.AddLabeledEnumDropDown(this, "ܣ", base.Settings.EncryptionMethod, ref rowIndex, ref tabIndex, Encryption.EncryptionMethodToString);
_passwordEncryptionMethodCombo.Enter += PasswordEncryptionMethodCombo_Enter;
_passwordEncryptionMethodCombo.SelectedIndexChanged += PasswordEncryptionMethodCombo_Changed;
_passwordEncryptionDataLabel = FormTools.NewLabel(string.Empty, 0, rowIndex);
@@ -35,7 +40,7 @@ public EncryptionSettingsTabPage(TabbedSettingsDialog dialog, EncryptionSettings
Enabled = false,
Location = FormTools.NewLocation(1, rowIndex++),
Width = 340,
- TabIndex = num++,
+ TabIndex = tabIndex++,
TextAlign = ContentAlignment.MiddleLeft
};
_passwordEncryptionDataButton.Click += PasswordEncryptionMethodButton_Click;
@@ -44,8 +49,10 @@ public EncryptionSettingsTabPage(TabbedSettingsDialog dialog, EncryptionSettings
base.Controls.Add(_passwordEncryptionDataLabel, _passwordEncryptionDataButton, _passwordEncryptionDataInfoLabel);
}
- protected override void UpdateControls() {
- if (base.Settings.EncryptionMethod.Value == EncryptionMethod.Certificate) {
+ protected override void UpdateControls()
+ {
+ if (base.Settings.EncryptionMethod.Value == EncryptionMethod.Certificate)
+ {
X509Certificate2 certificate = Encryption.GetCertificate(base.Settings.CredentialData.Value);
_passwordEncryptionDataButton.Tag = certificate;
}
@@ -54,51 +61,65 @@ protected override void UpdateControls() {
PasswordEncryptionMethodCombo_Changed(null, null);
}
- protected override void UpdateSettings() {
+ protected override void UpdateSettings()
+ {
base.UpdateSettings();
X509Certificate2 x509Certificate = (X509Certificate2)_passwordEncryptionDataButton.Tag;
base.Settings.CredentialData.Value = ((x509Certificate != null) ? x509Certificate.Thumbprint : string.Empty);
base.Settings.CredentialName.Value = _passwordEncryptionDataButton.Text;
}
- private void PasswordEncryptionMethodCombo_Enter(object sender, EventArgs e) {
+ private void PasswordEncryptionMethodCombo_Enter(object sender, EventArgs e)
+ {
_passwordEncryptionMethodPrevious = _passwordEncryptionMethodCombo.SelectedValue;
}
- private void PasswordEncryptionMethodCombo_Changed(object sender, EventArgs e) {
- switch (_passwordEncryptionMethodCombo.SelectedValue) {
- case EncryptionMethod.LogonCredentials:
- _passwordEncryptionDataLabel.Text = "û";
- _passwordEncryptionDataButton.Text = CredentialsUI.GetLoggedInUser();
- _passwordEncryptionDataButton.Tag = null;
- _passwordEncryptionDataButton.Enabled = false;
- _passwordEncryptionDataInfoLabel.Text = string.Empty;
- break;
- case EncryptionMethod.Certificate: {
- X509Certificate2 x509Certificate = _passwordEncryptionDataButton.Tag as X509Certificate2;
- if (x509Certificate == null) {
- try {
- base.Enabled = false;
- x509Certificate = Encryption.SelectCertificate();
- }
- finally {
- base.Enabled = true;
- }
+ private void PasswordEncryptionMethodCombo_Changed(object sender, EventArgs e)
+ {
+ switch (_passwordEncryptionMethodCombo.SelectedValue)
+ {
+ case EncryptionMethod.LogonCredentials:
+ _passwordEncryptionDataLabel.Text = "û";
+ _passwordEncryptionDataButton.Text = CredentialsUI.GetLoggedInUser();
+ _passwordEncryptionDataButton.Tag = null;
+ _passwordEncryptionDataButton.Enabled = false;
+ _passwordEncryptionDataInfoLabel.Text = string.Empty;
+ break;
+ case EncryptionMethod.Certificate:
+ {
+ X509Certificate2 x509Certificate = _passwordEncryptionDataButton.Tag as X509Certificate2;
+ if (x509Certificate == null)
+ {
+ try
+ {
+ base.Enabled = false;
+ x509Certificate = Encryption.SelectCertificate();
}
- if (x509Certificate != null)
- SetSelectedCertificate(x509Certificate);
- else
- _passwordEncryptionMethodCombo.SelectedValue = _passwordEncryptionMethodPrevious;
- break;
+ finally
+ {
+ base.Enabled = true;
+ }
+ }
+ if (x509Certificate != null)
+ {
+ SetSelectedCertificate(x509Certificate);
}
- default:
+ else
+ {
+ _passwordEncryptionMethodCombo.SelectedValue = _passwordEncryptionMethodPrevious;
+ }
+ break;
+ }
+ default:
throw new NotImplementedException("ļܷ{0}".InvariantFormat(_passwordEncryptionMethodCombo.SelectedValue.ToString()));
}
_passwordEncryptionMethodPrevious = _passwordEncryptionMethodCombo.SelectedValue;
}
- protected void SetSelectedCertificate(X509Certificate2 cert) {
- if (cert != null) {
+ protected void SetSelectedCertificate(X509Certificate2 cert)
+ {
+ if (cert != null)
+ {
_passwordEncryptionDataButton.Text = cert.SimpleName();
_passwordEncryptionDataButton.Tag = cert;
_passwordEncryptionDataButton.Enabled = _passwordEncryptionMethodCombo.Enabled;
@@ -107,13 +128,16 @@ protected void SetSelectedCertificate(X509Certificate2 cert) {
}
}
- private void PasswordEncryptionMethodButton_Click(object sender, EventArgs e) {
+ private void PasswordEncryptionMethodButton_Click(object sender, EventArgs e)
+ {
X509Certificate2 selectedCertificate;
- try {
+ try
+ {
base.Enabled = false;
selectedCertificate = Encryption.SelectCertificate();
}
- finally {
+ finally
+ {
base.Enabled = true;
}
SetSelectedCertificate(selectedCertificate);
diff --git a/RdcMan/EnumMenuItem.cs b/RdcMan/EnumMenuItem.cs
index 1907eef..7f9c686 100644
--- a/RdcMan/EnumMenuItem.cs
+++ b/RdcMan/EnumMenuItem.cs
@@ -1,19 +1,24 @@
-namespace RdcMan {
- internal abstract class EnumMenuItem : RdcMenuItem {
+namespace RdcMan
+{
+ internal abstract class EnumMenuItem : RdcMenuItem
+ {
protected abstract T Value { get; set; }
- protected EnumMenuItem(string text, T value) {
+ protected EnumMenuItem(string text, T value)
+ {
Text = text;
base.Tag = value;
}
- protected override void OnClick() {
+ protected override void OnClick()
+ {
Value = (T)base.Tag;
Program.Preferences.NeedToSave = true;
}
- public override void Update() {
+ public override void Update()
+ {
base.Checked = base.Tag.Equals(Value);
}
}
-}
\ No newline at end of file
+}
diff --git a/RdcMan/EnumSetting.cs b/RdcMan/EnumSetting.cs
index a18edcb..6cd9ba1 100644
--- a/RdcMan/EnumSetting.cs
+++ b/RdcMan/EnumSetting.cs
@@ -1,22 +1,33 @@
using System;
using System.Xml;
-namespace RdcMan {
- public class EnumSetting : Setting where TEnum : struct {
+namespace RdcMan
+{
+ public class EnumSetting : Setting where TEnum : struct
+ {
public EnumSetting(object o)
- : base(o) {
+ : base(o)
+ {
}
- public override void ReadXml(XmlNode xmlNode, RdcTreeNode node) {
+ public override void ReadXml(XmlNode xmlNode, RdcTreeNode node)
+ {
if (int.TryParse(xmlNode.InnerText, out var result))
+ {
base.Value = (TEnum)(object)result;
+ }
else if (bool.TryParse(xmlNode.InnerText, out bool result2))
+ {
base.Value = (TEnum)(object)(result2 ? 1 : 0);
+ }
else
+ {
base.Value = (TEnum)Enum.Parse(typeof(TEnum), xmlNode.InnerText);
+ }
}
- public override void WriteXml(XmlTextWriter tw, RdcTreeNode node) {
+ public override void WriteXml(XmlTextWriter tw, RdcTreeNode node)
+ {
tw.WriteString(base.Value.ToString());
}
}
diff --git a/RdcMan/FavoriteServerRef.cs b/RdcMan/FavoriteServerRef.cs
index 42082f2..a32690f 100644
--- a/RdcMan/FavoriteServerRef.cs
+++ b/RdcMan/FavoriteServerRef.cs
@@ -1,10 +1,14 @@
-namespace RdcMan {
- internal class FavoriteServerRef : ServerRef {
+namespace RdcMan
+{
+ internal class FavoriteServerRef : ServerRef
+ {
public FavoriteServerRef(Server server)
- : base(server) {
+ : base(server)
+ {
}
- public override bool CanRemove(bool popUI) {
+ public override bool CanRemove(bool popUI)
+ {
return AllowEdit(popUI);
}
}
diff --git a/RdcMan/FavoritesGroup.cs b/RdcMan/FavoritesGroup.cs
index 168f6b9..299442f 100644
--- a/RdcMan/FavoritesGroup.cs
+++ b/RdcMan/FavoritesGroup.cs
@@ -1,32 +1,39 @@
using System.ComponentModel.Composition;
-namespace RdcMan {
+namespace RdcMan
+{
[Export(typeof(IBuiltInVirtualGroup))]
- internal class FavoritesGroup : BuiltInVirtualGroup, IServerRefFactory {
+ internal class FavoritesGroup : BuiltInVirtualGroup, IServerRefFactory
+ {
public static FavoritesGroup Instance { get; private set; }
protected override string XmlNodeName => "favorites";
- private FavoritesGroup() {
+ private FavoritesGroup()
+ {
base.Text = "ղؼ";
Instance = this;
}
- public override FavoriteServerRef AddReference(ServerBase serverBase) {
+ public override FavoriteServerRef AddReference(ServerBase serverBase)
+ {
base.IsInTree = true;
return base.AddReference(serverBase);
}
- public override bool CanDropServers() {
+ public override bool CanDropServers()
+ {
return true;
}
- public override bool HandleMove(RdcTreeNode childNode) {
+ public override bool HandleMove(RdcTreeNode childNode)
+ {
AddReference(childNode as ServerBase);
return true;
}
- public ServerRef Create(Server server) {
+ public ServerRef Create(Server server)
+ {
return new FavoriteServerRef(server);
}
}
diff --git a/RdcMan/FileGroup.cs b/RdcMan/FileGroup.cs
index 7217d2e..f0b0e3d 100644
--- a/RdcMan/FileGroup.cs
+++ b/RdcMan/FileGroup.cs
@@ -5,8 +5,10 @@
using System.Windows.Forms;
using System.Xml;
-namespace RdcMan {
- public class FileGroup : GroupBase {
+namespace RdcMan
+{
+ public class FileGroup : GroupBase
+ {
internal const string XmlNodeName = "file";
protected new static Dictionary NodeActions;
@@ -21,37 +23,50 @@ public class FileGroup : GroupBase {
public string Pathname { get; set; }
- static FileGroup() {
+ static FileGroup()
+ {
NodeActions = new Dictionary(GroupBase.NodeActions);
- NodeActions["credentialsProfiles"] = delegate (XmlNode childNode, RdcTreeNode parent, ICollection errors) {
+ NodeActions["credentialsProfiles"] = delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors)
+ {
(parent as FileGroup).CredentialsProfiles.ReadXml(childNode, ProfileScope.File, parent, errors);
};
ServerTree.Instance.GroupChanged += OnGroupChanged;
ServerTree.Instance.ServerChanged += OnServerChanged;
}
- private static void OnServerChanged(ServerChangedEventArgs e) {
- if (e.ChangeType.HasFlag(ChangeType.TreeChanged) || e.ChangeType.HasFlag(ChangeType.PropertyChanged)) {
+ private static void OnServerChanged(ServerChangedEventArgs e)
+ {
+ if (e.ChangeType.HasFlag(ChangeType.TreeChanged) || e.ChangeType.HasFlag(ChangeType.PropertyChanged))
+ {
FileGroup fileGroup = e.Server.FileGroup;
if (fileGroup != null)
+ {
fileGroup.HasChangedSinceWrite = true;
+ }
}
}
- private static void OnGroupChanged(GroupChangedEventArgs e) {
- if (e.ChangeType.HasFlag(ChangeType.TreeChanged) || e.ChangeType.HasFlag(ChangeType.PropertyChanged)) {
+ private static void OnGroupChanged(GroupChangedEventArgs e)
+ {
+ if (e.ChangeType.HasFlag(ChangeType.TreeChanged) || e.ChangeType.HasFlag(ChangeType.PropertyChanged))
+ {
FileGroup fileGroup = e.Group.FileGroup;
if (fileGroup != null)
+ {
fileGroup.HasChangedSinceWrite = true;
+ }
}
}
- internal FileGroup(string pathname) {
+ internal FileGroup(string pathname)
+ {
Pathname = Path.GetFullPath(pathname);
- if (File.Exists(Pathname)) {
+ if (File.Exists(Pathname))
+ {
base.IsReadOnly = File.GetAttributes(Pathname).HasFlag(FileAttributes.ReadOnly);
}
- else {
+ else
+ {
base.Properties.GroupName.Value = Path.GetFileNameWithoutExtension(Pathname);
base.Text = base.Properties.GroupName.Value;
}
@@ -62,55 +77,67 @@ internal FileGroup(string pathname) {
base.AllSettingsGroups.Add(EncryptionSettings);
}
- public string GetFilename() {
+ public string GetFilename()
+ {
return Path.GetFileName(Pathname);
}
- public string GetDirectory() {
+ public string GetDirectory()
+ {
return Path.GetDirectoryName(Pathname);
}
- protected override void InitSettings() {
+ protected override void InitSettings()
+ {
((RdcTreeNode)this).Properties = new FileGroupSettings();
base.InitSettings();
}
- internal override void ReadXml(XmlNode xmlNode, ICollection errors) {
+ internal override void ReadXml(XmlNode xmlNode, ICollection errors)
+ {
ReadXml(NodeActions, xmlNode, errors);
base.Text = base.Properties.GroupName.Value;
- if (base.IsReadOnly) {
+ if (base.IsReadOnly)
+ {
base.Text += " {RO}";
}
}
- internal override void WriteXml(XmlTextWriter tw) {
+ internal override void WriteXml(XmlTextWriter tw)
+ {
tw.WriteStartElement("file");
CredentialsProfiles.WriteXml(tw, this);
base.WriteXml(tw);
tw.WriteEndElement();
}
- public sealed override bool ConfirmRemove(bool askUser) {
+ public sealed override bool ConfirmRemove(bool askUser)
+ {
FormTools.InformationDialog("ʹļ˵ر " + base.Text + " ");
return false;
}
- public override void DoPropertiesDialog(Form parentForm, string activeTabName) {
+ public override void DoPropertiesDialog(Form parentForm, string activeTabName)
+ {
using FileGroupPropertiesDialog fileGroupPropertiesDialog = FileGroupPropertiesDialog.NewPropertiesDialog(this, parentForm);
fileGroupPropertiesDialog.SetActiveTab(activeTabName);
- if (fileGroupPropertiesDialog.ShowDialog() == DialogResult.OK) {
+ if (fileGroupPropertiesDialog.ShowDialog() == DialogResult.OK)
+ {
UpdateSettings(fileGroupPropertiesDialog);
ServerTree.Instance.OnNodeChanged(this, ChangeType.PropertyChanged);
}
}
- internal void CheckCredentials() {
+ internal void CheckCredentials()
+ {
Dictionary> missingProfiles = new Dictionary>(StringComparer.OrdinalIgnoreCase);
- this.VisitNodes(delegate (RdcTreeNode node) {
+ this.VisitNodes(delegate(RdcTreeNode node)
+ {
CheckCredentials(node, node.LogonCredentials, "¼ƾ֤", missingProfiles);
CheckCredentials(node, node.GatewaySettings, "", missingProfiles);
});
- if (missingProfiles.Count <= 0) {
+ if (missingProfiles.Count <= 0)
+ {
return;
}
StringBuilder stringBuilder = new StringBuilder();
@@ -118,24 +145,30 @@ internal void CheckCredentials() {
.AppendLine("ӵ༭Ե֮ǰȱٵļοʧ")
.AppendLine(" ȷ ϸϢƵ塣")
.AppendLine();
- foreach (KeyValuePair> item in missingProfiles) {
+ foreach (KeyValuePair> item in missingProfiles)
+ {
stringBuilder.AppendLine("ļƣ" + item.Key);
stringBuilder.AppendFormat("ڣ");
- foreach (string item2 in item.Value) {
+ foreach (string item2 in item.Value)
+ {
stringBuilder.Append(" " + item2);
}
stringBuilder.AppendLine().AppendLine();
}
DialogResult dialogResult = FormTools.ExclamationDialog(stringBuilder.ToString(), MessageBoxButtons.OKCancel);
- if (dialogResult == DialogResult.OK) {
+ if (dialogResult == DialogResult.OK)
+ {
Clipboard.SetText(stringBuilder.ToString());
}
}
- private void CheckCredentials(RdcTreeNode node, LogonCredentials credentials, string name, Dictionary> missingProfiles) {
- if (credentials != null && credentials.InheritSettingsType.Mode != 0 && !node.ResolveCredentials(credentials)) {
+ private void CheckCredentials(RdcTreeNode node, LogonCredentials credentials, string name, Dictionary> missingProfiles)
+ {
+ if (credentials != null && credentials.InheritSettingsType.Mode != 0 && !node.ResolveCredentials(credentials))
+ {
string key = LogonCredentials.ConstructQualifiedName(credentials);
- if (!missingProfiles.TryGetValue(key, out var value)) {
+ if (!missingProfiles.TryGetValue(key, out var value))
+ {
List list2 = (missingProfiles[key] = new List());
value = list2;
}
diff --git a/RdcMan/FileGroupPropertiesDialog.cs b/RdcMan/FileGroupPropertiesDialog.cs
index cd719a0..d81a2cd 100644
--- a/RdcMan/FileGroupPropertiesDialog.cs
+++ b/RdcMan/FileGroupPropertiesDialog.cs
@@ -1,18 +1,23 @@
using System.Windows.Forms;
-namespace RdcMan {
- internal class FileGroupPropertiesDialog : GroupBasePropertiesDialog {
+namespace RdcMan
+{
+ internal class FileGroupPropertiesDialog : GroupBasePropertiesDialog
+ {
protected FileGroupPropertiesDialog(FileGroup group, string dialogTitle, string acceptButtonText, Form parentForm)
- : base(group, dialogTitle, acceptButtonText, parentForm) {
+ : base(group, dialogTitle, acceptButtonText, parentForm)
+ {
}
- public static FileGroupPropertiesDialog NewPropertiesDialog(FileGroup group, Form parentForm) {
+ public static FileGroupPropertiesDialog NewPropertiesDialog(FileGroup group, Form parentForm)
+ {
FileGroupPropertiesDialog fileGroupPropertiesDialog = new FileGroupPropertiesDialog(group, group.Text + " ļ", "ȷ", parentForm);
fileGroupPropertiesDialog.CreateControls(group);
return fileGroupPropertiesDialog;
}
- public override void CreateControls(RdcTreeNode settings) {
+ public override void CreateControls(RdcTreeNode settings)
+ {
FileGroupPropertiesTabPage page = (FileGroupPropertiesTabPage)(base.PropertiesPage = settings.Properties.CreateTabPage(this) as FileGroupPropertiesTabPage);
AddTabPage(page);
base.PropertiesPage.ParentGroupChanged += base.PopulateCredentialsProfiles;
diff --git a/RdcMan/FileGroupPropertiesTabPage.cs b/RdcMan/FileGroupPropertiesTabPage.cs
index 4f954e2..20d29ad 100644
--- a/RdcMan/FileGroupPropertiesTabPage.cs
+++ b/RdcMan/FileGroupPropertiesTabPage.cs
@@ -1,19 +1,23 @@
using System.Windows.Forms;
-namespace RdcMan {
- internal class FileGroupPropertiesTabPage : GroupBasePropertiesTabPage {
+namespace RdcMan
+{
+ internal class FileGroupPropertiesTabPage : GroupBasePropertiesTabPage
+ {
private readonly TextBox _pathnameTextBox;
public FileGroupPropertiesTabPage(TabbedSettingsDialog dialog, FileGroupSettings settings)
- : base(dialog, settings, settings.Name) {
+ : base(dialog, settings, settings.Name)
+ {
int rowIndex = 0;
- int num = 0;
- AddGroupName(ref rowIndex, ref num);
- _pathnameTextBox = FormTools.AddLabeledTextBox(this, "·ƣ", ref rowIndex, ref num);
- AddComment(ref rowIndex, ref num).Setting = base.Settings.Comment;
+ int tabIndex = 0;
+ AddGroupName(ref rowIndex, ref tabIndex);
+ _pathnameTextBox = FormTools.AddLabeledTextBox(this, "·ƣ", ref rowIndex, ref tabIndex);
+ AddComment(ref rowIndex, ref tabIndex).Setting = base.Settings.Comment;
}
- protected override void UpdateControls() {
+ protected override void UpdateControls()
+ {
base.UpdateControls();
_pathnameTextBox.Enabled = false;
_pathnameTextBox.Text = ((base.Dialog as FileGroupPropertiesDialog).AssociatedNode as FileGroup).Pathname;
diff --git a/RdcMan/FileGroupSettings.cs b/RdcMan/FileGroupSettings.cs
index 2e4a298..56c2b92 100644
--- a/RdcMan/FileGroupSettings.cs
+++ b/RdcMan/FileGroupSettings.cs
@@ -2,35 +2,43 @@
using System.Windows.Forms;
using System.Xml;
-namespace RdcMan {
- public class FileGroupSettings : GroupSettings {
+namespace RdcMan
+{
+ public class FileGroupSettings : GroupSettings
+ {
//internal new const string TabName = "File Settings";
private static Dictionary _settingProperties;
protected override Dictionary SettingProperties => _settingProperties;
- static FileGroupSettings() {
+ static FileGroupSettings()
+ {
typeof(FileGroupSettings).GetSettingProperties(out _settingProperties);
}
public FileGroupSettings()
- : base("ļ") {
+ : base("ļ")
+ {
}
protected FileGroupSettings(string name)
- : base(name) {
+ : base(name)
+ {
}
- public override TabPage CreateTabPage(TabbedSettingsDialog dialog) {
+ public override TabPage CreateTabPage(TabbedSettingsDialog dialog)
+ {
return new FileGroupPropertiesTabPage(dialog, this);
}
- protected override void WriteSettings(XmlTextWriter tw, RdcTreeNode node) {
+ protected override void WriteSettings(XmlTextWriter tw, RdcTreeNode node)
+ {
HashSet hashSet = new HashSet();
if (string.IsNullOrEmpty(base.Comment.Value))
+ {
hashSet.Add(base.Comment);
-
+ }
base.WriteSettings(tw, node, hashSet);
}
diff --git a/RdcMan/FileRequiredMenuItem.cs b/RdcMan/FileRequiredMenuItem.cs
index 986f6db..07f8f2f 100644
--- a/RdcMan/FileRequiredMenuItem.cs
+++ b/RdcMan/FileRequiredMenuItem.cs
@@ -1,25 +1,31 @@
using System;
-namespace RdcMan {
- internal class FileRequiredMenuItem : RdcMenuItem {
+namespace RdcMan
+{
+ internal class FileRequiredMenuItem : RdcMenuItem
+ {
private readonly Action _clickDelegate;
public FileRequiredMenuItem(string text, MenuNames name, Action clickDelegate)
- : base(text) {
+ : base(text)
+ {
base.Name = name.ToString();
_clickDelegate = clickDelegate;
}
public FileRequiredMenuItem(string text, MenuNames name, string shortcut, Action clickDelegate)
- : this(text, name, clickDelegate) {
+ : this(text, name, clickDelegate)
+ {
base.ShortcutKeyDisplayString = shortcut;
}
- public override void Update() {
+ public override void Update()
+ {
Enabled = ServerTree.Instance.AnyOpenedEditableFiles();
}
- protected override void OnClick() {
+ protected override void OnClick()
+ {
_clickDelegate();
}
}
diff --git a/RdcMan/FindServersDialog.cs b/RdcMan/FindServersDialog.cs
index fd674cd..98522ca 100644
--- a/RdcMan/FindServersDialog.cs
+++ b/RdcMan/FindServersDialog.cs
@@ -4,8 +4,10 @@
using System.Text.RegularExpressions;
using System.Windows.Forms;
-namespace RdcMan {
- internal class FindServersDialog : SelectServersDialogBase {
+namespace RdcMan
+{
+ internal class FindServersDialog : SelectServersDialogBase
+ {
private string _previousFilterText;
private List _servers;
@@ -13,13 +15,14 @@ internal class FindServersDialog : SelectServersDialogBase {
private TextBox _filterTextBox;
public FindServersDialog()
- : base("ҷ", "Select") {
+ : base("ҷ", "ѡ ")
+ {
int rowIndex = 0;
int num = 0;
- AddLabel("Թ˷", ref rowIndex, ref num);
+ AddLabel("Թ˷", ref rowIndex, ref num);
_filterTextBox = FormTools.NewTextBox(0, rowIndex++, num++);
_filterTextBox.Enabled = true;
- _filterTextBox.Width = 500;
+ _filterTextBox.Width = DialogWidth;
_filterTextBox.TextChanged += Filter_TextChanged;
base.Controls.Add(_filterTextBox);
AddListView(ref rowIndex, ref num);
@@ -32,92 +35,123 @@ public FindServersDialog()
PopulateList();
}
- protected override void OnClosed(EventArgs e) {
- if (base.ListView.CheckedItems.Count == 0 && base.ListView.Items.Count > 0) {
+ protected override void OnClosed(EventArgs e)
+ {
+ if (base.ListView.CheckedItems.Count == 0 && base.ListView.Items.Count > 0)
+ {
if (base.ListView.FocusedItem == null)
+ {
base.ListView.FocusedItem = base.ListView.Items[0];
-
+ }
base.ListView.FocusedItem.Checked = true;
}
}
- private void CollectServers() {
+ private void CollectServers()
+ {
_servers = new List();
- ServerTree.Instance.Nodes.VisitNodes(delegate (RdcTreeNode node) {
+ ServerTree.Instance.Nodes.VisitNodes(delegate(RdcTreeNode node)
+ {
if (node is Server item)
+ {
_servers.Add(item);
+ }
});
}
- private void PopulateList() {
- try {
+ private void PopulateList()
+ {
+ try
+ {
Regex regex = new Regex(_filterTextBox.Text, RegexOptions.IgnoreCase | RegexOptions.Compiled);
base.ListView.BeginUpdate();
SuspendItemChecked();
base.ListView.Items.Clear();
- foreach (Server server in _servers) {
- if (regex.IsMatch(server.FullPath))
+ foreach (Server server in _servers)
+ {
+ if (regex.IsMatch(server.FullPath) || regex.IsMatch(server.ServerName))
+ {
base.ListView.Items.Add(CreateListViewItem(server));
+ }
}
}
- catch (Exception) {
+ catch (Exception)
+ {
}
- finally {
+ finally
+ {
ResumeItemChecked();
base.ListView.EndUpdate();
}
}
- private void FilterList() {
- try {
+ private void FilterList()
+ {
+ try
+ {
Regex regex = new Regex(_filterTextBox.Text, RegexOptions.IgnoreCase | RegexOptions.Compiled);
int num = 0;
- while (num < base.ListView.Items.Count) {
+ while (num < base.ListView.Items.Count)
+ {
Server server = base.ListView.Items[num].Tag as Server;
- if (!regex.IsMatch(server.FullPath))
+ if (!(regex.IsMatch(server.FullPath) || regex.IsMatch(server.ServerName)))
+ {
base.ListView.Items.RemoveAt(num);
+ }
else
+ {
num++;
+ }
}
}
- catch (Exception) {
+ catch (Exception)
+ {
}
}
- private void ContextMenuPopup(object menuSender, EventArgs args) {
+ private void ContextMenuPopup(object menuSender, EventArgs args)
+ {
ContextMenuStrip contextMenuStrip = menuSender as ContextMenuStrip;
List selectedServers = base.SelectedServers.ToList();
- if (selectedServers.Count == 0) {
+ if (selectedServers.Count == 0)
+ {
if (base.ListView.FocusedItem == null)
+ {
return;
-
+ }
selectedServers.Add(base.ListView.FocusedItem.Tag as ServerBase);
}
contextMenuStrip.Items.Clear();
NodeHelper.AnyOrAllConnected(selectedServers, out var anyConnected, out var allConnected);
- ToolStripMenuItem toolStripMenuItem = new DelegateMenuItem("(&C)", MenuNames.SessionConnect, delegate {
+ ToolStripMenuItem toolStripMenuItem = new DelegateMenuItem("(&C)", MenuNames.SessionConnect, delegate
+ {
NodeHelper.ThrottledConnect(selectedServers);
OK();
});
toolStripMenuItem.Enabled = !allConnected;
contextMenuStrip.Items.Add(toolStripMenuItem);
- toolStripMenuItem = new DelegateMenuItem("(&R)", MenuNames.SessionReconnect, delegate {
- selectedServers.ForEach(delegate (ServerBase server) {
+ toolStripMenuItem = new DelegateMenuItem("(&R)", MenuNames.SessionReconnect, delegate
+ {
+ selectedServers.ForEach(delegate(ServerBase server)
+ {
server.Reconnect();
});
OK();
});
toolStripMenuItem.Enabled = anyConnected;
contextMenuStrip.Items.Add(toolStripMenuItem);
- toolStripMenuItem = new DelegateMenuItem("Ͽ(&D)", MenuNames.SessionDisconnect, delegate {
+ toolStripMenuItem = new DelegateMenuItem("Ͽ(&D)", MenuNames.SessionDisconnect, delegate
+ {
NodeHelper.ThrottledDisconnect(selectedServers);
OK();
});
toolStripMenuItem.Enabled = anyConnected;
contextMenuStrip.Items.Add(toolStripMenuItem);
contextMenuStrip.Items.Add("-");
- toolStripMenuItem = new DelegateMenuItem("ע(%L)", MenuNames.SessionLogOff, delegate {
- selectedServers.ForEach(delegate (ServerBase server) {
+ toolStripMenuItem = new DelegateMenuItem("ע(%L)", MenuNames.SessionLogOff, delegate
+ {
+ selectedServers.ForEach(delegate(ServerBase server)
+ {
server.LogOff();
});
OK();
@@ -125,9 +159,12 @@ private void ContextMenuPopup(object menuSender, EventArgs args) {
toolStripMenuItem.Enabled = !Policies.DisableLogOff && anyConnected;
contextMenuStrip.Items.Add(toolStripMenuItem);
contextMenuStrip.Items.Add("-");
- toolStripMenuItem = new DelegateMenuItem("ɾ(&V)", MenuNames.EditRemove, delegate {
- if (!anyConnected || FormTools.YesNoDialog("лԾĻỰ ȷɾ") == DialogResult.Yes) {
- selectedServers.ForEach(delegate (ServerBase server) {
+ toolStripMenuItem = new DelegateMenuItem("ɾ(&V)", MenuNames.EditRemove, delegate
+ {
+ if (!anyConnected || FormTools.YesNoDialog("лԾĻỰ ȷɾ") == DialogResult.Yes)
+ {
+ selectedServers.ForEach(delegate(ServerBase server)
+ {
ServerTree.Instance.ConfirmRemove(server, askUser: false);
});
Cancel();
@@ -135,20 +172,26 @@ private void ContextMenuPopup(object menuSender, EventArgs args) {
});
contextMenuStrip.Items.Add(toolStripMenuItem);
contextMenuStrip.Items.Add("-");
- contextMenuStrip.Items.Add(new DelegateMenuItem("ӵղؼ(&F)", MenuNames.EditAddToFavorites, delegate {
- selectedServers.ForEach(delegate (ServerBase server) {
+ contextMenuStrip.Items.Add(new DelegateMenuItem("ӵղؼ(&F)", MenuNames.EditAddToFavorites, delegate
+ {
+ selectedServers.ForEach(delegate(ServerBase server)
+ {
FavoritesGroup.Instance.AddReference(server);
});
OK();
}));
}
- private void Filter_TextChanged(object sender, EventArgs e) {
+ private void Filter_TextChanged(object sender, EventArgs e)
+ {
if (_filterTextBox.Text.StartsWith(_previousFilterText))
+ {
FilterList();
+ }
else
+ {
PopulateList();
-
+ }
_previousFilterText = _filterTextBox.Text;
}
}
diff --git a/RdcMan/FormTools.cs b/RdcMan/FormTools.cs
index 2563337..96a1cc9 100644
--- a/RdcMan/FormTools.cs
+++ b/RdcMan/FormTools.cs
@@ -3,11 +3,13 @@
using System.Drawing;
using System.Windows.Forms;
-namespace RdcMan {
- public static class FormTools {
+namespace RdcMan
+{
+ public static class FormTools
+ {
public const int TabControlWidth = 520;
- public const int TabControlHeight = 355;
+ public const int TabControlHeight = 350;
public const int ControlHeight = 20;
@@ -43,31 +45,38 @@ public static class FormTools {
public const int GroupBoxWidth = 496;
- public static int XPos(int colIndex) {
+ public static int XPos(int colIndex)
+ {
return HorizontalMargin + IndexIndent * colIndex;
}
- public static int YPos(int rowIndex) {
+ public static int YPos(int rowIndex)
+ {
return TopMargin + Indent * rowIndex;
}
- public static int YPosNoMargin(int rowIndex) {
+ public static int YPosNoMargin(int rowIndex)
+ {
return Indent * rowIndex;
}
- public static Point TopLeftLocation() {
+ public static Point TopLeftLocation()
+ {
return new Point(VerticalSpace, HorizontalSpace);
}
- public static Point NewLocation(int colIndex, int rowIndex) {
+ public static Point NewLocation(int colIndex, int rowIndex)
+ {
return new Point(XPos(colIndex), YPos(rowIndex));
}
- public static Point NewUngroupedLocation(int colIndex, int rowIndex) {
+ public static Point NewUngroupedLocation(int colIndex, int rowIndex)
+ {
return new Point(TopMargin + LabelWidth * colIndex, YPos(rowIndex));
}
- public static Label NewLabel(string text, int colIndex, int rowIndex) {
+ public static Label NewLabel(string text, int colIndex, int rowIndex)
+ {
Label label = new Label {
Location = NewLocation(colIndex, rowIndex),
Text = text,
@@ -77,7 +86,8 @@ public static Label NewLabel(string text, int colIndex, int rowIndex) {
return label;
}
- public static RdcTextBox NewTextBox(int colIndex, int rowIndex, int tabIndex) {
+ public static RdcTextBox NewTextBox(int colIndex, int rowIndex, int tabIndex)
+ {
RdcTextBox rdcTextBox = new RdcTextBox {
Enabled = false,
Location = NewLocation(colIndex, rowIndex),
@@ -87,7 +97,8 @@ public static RdcTextBox NewTextBox(int colIndex, int rowIndex, int tabIndex) {
return rdcTextBox;
}
- public static RdcTextBox NewTextBox(int colIndex, int rowIndex, int tabIndex, int height) {
+ public static RdcTextBox NewTextBox(int colIndex, int rowIndex, int tabIndex, int height)
+ {
RdcTextBox rdcTextBox = new RdcTextBox {
Location = NewLocation(colIndex, rowIndex),
Size = new Size(TextBoxWidth, ControlHeight * height),
@@ -99,7 +110,8 @@ public static RdcTextBox NewTextBox(int colIndex, int rowIndex, int tabIndex, in
return rdcTextBox;
}
- public static RdcTextBox AddLabeledTextBox(Control parent, string text, ref int rowIndex, ref int tabIndex) {
+ public static RdcTextBox AddLabeledTextBox(Control parent, string text, ref int rowIndex, ref int tabIndex)
+ {
Label value = NewLabel(text, 0, rowIndex);
RdcTextBox rdcTextBox = NewTextBox(1, rowIndex++, tabIndex++);
parent.Controls.Add(value);
@@ -107,17 +119,20 @@ public static RdcTextBox AddLabeledTextBox(Control parent, string text, ref int
return rdcTextBox;
}
- public static RdcTextBox AddLabeledTextBox(Control parent, string text, StringSetting setting, ref int rowIndex, ref int tabIndex) {
+ public static RdcTextBox AddLabeledTextBox(Control parent, string text, StringSetting setting, ref int rowIndex, ref int tabIndex)
+ {
RdcTextBox rdcTextBox = AddLabeledTextBox(parent, text, ref rowIndex, ref tabIndex);
rdcTextBox.Setting = setting;
return rdcTextBox;
}
- public static RdcCheckBox NewCheckBox(string text, int colIndex, int rowIndex, int tabIndex) {
+ public static RdcCheckBox NewCheckBox(string text, int colIndex, int rowIndex, int tabIndex)
+ {
return NewCheckBox(text, colIndex, rowIndex, tabIndex, TextBoxWidth);
}
- public static RdcCheckBox NewCheckBox(string text, int colIndex, int rowIndex, int tabIndex, int width) {
+ public static RdcCheckBox NewCheckBox(string text, int colIndex, int rowIndex, int tabIndex, int width)
+ {
RdcCheckBox rdcCheckBox = new() {
Location = NewLocation(colIndex, rowIndex),
Size = new Size(width, ControlHeight),
@@ -127,8 +142,10 @@ public static RdcCheckBox NewCheckBox(string text, int colIndex, int rowIndex, i
return rdcCheckBox;
}
- public static RdcCheckBox AddCheckBox(Control parent, string text, BoolSetting setting, int colIndex, ref int rowIndex, ref int tabIndex) {
- RdcCheckBox rdcCheckBox = new RdcCheckBox {
+ public static RdcCheckBox AddCheckBox(Control parent, string text, BoolSetting setting, int colIndex, ref int rowIndex, ref int tabIndex)
+ {
+ RdcCheckBox rdcCheckBox = new RdcCheckBox
+ {
Setting = setting,
Location = NewLocation(colIndex, rowIndex++),
Size = new Size(TextBoxWidth, ControlHeight),
@@ -139,11 +156,13 @@ public static RdcCheckBox AddCheckBox(Control parent, string text, BoolSetting s
return rdcCheckBox;
}
- public static ValueComboBox AddLabeledEnumDropDown(Control parent, string text, ref int rowIndex, ref int tabIndex, Func toString) where TEnum : struct {
+ public static ValueComboBox AddLabeledEnumDropDown(Control parent, string text, ref int rowIndex, ref int tabIndex, Func toString) where TEnum : struct
+ {
return AddLabeledValueDropDown(parent, text, ref rowIndex, ref tabIndex, toString, Helpers.EnumValues());
}
- public static ValueComboBox AddLabeledValueDropDown(Control parent, string text, ref int rowIndex, ref int tabIndex, Func toString, IEnumerable values) {
+ public static ValueComboBox AddLabeledValueDropDown(Control parent, string text, ref int rowIndex, ref int tabIndex, Func toString, IEnumerable values)
+ {
Label value = NewLabel(text, 0, rowIndex);
ValueComboBox valueComboBox = new ValueComboBox(values, toString);
SetDropDownProperties(valueComboBox, 1, rowIndex++, tabIndex++);
@@ -152,7 +171,8 @@ public static ValueComboBox AddLabeledValueDropDown(Control pare
return valueComboBox;
}
- public static ValueComboBox AddLabeledValueDropDown(Control parent, string text, Setting setting, ref int rowIndex, ref int tabIndex, Func toString, IEnumerable values) {
+ public static ValueComboBox AddLabeledValueDropDown(Control parent, string text, Setting setting, ref int rowIndex, ref int tabIndex, Func toString, IEnumerable values)
+ {
Label value = NewLabel(text, 0, rowIndex);
ValueComboBox valueComboBox = new ValueComboBox(setting, values, toString);
SetDropDownProperties(valueComboBox, 1, rowIndex++, tabIndex++);
@@ -161,7 +181,8 @@ public static ValueComboBox AddLabeledValueDropDown(Control pare
return valueComboBox;
}
- public static ValueComboBox AddLabeledEnumDropDown(Control parent, string text, EnumSetting setting, ref int rowIndex, ref int tabIndex, Func toString) where TEnum : struct {
+ public static ValueComboBox AddLabeledEnumDropDown(Control parent, string text, EnumSetting setting, ref int rowIndex, ref int tabIndex, Func toString) where TEnum : struct
+ {
Label value = NewLabel(text, 0, rowIndex);
ValueComboBox valueComboBox = new ValueComboBox(setting, Helpers.EnumValues(), toString);
SetDropDownProperties(valueComboBox, 1, rowIndex++, tabIndex++);
@@ -170,29 +191,36 @@ public static ValueComboBox AddLabeledEnumDropDown(Control parent,
return valueComboBox;
}
- private static void SetDropDownProperties(ComboBox comboBox, int colIndex, int rowIndex, int tabIndex) {
+ private static void SetDropDownProperties(ComboBox comboBox, int colIndex, int rowIndex, int tabIndex)
+ {
comboBox.Location = NewLocation(colIndex, rowIndex);
comboBox.Size = new Size(DropDownWidth, ControlHeight);
comboBox.TabIndex = tabIndex;
}
- public static void LayoutGroupBox(GroupBox groupBox, int numCols, Control previousGroupBox) {
+ public static void LayoutGroupBox(GroupBox groupBox, int numCols, Control previousGroupBox)
+ {
LayoutGroupBox(groupBox, numCols, previousGroupBox, 0, 0);
}
- public static void LayoutGroupBox(GroupBox groupBox, int numCols, Control previousControl, int rowIndex, int tabIndex) {
+ public static void LayoutGroupBox(GroupBox groupBox, int numCols, Control previousControl, int rowIndex, int tabIndex)
+ {
int num = 0;
- foreach (Control control in groupBox.Controls) {
+ foreach (Control control in groupBox.Controls)
+ {
if (num == 1 && control.Width == TextBoxWidth)
+ {
control.Width -= HorizontalMargin;
-
+ }
control.Location = NewLocation(num++, rowIndex);
control.TabIndex = tabIndex;
tabIndex += 2;
if (!(control is Label))
+ {
control.TabStop = true;
-
- if (num == numCols) {
+ }
+ if (num == numCols)
+ {
num = 0;
rowIndex++;
}
@@ -200,34 +228,44 @@ public static void LayoutGroupBox(GroupBox groupBox, int numCols, Control previo
groupBox.SizeAndLocate(previousControl);
}
- public static void AddControlsAndSizeGroup(this GroupBox groupBox, params Control[] controls) {
+ public static void AddControlsAndSizeGroup(this GroupBox groupBox, params Control[] controls)
+ {
groupBox.Controls.AddRange(controls);
- foreach (Control control in groupBox.Controls) {
+ foreach (Control control in groupBox.Controls)
+ {
if (control.Width == TextBoxWidth)
+ {
control.Width -= HorizontalMargin;
+ }
}
}
- public static void SizeAndLocate(this GroupBox groupBox, Control previousControl) {
- int num = HorizontalMargin;
- if (previousControl != null) {
+ public static void SizeAndLocate(this GroupBox groupBox, Control previousControl)
+ {
+ int num = 8;
+ if (previousControl != null)
+ {
groupBox.TabIndex = previousControl.TabIndex + 1;
num += previousControl.Bottom;
}
else
+ {
groupBox.TabIndex = 1;
-
+ }
groupBox.Location = new Point(HorizontalMargin, num);
ResizeGroupBox(groupBox);
}
- public static void ResizeGroupBox(GroupBox groupBox) {
+ public static void ResizeGroupBox(GroupBox groupBox)
+ {
int num = ComputeControlHeightFromChildren(groupBox);
groupBox.Size = new Size(GroupBoxWidth, num + HorizontalMargin);
}
- public static TabPage NewTabPage(string name) {
- TabPage tabPage = new TabPage {
+ public static TabPage NewTabPage(string name)
+ {
+ TabPage tabPage = new TabPage
+ {
Location = TopLeftLocation(),
Size = new Size(TabPageWidth, TabPageHeight),
Text = name
@@ -236,18 +274,22 @@ public static TabPage NewTabPage(string name) {
return tabPage;
}
- public static TabPage NewTabPage(this TabControl parent, string name) {
+ public static TabPage NewTabPage(this TabControl parent, string name)
+ {
TabPage tabPage = NewTabPage(name);
parent.Controls.Add(tabPage);
return tabPage;
}
- public static Control[] NewSizeRadios() {
+ public static Control[] NewSizeRadios()
+ {
Control[] array = new Control[SizeHelper.StockSizes.Length];
int num = 0;
Size[] stockSizes = SizeHelper.StockSizes;
- foreach (Size size in stockSizes) {
- array[num++] = new RadioButton {
+ foreach (Size size in stockSizes)
+ {
+ array[num++] = new RadioButton
+ {
Tag = size,
Text = size.ToFormattedString()
};
@@ -255,10 +297,12 @@ public static Control[] NewSizeRadios() {
return array;
}
- public static void AddButtonsAndSizeForm(Form form, Button okButton, Button cancelButton) {
+ public static void AddButtonsAndSizeForm(Form form, Button okButton, Button cancelButton)
+ {
int num = 0;
int num2 = 0;
- foreach (Control control in form.Controls) {
+ foreach (Control control in form.Controls)
+ {
num = Math.Max(num, control.Right);
num2 = Math.Max(num2, control.Bottom);
}
@@ -272,51 +316,63 @@ public static void AddButtonsAndSizeForm(Form form, Button okButton, Button canc
form.ClientSize = new Size(num, okButton.Location.Y + okButton.Height + TopMargin);
}
- public static int ComputeControlHeightFromChildren(Control control) {
+ public static int ComputeControlHeightFromChildren(Control control)
+ {
int num = 0;
- foreach (Control control2 in control.Controls) {
+ foreach (Control control2 in control.Controls)
+ {
num = Math.Max(num, control2.Bottom);
}
return num;
}
- public static void ErrorDialog(string text) {
+ public static void ErrorDialog(string text)
+ {
MessageBox.Show(Program.TheForm, text, "RDCMan Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
- public static void InformationDialog(string text) {
+ public static void InformationDialog(string text)
+ {
MessageBox.Show(Program.TheForm, text, "RDCMan", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
- public static DialogResult ExclamationDialog(string text, MessageBoxButtons buttons) {
+ public static DialogResult ExclamationDialog(string text, MessageBoxButtons buttons)
+ {
return MessageBox.Show(Program.TheForm, text, "RDCMan", buttons, MessageBoxIcon.Exclamation);
}
- public static DialogResult YesNoDialog(string text) {
+ public static DialogResult YesNoDialog(string text)
+ {
return YesNoDialog(Program.TheForm, text, MessageBoxDefaultButton.Button2);
}
- public static DialogResult YesNoDialog(string text, MessageBoxDefaultButton defaultButton) {
+ public static DialogResult YesNoDialog(string text, MessageBoxDefaultButton defaultButton)
+ {
return YesNoDialog(Program.TheForm, text, defaultButton);
}
- public static DialogResult YesNoDialog(Form owner, string text) {
+ public static DialogResult YesNoDialog(Form owner, string text)
+ {
return YesNoDialog(owner, text, MessageBoxDefaultButton.Button2);
}
- public static DialogResult YesNoDialog(Form owner, string text, MessageBoxDefaultButton defaultButton) {
+ public static DialogResult YesNoDialog(Form owner, string text, MessageBoxDefaultButton defaultButton)
+ {
return MessageBox.Show(owner, text, "RDCMan", MessageBoxButtons.YesNo, MessageBoxIcon.Question, defaultButton);
}
- public static DialogResult YesNoCancelDialog(string text) {
+ public static DialogResult YesNoCancelDialog(string text)
+ {
return YesNoCancelDialog(text, MessageBoxDefaultButton.Button2);
}
- public static DialogResult YesNoCancelDialog(string text, MessageBoxDefaultButton defaultButton) {
+ public static DialogResult YesNoCancelDialog(string text, MessageBoxDefaultButton defaultButton)
+ {
return MessageBox.Show(Program.TheForm, text, "RDCMan", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, defaultButton);
}
- public static void ScaleAndLayout(this Form form) {
+ public static void ScaleAndLayout(this Form form)
+ {
form.PerformAutoScale();
form.ResumeLayout(performLayout: false);
form.PerformLayout();
diff --git a/RdcMan/GatewaySettings.cs b/RdcMan/GatewaySettings.cs
index 49071a7..fbd9f61 100644
--- a/RdcMan/GatewaySettings.cs
+++ b/RdcMan/GatewaySettings.cs
@@ -1,11 +1,13 @@
using System.Collections.Generic;
using System.Windows.Forms;
-namespace RdcMan {
- public class GatewaySettings : LogonCredentials {
- //public new const string TabName = "";
+namespace RdcMan
+{
+ public class GatewaySettings : LogonCredentials
+ {
+ //public new const string TabName = "Gateway Settings";
- private static readonly Dictionary _settingProperties;
+ private static Dictionary _settingProperties;
protected override Dictionary SettingProperties => _settingProperties;
@@ -27,19 +29,23 @@ public class GatewaySettings : LogonCredentials {
[Setting("enableCredSspSupport", DefaultValue = true, IsObsolete = true)]
public BoolSetting EnableCredentialSspSupport { get; private set; }
- static GatewaySettings() {
+ static GatewaySettings()
+ {
typeof(GatewaySettings).GetSettingProperties(out _settingProperties);
}
public GatewaySettings()
- : base("", "gatewaySettings") {
+ : base("", "gatewaySettings")
+ {
}
- public override TabPage CreateTabPage(TabbedSettingsDialog dialog) {
+ public override TabPage CreateTabPage(TabbedSettingsDialog dialog)
+ {
return new GatewaySettingsTabPage(dialog, this);
}
- protected override void Copy(RdcTreeNode node) {
+ protected override void Copy(RdcTreeNode node)
+ {
Copy(node.GatewaySettings);
}
}
diff --git a/RdcMan/GatewaySettingsTabPage.cs b/RdcMan/GatewaySettingsTabPage.cs
index 11d5208..8ed7790 100644
--- a/RdcMan/GatewaySettingsTabPage.cs
+++ b/RdcMan/GatewaySettingsTabPage.cs
@@ -1,8 +1,10 @@
using System;
using System.Windows.Forms;
-namespace RdcMan {
- public class GatewaySettingsTabPage : CredentialsTabPage {
+namespace RdcMan
+{
+ public class GatewaySettingsTabPage : CredentialsTabPage
+ {
private CheckBox _useGatewayServerCheckBox;
private ValueComboBox _gatewayLogonMethodCombo;
@@ -14,22 +16,24 @@ public class GatewaySettingsTabPage : CredentialsTabPage {
private CheckBox _gatewayCredSharingCheckBox;
public GatewaySettingsTabPage(TabbedSettingsDialog dialog, GatewaySettings settings)
- : base(dialog, settings) {
+ : base(dialog, settings)
+ {
}
- public void CreateControls(LogonCredentialsDialogOptions options) {
- int num = 0;
+ public void CreateControls(LogonCredentialsDialogOptions options)
+ {
+ int tabIndex = 0;
int rowIndex = 0;
- CreateInheritanceControl(ref rowIndex, ref num);
+ CreateInheritanceControl(ref rowIndex, ref tabIndex);
if (base.InheritanceControl != null) {
base.InheritanceControl.EnabledChanged += delegate (bool enabled) {
_useGatewayServerCheckBox.Enabled = enabled;
UseGatewayServerCheckBox_CheckedChanged(null, null);
};
}
- _useGatewayServerCheckBox = FormTools.AddCheckBox(this, "ʹ TS ط(&U)", base.Settings.UseGatewayServer, 1, ref rowIndex, ref num);
+ _useGatewayServerCheckBox = FormTools.AddCheckBox(this, "ʹ TS ط(&U)", base.Settings.UseGatewayServer, 1, ref rowIndex, ref tabIndex);
_useGatewayServerCheckBox.CheckedChanged += UseGatewayServerCheckBox_CheckedChanged;
- _gatewayHostNameTextBox = FormTools.AddLabeledTextBox(this, "(&S)", base.Settings.HostName, ref rowIndex, ref num);
+ _gatewayHostNameTextBox = FormTools.AddLabeledTextBox(this, "(&S)", base.Settings.HostName, ref rowIndex, ref tabIndex);
_gatewayHostNameTextBox.Validate = delegate {
if (_gatewayHostNameTextBox.Enabled) {
_gatewayHostNameTextBox.Text = _gatewayHostNameTextBox.Text.Trim();
@@ -39,42 +43,51 @@ public void CreateControls(LogonCredentialsDialogOptions options) {
}
return null;
};
- _gatewayLocalBypassCheckBox = FormTools.AddCheckBox(this, "ƹصַ(&B)", base.Settings.BypassGatewayForLocalAddresses, 1, ref rowIndex, ref num);
- _gatewayLogonMethodCombo = FormTools.AddLabeledEnumDropDown(this, "¼ʽ(&L)", base.Settings.LogonMethod, ref rowIndex, ref num, RdpClient.GatewayLogonMethodToString);
+ _gatewayLocalBypassCheckBox = FormTools.AddCheckBox(this, "ƹصַ(&B)", base.Settings.BypassGatewayForLocalAddresses, 1, ref rowIndex, ref tabIndex);
+ _gatewayLogonMethodCombo = FormTools.AddLabeledEnumDropDown(this, "¼ʽ(&L)", base.Settings.LogonMethod, ref rowIndex, ref tabIndex, RdpClient.GatewayLogonMethodToString);
_gatewayLogonMethodCombo.SelectedValueChanged += GatewayLogonMethodComboBox_SelectedValueChanged;
if (RdpClient.SupportsGatewayCredentials) {
- _gatewayCredSharingCheckBox = FormTools.AddCheckBox(this, "Զ̼ƾ֤(&C)", base.Settings.CredentialSharing, 1, ref rowIndex, ref num);
+ _gatewayCredSharingCheckBox = FormTools.AddCheckBox(this, "Զ̼ƾ֤(&C)", base.Settings.CredentialSharing, 1, ref rowIndex, ref tabIndex);
_gatewayCredSharingCheckBox.CheckedChanged += GatewayCredSharingCheckBox_CheckedChanged;
_credentialsUI = new CredentialsUI(base.InheritanceControl);
- _credentialsUI.AddControlsToParent(this, options, ref rowIndex, ref num);
+ _credentialsUI.AddControlsToParent(this, options, ref rowIndex, ref tabIndex);
}
}
- protected override void UpdateControls() {
+ protected override void UpdateControls()
+ {
base.UpdateControls();
if (base.InheritanceControl == null)
+ {
UseGatewayServerCheckBox_CheckedChanged(null, null);
+ }
}
- private void GatewayCredSharingCheckBox_CheckedChanged(object sender, EventArgs e) {
+ private void GatewayCredSharingCheckBox_CheckedChanged(object sender, EventArgs e)
+ {
GatewayLogonMethodComboBox_SelectedValueChanged(null, null);
}
- private void UseGatewayServerCheckBox_CheckedChanged(object sender, EventArgs e) {
+ private void UseGatewayServerCheckBox_CheckedChanged(object sender, EventArgs e)
+ {
bool enabled = _useGatewayServerCheckBox.Enabled && _useGatewayServerCheckBox.Checked;
_gatewayHostNameTextBox.Enabled = enabled;
_gatewayLogonMethodCombo.Enabled = enabled;
_gatewayLocalBypassCheckBox.Enabled = enabled;
if (RdpClient.SupportsGatewayCredentials)
+ {
_gatewayCredSharingCheckBox.Enabled = enabled;
-
+ }
GatewayLogonMethodComboBox_SelectedValueChanged(null, null);
}
- private void GatewayLogonMethodComboBox_SelectedValueChanged(object sender, EventArgs e) {
+ private void GatewayLogonMethodComboBox_SelectedValueChanged(object sender, EventArgs e)
+ {
bool enable = _gatewayLogonMethodCombo.Enabled && _gatewayLogonMethodCombo.SelectedValue == RdpClient.GatewayLogonMethod.NTLM;
if (RdpClient.SupportsGatewayCredentials)
+ {
_credentialsUI.EnableDisableControls(enable);
+ }
}
}
}
diff --git a/RdcMan/GlobalOptionsDialog.cs b/RdcMan/GlobalOptionsDialog.cs
index 50e506a..f3f43ce 100644
--- a/RdcMan/GlobalOptionsDialog.cs
+++ b/RdcMan/GlobalOptionsDialog.cs
@@ -3,14 +3,18 @@
using System.Linq;
using System.Windows.Forms;
-namespace RdcMan {
- public class GlobalOptionsDialog : TabbedSettingsDialog {
- private class BandwidthItem {
+namespace RdcMan
+{
+ public class GlobalOptionsDialog : TabbedSettingsDialog
+ {
+ private class BandwidthItem
+ {
public string Text;
public int Flags;
- public BandwidthItem(string text, int flags) {
+ public BandwidthItem(string text, int flags)
+ {
Text = text;
Flags = flags;
}
@@ -64,7 +68,9 @@ public BandwidthItem(string text, int flags) {
private readonly BandwidthItem[] _bandwidthItems;
- protected GlobalOptionsDialog(Form parentForm) : base("ѡ", "ȷ", parentForm) {
+ protected GlobalOptionsDialog(Form parentForm)
+ : base("ѡ", "ȷ", parentForm)
+ {
_bandwidthItems = new BandwidthItem[5]
{
new BandwidthItem("Modem (28.8 Kbps)", 15),
@@ -76,15 +82,18 @@ public BandwidthItem(string text, int flags) {
InitializeComponent();
}
- public static GlobalOptionsDialog New() {
+ public static GlobalOptionsDialog New()
+ {
GlobalOptionsDialog globalOptionsDialog = new GlobalOptionsDialog(Program.TheForm);
globalOptionsDialog.InitializeControlsFromPreferences();
return globalOptionsDialog;
}
- private void InitializeControlsFromPreferences() {
+ private void InitializeControlsFromPreferences()
+ {
MainForm theForm = Program.TheForm;
- foreach (CheckBox control in _virtualGroupsGroup.Controls) {
+ foreach (CheckBox control in _virtualGroupsGroup.Controls)
+ {
control.Checked = (control.Tag as IBuiltInVirtualGroup).IsInTree;
}
_treeLocationCombo.SelectedValue = Program.TheForm.ServerTreeLocation;
@@ -93,32 +102,41 @@ private void InitializeControlsFromPreferences() {
_connectionBarAutoHiddenCheckBox.Checked = Program.Preferences.ConnectionBarState == RdpClient.ConnectionBarState.AutoHide;
_connectionBarAutoHiddenCheckBox.Enabled = _connectionBarEnabledCheckBox.Enabled;
if (RdpClient.SupportsPanning)
+ {
_panningAccelerationUpDown.Enabled = Program.Preferences.EnablePanning;
-
+ }
Size clientSize = theForm.GetClientSize();
- RadioButton radioButton = _casSizeGroup.Controls.OfType().Where(delegate (RadioButton r) {
+ RadioButton radioButton = _casSizeGroup.Controls.OfType().Where(delegate(RadioButton r)
+ {
Size? size = (Size?)r.Tag;
Size size2 = clientSize;
return !size.HasValue ? false : !size.HasValue || size.GetValueOrDefault() == size2;
}).FirstOrDefault();
if (radioButton != null)
+ {
radioButton.Checked = true;
+ }
else
+ {
_casCustomRadio.Checked = true;
-
+ }
_casCustomButton.Text = clientSize.ToFormattedString();
_thumbnailPixelsButton.Text = Program.Preferences.ThumbnailSize.ToFormattedString();
_thumbnailPercentageTextBox.Text = Program.Preferences.ThumbnailPercentage.ToString();
if (Program.Preferences.ThumbnailSizeIsInPixels)
+ {
_thumbnailPixelsRadio.Checked = true;
+ }
else
+ {
_thumbnailPercentageRadio.Checked = true;
-
+ }
SetBandwidthCheckBoxes(Program.Preferences.PerformanceFlags);
_persistentBitmapCachingCheckBox.Checked = Program.Preferences.PersistentBitmapCaching;
}
- public void UpdatePreferences() {
+ public void UpdatePreferences()
+ {
UpdateSettings();
MainForm theForm = Program.TheForm;
foreach (CheckBox control in _virtualGroupsGroup.Controls) {
@@ -147,7 +165,8 @@ where r.Checked
Program.Preferences.ThumbnailPercentage = thumbnailPercentage;
}
- private void InitializeComponent() {
+ private void InitializeComponent()
+ {
this.CreateGeneralPage();
this.CreateServerTreePage();
this.CreateClientAreaPage();
@@ -158,7 +177,8 @@ private void InitializeComponent() {
this.ScaleAndLayout();
}
- private TabPage NewTabPage(string name) {
+ private TabPage NewTabPage(string name)
+ {
TabPage tabPage = new SettingsTabPage {
Location = FormTools.TopLeftLocation(),
Size = new Size(FormTools.TabControlWidth-8, FormTools.TabControlHeight-14),
@@ -169,20 +189,21 @@ private TabPage NewTabPage(string name) {
return tabPage;
}
- private TabPage CreateFullScreenPage() {
+ private TabPage CreateFullScreenPage()
+ {
int rowIndex = 0;
- int num = 0;
+ int tabIndex = 0;
TabPage tabPage = NewTabPage("ȫ");
- _connectionBarEnabledCheckBox = FormTools.NewCheckBox("ʾȫ", 0, rowIndex++, num++);
+ _connectionBarEnabledCheckBox = FormTools.NewCheckBox("ʾȫ", 0, rowIndex++, tabIndex++);
_connectionBarEnabledCheckBox.CheckedChanged += ConnectionBarEnabledCheckedChanged;
- _connectionBarAutoHiddenCheckBox = FormTools.NewCheckBox("Զ", 0, rowIndex++, num++);
+ _connectionBarAutoHiddenCheckBox = FormTools.NewCheckBox("Զ", 0, rowIndex++, tabIndex++);
_connectionBarAutoHiddenCheckBox.Location = new Point(_connectionBarEnabledCheckBox.Left + 24, _connectionBarAutoHiddenCheckBox.Top);
- FormTools.AddCheckBox(tabPage, "ȫʼλ", Program.Preferences.Settings.FullScreenWindowIsTopMost, 0, ref rowIndex, ref num);
+ FormTools.AddCheckBox(tabPage, "ȫʼλ", Program.Preferences.Settings.FullScreenWindowIsTopMost, 0, ref rowIndex, ref tabIndex);
if (RdpClient.SupportsMonitorSpanning) {
- FormTools.AddCheckBox(tabPage, "Ҫʱʹǫ̈ʾ", Program.Preferences.Settings.UseMultipleMonitors, 0, ref rowIndex, ref num);
+ FormTools.AddCheckBox(tabPage, "Ҫʱʹǫ̈ʾ", Program.Preferences.Settings.UseMultipleMonitors, 0, ref rowIndex, ref tabIndex);
}
if (RdpClient.SupportsPanning) {
- _enablePanningCheckBox = FormTools.NewCheckBox("ʹûǹ", 0, rowIndex++, num++);
+ _enablePanningCheckBox = FormTools.NewCheckBox("ʹûǹ", 0, rowIndex++, tabIndex++);
_enablePanningCheckBox.Setting = Program.Preferences.Settings.EnablePanning;
_enablePanningCheckBox.CheckedChanged += EnablePanningCheckedChanged;
Label label = FormTools.NewLabel("ٶ", 0, rowIndex);
@@ -193,7 +214,7 @@ private TabPage CreateFullScreenPage() {
Minimum = 1m,
Maximum = 9m,
Size = new Size(40, FormTools.ControlHeight),
- TabIndex = num++,
+ TabIndex = tabIndex++,
Setting = Program.Preferences.Settings.PanningAcceleration
};
tabPage.Controls.Add(_enablePanningCheckBox, label, _panningAccelerationUpDown);
@@ -202,60 +223,63 @@ private TabPage CreateFullScreenPage() {
return tabPage;
}
- private TabPage CreateExperiencePage() {
+ private TabPage CreateExperiencePage()
+ {
TabPage tabPage = NewTabPage("");
int rowIndex = 0;
- int num = 0;
- _bandwidthComboBox = FormTools.AddLabeledValueDropDown(tabPage, "ٶ(&S)", ref rowIndex, ref num, (BandwidthItem v) => v.Text, _bandwidthItems);
+ int tabIndex = 0;
+ _bandwidthComboBox = FormTools.AddLabeledValueDropDown(tabPage, "ٶ(&S)", ref rowIndex, ref tabIndex, (BandwidthItem v) => v.Text, _bandwidthItems);
_bandwidthComboBox.SelectedIndexChanged += BandwidthCombo_ControlChanged;
Label label = FormTools.NewLabel("£", 0, rowIndex);
- _desktopBackgroundCheckBox = FormTools.NewCheckBox("汳", 1, rowIndex++, num++);
+ _desktopBackgroundCheckBox = FormTools.NewCheckBox("汳", 1, rowIndex++, tabIndex++);
_desktopBackgroundCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
- _fontSmoothingCheckBox = FormTools.NewCheckBox("ƽ", 1, rowIndex++, num++);
+ _fontSmoothingCheckBox = FormTools.NewCheckBox("ƽ", 1, rowIndex++, tabIndex++);
_fontSmoothingCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
- _desktopCompositionCheckBox = FormTools.NewCheckBox("ƴ", 1, rowIndex++, num++);
+ _desktopCompositionCheckBox = FormTools.NewCheckBox("ƴ", 1, rowIndex++, tabIndex++);
_desktopCompositionCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
- _windowDragCheckBox = FormTools.NewCheckBox("϶ʱʾ", 1, rowIndex++, num++);
+ _windowDragCheckBox = FormTools.NewCheckBox("϶ʱʾ", 1, rowIndex++, tabIndex++);
_windowDragCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
- _menuAnimationCheckBox = FormTools.NewCheckBox("˵ʹڶ", 1, rowIndex++, num++);
+ _menuAnimationCheckBox = FormTools.NewCheckBox("˵ʹڶ", 1, rowIndex++, tabIndex++);
_menuAnimationCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
- _themesCheckBox = FormTools.NewCheckBox("", 1, rowIndex++, num++);
+ _themesCheckBox = FormTools.NewCheckBox("", 1, rowIndex++, tabIndex++);
_themesCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
rowIndex++;
- _persistentBitmapCachingCheckBox = FormTools.NewCheckBox("־λͼ", 1, rowIndex++, num++);
+ _persistentBitmapCachingCheckBox = FormTools.NewCheckBox("־λͼ", 1, rowIndex++, tabIndex++);
tabPage.Controls.Add(label, _desktopBackgroundCheckBox, _fontSmoothingCheckBox, _desktopCompositionCheckBox, _windowDragCheckBox, _menuAnimationCheckBox, _themesCheckBox, _persistentBitmapCachingCheckBox);
return tabPage;
}
- private TabPage CreateHotKeysPage() {
+ private TabPage CreateHotKeysPage()
+ {
GlobalSettings settings = Program.Preferences.Settings;
TabPage tabPage = NewTabPage("ȼ");
GroupBox groupBox = new GroupBox {
Text = "ALT ȼ Windows ϼδضʱЧ"
};
int rowIndex = 0;
- int num = 0;
- AddHotKeyBox(groupBox, "ALT+TAB", "ALT+", settings.HotKeyAltTab, ref rowIndex, ref num);
- AddHotKeyBox(groupBox, "ALT+SHIFT+TAB", "ALT+", settings.HotKeyAltShiftTab, ref rowIndex, ref num);
- AddHotKeyBox(groupBox, "ALT+ESC", "ALT+", settings.HotKeyAltEsc, ref rowIndex, ref num);
- AddHotKeyBox(groupBox, "ALT+SPACE", "ALT+", settings.HotKeyAltSpace, ref rowIndex, ref num);
- AddHotKeyBox(groupBox, "CTRL+ESC", "ALT+", settings.HotKeyCtrlEsc, ref rowIndex, ref num);
+ int tabIndex = 0;
+ AddHotKeyBox(groupBox, "ALT+TAB", "ALT+", settings.HotKeyAltTab, ref rowIndex, ref tabIndex);
+ AddHotKeyBox(groupBox, "ALT+SHIFT+TAB", "ALT+", settings.HotKeyAltShiftTab, ref rowIndex, ref tabIndex);
+ AddHotKeyBox(groupBox, "ALT+ESC", "ALT+", settings.HotKeyAltEsc, ref rowIndex, ref tabIndex);
+ AddHotKeyBox(groupBox, "ALT+SPACE", "ALT+", settings.HotKeyAltSpace, ref rowIndex, ref tabIndex);
+ AddHotKeyBox(groupBox, "CTRL+ESC", "ALT+", settings.HotKeyCtrlEsc, ref rowIndex, ref tabIndex);
groupBox.SizeAndLocate(null);
GroupBox groupBox2 = new GroupBox {
Text = "CTRL+ALT ȼʼЧ"
};
rowIndex = 0;
- num = 0;
- AddHotKeyBox(groupBox2, "CTRL+ALT+DEL", "CTRL+ALT+", settings.HotKeyCtrlAltDel, ref rowIndex, ref num);
- AddHotKeyBox(groupBox2, "ȫ", "CTRL+ALT+", settings.HotKeyFullScreen, ref rowIndex, ref num);
- AddHotKeyBox(groupBox2, "һỰ", "CTRL+ALT+", settings.HotKeyFocusReleaseLeft, ref rowIndex, ref num);
- AddHotKeyBox(groupBox2, "ѡỰ", "CTRL+ALT+", settings.HotKeyFocusReleaseRight, ref rowIndex, ref num);
+ tabIndex = 0;
+ AddHotKeyBox(groupBox2, "CTRL+ALT+DEL", "CTRL+ALT+", settings.HotKeyCtrlAltDel, ref rowIndex, ref tabIndex);
+ AddHotKeyBox(groupBox2, "ȫ", "CTRL+ALT+", settings.HotKeyFullScreen, ref rowIndex, ref tabIndex);
+ AddHotKeyBox(groupBox2, "һỰ", "CTRL+ALT+", settings.HotKeyFocusReleaseLeft, ref rowIndex, ref tabIndex);
+ AddHotKeyBox(groupBox2, "ѡỰ", "CTRL+ALT+", settings.HotKeyFocusReleaseRight, ref rowIndex, ref tabIndex);
groupBox2.SizeAndLocate(groupBox);
tabPage.Controls.Add(groupBox, groupBox2);
return tabPage;
}
- private void AddHotKeyBox(Control parent, string label, string prefix, EnumSetting setting, ref int rowIndex, ref int tabIndex) {
+ private void AddHotKeyBox(Control parent, string label, string prefix, EnumSetting setting, ref int rowIndex, ref int tabIndex)
+ {
parent.Controls.Add(FormTools.NewLabel(label, 0, rowIndex));
HotKeyBox value = new HotKeyBox {
Prefix = prefix,
@@ -328,21 +352,22 @@ private TabPage CreateClientAreaPage() {
return tabPage;
}
- private TabPage CreateServerTreePage() {
+ private TabPage CreateServerTreePage()
+ {
int rowIndex = 0;
- int num = 0;
+ int tabIndex = 0;
TabPage tabPage = NewTabPage("");
GroupBox groupBox = new GroupBox {
Text = ""
};
- FormTools.AddCheckBox(groupBox, "ѡתƵԶ̿ͻ", Program.Preferences.Settings.FocusOnClick, 0, ref rowIndex, ref num);
- FormTools.AddCheckBox(groupBox, "ؼڷǻ״̬ʱʹڵ䰵", Program.Preferences.Settings.DimNodesWhenInactive, 0, ref rowIndex, ref num);
- _treeLocationCombo = FormTools.AddLabeledValueDropDown(groupBox, "λã", ref rowIndex, ref num, (DockStyle v) => v.ToString(), new DockStyle[2]
+ FormTools.AddCheckBox(groupBox, "ѡתƵԶ̿ͻ", Program.Preferences.Settings.FocusOnClick, 0, ref rowIndex, ref tabIndex);
+ FormTools.AddCheckBox(groupBox, "ؼڷǻ״̬ʱʹڵ䰵", Program.Preferences.Settings.DimNodesWhenInactive, 0, ref rowIndex, ref tabIndex);
+ _treeLocationCombo = FormTools.AddLabeledValueDropDown(groupBox, "λã", ref rowIndex, ref tabIndex, (DockStyle v) => v.ToString(), new DockStyle[2]
{
DockStyle.Left,
DockStyle.Right
});
- _treeVisibilityCombo = FormTools.AddLabeledValueDropDown(groupBox, "ɼԣ", ref rowIndex, ref num, (ControlVisibility v) => v.ToString(), new ControlVisibility[3]
+ _treeVisibilityCombo = FormTools.AddLabeledValueDropDown(groupBox, "ɼԣ", ref rowIndex, ref tabIndex, (ControlVisibility v) => v.ToString(), new ControlVisibility[3]
{
ControlVisibility.Dock,
ControlVisibility.AutoHide,
@@ -357,7 +382,7 @@ private TabPage CreateServerTreePage() {
Size = new Size(40, 24),
Setting = Program.Preferences.Settings.ServerTreeAutoHidePopUpDelay,
TabStop = true,
- TabIndex = num++
+ TabIndex = tabIndex++
};
_treeVisibilityCombo.SelectedIndexChanged += delegate {
serverTreeAutoHidePopUpDelay.Enabled = _treeVisibilityCombo.SelectedValue == ControlVisibility.AutoHide;
@@ -384,31 +409,32 @@ private TabPage CreateServerTreePage() {
FormTools.LayoutGroupBox(_virtualGroupsGroup, 2, groupBox);
_virtualGroupsGroup.Height -= 6;
rowIndex = 0;
- num = 0;
+ tabIndex = 0;
GroupBox groupBox2 = new GroupBox {
Text = ""
};
- FormTools.AddLabeledValueDropDown(groupBox2, "˳", Program.Preferences.Settings.GroupSortOrder, ref rowIndex, ref num, Helpers.SortOrderToString, new SortOrder[2] {
+ FormTools.AddLabeledValueDropDown(groupBox2, "˳", Program.Preferences.Settings.GroupSortOrder, ref rowIndex, ref tabIndex, Helpers.SortOrderToString, new SortOrder[2] {
SortOrder.ByName,
SortOrder.None
});
- FormTools.AddLabeledEnumDropDown(groupBox2, "˳", Program.Preferences.Settings.ServerSortOrder, ref rowIndex, ref num, Helpers.SortOrderToString);
+ FormTools.AddLabeledEnumDropDown(groupBox2, "˳", Program.Preferences.Settings.ServerSortOrder, ref rowIndex, ref tabIndex, Helpers.SortOrderToString);
FormTools.LayoutGroupBox(groupBox2, 2, _virtualGroupsGroup);
tabPage.Controls.Add(groupBox, _virtualGroupsGroup, groupBox2);
return tabPage;
}
- private TabPage CreateGeneralPage() {
+ private TabPage CreateGeneralPage()
+ {
int rowIndex = 0;
- int num = 0;
+ int tabIndex = 0;
TabPage tabPage = NewTabPage("");
- FormTools.AddCheckBox(tabPage, "˵ֱ ALT", Program.Preferences.Settings.HideMainMenu, 0, ref rowIndex, ref num);
- RdcCheckBox autoSaveCheckBox = FormTools.AddCheckBox(tabPage, "Զ", Program.Preferences.Settings.AutoSaveFiles, 0, ref rowIndex, ref num);
+ FormTools.AddCheckBox(tabPage, "˵ֱ ALT", Program.Preferences.Settings.HideMainMenu, 0, ref rowIndex, ref tabIndex);
+ RdcCheckBox autoSaveCheckBox = FormTools.AddCheckBox(tabPage, "Զ", Program.Preferences.Settings.AutoSaveFiles, 0, ref rowIndex, ref tabIndex);
autoSaveCheckBox.Size = new Size(120, 24);
NumericTextBox autoSaveInterval = new NumericTextBox(0, 60, "ԶΪ 0 60 ӣ") {
Location = new Point(autoSaveCheckBox.Right + 1, autoSaveCheckBox.Top + 2),
Size = new Size(FormTools.ControlHeight, 24),
- TabIndex = num++,
+ TabIndex = tabIndex++,
TabStop = true,
Enabled = false
};
@@ -421,10 +447,10 @@ private TabPage CreateGeneralPage() {
Size = new Size(60, 24),
Text = ""
};
- RdcCheckBox rdcCheckBox = FormTools.AddCheckBox(tabPage, "ʱʾӵķ", Program.Preferences.Settings.ReconnectOnStartup, 0, ref rowIndex, ref num);
+ RdcCheckBox rdcCheckBox = FormTools.AddCheckBox(tabPage, "ʱʾӵķ", Program.Preferences.Settings.ReconnectOnStartup, 0, ref rowIndex, ref tabIndex);
Button button = new Button {
Location = new Point(8, rdcCheckBox.Bottom + 8),
- TabIndex = num++,
+ TabIndex = tabIndex++,
Text = "Ĭ...",
Width = 140
};
@@ -435,42 +461,51 @@ private TabPage CreateGeneralPage() {
return tabPage;
}
- private void EnablePanningCheckedChanged(object sender, EventArgs e) {
+ private void EnablePanningCheckedChanged(object sender, EventArgs e)
+ {
_panningAccelerationUpDown.Enabled = _enablePanningCheckBox.Checked;
}
- private void ConnectionBarEnabledCheckedChanged(object sender, EventArgs e) {
+ private void ConnectionBarEnabledCheckedChanged(object sender, EventArgs e)
+ {
_connectionBarAutoHiddenCheckBox.Enabled = _connectionBarEnabledCheckBox.Checked;
}
- private void CustomSizeClick(object sender, EventArgs e) {
+ private void CustomSizeClick(object sender, EventArgs e)
+ {
Button button = sender as Button;
Size size = SizeHelper.Parse(button.Text);
using CustomSizeDialog customSizeDialog = new CustomSizeDialog(size);
- if (customSizeDialog.ShowDialog() == DialogResult.OK) {
+ if (customSizeDialog.ShowDialog() == DialogResult.OK)
+ {
button.Text = customSizeDialog.WidthText + SizeHelper.Separator + customSizeDialog.HeightText;
_thumbnailPixelsRadio.Checked = true;
}
}
- private void ThumbnailPercentageRadioCheckedChanged(object sender, EventArgs e) {
+ private void ThumbnailPercentageRadioCheckedChanged(object sender, EventArgs e)
+ {
_thumbnailPercentageTextBox.Enabled = (sender as RadioButton).Checked;
_thumbnailPixelsButton.Enabled = !_thumbnailPercentageTextBox.Enabled;
}
- private void BandwidthCombo_ControlChanged(object sender, EventArgs e) {
+ private void BandwidthCombo_ControlChanged(object sender, EventArgs e)
+ {
BandwidthSettingsChanged();
}
- private void BandwidthSettingsChanged() {
- if (!_inHandler) {
+ private void BandwidthSettingsChanged()
+ {
+ if (!_inHandler)
+ {
_inHandler = true;
SetBandwidthCheckBoxes(_bandwidthComboBox.SelectedValue.Flags);
_inHandler = false;
}
}
- private void SetBandwidthCheckBoxes(int flags) {
+ private void SetBandwidthCheckBoxes(int flags)
+ {
_desktopBackgroundCheckBox.Checked = (flags & 1) == 0;
_fontSmoothingCheckBox.Checked = (flags & 0x80) != 0;
_desktopCompositionCheckBox.Checked = (flags & 0x100) != 0;
@@ -479,8 +514,10 @@ private void SetBandwidthCheckBoxes(int flags) {
_themesCheckBox.Checked = (flags & 8) == 0;
}
- private void PerfCheckBox_CheckedChanged(object sender, EventArgs e) {
- if (!_inHandler) {
+ private void PerfCheckBox_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!_inHandler)
+ {
_inHandler = true;
int flags = ComputeFlagsFromCheckBoxes();
BandwidthItem selectedValue = _bandwidthItems.Where((BandwidthItem i) => i.Flags == flags).FirstOrDefault() ?? _bandwidthItems.First((BandwidthItem i) => i.Text.Equals("Զ"));
@@ -489,7 +526,8 @@ private void PerfCheckBox_CheckedChanged(object sender, EventArgs e) {
}
}
- private int ComputeFlagsFromCheckBoxes() {
+ private int ComputeFlagsFromCheckBoxes()
+ {
int num = 0;
if (!_desktopBackgroundCheckBox.Checked)
num |= 1;
diff --git a/RdcMan/GlobalSettings.cs b/RdcMan/GlobalSettings.cs
index 337aa1d..5211899 100644
--- a/RdcMan/GlobalSettings.cs
+++ b/RdcMan/GlobalSettings.cs
@@ -4,8 +4,10 @@
using System.Windows.Forms;
using System.Xml;
-namespace RdcMan {
- public sealed class GlobalSettings : SettingsGroup {
+namespace RdcMan
+{
+ public sealed class GlobalSettings : SettingsGroup
+ {
//public const string TabName = "Preferences";
private static Dictionary _settingProperties;
@@ -156,7 +158,8 @@ public sealed class GlobalSettings : SettingsGroup {
[Setting("WindowSize")]
public SizeSetting WindowSize { get; private set; }
- static GlobalSettings() {
+ static GlobalSettings()
+ {
typeof(GlobalSettings).GetSettingProperties(out _settingProperties);
_settingProperties["ThumbnailSize"].Attribute.DefaultValue = new Size(160, 120);
_settingProperties["WindowPosition"].Attribute.DefaultValue = new Point(200, 200);
@@ -164,13 +167,17 @@ static GlobalSettings() {
}
public GlobalSettings()
- : base("ѡ", "Settings") {
+ : base("ѡ", "Settings")
+ {
base.InheritSettingsType.Mode = InheritanceMode.Disabled;
}
- public void TransferPreferences(Preferences prefs) {
- foreach (string key in _settingProperties.Keys) {
- try {
+ public void TransferPreferences(Preferences prefs)
+ {
+ foreach (string key in _settingProperties.Keys)
+ {
+ try
+ {
object transferValue = prefs.GetTransferValue(key);
SetValue(key, transferValue);
}
@@ -178,26 +185,31 @@ public void TransferPreferences(Preferences prefs) {
}
}
- public object GetValue(string name) {
+ public object GetValue(string name)
+ {
object value = _settingProperties[name].Property.GetValue(this, null);
return value.GetType().GetProperty("Value").GetValue(value, null);
}
- public void SetValue(string name, object value) {
+ public void SetValue(string name, object value)
+ {
object value2 = _settingProperties[name].Property.GetValue(this, null);
value2.GetType().GetProperty("Value").SetValue(value2, value, null);
}
- public override TabPage CreateTabPage(TabbedSettingsDialog dialog) {
+ public override TabPage CreateTabPage(TabbedSettingsDialog dialog)
+ {
throw new NotImplementedException();
}
- protected override void WriteSettings(XmlTextWriter tw, RdcTreeNode node) {
+ protected override void WriteSettings(XmlTextWriter tw, RdcTreeNode node)
+ {
tw.WriteAttributeString("programVersion", Program.TheForm.VersionText);
base.WriteSettings(tw, node);
}
- protected override void Copy(RdcTreeNode node) {
+ protected override void Copy(RdcTreeNode node)
+ {
throw new InvalidOperationException("GlobalSettings should never be copied");
}
}
diff --git a/RdcMan/Group.cs b/RdcMan/Group.cs
index b0bc457..6e9ea36 100644
--- a/RdcMan/Group.cs
+++ b/RdcMan/Group.cs
@@ -2,58 +2,71 @@
using System.Windows.Forms;
using System.Xml;
-namespace RdcMan {
- public class Group : GroupBase {
+namespace RdcMan
+{
+ public class Group : GroupBase
+ {
//public const string XmlNodeName = "group";
- protected Group() { }
+ protected Group()
+ {
+ }
- internal static Group CreateForAddDialog() {
+ internal static Group CreateForAddDialog()
+ {
return new Group();
}
- public static Group Create(string name, GroupBase parent) {
+ public static Group Create(string name, GroupBase parent)
+ {
Group group = new Group();
group.Properties.GroupName.Value = name;
group.FinishConstruction(parent);
return group;
}
- internal static Group Create(GroupPropertiesDialog dlg) {
+ internal static Group Create(GroupPropertiesDialog dlg)
+ {
Group group = dlg.AssociatedNode as Group;
group.UpdateSettings(dlg);
group.FinishConstruction(dlg.PropertiesPage.ParentGroup);
return group;
}
- internal static Group Create(XmlNode xmlNode, GroupBase parent, ICollection errors) {
+ internal static Group Create(XmlNode xmlNode, GroupBase parent, ICollection errors)
+ {
Group group = new Group();
group.ReadXml(xmlNode, errors);
group.FinishConstruction(parent);
return group;
}
- protected override void InitSettings() {
+ protected override void InitSettings()
+ {
((RdcTreeNode)this).Properties = new GroupSettings();
base.InitSettings();
}
- internal override void WriteXml(XmlTextWriter tw) {
+ internal override void WriteXml(XmlTextWriter tw)
+ {
tw.WriteStartElement("group");
base.WriteXml(tw);
tw.WriteEndElement();
}
- public override void DoPropertiesDialog(Form parentForm, string activeTabName) {
+ public override void DoPropertiesDialog(Form parentForm, string activeTabName)
+ {
using GroupPropertiesDialog groupPropertiesDialog = GroupPropertiesDialog.NewPropertiesDialog(this, parentForm);
groupPropertiesDialog.SetActiveTab(activeTabName);
- if (groupPropertiesDialog.ShowDialog() == DialogResult.OK) {
+ if (groupPropertiesDialog.ShowDialog() == DialogResult.OK)
+ {
UpdateSettings(groupPropertiesDialog);
ServerTree.Instance.OnNodeChanged(this, ChangeType.PropertyChanged);
}
}
- private void FinishConstruction(GroupBase parent) {
+ private void FinishConstruction(GroupBase parent)
+ {
base.Text = base.Properties.GroupName.Value;
ServerTree.Instance.AddNode(this, parent);
ChangeImageIndex(ImageConstants.Group);
diff --git a/RdcMan/GroupBase.cs b/RdcMan/GroupBase.cs
index 681b8a1..bf0ceff 100644
--- a/RdcMan/GroupBase.cs
+++ b/RdcMan/GroupBase.cs
@@ -4,8 +4,10 @@
using System.Xml;
using RdcMan.Configuration;
-namespace RdcMan {
- public abstract class GroupBase : RdcTreeNode {
+namespace RdcMan
+{
+ public abstract class GroupBase : RdcTreeNode
+ {
//internal const string XmlGroupNameTag = "name";
//internal const string XmlExpandedTag = "expanded";
@@ -35,30 +37,46 @@ internal bool HasServers {
get => base.Nodes.Count == 0 ? false : base.Nodes[0] is ServerBase;
}
- internal int NumberOfServers {
- get {
- if (_numberOfServers == -1) {
+ internal int NumberOfServers
+ {
+ get
+ {
+ if (_numberOfServers == -1)
+ {
_numberOfServers = 0;
- foreach (TreeNode node in base.Nodes) {
+ foreach (TreeNode node in base.Nodes)
+ {
if (node is GroupBase groupBase)
+ {
_numberOfServers += groupBase.NumberOfServers;
+ }
else
+ {
_numberOfServers++;
+ }
}
}
return _numberOfServers;
}
}
- internal int NumberOfConnectedServers {
- get {
- if (_numberOfConnectedServers == -1) {
+ internal int NumberOfConnectedServers
+ {
+ get
+ {
+ if (_numberOfConnectedServers == -1)
+ {
_numberOfConnectedServers = 0;
- foreach (TreeNode node in base.Nodes) {
+ foreach (TreeNode node in base.Nodes)
+ {
if (node is GroupBase groupBase)
+ {
_numberOfConnectedServers += groupBase.NumberOfConnectedServers;
+ }
else if ((node as ServerBase).IsConnected)
+ {
_numberOfConnectedServers++;
+ }
}
}
return _numberOfConnectedServers;
@@ -71,56 +89,70 @@ public bool HasGroups {
get => base.Nodes.Count > 0 ? base.Nodes[0] is GroupBase : false;
}
- static GroupBase() {
- NodeActions = new Dictionary {
+ static GroupBase()
+ {
+ NodeActions = new Dictionary
+ {
{
"properties",
- delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors) {
+ delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors)
+ {
if (SchemaVersion <= 2)
+ {
(parent as GroupBase).ReadXml(PropertyActions, childNode, errors);
+ }
else
+ {
(parent as GroupBase).ReadXmlSettingsGroup(childNode, errors);
+ }
}
},
{
"server",
- delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors) {
+ delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors)
+ {
Server server = Server.Create(childNode, parent as GroupBase, errors);
LongRunningActionForm.Instance.UpdateStatus(server.Properties.DisplayName.Value);
}
},
{
"group",
- delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors) {
+ delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors)
+ {
GroupBase groupBase2 = Group.Create(childNode, parent as GroupBase, errors);
LongRunningActionForm.Instance.UpdateStatus(groupBase2.Properties.GroupName.Value);
}
},
{
"smartGroup",
- delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors) {
+ delegate(XmlNode childNode, RdcTreeNode parent, ICollection errors)
+ {
GroupBase groupBase = SmartGroup.Create(childNode, parent as GroupBase, errors);
LongRunningActionForm.Instance.UpdateStatus(groupBase.Properties.GroupName.Value);
}
}
};
- PropertyActions = new Dictionary {
+ PropertyActions = new Dictionary
+ {
{
"name",
- delegate(XmlNode childNode, RdcTreeNode node, ICollection errors) {
+ delegate(XmlNode childNode, RdcTreeNode node, ICollection errors)
+ {
(node as GroupBase).Properties.GroupName.Value = childNode.InnerText;
}
},
{
"expanded",
- delegate(XmlNode childNode, RdcTreeNode node, ICollection errors) {
+ delegate(XmlNode childNode, RdcTreeNode node, ICollection errors)
+ {
bool.TryParse(childNode.InnerText, out var result);
(node as GroupBase).Properties.Expanded.Value = result;
}
},
{
"comment",
- delegate(XmlNode childNode, RdcTreeNode node, ICollection errors) {
+ delegate(XmlNode childNode, RdcTreeNode node, ICollection errors)
+ {
(node as GroupBase).Properties.Comment.Value = childNode.InnerText;
}
}
@@ -128,9 +160,11 @@ static GroupBase() {
Server.ConnectionStateChanged += Server_ConnectionStateChanged;
}
- private static void Server_ConnectionStateChanged(ConnectionStateChangedEventArgs args) {
+ private static void Server_ConnectionStateChanged(ConnectionStateChangedEventArgs args)
+ {
(args.Server.Parent as GroupBase).OnConnectionStateChange(args.Server);
- args.Server.VisitServerRefs(delegate (ServerRef r) {
+ args.Server.VisitServerRefs(delegate(ServerRef r)
+ {
(r.Parent as GroupBase).OnConnectionStateChange(r);
});
}
@@ -139,37 +173,45 @@ public virtual bool CanRemoveChildren() {
return base.Nodes.Count > 0 ? AllowEdit(popUI: false) : false;
}
- protected override void InitSettings() {
+ protected override void InitSettings()
+ {
base.DisplaySettings = new GroupDisplaySettings();
base.InitSettings();
}
- internal override void UpdateSettings(NodePropertiesDialog dlg) {
+ internal override void UpdateSettings(NodePropertiesDialog dlg)
+ {
base.UpdateSettings(dlg);
base.Text = Properties.GroupName.Value;
}
- public override void InvalidateNode() {
+ public override void InvalidateNode()
+ {
_numberOfServers = -1;
ResetConnectionStatistics(this);
base.InvalidateNode();
}
- internal void ResetConnectionStatistics() {
- this.VisitNodeAndParents(delegate (RdcTreeNode group) {
+ internal void ResetConnectionStatistics()
+ {
+ this.VisitNodeAndParents(delegate(RdcTreeNode group)
+ {
ResetConnectionStatistics((GroupBase)group);
});
}
- private static void ResetConnectionStatistics(GroupBase group) {
+ private static void ResetConnectionStatistics(GroupBase group)
+ {
group._numberOfConnectedServers = -1;
}
- public virtual bool CanAddServers() {
+ public virtual bool CanAddServers()
+ {
return CanDropServers();
}
- public virtual bool CanAddGroups() {
+ public virtual bool CanAddGroups()
+ {
return CanDropGroups();
}
@@ -181,28 +223,37 @@ public virtual bool CanDropGroups() {
return !HasServers ? AllowEdit(popUI: false) : false;
}
- public virtual DragDropEffects DropBehavior() {
+ public virtual DragDropEffects DropBehavior()
+ {
return DragDropEffects.Move;
}
- internal override void Show() {
+ internal override void Show()
+ {
Program.TheForm.ShowGroup(this);
}
- internal override void Hide() {
+ internal override void Hide()
+ {
Program.TheForm.HideGroup(this);
}
- internal override void WriteXml(XmlTextWriter tw) {
+ internal override void WriteXml(XmlTextWriter tw)
+ {
Properties.Expanded.Value = base.IsExpanded;
WriteXmlSettingsGroups(tw);
foreach (RdcTreeNode node in base.Nodes)
+ {
node.WriteXml(tw);
+ }
}
- public void RemoveChildren() {
- ServerTree.Instance.Operation(OperationBehavior.SuspendSelect | OperationBehavior.SuspendSort | OperationBehavior.SuspendUpdate | OperationBehavior.SuspendGroupChanged, delegate {
- base.Nodes.ForEach(delegate (TreeNode node) {
+ public void RemoveChildren()
+ {
+ ServerTree.Instance.Operation(OperationBehavior.SuspendSelect | OperationBehavior.SuspendSort | OperationBehavior.SuspendUpdate | OperationBehavior.SuspendGroupChanged, delegate
+ {
+ base.Nodes.ForEach(delegate(TreeNode node)
+ {
(node as RdcTreeNode).OnRemoving();
});
base.Nodes.Clear();
@@ -210,113 +261,153 @@ public void RemoveChildren() {
ServerTree.Instance.OnGroupChanged(this, ChangeType.TreeChanged);
}
- public override void OnRemoving() {
+ public override void OnRemoving()
+ {
Hide();
RemoveChildren();
}
- public override void Connect() {
+ public override void Connect()
+ {
ConnectAs(null, null);
}
- public override void ConnectAs(LogonCredentials logonSettings, ConnectionSettings connectionSettings) {
+ public override void ConnectAs(LogonCredentials logonSettings, ConnectionSettings connectionSettings)
+ {
List allChildren = this.GetAllChildren((ServerBase s) => !s.IsConnected);
int count = allChildren.Count;
- if (count >= Current.RdcManSection.WarningThresholds.Connect) {
- DialogResult dialogResult = FormTools.YesNoDialog(base.Text + " " + count + " Ͽӵķ ȷ");
+ if (count >= Current.RdcManSection.WarningThresholds.Connect)
+ {
+ DialogResult dialogResult = FormTools.YesNoDialog(base.Text + " " + count + " δӵķ ȷ");
if (dialogResult != DialogResult.Yes)
+ {
return;
+ }
}
NodeHelper.ThrottledConnectAs(allChildren, logonSettings, connectionSettings);
}
- public override void Reconnect() {
- this.GetAllChildren((ServerBase s) => s.IsConnected).ForEach(delegate (ServerBase server) {
+ public override void Reconnect()
+ {
+ this.GetAllChildren((ServerBase s) => s.IsConnected).ForEach(delegate(ServerBase server)
+ {
server.Reconnect();
});
}
- public override void Disconnect() {
+ public override void Disconnect()
+ {
NodeHelper.ThrottledDisconnect(this.GetAllChildren((ServerBase s) => s.IsConnected));
}
- public override void LogOff() {
- foreach (ServerBase allChild in this.GetAllChildren((ServerBase s) => s.IsConnected)) {
+ public override void LogOff()
+ {
+ foreach (ServerBase allChild in this.GetAllChildren((ServerBase s) => s.IsConnected))
+ {
allChild.LogOff();
Thread.Sleep(25);
}
}
- private void OnConnectionStateChange(ServerBase server) {
+ private void OnConnectionStateChange(ServerBase server)
+ {
InheritSettings();
- if (!server.IsConnected) {
+ if (!server.IsConnected)
+ {
ReconnectServerRef reconnectServerRef = server.ServerNode.FindServerRef();
if (reconnectServerRef != null && reconnectServerRef.NeedToReconnect)
+ {
return;
+ }
}
bool flag = false;
if (Program.Preferences.ServerSortOrder == SortOrder.ByStatus)
+ {
flag |= ServerTree.Instance.SortNode(server);
+ }
if (flag | !(server.ServerNode.Parent as GroupBase).DisplaySettings.ShowDisconnectedThumbnails.Value)
+ {
ServerTree.Instance.OnGroupChanged(this, ChangeType.InvalidateUI);
+ }
}
- public override bool CanDropOnTarget(RdcTreeNode targetNode) {
+ public override bool CanDropOnTarget(RdcTreeNode targetNode)
+ {
if (targetNode == this)
+ {
return true;
-
+ }
GroupBase groupBase = targetNode as GroupBase;
if (groupBase == null)
+ {
return false;
-
+ }
if (!groupBase.CanDropGroups())
+ {
return false;
-
+ }
if (!AllowEdit(popUI: false))
+ {
return false;
-
- while (groupBase != null) {
+ }
+ while (groupBase != null)
+ {
if (groupBase.Parent == this)
+ {
return false;
-
+ }
groupBase = groupBase.Parent as GroupBase;
}
return true;
}
- public override bool ConfirmRemove(bool askUser) {
+ public override bool ConfirmRemove(bool askUser)
+ {
if (!CanRemove(popUI: true))
+ {
return false;
-
+ }
AnyOrAllConnected(out var anyConnected, out var _);
- if (anyConnected) {
- FormTools.InformationDialog(base.Text + " лỰɾ֮ǰϿǡ");
+ if (anyConnected)
+ {
+ FormTools.InformationDialog(base.Text + " лỰɾ֮ǰҪȶϿ");
return false;
}
- if (askUser && base.Nodes.Count > 0) {
+ if (askUser && base.Nodes.Count > 0)
+ {
DialogResult dialogResult = FormTools.YesNoDialog("ɾ " + base.Text + " ");
if (dialogResult != DialogResult.Yes)
+ {
return false;
+ }
}
return true;
}
- public void AnyOrAllConnected(out bool anyConnected, out bool allConnected) {
+ public void AnyOrAllConnected(out bool anyConnected, out bool allConnected)
+ {
bool any = false;
bool all = true;
- base.Nodes.VisitNodes(delegate (RdcTreeNode node) {
- if (node is ServerBase serverBase) {
+ base.Nodes.VisitNodes(delegate(RdcTreeNode node)
+ {
+ if (node is ServerBase serverBase)
+ {
if (serverBase.IsConnected)
+ {
any = true;
+ }
else
+ {
all = false;
+ }
}
});
anyConnected = any;
allConnected = all;
}
- internal virtual void ReadXml(XmlNode xmlNode, ICollection errors) {
+ internal virtual void ReadXml(XmlNode xmlNode, ICollection errors)
+ {
ReadXml(NodeActions, xmlNode, errors);
}
}
diff --git a/RdcMan/GroupBasePropertiesDialog.cs b/RdcMan/GroupBasePropertiesDialog.cs
index 3dc3e3f..2d2bf65 100644
--- a/RdcMan/GroupBasePropertiesDialog.cs
+++ b/RdcMan/GroupBasePropertiesDialog.cs
@@ -5,8 +5,10 @@
using System.Text;
using System.Windows.Forms;
-namespace RdcMan {
- internal abstract class GroupBasePropertiesDialog : NodePropertiesDialog {
+namespace RdcMan
+{
+ internal abstract class GroupBasePropertiesDialog : NodePropertiesDialog
+ {
protected ListBox _credentialsListBox;
private CredentialsStore _credentialsStore;
@@ -14,31 +16,38 @@ internal abstract class GroupBasePropertiesDialog : NodePropertiesDialog {
private int _credentialsStoreChangeId;
protected GroupBasePropertiesDialog(GroupBase group, string dialogTitle, string acceptButtonText, Form parentForm)
- : base(group, dialogTitle, acceptButtonText, parentForm) { }
+ : base(group, dialogTitle, acceptButtonText, parentForm)
+ {
+ }
- protected int CreateProfileManagementTabPage() {
+ protected int CreateProfileManagementTabPage()
+ {
int result = 0;
TabPage tabPage = FormTools.NewTabPage("¼ƾ֤");
Label label = FormTools.NewLabel("¼ƾ֤", 0, result++);
- _credentialsListBox = new ListBox {
+ _credentialsListBox = new ListBox
+ {
Location = FormTools.NewLocation(0, result++),
Size = new Size(340, 200)
};
_credentialsListBox.KeyDown += CredentialsListBox_KeyDown;
_credentialsListBox.DoubleClick += EditButton_Click;
_credentialsListBox.VisibleChanged += CredentialsListBox_VisibleChanged;
- Button button = new Button {
- Text = "(&A)",
+ Button button = new Button
+ {
+ Text = "(&A)",
Location = new Point(_credentialsListBox.Right + FormTools.ControlHeight, _credentialsListBox.Top)
};
button.Click += AddButton_Click;
- Button button2 = new Button {
- Text = "(&E)༭",
+ Button button2 = new Button
+ {
+ Text = "༭(&E)",
Location = new Point(_credentialsListBox.Right + FormTools.ControlHeight, button.Bottom + FormTools.VerticalSpace)
};
button2.Click += EditButton_Click;
- Button button3 = new Button {
- Text = "(&D)ɾ",
+ Button button3 = new Button
+ {
+ Text = "ɾ(&D)",
Location = new Point(_credentialsListBox.Right + FormTools.ControlHeight, button2.Bottom + FormTools.VerticalSpace)
};
button3.Click += DeleteButton_Click;
@@ -48,47 +57,60 @@ protected int CreateProfileManagementTabPage() {
return result;
}
- private void CredentialsListBox_VisibleChanged(object sender, EventArgs e) {
+ private void CredentialsListBox_VisibleChanged(object sender, EventArgs e)
+ {
PopulateCredentialsListBoxIfChanged();
}
- private void PopulateCredentialsListBoxIfChanged() {
+ private void PopulateCredentialsListBoxIfChanged()
+ {
if (_credentialsStoreChangeId != _credentialsStore.ChangeId)
+ {
PopulateCredentialsListBox();
+ }
}
- protected void PopulateCredentialsManagementTab(CredentialsStore store) {
+ protected void PopulateCredentialsManagementTab(CredentialsStore store)
+ {
_credentialsStore = store;
PopulateCredentialsListBox();
}
- private void PopulateCredentialsListBox() {
+ private void PopulateCredentialsListBox()
+ {
_credentialsListBox.Items.Clear();
- foreach (CredentialsProfile profile in _credentialsStore.Profiles) {
+ foreach (CredentialsProfile profile in _credentialsStore.Profiles)
+ {
_credentialsListBox.Items.Add(profile);
}
_credentialsStoreChangeId = _credentialsStore.ChangeId;
}
- private void AddButton_Click(object sender, EventArgs e) {
+ private void AddButton_Click(object sender, EventArgs e)
+ {
using AddCredentialsDialog addCredentialsDialog = new AddCredentialsDialog(base.AssociatedNode);
- if (addCredentialsDialog.ShowDialog() == DialogResult.OK) {
+ if (addCredentialsDialog.ShowDialog() == DialogResult.OK)
+ {
CredentialsProfile credentialsProfile = new CredentialsProfile(addCredentialsDialog.ProfileName, addCredentialsDialog.ProfileScope, addCredentialsDialog.UserName, addCredentialsDialog.Password.Value, addCredentialsDialog.Domain);
if (!_credentialsStore.Contains(credentialsProfile.ProfileName))
+ {
_credentialsListBox.Items.Add(credentialsProfile);
-
+ }
_credentialsStore[credentialsProfile.ProfileName] = credentialsProfile;
}
}
- private void EditButton_Click(object sender, EventArgs e) {
+ private void EditButton_Click(object sender, EventArgs e)
+ {
int selectedIndex = _credentialsListBox.SelectedIndex;
if (selectedIndex == -1)
+ {
return;
-
+ }
CredentialsProfile credentialsProfile = _credentialsListBox.Items[selectedIndex] as CredentialsProfile;
using LogonSettingsDialog logonSettingsDialog = LogonSettingsDialog.NewEditCredentialsDialog(credentialsProfile);
- if (logonSettingsDialog.ShowDialog() == DialogResult.OK) {
+ if (logonSettingsDialog.ShowDialog() == DialogResult.OK)
+ {
PasswordSetting password = (logonSettingsDialog.PasswordChanged ? logonSettingsDialog.Password : credentialsProfile.Password);
credentialsProfile = new CredentialsProfile(credentialsProfile.ProfileName, credentialsProfile.ProfileScope, logonSettingsDialog.UserName, password, logonSettingsDialog.Domain);
_credentialsStore[credentialsProfile.ProfileName] = credentialsProfile;
@@ -96,73 +118,95 @@ private void EditButton_Click(object sender, EventArgs e) {
}
}
- private void DeleteButton_Click(object sender, EventArgs e) {
+ private void DeleteButton_Click(object sender, EventArgs e)
+ {
DeleteCredentials();
}
- private void CredentialsListBox_KeyDown(object sender, KeyEventArgs e) {
- if (e.KeyCode == Keys.Delete) {
+ private void CredentialsListBox_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Delete)
+ {
e.Handled = true;
DeleteCredentials();
}
}
- private void DeleteCredentials() {
+ private void DeleteCredentials()
+ {
int selectedIndex = _credentialsListBox.SelectedIndex;
if (selectedIndex == -1)
+ {
return;
-
+ }
CredentialsProfile credentialsProfile = _credentialsListBox.Items[selectedIndex] as CredentialsProfile;
ICollection credentialsInUseLocations = GetCredentialsInUseLocations(credentialsProfile);
- if (credentialsInUseLocations.Count > 0) {
+ if (credentialsInUseLocations.Count > 0)
+ {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine(credentialsProfile.ProfileName + " Щڵʹã").AppendLine();
- foreach (string item in credentialsInUseLocations) {
+ foreach (string item in credentialsInUseLocations)
+ {
stringBuilder.AppendLine(item);
}
- stringBuilder.AppendLine().AppendLine("ȷҪɾ");
+ stringBuilder.AppendLine().AppendLine("ȷҪɾ");
if (FormTools.YesNoDialog(stringBuilder.ToString()) != DialogResult.Yes)
+ {
return;
+ }
}
_credentialsStore.Remove(credentialsProfile.ProfileName);
_credentialsListBox.Items.RemoveAt(selectedIndex);
RevertDeletedCredentials(credentialsProfile);
}
- private ICollection GetCredentialsInUseLocations(CredentialsProfile credentials) {
+ private ICollection GetCredentialsInUseLocations(CredentialsProfile credentials)
+ {
HashSet inUseLocations = new HashSet();
ICollection nodes = ((base.AssociatedNode.FileGroup == null) ? ((IList)ServerTree.Instance.Nodes) : ((IList)new FileGroup[1] { base.AssociatedNode.FileGroup }));
- foreach (TabPage tabPage in base.TabPages) {
+ foreach (TabPage tabPage in base.TabPages)
+ {
if (tabPage is ICredentialsTabPage credentialsTabPage && credentialsTabPage.Credentials == credentials)
+ {
inUseLocations.Add("{0}.{1}".InvariantFormat(Text, tabPage.Text));
+ }
}
- nodes.VisitNodes(delegate (RdcTreeNode node) {
+ nodes.VisitNodes(delegate(RdcTreeNode node)
+ {
if (node is VirtualGroup)
+ {
return NodeVisitorResult.NoRecurse;
-
+ }
if (node.LogonCredentials.DirectlyReferences(credentials))
+ {
inUseLocations.Add("{0}.{1}".InvariantFormat(node.FullPath, "¼ƾ֤"));
-
+ }
if (node.GatewaySettings.DirectlyReferences(credentials))
+ {
inUseLocations.Add("{0}.{1}".InvariantFormat(node.FullPath, ""));
-
+ }
return NodeVisitorResult.Continue;
});
return inUseLocations;
}
- private void RevertDeletedCredentials(CredentialsProfile credentials) {
+ private void RevertDeletedCredentials(CredentialsProfile credentials)
+ {
ICollection nodes = ((base.AssociatedNode.FileGroup == null) ? ((IList)ServerTree.Instance.Nodes) : ((IList)new FileGroup[1] { base.AssociatedNode.FileGroup }));
- nodes.VisitNodes(delegate (RdcTreeNode node) {
+ nodes.VisitNodes(delegate(RdcTreeNode node)
+ {
if (node is VirtualGroup)
+ {
return NodeVisitorResult.NoRecurse;
-
+ }
if (node.LogonCredentials.DirectlyReferences(credentials))
+ {
node.LogonCredentials.ProfileName.Reset();
-
+ }
if (node.GatewaySettings.DirectlyReferences(credentials))
+ {
node.GatewaySettings.ProfileName.Reset();
-
+ }
return NodeVisitorResult.Continue;
});
}
diff --git a/RdcMan/GroupBasePropertiesTabPage.cs b/RdcMan/GroupBasePropertiesTabPage.cs
index dc6b159..fd1e870 100644
--- a/RdcMan/GroupBasePropertiesTabPage.cs
+++ b/RdcMan/GroupBasePropertiesTabPage.cs
@@ -1,26 +1,34 @@
-namespace RdcMan {
- internal class GroupBasePropertiesTabPage : NodePropertiesPage where TSettingsGroup : GroupSettings {
+namespace RdcMan
+{
+ internal class GroupBasePropertiesTabPage : NodePropertiesPage where TSettingsGroup : GroupSettings
+ {
private RdcTextBox _groupNameTextBox;
protected GroupBasePropertiesTabPage(TabbedSettingsDialog dialog, TSettingsGroup settings, string name)
- : base(dialog, settings, name) { }
+ : base(dialog, settings, name)
+ {
+ }
- protected void AddGroupName(ref int rowIndex, ref int tabIndex) {
+ protected void AddGroupName(ref int rowIndex, ref int tabIndex)
+ {
_groupNameTextBox = FormTools.AddLabeledTextBox(this, "(&G)", base.Settings.GroupName, ref rowIndex, ref tabIndex);
_groupNameTextBox.Enabled = true;
- _groupNameTextBox.Validate = delegate {
+ _groupNameTextBox.Validate = delegate
+ {
_groupNameTextBox.Text = _groupNameTextBox.Text.Trim();
string text = _groupNameTextBox.Text;
if (text.Length == 0)
+ {
return "";
-
+ }
string pathSeparator = ServerTree.Instance.PathSeparator;
return (text.IndexOf(pathSeparator) != -1) ? ("Ʋܰ·ָ \"" + pathSeparator + "\"") : null;
};
base.FocusControl = _groupNameTextBox;
}
- protected override bool CanBeParent(GroupBase group) {
+ protected override bool CanBeParent(GroupBase group)
+ {
return group.CanAddGroups();
}
}
diff --git a/RdcMan/GroupChangedEventArgs.cs b/RdcMan/GroupChangedEventArgs.cs
index 4fff740..4e63c34 100644
--- a/RdcMan/GroupChangedEventArgs.cs
+++ b/RdcMan/GroupChangedEventArgs.cs
@@ -1,12 +1,15 @@
using System;
-namespace RdcMan {
- public class GroupChangedEventArgs : EventArgs {
+namespace RdcMan
+{
+ public class GroupChangedEventArgs : EventArgs
+ {
public GroupBase Group { get; private set; }
public ChangeType ChangeType { get; private set; }
- public GroupChangedEventArgs(GroupBase group, ChangeType changeType) {
+ public GroupChangedEventArgs(GroupBase group, ChangeType changeType)
+ {
Group = group;
ChangeType = changeType;
}
diff --git a/RdcMan/GroupDisplaySettings.cs b/RdcMan/GroupDisplaySettings.cs
index 07e34a0..228fdc6 100644
--- a/RdcMan/GroupDisplaySettings.cs
+++ b/RdcMan/GroupDisplaySettings.cs
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Windows.Forms;
-namespace RdcMan {
- public class GroupDisplaySettings : CommonDisplaySettings {
+namespace RdcMan
+{
+ public class GroupDisplaySettings : CommonDisplaySettings
+ {
private static Dictionary _settingProperties;
protected override Dictionary SettingProperties => _settingProperties;
@@ -16,11 +18,13 @@ public class GroupDisplaySettings : CommonDisplaySettings {
[Setting("showDisconnectedThumbnails", DefaultValue = true)]
public BoolSetting ShowDisconnectedThumbnails { get; protected set; }
- static GroupDisplaySettings() {
+ static GroupDisplaySettings()
+ {
typeof(GroupDisplaySettings).GetSettingProperties(out _settingProperties);
}
- public override TabPage CreateTabPage(TabbedSettingsDialog dialog) {
+ public override TabPage CreateTabPage(TabbedSettingsDialog dialog)
+ {
return new GroupDisplaySettingsTabPage(dialog, this);
}
}
diff --git a/RdcMan/GroupDisplaySettingsTabPage.cs b/RdcMan/GroupDisplaySettingsTabPage.cs
index bb9b8bb..ae27719 100644
--- a/RdcMan/GroupDisplaySettingsTabPage.cs
+++ b/RdcMan/GroupDisplaySettingsTabPage.cs
@@ -1,33 +1,41 @@
using System.Drawing;
-namespace RdcMan {
- public class GroupDisplaySettingsTabPage : DisplaySettingsTabPage {
+namespace RdcMan
+{
+ public class GroupDisplaySettingsTabPage : DisplaySettingsTabPage
+ {
private readonly RdcCheckBox _previewCheckBox;
private readonly RdcCheckBox _interactionCheckBox;
public GroupDisplaySettingsTabPage(TabbedSettingsDialog dialog, GroupDisplaySettings settings)
- : base(dialog, settings) {
+ : base(dialog, settings)
+ {
Create(out var rowIndex, out var num);
_previewCheckBox = FormTools.AddCheckBox(this, "ͼԤỰ(&P)", settings.SessionThumbnailPreview, 0, ref rowIndex, ref num);
_interactionCheckBox = FormTools.AddCheckBox(this, "ͼỰ(&A)", settings.AllowThumbnailSessionInteraction, 0, ref rowIndex, ref num);
_interactionCheckBox.Location = new Point(_previewCheckBox.Left + 24, _interactionCheckBox.Top);
- _previewCheckBox.CheckedChanged += delegate {
+ _previewCheckBox.CheckedChanged += delegate
+ {
PreviewCheckBoxChanged();
};
- if (base.InheritanceControl != null) {
- base.InheritanceControl.EnabledChanged += delegate {
+ if (base.InheritanceControl != null)
+ {
+ base.InheritanceControl.EnabledChanged += delegate
+ {
PreviewCheckBoxChanged();
};
}
FormTools.AddCheckBox(this, "ʾϿӵͼ(&D)", settings.ShowDisconnectedThumbnails, 0, ref rowIndex, ref num);
}
- private void PreviewCheckBoxChanged() {
+ private void PreviewCheckBoxChanged()
+ {
_interactionCheckBox.Enabled = _previewCheckBox.Checked && _previewCheckBox.Enabled;
}
- protected override void UpdateControls() {
+ protected override void UpdateControls()
+ {
base.UpdateControls();
PreviewCheckBoxChanged();
}
diff --git a/RdcMan/GroupPropertiesDialog.cs b/RdcMan/GroupPropertiesDialog.cs
index cf9ce85..bfa78ce 100644
--- a/RdcMan/GroupPropertiesDialog.cs
+++ b/RdcMan/GroupPropertiesDialog.cs
@@ -1,32 +1,41 @@
using System.Windows.Forms;
-namespace RdcMan {
- internal class GroupPropertiesDialog : GroupBasePropertiesDialog {
+namespace RdcMan
+{
+ internal class GroupPropertiesDialog : GroupBasePropertiesDialog
+ {
protected GroupPropertiesDialog(GroupBase group, string dialogTitle, string acceptButtonText, Form parentForm)
- : base(group, dialogTitle, acceptButtonText, parentForm) {
+ : base(group, dialogTitle, acceptButtonText, parentForm)
+ {
}
- public override void CreateControls(RdcTreeNode settingsNode) {
+ public override void CreateControls(RdcTreeNode settingsNode)
+ {
GroupPropertiesTabPage page = (GroupPropertiesTabPage)(base.PropertiesPage = settingsNode.Properties.CreateTabPage(this) as GroupPropertiesTabPage);
AddTabPage(page);
base.PropertiesPage.ParentGroupChanged += base.PopulateCredentialsProfiles;
base.CreateControls(settingsNode);
}
- public static GroupPropertiesDialog NewAddDialog(GroupBase parent) {
+ public static GroupPropertiesDialog NewAddDialog(GroupBase parent)
+ {
Group group = Group.CreateForAddDialog();
GroupPropertiesDialog groupPropertiesDialog = new GroupPropertiesDialog(group, "", "", null);
groupPropertiesDialog.CreateControls(group);
if (parent != null && !parent.CanAddGroups())
+ {
parent = null;
- if (!groupPropertiesDialog.PropertiesPage.PopulateParentDropDown(null, parent)) {
+ }
+ if (!groupPropertiesDialog.PropertiesPage.PopulateParentDropDown(null, parent))
+ {
groupPropertiesDialog.Dispose();
return null;
}
return groupPropertiesDialog;
}
- public static GroupPropertiesDialog NewPropertiesDialog(Group group, Form parentForm) {
+ public static GroupPropertiesDialog NewPropertiesDialog(Group group, Form parentForm)
+ {
GroupPropertiesDialog groupPropertiesDialog = new GroupPropertiesDialog(group, group.Text + " ", "ȷ", parentForm);
groupPropertiesDialog.CreateControls(group);
groupPropertiesDialog.PropertiesPage.PopulateParentDropDown(group, group.Parent as GroupBase);
diff --git a/RdcMan/GroupPropertiesTabPage.cs b/RdcMan/GroupPropertiesTabPage.cs
index 58c0b9f..3917636 100644
--- a/RdcMan/GroupPropertiesTabPage.cs
+++ b/RdcMan/GroupPropertiesTabPage.cs
@@ -1,7 +1,10 @@
-namespace RdcMan {
- internal class GroupPropertiesTabPage : GroupBasePropertiesTabPage {
+namespace RdcMan
+{
+ internal class GroupPropertiesTabPage : GroupBasePropertiesTabPage
+ {
public GroupPropertiesTabPage(TabbedSettingsDialog dialog, GroupSettings settings)
- : base(dialog, settings, settings.Name) {
+ : base(dialog, settings, settings.Name)
+ {
int rowIndex = 0;
int num = 0;
AddGroupName(ref rowIndex, ref num);
diff --git a/RdcMan/GroupSettings.cs b/RdcMan/GroupSettings.cs
index c4e43d3..f023a56 100644
--- a/RdcMan/GroupSettings.cs
+++ b/RdcMan/GroupSettings.cs
@@ -2,9 +2,11 @@
using System.Windows.Forms;
using System.Xml;
-namespace RdcMan {
- public class GroupSettings : CommonNodeSettings {
- //internal const string TabName = "";
+namespace RdcMan
+{
+ public class GroupSettings : CommonNodeSettings
+ {
+ //internal const string TabName = "Group Settings";
private static Dictionary _settingProperties;
@@ -15,7 +17,8 @@ public class GroupSettings : CommonNodeSettings {
protected override Dictionary SettingProperties => _settingProperties;
- static GroupSettings() {
+ static GroupSettings()
+ {
typeof(GroupSettings).GetSettingProperties(out _settingProperties);
}
@@ -23,18 +26,23 @@ static GroupSettings() {
protected GroupSettings(string name) : base(name) { }
- public override TabPage CreateTabPage(TabbedSettingsDialog dialog) {
+ public override TabPage CreateTabPage(TabbedSettingsDialog dialog)
+ {
return new GroupPropertiesTabPage(dialog, this);
}
- protected override void WriteSettings(XmlTextWriter tw, RdcTreeNode node) {
+ protected override void WriteSettings(XmlTextWriter tw, RdcTreeNode node)
+ {
HashSet hashSet = new HashSet();
if (string.IsNullOrEmpty(base.Comment.Value))
+ {
hashSet.Add(base.Comment);
-
+ }
base.WriteSettings(tw, node, hashSet);
}
- protected override void Copy(RdcTreeNode node) { }
+ protected override void Copy(RdcTreeNode node)
+ {
+ }
}
}
diff --git a/RdcMan/HeaderColumnClickEventArgs.cs b/RdcMan/HeaderColumnClickEventArgs.cs
index 92ebedd..5188457 100644
--- a/RdcMan/HeaderColumnClickEventArgs.cs
+++ b/RdcMan/HeaderColumnClickEventArgs.cs
@@ -1,12 +1,15 @@
using System;
-namespace RdcMan {
- public class HeaderColumnClickEventArgs : EventArgs {
+namespace RdcMan
+{
+ public class HeaderColumnClickEventArgs : EventArgs
+ {
public int Column { get; private set; }
public bool IsChecked { get; private set; }
- public HeaderColumnClickEventArgs(int column, bool isChecked) {
+ public HeaderColumnClickEventArgs(int column, bool isChecked)
+ {
Column = column;
IsChecked = isChecked;
}
diff --git a/RdcMan/HeaderColumnClickEventHandler.cs b/RdcMan/HeaderColumnClickEventHandler.cs
index ea88dd0..c058ef4 100644
--- a/RdcMan/HeaderColumnClickEventHandler.cs
+++ b/RdcMan/HeaderColumnClickEventHandler.cs
@@ -1,3 +1,4 @@
-namespace RdcMan {
+namespace RdcMan
+{
public delegate void HeaderColumnClickEventHandler(object sender, HeaderColumnClickEventArgs args);
}
diff --git a/RdcMan/Helpers.cs b/RdcMan/Helpers.cs
index a680adf..730ab88 100644
--- a/RdcMan/Helpers.cs
+++ b/RdcMan/Helpers.cs
@@ -8,16 +8,20 @@
using System.Xml;
using Win32;
-namespace RdcMan {
- public static class Helpers {
+namespace RdcMan
+{
+ public static class Helpers
+ {
public delegate void ReadXmlDelegate(XmlNode childNode, RdcTreeNode node, ICollection errors);
- private class OperationTimer : IDisposable {
- private readonly Stopwatch _stopWatch;
+ private class OperationTimer : IDisposable
+ {
+ private Stopwatch _stopWatch;
- private readonly string _text;
+ private string _text;
- public OperationTimer(string text) {
+ public OperationTimer(string text)
+ {
_text = text;
_stopWatch = new Stopwatch();
_stopWatch.Start();
@@ -25,33 +29,40 @@ public OperationTimer(string text) {
Log.AdjustIndent(1);
}
- void IDisposable.Dispose() {
+ void IDisposable.Dispose()
+ {
_stopWatch.Stop();
Log.AdjustIndent(-1);
Log.Write("Finished {0}: {1} ms", _text, _stopWatch.ElapsedMilliseconds);
}
}
- public static bool IsControlKeyPressed {
- get {
+ public static bool IsControlKeyPressed
+ {
+ get
+ {
short asyncKeyState = User.GetAsyncKeyState(17);
return (asyncKeyState & 0x8000) != 0;
}
}
- public static void Add(this Control.ControlCollection collection, params Control[] controls) {
+ public static void Add(this Control.ControlCollection collection, params Control[] controls)
+ {
collection.AddRange(controls);
}
- public static string GetName(this XmlNode node) {
+ public static string GetName(this XmlNode node)
+ {
XmlAttribute xmlAttribute = node.Attributes["name"];
return xmlAttribute != null ? xmlAttribute.Value : node.Name;
}
- public static string GetFullPath(this XmlNode node) {
+ public static string GetFullPath(this XmlNode node)
+ {
StringBuilder stringBuilder = new StringBuilder(node.GetName());
XmlNode parentNode = node.ParentNode;
- while (parentNode != null && !(parentNode is XmlDocument)) {
+ while (parentNode != null && !(parentNode is XmlDocument))
+ {
stringBuilder.Insert(0, "/");
stringBuilder.Insert(0, parentNode.GetName());
parentNode = parentNode.ParentNode;
@@ -59,21 +70,29 @@ public static string GetFullPath(this XmlNode node) {
return stringBuilder.ToString();
}
- public static void ForEach(this IEnumerable objects, Action action) {
+ public static void ForEach(this IEnumerable objects, Action action)
+ {
foreach (TObject @object in objects)
+ {
action(@object);
+ }
}
- public static void ForEach(this TreeNodeCollection objects, Action action) {
+ public static void ForEach(this TreeNodeCollection objects, Action action)
+ {
foreach (TreeNode @object in objects)
+ {
action(@object);
+ }
}
- public static TEnum ParseEnum(this string value) where TEnum : struct {
+ public static TEnum ParseEnum(this string value) where TEnum : struct
+ {
return (TEnum)Enum.Parse(typeof(TEnum), value);
}
- public static IEnumerable EnumValues() where TEnum : struct {
+ public static IEnumerable EnumValues() where TEnum : struct
+ {
return Enum.GetValues(typeof(TEnum)).Cast();
}
@@ -86,45 +105,57 @@ public static string SortOrderToString(SortOrder sortOrder) {
};
}
- public static string GetTemporaryFileName(string fileName, string suffix) {
+ public static string GetTemporaryFileName(string fileName, string suffix)
+ {
string text = fileName + suffix;
int num = 0;
while (File.Exists(text))
+ {
text = fileName + suffix + num++;
-
+ }
return text;
}
- public static void MoveTemporaryToPermanent(string newFileName, string fileName, bool saveOld) {
+ public static void MoveTemporaryToPermanent(string newFileName, string fileName, bool saveOld)
+ {
string temporaryFileName = GetTemporaryFileName(fileName, ".old");
if (File.Exists(fileName))
+ {
File.Move(fileName, temporaryFileName);
-
+ }
File.Move(newFileName, fileName);
-
if (!saveOld)
+ {
File.Delete(temporaryFileName);
+ }
}
- public static int NaturalCompare(string x, string y) {
+ public static int NaturalCompare(string x, string y)
+ {
int i = 0;
int i2 = 0;
- while (i < x.Length && i2 < y.Length) {
+ while (i < x.Length && i2 < y.Length)
+ {
char c = char.ToLowerInvariant(x[i]);
char c2 = char.ToLowerInvariant(y[i]);
- if (char.IsDigit(c) && char.IsDigit(c2)) {
+ if (char.IsDigit(c) && char.IsDigit(c2))
+ {
uint num = ParseNumber(x, ref i);
uint num2 = ParseNumber(y, ref i2);
if (num != num2)
return num >= num2 ? 1 : -1;
if (i != i2)
+ {
return i2 - i;
+ }
}
- else {
+ else
+ {
if (c != c2)
+ {
return c - c2;
-
+ }
i++;
i2++;
}
@@ -132,15 +163,18 @@ public static int NaturalCompare(string x, string y) {
return x.Length - y.Length;
}
- private static uint ParseNumber(string s, ref int i) {
+ private static uint ParseNumber(string s, ref int i)
+ {
uint num = (uint)(s[i] - 48);
while (++i < s.Length && char.IsDigit(s[i]))
+ {
num = num * 10 + s[i] - 48;
-
+ }
return num;
}
- public static IDisposable Timer(string format, params object[] args) {
+ public static IDisposable Timer(string format, params object[] args)
+ {
return new OperationTimer(format.InvariantFormat(args));
}
diff --git a/RdcMan/HotKeyBox.cs b/RdcMan/HotKeyBox.cs
index 1e09702..489eb8f 100644
--- a/RdcMan/HotKeyBox.cs
+++ b/RdcMan/HotKeyBox.cs
@@ -1,43 +1,57 @@
using System.Windows.Forms;
-namespace RdcMan {
- public class HotKeyBox : TextBox, ISettingControl {
+namespace RdcMan
+{
+ public class HotKeyBox : TextBox, ISettingControl
+ {
private Keys _hotKey;
public string Prefix { get; set; }
public EnumSetting Setting { get; set; }
- public Keys HotKey {
+ public Keys HotKey
+ {
get => _hotKey;
- set {
+ set
+ {
_hotKey = value;
Text = string.Concat(str1: (HotKey == Keys.Next) ? "PageDown" : ((HotKey == Keys.Cancel) ? "Break" : ((HotKey >= Keys.D0 && HotKey <= Keys.D9) ? ((int)(HotKey - 48)).ToString() : ((HotKey < Keys.NumPad0 || HotKey > Keys.NumPad9) ? HotKey.ToString() : ((int)(HotKey - 96) + " (num pad)")))), str0: Prefix).ToUpper();
}
}
- protected override bool ProcessCmdKey(ref Message m, Keys keyData) {
+ protected override bool ProcessCmdKey(ref Message m, Keys keyData)
+ {
Keys keys = keyData & Keys.KeyCode;
if (keys == Keys.Tab || keys == Keys.Escape)
+ {
return base.ProcessCmdKey(ref m, keyData);
-
+ }
if ((keyData & Keys.Modifiers) == 0 || keys == Keys.Cancel)
+ {
HotKey = keys;
-
+ }
return true;
}
- void ISettingControl.UpdateControl() {
+ void ISettingControl.UpdateControl()
+ {
if (Setting != null)
+ {
HotKey = Setting.Value;
+ }
}
- void ISettingControl.UpdateSetting() {
+ void ISettingControl.UpdateSetting()
+ {
if (Setting != null)
+ {
Setting.Value = HotKey;
+ }
}
- string ISettingControl.Validate() {
+ string ISettingControl.Validate()
+ {
return null;
}
}
diff --git a/RdcMan/IBuiltInVirtualGroup.cs b/RdcMan/IBuiltInVirtualGroup.cs
index 74f07f6..960aecc 100644
--- a/RdcMan/IBuiltInVirtualGroup.cs
+++ b/RdcMan/IBuiltInVirtualGroup.cs
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Xml;
-namespace RdcMan {
- internal interface IBuiltInVirtualGroup {
+namespace RdcMan
+{
+ internal interface IBuiltInVirtualGroup
+ {
string XmlNodeName { get; }
string Text { get; }
diff --git a/RdcMan/ICredentialsTabPage.cs b/RdcMan/ICredentialsTabPage.cs
index 0cd448d..2f472ef 100644
--- a/RdcMan/ICredentialsTabPage.cs
+++ b/RdcMan/ICredentialsTabPage.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public interface ICredentialsTabPage {
+namespace RdcMan
+{
+ public interface ICredentialsTabPage
+ {
CredentialsProfile Credentials { get; }
void PopulateCredentialsProfiles(FileGroup file);
diff --git a/RdcMan/IDeferDecryption.cs b/RdcMan/IDeferDecryption.cs
index d988fad..9e661b4 100644
--- a/RdcMan/IDeferDecryption.cs
+++ b/RdcMan/IDeferDecryption.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public interface IDeferDecryption {
+namespace RdcMan
+{
+ public interface IDeferDecryption
+ {
bool IsDecrypted { get; set; }
void Decrypt(EncryptionSettings settings);
diff --git a/RdcMan/ILogonCredentials.cs b/RdcMan/ILogonCredentials.cs
index 4551d34..840303a 100644
--- a/RdcMan/ILogonCredentials.cs
+++ b/RdcMan/ILogonCredentials.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public interface ILogonCredentials {
+namespace RdcMan
+{
+ public interface ILogonCredentials
+ {
string ProfileName { get; }
ProfileScope ProfileScope { get; }
diff --git a/RdcMan/IMainForm.cs b/RdcMan/IMainForm.cs
index 9817d5a..0b5e042 100644
--- a/RdcMan/IMainForm.cs
+++ b/RdcMan/IMainForm.cs
@@ -1,8 +1,10 @@
using System;
using System.Windows.Forms;
-namespace RdcMan {
- public interface IMainForm {
+namespace RdcMan
+{
+ public interface IMainForm
+ {
MenuStrip MainMenuStrip { get; }
bool RegisterShortcut(Keys shortcutKey, Action action);
diff --git a/RdcMan/INodePropertiesPage.cs b/RdcMan/INodePropertiesPage.cs
index 2bc3e51..f9ba964 100644
--- a/RdcMan/INodePropertiesPage.cs
+++ b/RdcMan/INodePropertiesPage.cs
@@ -1,7 +1,9 @@
using System;
-namespace RdcMan {
- public interface INodePropertiesPage {
+namespace RdcMan
+{
+ public interface INodePropertiesPage
+ {
GroupBase ParentGroup { get; }
event Action ParentGroupChanged;
diff --git a/RdcMan/IPlugin.cs b/RdcMan/IPlugin.cs
index 3c875d6..de342d5 100644
--- a/RdcMan/IPlugin.cs
+++ b/RdcMan/IPlugin.cs
@@ -1,8 +1,10 @@
using System.Windows.Forms;
using System.Xml;
-namespace RdcMan {
- public interface IPlugin {
+namespace RdcMan
+{
+ public interface IPlugin
+ {
void PreLoad(IPluginContext context, XmlNode xmlNode);
void PostLoad(IPluginContext context);
diff --git a/RdcMan/IPluginContext.cs b/RdcMan/IPluginContext.cs
index 92a9f88..356bc58 100644
--- a/RdcMan/IPluginContext.cs
+++ b/RdcMan/IPluginContext.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public interface IPluginContext {
+namespace RdcMan
+{
+ public interface IPluginContext
+ {
IMainForm MainForm { get; }
IServerTree Tree { get; }
diff --git a/RdcMan/IRdpClient.cs b/RdcMan/IRdpClient.cs
index d74ca10..f1315d9 100644
--- a/RdcMan/IRdpClient.cs
+++ b/RdcMan/IRdpClient.cs
@@ -1,3 +1,4 @@
-namespace RdcMan {
+namespace RdcMan
+{
internal interface IRdpClient { }
}
diff --git a/RdcMan/IServerRefFactory.cs b/RdcMan/IServerRefFactory.cs
index a0e7c10..1321194 100644
--- a/RdcMan/IServerRefFactory.cs
+++ b/RdcMan/IServerRefFactory.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- internal interface IServerRefFactory {
+namespace RdcMan
+{
+ internal interface IServerRefFactory
+ {
ServerRef Create(Server server);
}
}
diff --git a/RdcMan/IServerTree.cs b/RdcMan/IServerTree.cs
index 849c1ba..53c535c 100644
--- a/RdcMan/IServerTree.cs
+++ b/RdcMan/IServerTree.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public interface IServerTree {
+namespace RdcMan
+{
+ public interface IServerTree
+ {
GroupBase RootNode { get; }
void AddNode(RdcTreeNode node, GroupBase parent);
diff --git a/RdcMan/ISetting.cs b/RdcMan/ISetting.cs
index 2bb5097..cd0cbbe 100644
--- a/RdcMan/ISetting.cs
+++ b/RdcMan/ISetting.cs
@@ -1,7 +1,9 @@
using System.Xml;
-namespace RdcMan {
- public interface ISetting {
+namespace RdcMan
+{
+ public interface ISetting
+ {
void ReadXml(XmlNode xmlNode, RdcTreeNode node);
void WriteXml(XmlTextWriter tw, RdcTreeNode node);
diff --git a/RdcMan/ISettingControl.cs b/RdcMan/ISettingControl.cs
index e25679e..e9b7479 100644
--- a/RdcMan/ISettingControl.cs
+++ b/RdcMan/ISettingControl.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public interface ISettingControl {
+namespace RdcMan
+{
+ public interface ISettingControl
+ {
void UpdateControl();
void UpdateSetting();
diff --git a/RdcMan/ISettingsTabPage.cs b/RdcMan/ISettingsTabPage.cs
index 9d11bc7..ef2d419 100644
--- a/RdcMan/ISettingsTabPage.cs
+++ b/RdcMan/ISettingsTabPage.cs
@@ -1,7 +1,9 @@
using System.Windows.Forms;
-namespace RdcMan {
- public interface ISettingsTabPage {
+namespace RdcMan
+{
+ public interface ISettingsTabPage
+ {
InheritanceControl InheritanceControl { get; }
Control FocusControl { get; }
diff --git a/RdcMan/IUndockedServerForm.cs b/RdcMan/IUndockedServerForm.cs
index 01467b6..0f6ec5e 100644
--- a/RdcMan/IUndockedServerForm.cs
+++ b/RdcMan/IUndockedServerForm.cs
@@ -1,7 +1,9 @@
using System.Windows.Forms;
-namespace RdcMan {
- public interface IUndockedServerForm {
+namespace RdcMan
+{
+ public interface IUndockedServerForm
+ {
MenuStrip MainMenuStrip { get; }
ServerBase Server { get; }
diff --git a/RdcMan/ImageConstants.cs b/RdcMan/ImageConstants.cs
index be1de20..46a3b4c 100644
--- a/RdcMan/ImageConstants.cs
+++ b/RdcMan/ImageConstants.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public enum ImageConstants {
+namespace RdcMan
+{
+ public enum ImageConstants
+ {
DisconnectedServer,
ConnectingServer,
ConnectingSelectedServer,
diff --git a/RdcMan/ImportServersPropertiesPage.cs b/RdcMan/ImportServersPropertiesPage.cs
index 3b252a9..5bc5eb5 100644
--- a/RdcMan/ImportServersPropertiesPage.cs
+++ b/RdcMan/ImportServersPropertiesPage.cs
@@ -5,26 +5,31 @@
using System.Text.RegularExpressions;
using System.Windows.Forms;
-namespace RdcMan {
- internal class ImportServersPropertiesPage : NodePropertiesPage {
- private readonly RdcTextBox _fileNameTextBox;
+namespace RdcMan
+{
+ internal class ImportServersPropertiesPage : NodePropertiesPage
+ {
+ private RdcTextBox _fileNameTextBox;
- private readonly RdcTextBox _serversTextBox;
+ private RdcTextBox _serversTextBox;
public List ExpandedServerNames { get; private set; }
public ImportServersPropertiesPage(TabbedSettingsDialog dialog)
- : base(dialog, (SettingsGroup)null, "") {
+ : base(dialog, (SettingsGroup)null, "")
+ {
int num = 0;
int num2 = 0;
- Label value = new Label {
+ Label value = new Label
+ {
Location = FormTools.NewLocation(0, num2),
Size = new Size(480, 48),
Text = "ѡзϢļıϢɶźͻзָչ."
};
num2 += 2;
base.Controls.Add(value);
- Button browseButton = new Button {
+ Button browseButton = new Button
+ {
TabIndex = num++,
Text = "(&B)"
};
@@ -40,10 +45,12 @@ public ImportServersPropertiesPage(TabbedSettingsDialog dialog)
num2 += 6;
base.Controls.Add(browseButton, _serversTextBox);
AddParentCombo(ref num2, ref num);
- _fileNameTextBox.TextChanged += delegate {
+ _fileNameTextBox.TextChanged += delegate
+ {
_serversTextBox.Enabled = string.IsNullOrEmpty(_fileNameTextBox.Text);
};
- _serversTextBox.TextChanged += delegate {
+ _serversTextBox.TextChanged += delegate
+ {
RdcTextBox fileNameTextBox = _fileNameTextBox;
bool enabled = (browseButton.Enabled = string.IsNullOrEmpty(_serversTextBox.Text));
fileNameTextBox.Enabled = enabled;
@@ -51,45 +58,55 @@ public ImportServersPropertiesPage(TabbedSettingsDialog dialog)
base.FocusControl = _fileNameTextBox;
}
- protected override bool IsValid() {
+ protected override bool IsValid()
+ {
Control c = _serversTextBox;
string text = _serversTextBox.Text;
base.Dialog.SetError(_serversTextBox, null);
base.Dialog.SetError(_fileNameTextBox, null);
- if (!string.IsNullOrEmpty(_fileNameTextBox.Text)) {
+ if (!string.IsNullOrEmpty(_fileNameTextBox.Text))
+ {
c = _fileNameTextBox;
- try {
+ try
+ {
text = File.ReadAllText(_fileNameTextBox.Text);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
base.Dialog.SetError(_fileNameTextBox, ex.Message);
return false;
}
}
- if (string.IsNullOrWhiteSpace(text)) {
+ if (string.IsNullOrWhiteSpace(text))
+ {
base.Dialog.SetError(_fileNameTextBox, "ļ");
return false;
}
- try {
+ try
+ {
List list = new List();
text = text.Replace(Environment.NewLine, ",");
MatchCollection matchCollection = Regex.Matches(text, "([^,\\{\\s]*\\{[^\\}]*\\}[^,\\{,\\}\\s]*)|([^,\\{\\}\\s]+)");
- foreach (Match item in matchCollection) {
+ foreach (Match item in matchCollection)
+ {
list.AddRange(StringUtilities.ExpandPattern(item.Groups[0].Value.Trim()));
}
ExpandedServerNames = list;
}
- catch (Exception ex2) {
+ catch (Exception ex2)
+ {
base.Dialog.SetError(c, ex2.Message);
}
return true;
}
- protected override bool CanBeParent(GroupBase group) {
+ protected override bool CanBeParent(GroupBase group)
+ {
return group.CanAddServers();
}
- private void OnBrowseClick(object sender, EventArgs e) {
+ private void OnBrowseClick(object sender, EventArgs e)
+ {
using OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Title = "";
openFileDialog.DefaultExt = "txt";
@@ -98,7 +115,9 @@ private void OnBrowseClick(object sender, EventArgs e) {
openFileDialog.RestoreDirectory = false;
openFileDialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK)
+ {
_fileNameTextBox.Text = openFileDialog.FileName;
+ }
}
}
}
diff --git a/RdcMan/InheritSettingsType.cs b/RdcMan/InheritSettingsType.cs
index 42831f4..b6fee5d 100644
--- a/RdcMan/InheritSettingsType.cs
+++ b/RdcMan/InheritSettingsType.cs
@@ -1,27 +1,33 @@
using System;
using System.Xml;
-namespace RdcMan {
- public class InheritSettingsType {
+namespace RdcMan
+{
+ public class InheritSettingsType
+ {
public InheritanceMode Mode { get; set; }
- public InheritSettingsType() {
+ public InheritSettingsType()
+ {
Mode = InheritanceMode.FromParent;
}
- public GroupBase GetInheritedSettingsNode(RdcTreeNode node) {
- switch (Mode) {
- case InheritanceMode.None:
- case InheritanceMode.Disabled:
- return null;
- case InheritanceMode.FromParent:
+ public GroupBase GetInheritedSettingsNode(RdcTreeNode node)
+ {
+ switch (Mode)
+ {
+ case InheritanceMode.None:
+ case InheritanceMode.Disabled:
+ return null;
+ case InheritanceMode.FromParent:
return (node.Parent != null) ? node.Parent as GroupBase : DefaultSettingsGroup.Instance;
- default:
- throw new Exception("Unexpected inheritance kind");
+ default:
+ throw new Exception("Unexpected inheritance kind");
}
}
- public void WriteXml(XmlTextWriter tw) {
+ public void WriteXml(XmlTextWriter tw)
+ {
tw.WriteAttributeString("inherit", Mode.ToString());
}
}
diff --git a/RdcMan/InheritanceControl.cs b/RdcMan/InheritanceControl.cs
index f74652c..ff86ecd 100644
--- a/RdcMan/InheritanceControl.cs
+++ b/RdcMan/InheritanceControl.cs
@@ -3,8 +3,10 @@
using System.Linq;
using System.Windows.Forms;
-namespace RdcMan {
- public class InheritanceControl {
+namespace RdcMan
+{
+ public class InheritanceControl
+ {
public CheckBox FromParentCheck;
//private const string SourcePrefix = "Source: ";
@@ -23,15 +25,18 @@ public class InheritanceControl {
public event Action EnabledChanged;
- public InheritanceControl(TabbedSettingsDialog dialog, string settingsGroupName) {
+ public InheritanceControl(TabbedSettingsDialog dialog, string settingsGroupName)
+ {
_dialog = dialog;
_settingsGroupName = settingsGroupName;
_sourceNode = DefaultSettingsGroup.Instance;
_enabled = true;
}
- public void Create(Control parent, ref int rowIndex, ref int tabIndex) {
- _disabledLabel = new Label {
+ public void Create(Control parent, ref int rowIndex, ref int tabIndex)
+ {
+ _disabledLabel = new Label
+ {
Enabled = true,
Location = new Point(0, (parent.Height - FormTools.ControlHeight) / 2),
Size = new Size(parent.Width, FormTools.ControlHeight),
@@ -40,7 +45,8 @@ public void Create(Control parent, ref int rowIndex, ref int tabIndex) {
};
FromParentCheck = FormTools.NewCheckBox("Ӹ̳(&H)", 1, rowIndex++, tabIndex++);
FromParentCheck.CheckedChanged += CheckChangedHandler;
- _sourceButton = new Button {
+ _sourceButton = new Button
+ {
Location = FormTools.NewLocation(1, rowIndex++)
};
_sourceButton.Size = new Size(340, _sourceButton.Height);
@@ -51,17 +57,20 @@ public void Create(Control parent, ref int rowIndex, ref int tabIndex) {
parent.Controls.Add(_sourceButton);
}
- private void SourceButton_Click(object sender, EventArgs e) {
+ private void SourceButton_Click(object sender, EventArgs e)
+ {
string activeTabName = ((_sourceButton.Parent is TabPage tabPage) ? tabPage.Text : string.Empty);
_sourceNode.DoPropertiesDialog(_sourceButton.FindForm(), activeTabName);
}
- private void SourceButton_TextChanged(object sender, EventArgs e) {
+ private void SourceButton_TextChanged(object sender, EventArgs e)
+ {
string text = _sourceButton.Text;
Graphics graphics = _sourceButton.CreateGraphics();
bool flag = false;
SizeF sizeF = graphics.MeasureString(text, _sourceButton.Font);
- while (Math.Round(sizeF.Width, 1) > (double)_sourceButton.Width) {
+ while (Math.Round(sizeF.Width, 1) > (double)_sourceButton.Width)
+ {
double num = Math.Round(sizeF.Width, 0) - (double)_sourceButton.Width;
int num2 = (int)Math.Round(num / (double)_sourceButton.Font.Size, 0) + 4;
text = "Source: ..." + text.Substring(num2 + "Source: ".Length);
@@ -69,76 +78,109 @@ private void SourceButton_TextChanged(object sender, EventArgs e) {
sizeF = graphics.MeasureString(text, _sourceButton.Font);
}
if (flag)
+ {
_sourceButton.Text = text;
+ }
}
- public void UpdateControlsFromSettings(InheritSettingsType settings) {
+ public void UpdateControlsFromSettings(InheritSettingsType settings)
+ {
bool flag = settings.Mode == InheritanceMode.FromParent;
if (flag != FromParentCheck.Checked)
+ {
FromParentCheck.Checked = flag;
+ }
else
+ {
OnSettingChanged();
+ }
}
- public void Enable(bool value, string reason) {
+ public void Enable(bool value, string reason)
+ {
_enabled = value;
_disabledLabel.Text = "Щò {0}".InvariantFormat(reason);
- foreach (Control control in FromParentCheck.Parent.Controls) {
+ foreach (Control control in FromParentCheck.Parent.Controls)
+ {
control.Visible = _enabled;
}
_disabledLabel.Enabled = !_enabled;
_disabledLabel.Visible = !_enabled;
if (_enabled)
+ {
OnSettingChanged();
+ }
}
- private void CheckChangedHandler(object sender, EventArgs e) {
+ private void CheckChangedHandler(object sender, EventArgs e)
+ {
OnSettingChanged();
}
- private void OnSettingChanged() {
+ private void OnSettingChanged()
+ {
CheckBox fromParentCheck = FromParentCheck;
EnableDisableControls(!fromParentCheck.Checked);
- if (fromParentCheck.Checked) {
+ if (fromParentCheck.Checked)
+ {
GroupBase groupBase = _dialog.TabPages.OfType().First().ParentGroup;
- if (groupBase != _sourceNode) {
+ if (groupBase != _sourceNode)
+ {
if (groupBase == null)
+ {
_sourceNode = DefaultSettingsGroup.Instance;
- else {
- while (true) {
+ }
+ else
+ {
+ while (true)
+ {
SettingsGroup settingsGroupByName = groupBase.GetSettingsGroupByName(_settingsGroupName);
if (settingsGroupByName.InheritSettingsType.Mode != 0)
+ {
break;
-
+ }
groupBase = settingsGroupByName.InheritSettingsType.GetInheritedSettingsNode(groupBase);
}
_sourceNode = groupBase;
}
}
if (_sourceNode != DefaultSettingsGroup.Instance)
+ {
_sourceButton.Text = "Source: " + _sourceNode.FullPath;
+ }
else
+ {
_sourceButton.Text = "Source: Ĭ";
-
+ }
_sourceButton.Show();
}
else
+ {
_sourceButton.Hide();
+ }
}
- public void EnableDisableControls(bool enable) {
- foreach (Control control in FromParentCheck.Parent.Controls) {
+ public void EnableDisableControls(bool enable)
+ {
+ foreach (Control control in FromParentCheck.Parent.Controls)
+ {
if (control != FromParentCheck && control != _sourceButton)
+ {
control.Enabled = enable;
+ }
}
if (this.EnabledChanged != null)
+ {
this.EnabledChanged(enable);
+ }
}
- public InheritanceMode GetInheritanceMode() {
+ public InheritanceMode GetInheritanceMode()
+ {
if (FromParentCheck.Checked)
+ {
return InheritanceMode.FromParent;
-
+ }
return InheritanceMode.None;
}
}
diff --git a/RdcMan/InheritanceMode.cs b/RdcMan/InheritanceMode.cs
index 9ec554e..1ef64a7 100644
--- a/RdcMan/InheritanceMode.cs
+++ b/RdcMan/InheritanceMode.cs
@@ -1,5 +1,7 @@
-namespace RdcMan {
- public enum InheritanceMode {
+namespace RdcMan
+{
+ public enum InheritanceMode
+ {
FromParent,
None,
Disabled
diff --git a/RdcMan/IntSetting.cs b/RdcMan/IntSetting.cs
index bb4f301..e8b1c75 100644
--- a/RdcMan/IntSetting.cs
+++ b/RdcMan/IntSetting.cs
@@ -1,10 +1,13 @@
using System.Xml;
-namespace RdcMan {
- public class IntSetting : Setting {
+namespace RdcMan
+{
+ public class IntSetting : Setting
+ {
public IntSetting(object o) : base(o) { }
- public override void ReadXml(XmlNode xmlNode, RdcTreeNode node) {
+ public override void ReadXml(XmlNode xmlNode, RdcTreeNode node)
+ {
base.Value = int.Parse(xmlNode.FirstChild.InnerText);
}
}
diff --git a/RdcMan/ListSessionsForm.cs b/RdcMan/ListSessionsForm.cs
index b447455..0c803b7 100644
--- a/RdcMan/ListSessionsForm.cs
+++ b/RdcMan/ListSessionsForm.cs
@@ -7,8 +7,10 @@
using System.Windows.Forms;
using Win32;
-namespace RdcMan {
- internal class ListSessionsForm : Form {
+namespace RdcMan
+{
+ internal class ListSessionsForm : Form
+ {
//private IContainer components;
public Label StatusLabel;
@@ -33,11 +35,14 @@ internal class ListSessionsForm : Form {
private bool _areQuerying;
- protected override void Dispose(bool disposing) {
- //if (disposing && components != null)
- // components.Dispose();
- base.Dispose(disposing);
- }
+ //protected override void Dispose(bool disposing)
+ //{
+ // if (disposing && components != null)
+ // {
+ // components.Dispose();
+ // }
+ // base.Dispose(disposing);
+ //}
private void InitializeComponent() {
base.SuspendLayout();
@@ -86,10 +91,10 @@ private void InitializeComponent() {
UseVisualStyleBackColor = true
};
this.RefreshButton.Click += new EventHandler(RefreshButton_Click);
+ base.ClientSize = new Size(366, 206);
base.Controls.Add(this.RefreshButton);
base.Controls.Add(this.SessionListView);
base.Controls.Add(this.StatusLabel);
- base.ClientSize = new Size(366, 206);
base.Name = "ListSessionsForm";
base.Load += new EventHandler(ListSessionsForm_Load);
base.SizeChanged += new EventHandler(ListSessionsForm_SizeChanged);
@@ -98,7 +103,8 @@ private void InitializeComponent() {
base.ResumeLayout(false);
}
- public ListSessionsForm(ServerBase server) {
+ public ListSessionsForm(ServerBase server)
+ {
InitializeComponent();
_remoteSessions = new RemoteSessions(server);
_areQuerying = true;
@@ -112,21 +118,25 @@ public ListSessionsForm(ServerBase server) {
base.Icon = Program.TheForm.Icon;
}
- private ListViewItem GetSelection() {
+ private ListViewItem GetSelection()
+ {
ListView sessionListView = SessionListView;
if (sessionListView.SelectedItems.Count != 1)
+ {
return null;
-
+ }
IEnumerator enumerator = sessionListView.SelectedItems.GetEnumerator();
enumerator.MoveNext();
return enumerator.Current as ListViewItem;
}
- private void ListSessionsForm_Load(object sender, EventArgs e) {
+ private void ListSessionsForm_Load(object sender, EventArgs e)
+ {
ThreadPool.QueueUserWorkItem(OpenThreadProc, this);
}
- private static void OpenThreadProc(object o) {
+ private static void OpenThreadProc(object o)
+ {
ListSessionsForm form = o as ListSessionsForm;
if (!form._remoteSessions.OpenServer()) {
form.Invoke((MethodInvoker)delegate {
@@ -134,15 +144,20 @@ private static void OpenThreadProc(object o) {
});
}
else
+ {
QuerySessions(form);
+ }
}
- private static void QuerySessions(object o) {
+ private static void QuerySessions(object o)
+ {
ListSessionsForm form = o as ListSessionsForm;
- if (form.IsDisposed) {
+ if (form.IsDisposed)
+ {
return;
}
- form.Invoke((MethodInvoker)delegate {
+ form.Invoke((MethodInvoker)delegate
+ {
form.SessionListView.BeginUpdate();
form.SessionListView.Items.Clear();
});
@@ -153,20 +168,24 @@ private static void QuerySessions(object o) {
});
return;
}
- foreach (RemoteSessionInfo item in list) {
+ foreach (RemoteSessionInfo item in list)
+ {
Wts.ConnectstateClass connectstateClass = item.State;
string text = ((item.DomainName.Length <= 0) ? item.UserName : (item.DomainName + "\\" + item.UserName));
- ListViewItem value = new ListViewItem {
+ ListViewItem value = new ListViewItem
+ {
Text = item.SessionId.ToString()
};
value.SubItems.Add(connectstateClass.ToString());
value.SubItems.Add(text);
value.SubItems.Add(item.ClientName);
- form.Invoke((MethodInvoker)delegate {
+ form.Invoke((MethodInvoker)delegate
+ {
form.SessionListView.Items.Add(value);
});
}
- form.Invoke((MethodInvoker)delegate {
+ form.Invoke((MethodInvoker)delegate
+ {
int count = form.SessionListView.Items.Count;
form.StatusLabel.Text = count + " Ự";
form.SortListView();
@@ -175,42 +194,50 @@ private static void QuerySessions(object o) {
});
}
- private void ListSessionsForm_FormClosed(object sender, FormClosedEventArgs e) {
+ private void ListSessionsForm_FormClosed(object sender, FormClosedEventArgs e)
+ {
_remoteSessions.CloseServer();
}
- private void RefreshButton_Click(object sender, EventArgs e) {
+ private void RefreshButton_Click(object sender, EventArgs e)
+ {
RefreshSessions();
}
- private void RefreshSessions() {
- lock (_queryLock) {
+ private void RefreshSessions()
+ {
+ lock (_queryLock)
+ {
if (_areQuerying)
+ {
return;
-
+ }
_areQuerying = true;
}
StatusLabel.Text = "ˢ...";
ThreadPool.QueueUserWorkItem(QuerySessions, this);
}
- private void OnContextMenu(object sender, EventArgs e) {
+ private void OnContextMenu(object sender, EventArgs e)
+ {
ContextMenu contextMenu = sender as ContextMenu;
ListViewItem selection = GetSelection();
- if (selection != null) {
+ if (selection != null)
+ {
contextMenu.MenuItems.Clear();
Wts.ConnectstateClass connectstateClass;
- switch (selection.SubItems[1].Text) {
- case "Active":
- case "Connected":
- connectstateClass = Wts.ConnectstateClass.Connected;
- break;
- case "Disconnected":
- connectstateClass = Wts.ConnectstateClass.Disconnected;
- break;
- default:
- connectstateClass = Wts.ConnectstateClass.ConnectQuery;
- break;
+ switch (selection.SubItems[1].Text)
+ {
+ case "Active":
+ case "Connected":
+ connectstateClass = Wts.ConnectstateClass.Connected;
+ break;
+ case "Disconnected":
+ connectstateClass = Wts.ConnectstateClass.Disconnected;
+ break;
+ default:
+ connectstateClass = Wts.ConnectstateClass.ConnectQuery;
+ break;
}
MenuItem item = new MenuItem("Ͽ(&D)", DisconnectSession) {
Enabled = (connectstateClass == Wts.ConnectstateClass.Connected)
@@ -223,46 +250,56 @@ private void OnContextMenu(object sender, EventArgs e) {
}
}
- private void DisconnectSession(object sender, EventArgs e) {
+ private void DisconnectSession(object sender, EventArgs e)
+ {
ListViewItem selection = GetSelection();
- if (int.TryParse(selection.SubItems[0].Text, out var result)) {
+ if (int.TryParse(selection.SubItems[0].Text, out var result))
+ {
_remoteSessions.DisconnectSession(result);
RefreshSessions();
}
}
- private void LogOffSession(object sender, EventArgs e) {
+ private void LogOffSession(object sender, EventArgs e)
+ {
ListViewItem selection = GetSelection();
- if (int.TryParse(selection.SubItems[0].Text, out var result)) {
+ if (int.TryParse(selection.SubItems[0].Text, out var result))
+ {
_remoteSessions.LogOffSession(result);
RefreshSessions();
}
}
- private void ListSessionsForm_Resize(object sender, EventArgs e) {
+ private void ListSessionsForm_Resize(object sender, EventArgs e)
+ {
SessionListView.Width = RefreshButton.Right - SessionListView.Left;
}
- private void SessionListView_ColumnClick(object sender, ColumnClickEventArgs e) {
+ private void SessionListView_ColumnClick(object sender, ColumnClickEventArgs e)
+ {
_sortOrder = new int[1];
int num = 0;
_sortOrder[num++] = e.Column;
SortListView();
}
- private void SortListView() {
+ private void SortListView()
+ {
ArrayList arrayList = new ArrayList(SessionListView.Items.Count);
foreach (ListViewItem item in SessionListView.Items)
+ {
arrayList.Add(item);
-
+ }
arrayList.Sort(new SessionListSortComparer(_sortOrder));
SessionListView.Items.Clear();
-
foreach (ListViewItem item2 in arrayList)
+ {
SessionListView.Items.Add(item2);
+ }
}
- private void ListSessionsForm_SizeChanged(object sender, EventArgs e) {
+ private void ListSessionsForm_SizeChanged(object sender, EventArgs e)
+ {
int num = Math.Max(20, base.ClientRectangle.Width - SessionListView.Location.X * 2);
int num2 = Math.Max(20, base.ClientRectangle.Height - SessionListView.Location.Y - 10);
SessionListView.Size = new Size(num, num2);
diff --git a/RdcMan/ListSetting.cs b/RdcMan/ListSetting.cs
index b7ac66e..aba779e 100644
--- a/RdcMan/ListSetting.cs
+++ b/RdcMan/ListSetting.cs
@@ -2,29 +2,40 @@
using System.Collections.Generic;
using System.Xml;
-namespace RdcMan {
- public class ListSetting : Setting> where T : class {
- //private const string XmlNodeName = "item";
+namespace RdcMan
+{
+ public class ListSetting : Setting> where T : class
+ {
+ private const string XmlNodeName = "item";
public ListSetting(object o)
- : base(o) {
+ : base(o)
+ {
if (base.Value == null)
+ {
base.Value = new List();
+ }
}
- public override void ReadXml(XmlNode xmlNode, RdcTreeNode node) {
+ public override void ReadXml(XmlNode xmlNode, RdcTreeNode node)
+ {
List list = new List();
- foreach (XmlNode childNode in xmlNode.ChildNodes) {
- if (childNode.Name != "item")
+ foreach (XmlNode childNode in xmlNode.ChildNodes)
+ {
+ if (childNode.Name != XmlNodeName)
+ {
throw new Exception();
+ }
list.Add(childNode.InnerText as T);
}
base.Value = list;
}
- public override void WriteXml(XmlTextWriter tw, RdcTreeNode node) {
- foreach (T item in base.Value) {
- tw.WriteElementString("item", item.ToString());
+ public override void WriteXml(XmlTextWriter tw, RdcTreeNode node)
+ {
+ foreach (T item in base.Value)
+ {
+ tw.WriteElementString(XmlNodeName, item.ToString());
}
}
}
diff --git a/RdcMan/LocalResourcesSettings.cs b/RdcMan/LocalResourcesSettings.cs
index 724c881..d9dc905 100644
--- a/RdcMan/LocalResourcesSettings.cs
+++ b/RdcMan/LocalResourcesSettings.cs
@@ -1,11 +1,13 @@
using System.Collections.Generic;
using System.Windows.Forms;
-namespace RdcMan {
- public class LocalResourcesSettings : SettingsGroup {
+namespace RdcMan
+{
+ public class LocalResourcesSettings : SettingsGroup
+ {
//internal const string TabName = "Local Resources";
- private static readonly Dictionary _settingProperties;
+ private static Dictionary _settingProperties;
protected override Dictionary SettingProperties => _settingProperties;
@@ -42,17 +44,23 @@ public class LocalResourcesSettings : SettingsGroup {
[Setting("redirectPnpDevices")]
public BoolSetting RedirectPnpDevices { get; private set; }
- static LocalResourcesSettings() {
+ static LocalResourcesSettings()
+ {
typeof(LocalResourcesSettings).GetSettingProperties(out _settingProperties);
}
- public LocalResourcesSettings() : base("Դ", "localResources") { }
+ public LocalResourcesSettings()
+ : base("Դ", "localResources")
+ {
+ }
- public override TabPage CreateTabPage(TabbedSettingsDialog dialog) {
+ public override TabPage CreateTabPage(TabbedSettingsDialog dialog)
+ {
return new LocalResourcesTabPage(dialog, this);
}
- protected override void Copy(RdcTreeNode node) {
+ protected override void Copy(RdcTreeNode node)
+ {
Copy(node.LocalResourceSettings);
}
}
diff --git a/RdcMan/LocalResourcesTabPage.cs b/RdcMan/LocalResourcesTabPage.cs
index 8344b4b..91918d3 100644
--- a/RdcMan/LocalResourcesTabPage.cs
+++ b/RdcMan/LocalResourcesTabPage.cs
@@ -4,8 +4,10 @@
using System.Windows.Forms;
using MSTSCLib;
-namespace RdcMan {
- public class LocalResourcesTabPage : SettingsTabPage {
+namespace RdcMan
+{
+ public class LocalResourcesTabPage : SettingsTabPage
+ {
private bool _processingAfterCheck;
private TreeNode _redirectDrivesCheckBox;
@@ -20,7 +22,9 @@ public class LocalResourcesTabPage : SettingsTabPage {
private TreeNode _redirectPnpDevicesCheckBox;
- public LocalResourcesTabPage(TabbedSettingsDialog dialog, LocalResourcesSettings settings) : base(dialog, settings) {
+ public LocalResourcesTabPage(TabbedSettingsDialog dialog, LocalResourcesSettings settings)
+ : base(dialog, settings)
+ {
int num = 0;
int rowIndex = 0;
CreateInheritanceControl(ref rowIndex, ref num);
@@ -29,25 +33,27 @@ public LocalResourcesTabPage(TabbedSettingsDialog dialog, LocalResourcesSettings
FormTools.AddLabeledEnumDropDown(this, "(&Q)", base.Settings.AudioRedirectionQuality, ref rowIndex, ref num, RdpClient.AudioRedirectionQualityToString);
FormTools.AddLabeledEnumDropDown(this, "Զ¼(&R)", base.Settings.AudioCaptureRedirectionMode, ref rowIndex, ref num, RdpClient.AudioCaptureRedirectionModeToString);
}
- FormTools.AddLabeledEnumDropDown(this, "&Windows ϼ", base.Settings.KeyboardHookMode, ref rowIndex, ref num, RdpClient.KeyboardHookModeToString);
- Label value = FormTools.NewLabel("ضѡ", 0, rowIndex);
+ FormTools.AddLabeledEnumDropDown(this, "ϼ(&W)", base.Settings.KeyboardHookMode, ref rowIndex, ref num, RdpClient.KeyboardHookModeToString);
+ Label value = FormTools.NewLabel("豸ض(&D)", 0, rowIndex);
TreeView treeView = new TreeView {
Location = FormTools.NewLocation(1, rowIndex),
- Size = new Size(340, 190),
+ Size = new Size(340, 160),
CheckBoxes = true,
Scrollable = true,
ShowLines = false
};
treeView.AfterCheck += RedirectView_AfterCheck;
- _redirectClipboardCheckBox = treeView.Nodes.Add("Clipboard");
- _redirectPrintersCheckBox = treeView.Nodes.Add("Printers");
- _redirectSmartCardsCheckBox = treeView.Nodes.Add("Smart cards");
- _redirectPortsCheckBox = treeView.Nodes.Add("Ports");
+ _redirectClipboardCheckBox = treeView.Nodes.Add("");
+ _redirectPrintersCheckBox = treeView.Nodes.Add("ӡ");
+ _redirectSmartCardsCheckBox = treeView.Nodes.Add("ܿ");
+ _redirectPortsCheckBox = treeView.Nodes.Add("ڶ˿");
_redirectDrivesCheckBox = treeView.Nodes.Add("Drives");
- _redirectPnpDevicesCheckBox = treeView.Nodes.Add("PnP devices");
- if (RdpClient.SupportsFineGrainedRedirection) {
+ _redirectPnpDevicesCheckBox = treeView.Nodes.Add("PnP豸");
+ if (RdpClient.SupportsFineGrainedRedirection)
+ {
IMsRdpDriveCollection driveCollection = RdpClient.DriveCollection;
- for (uint num2 = 0u; num2 < driveCollection.DriveCount; num2++) {
+ for (uint num2 = 0u; num2 < driveCollection.DriveCount; num2++)
+ {
IMsRdpDrive msRdpDrive = driveCollection.get_DriveByIndex(num2);
_redirectDrivesCheckBox.Nodes.Add(msRdpDrive.Name.Substring(0, msRdpDrive.Name.Length - 1));
}
@@ -56,7 +62,8 @@ public LocalResourcesTabPage(TabbedSettingsDialog dialog, LocalResourcesSettings
base.Controls.Add(treeView);
}
- protected override void UpdateControls() {
+ protected override void UpdateControls()
+ {
base.UpdateControls();
_redirectDrivesCheckBox.Checked = base.Settings.RedirectDrives.Value;
_redirectPortsCheckBox.Checked = base.Settings.RedirectPorts.Value;
@@ -74,7 +81,8 @@ protected override void UpdateControls() {
}
}
- protected override void UpdateSettings() {
+ protected override void UpdateSettings()
+ {
base.UpdateSettings();
base.Settings.RedirectDrives.Value = _redirectDrivesCheckBox.Checked;
List list = new List();
@@ -90,14 +98,19 @@ protected override void UpdateSettings() {
base.Settings.RedirectPnpDevices.Value = _redirectPnpDevicesCheckBox.Checked;
}
- private void RedirectView_AfterCheck(object sender, TreeViewEventArgs e) {
+ private void RedirectView_AfterCheck(object sender, TreeViewEventArgs e)
+ {
if (_processingAfterCheck)
+ {
return;
-
+ }
_processingAfterCheck = true;
if (e.Node.Nodes.Count == 0 && e.Node.Parent != null)
+ {
e.Node.Parent.Checked = e.Node.Parent.Nodes.Cast().All((TreeNode node) => node.Checked);
- else {
+ }
+ else
+ {
foreach (TreeNode node in e.Node.Nodes)
node.Checked = e.Node.Checked;
}
diff --git a/RdcMan/Log.cs b/RdcMan/Log.cs
index 869a74f..82c4474 100644
--- a/RdcMan/Log.cs
+++ b/RdcMan/Log.cs
@@ -5,28 +5,35 @@
using System.Reflection;
using RdcMan.Configuration;
-namespace RdcMan {
- public static class Log {
+namespace RdcMan
+{
+ public static class Log
+ {
private static int Indent;
private static TextWriter Writer;
public static bool Enabled { get; private set; }
- public static void Init() {
+ public static void Init()
+ {
LoggingElement loggingElement = Current.RdcManSection?.Logging;
Enabled = loggingElement?.Enabled ?? false;
- if (Enabled) {
+ if (Enabled)
+ {
string text = Environment.ExpandEnvironmentVariables(loggingElement.Path);
string format = "RDCMan-{0}.log";
foreach (FileInfo item in (from n in Directory.GetFiles(text, format.InvariantFormat("*"), SearchOption.TopDirectoryOnly)
- select new FileInfo(n) into i
- orderby i.CreationTime descending
- select i).Skip(loggingElement.MaximumNumberOfFiles - 1)) {
- try {
+ select new FileInfo(n) into i
+ orderby i.CreationTime descending
+ select i).Skip(loggingElement.MaximumNumberOfFiles - 1))
+ {
+ try
+ {
item.Delete();
}
- catch {
+ catch
+ {
}
}
string text2 = DateTime.Now.ToString("yyyyMMddHHmm");
@@ -40,40 +47,50 @@ orderby i.CreationTime descending
Write("mstscax.dll v{0}".InvariantFormat(RdpClient.RdpControlVersion));
}
- public static void Write(string format, params object[] args) {
- string value = "{0} {1} {2}".InvariantFormat(DateTime.Now.ToString("s"), new string(' ', Indent * 2), format.InvariantFormat(args));
- if (Enabled) {
+ public static void Write(string format, params object[] args)
+ {
+ if (Enabled)
+ {
+ string value = "{0} {1} {2}".InvariantFormat(DateTime.Now.ToString("s"), new string(' ', Indent * 2), format.InvariantFormat(args));
Writer.WriteLine(value);
Writer.Flush();
}
}
- public static void AdjustIndent(int delta) {
+ public static void AdjustIndent(int delta)
+ {
Indent += delta;
}
- public static void DumpObject(T o) {
+ public static void DumpObject(T o)
+ {
HashSet