From 4d024ee2276b519e71535cb13635e7492ee48ed9 Mon Sep 17 00:00:00 2001 From: indiff Date: Tue, 4 May 2021 23:02:32 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=F0=9F=9A=92=F0=9F=9A=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BandObjectLib/BandObjectLib.csproj | 5 +- BandObjectLib/Properties/AssemblyInfo.cs | 14 +- Installer/Installer.wxs | 13 +- .../ActivateByMouseHover.cs | 168 +- .../ActivateByMouseHover.csproj | 3 +- .../SettingForm.Designer.cs | 121 +- Plugins/ActivateByMouseHover/SettingForm.cs | 24 +- Plugins/ActivateByMouseHover/SettingForm.resx | 4 +- Plugins/Memo/Resource.cs | 128 +- Plugins/QTClock/Properties/AssemblyInfo.cs | 4 +- .../QTFileTools/Properties/AssemblyInfo.cs | 4 +- .../QTFolderButton/Properties/AssemblyInfo.cs | 4 +- Plugins/QTQuick/QTQuick.cs | 158 +- Plugins/QTQuick/QTQuick.csproj | 7 +- .../Properties/AssemblyInfo.cs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../ShowStatusBar/Properties/AssemblyInfo.cs | 4 +- QTPluginLib/CONSTANTS.cs | 46 +- QTPluginLib/Properties/AssemblyInfo.cs | 8 +- QTTabBar/Config.cs | 2 +- QTTabBar/OptionsDialog/Options01_Window.xaml | 2 + QTTabBar/PluginServer.cs | 1674 ++++++++--------- QTTabBar/Properties/AssemblyInfo.cs | 4 +- QTTabBar/QTButtonBar.cs | 12 +- QTTabBar/QTTabBarClass.cs | 11 +- QTTabBar/QTUtility.cs | 2 +- QTTabBar/QTabControl.cs | 11 + QTTabBar/Resource_String_zh_CN.Designer.cs | 2 +- QTTabBar/Resources_Image.Designer.cs | 2 +- QTTabBar/Resources_Image.resx | 2 +- QTTabBar/Resources_String.Designer.cs | 2 +- QTTabBar/UpdateChecker.cs | 4 +- Register/Register.bat | 4 +- "\346\270\205\347\220\206.bat" | 3 + 34 files changed, 1318 insertions(+), 1142 deletions(-) diff --git a/BandObjectLib/BandObjectLib.csproj b/BandObjectLib/BandObjectLib.csproj index 833c1e5..dcc240e 100644 --- a/BandObjectLib/BandObjectLib.csproj +++ b/BandObjectLib/BandObjectLib.csproj @@ -85,7 +85,7 @@ 4 none prompt - BandObjectLib.ruleset + MinimumRecommendedRules.ruleset @@ -152,9 +152,6 @@ False - - - diff --git a/BandObjectLib/Properties/AssemblyInfo.cs b/BandObjectLib/Properties/AssemblyInfo.cs index ce78284..63a0a26 100644 --- a/BandObjectLib/Properties/AssemblyInfo.cs +++ b/BandObjectLib/Properties/AssemblyInfo.cs @@ -22,15 +22,15 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. // -[assembly: AssemblyTitle("BandObjectLib")] -[assembly: AssemblyDescription("C# BandObject library")] +[assembly: AssemblyTitle("BandObjectLib")] +[assembly: AssemblyDescription("C# BandObject库")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("indiff")] [assembly: AssemblyProduct("QTTabBar")] [assembly: AssemblyCopyright("Copyright (C) 2007-2021")] [assembly: AssemblyTrademark("indiff")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyFileVersion("1.5.4.0")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyFileVersion("1.5.5.0")] // // Version information for an assembly consists of the following four values: // @@ -40,9 +40,9 @@ // Revision // // You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.5.4.0")] +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.5.5.0")] // // In order to sign your assembly you must specify a key to use. Refer to the diff --git a/Installer/Installer.wxs b/Installer/Installer.wxs index 28b691e..bcb454e 100644 --- a/Installer/Installer.wxs +++ b/Installer/Installer.wxs @@ -23,13 +23,13 @@ - - + + - + + @@ -227,7 +228,7 @@ Language="1033" - + diff --git a/Plugins/ActivateByMouseHover/ActivateByMouseHover.cs b/Plugins/ActivateByMouseHover/ActivateByMouseHover.cs index 7333582..53f3561 100644 --- a/Plugins/ActivateByMouseHover/ActivateByMouseHover.cs +++ b/Plugins/ActivateByMouseHover/ActivateByMouseHover.cs @@ -1,35 +1,35 @@ -// This file is part of QTTabBar, a shell extension for Microsoft -// Windows Explorer. -// Copyright (C) 2010 Quizo, Paul Accisano -// -// QTTabBar is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// QTTabBar is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with QTTabBar. If not, see . - -using System; -using System.Runtime.InteropServices; -using System.Text; -using QTPlugin; +// This file is part of QTTabBar, a shell extension for Microsoft +// Windows Explorer. +// Copyright (C) 2010 Quizo, Paul Accisano +// +// QTTabBar is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// QTTabBar is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with QTTabBar. If not, see . + +using System; +using System.Runtime.InteropServices; +using System.Text; +using QTPlugin; using QTPlugin.Interop; using System.Windows.Forms; using System.Globalization; -using Microsoft.Win32; - -namespace QuizoPlugins { +using Microsoft.Win32; + +namespace QuizoPlugins { // [Plugin(PluginType.Background, Author = "Quizo", Name = "Show StatusBar", Version = "0.9.0.0", Description = "ShowStatusBar")] [Plugin(PluginType.Background, Author = "indiff", Name = "鼠标悬浮激活标签", Version = "1.0.0.0", Description = "鼠标悬浮激活标签")] public class ActivateByMouseHover : IPluginClient - { - private IPluginServer pluginServer; + { + private IPluginServer pluginServer; private IShellBrowser shellBrowser; private System.Windows.Forms.Timer timer; @@ -37,60 +37,60 @@ public class ActivateByMouseHover : IPluginClient private ITab previousTab; private static int mouseHoverTime = 700; - private const string REGNAME = "ActivateByMouseHover"; - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, StringBuilder lpszClass, string lpszWindow); - - private static bool fVista = IsVista(); - private const int WM_COMMAND = 0x0111; - - private static bool IsVista() { - return Environment.OSVersion.Version.Major > 5; - } - + private const string REGNAME = "ActivateByMouseHover"; + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, StringBuilder lpszClass, string lpszWindow); + + private static bool fVista = IsVista(); + private const int WM_COMMAND = 0x0111; + + private static bool IsVista() { + return Environment.OSVersion.Version.Major > 5; + } + static ActivateByMouseHover() { ReadSetting(); - } - - - #region IPluginClient members - - public void Open(IPluginServer pluginServer, IShellBrowser shellBrowser) { - this.pluginServer = pluginServer; + } + + + #region IPluginClient members + + public void Open(IPluginServer pluginServer, IShellBrowser shellBrowser) { + this.pluginServer = pluginServer; this.shellBrowser = shellBrowser; - this.pluginServer.PointedTabChanged += new PluginEventHandler(pluginServer_PointedTabChanged); - - } - + this.pluginServer.PointedTabChanged += new PluginEventHandler(pluginServer_PointedTabChanged); + + } + public bool QueryShortcutKeys(out string[] actions) { actions = null; - return false; - } - + return false; + } + public void Close(EndCode endCode) { if (this.timer != null) { this.timer.Dispose(); this.timer = null; - } - } - - public bool HasOption { - get { - return false; - } - } - - public void OnMenuItemClick(MenuType menuType, string menuText, ITab tab) { - } - + } + } + + public bool HasOption { + get { + return true; + } + } + + public void OnMenuItemClick(MenuType menuType, string menuText, ITab tab) { + } + public void OnOption() { using (var sf = new SettingForm(mouseHoverTime)) { @@ -103,13 +103,13 @@ public void OnOption() { this.timer.Interval = mouseHoverTime; } } - } - } - - public void OnShortcutKeyPressed(int index) { - - } - + } + } + + public void OnShortcutKeyPressed(int index) { + + } + private void pluginServer_PointedTabChanged( object sender, PluginEventArgs e ) { @@ -168,7 +168,7 @@ private static void ReadSetting() private static void SaveSetting() { - using( var rkPlugin = Registry.CurrentUser.CreateSubKey( CONSTANTS.REGISTRY_PLUGINSETTINGS + @"\Quizo\" + REGNAME ) ) + using( var rkPlugin = Registry.CurrentUser.CreateSubKey( CONSTANTS.REGISTRY_PLUGINSETTINGS + @"\" + REGNAME ) ) { if( rkPlugin != null ) { @@ -237,10 +237,10 @@ public override string SupportURL public override void SetKey( int iKey ) { } - - - - #endregion - - } -} + + + + #endregion + + } +} diff --git a/Plugins/ActivateByMouseHover/ActivateByMouseHover.csproj b/Plugins/ActivateByMouseHover/ActivateByMouseHover.csproj index 2aa50c1..3314da9 100644 --- a/Plugins/ActivateByMouseHover/ActivateByMouseHover.csproj +++ b/Plugins/ActivateByMouseHover/ActivateByMouseHover.csproj @@ -16,7 +16,8 @@ v3.5 - + + true diff --git a/Plugins/ActivateByMouseHover/SettingForm.Designer.cs b/Plugins/ActivateByMouseHover/SettingForm.Designer.cs index 7f8e748..dcd902b 100644 --- a/Plugins/ActivateByMouseHover/SettingForm.Designer.cs +++ b/Plugins/ActivateByMouseHover/SettingForm.Designer.cs @@ -28,78 +28,79 @@ protected override void Dispose( bool disposing ) /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); - this.buttonOK = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 28); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(155, 15); - this.label1.TabIndex = 0; - this.label1.Text = "Mouse Hover Delay (msec): "; - // - // numericUpDown1 - // - this.numericUpDown1.Location = new System.Drawing.Point(173, 26); - this.numericUpDown1.Maximum = new decimal(new int[] { + this.label1 = new System.Windows.Forms.Label(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.buttonOK = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 28); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(155, 15); + this.label1.TabIndex = 0; + this.label1.Text = "Mouse Hover Delay (msec): "; + this.label1.Click += new System.EventHandler(this.label1_Click); + // + // numericUpDown1 + // + this.numericUpDown1.Location = new System.Drawing.Point(173, 26); + this.numericUpDown1.Maximum = new decimal(new int[] { 5000, 0, 0, 0}); - this.numericUpDown1.Minimum = new decimal(new int[] { + this.numericUpDown1.Minimum = new decimal(new int[] { 100, 0, 0, 0}); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Size = new System.Drawing.Size(78, 23); - this.numericUpDown1.TabIndex = 1; - this.numericUpDown1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.numericUpDown1.Value = new decimal(new int[] { + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(78, 23); + this.numericUpDown1.TabIndex = 1; + this.numericUpDown1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDown1.Value = new decimal(new int[] { 700, 0, 0, 0}); - // - // buttonOK - // - this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOK.Location = new System.Drawing.Point(176, 70); - this.buttonOK.Name = "buttonOK"; - this.buttonOK.Size = new System.Drawing.Size(75, 23); - this.buttonOK.TabIndex = 2; - this.buttonOK.Text = "OK"; - this.buttonOK.UseVisualStyleBackColor = true; - // - // SettingForm - // - this.AcceptButton = this.buttonOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(263, 105); - this.Controls.Add(this.buttonOK); - this.Controls.Add(this.numericUpDown1); - this.Controls.Add(this.label1); - this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SettingForm"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Activate By MouseHover"; - this.TopMost = true; - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOK.Location = new System.Drawing.Point(176, 70); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 2; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + // + // SettingForm + // + this.AcceptButton = this.buttonOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(263, 105); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.numericUpDown1); + this.Controls.Add(this.label1); + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SettingForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Activate By MouseHover"; + this.TopMost = true; + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/Plugins/ActivateByMouseHover/SettingForm.cs b/Plugins/ActivateByMouseHover/SettingForm.cs index b0791ec..3f45a6d 100644 --- a/Plugins/ActivateByMouseHover/SettingForm.cs +++ b/Plugins/ActivateByMouseHover/SettingForm.cs @@ -14,11 +14,18 @@ public SettingForm( int delay ) this.numericUpDown1.Value = delay; } - if( CultureInfo.CurrentCulture.Name == "ja-JP" ) - { - this.label1.Text = "寰呮鏅傞枔(銉熴儶绉)"; - } - } + if (CultureInfo.CurrentCulture.Name == "ja-JP") + { + this.label1.Text = "寰呮鏅傞枔(銉熴儶绉)"; + this.Text = "Activate By MouseHover"; + } + + if (CultureInfo.CurrentCulture.Name == "zh-CHS") + { + this.label1.Text = "寤舵椂鏃堕棿(姣)"; + this.Text = "榧犳爣鎮诞婵娲绘爣绛"; + } + } public int Value { @@ -26,6 +33,11 @@ public int Value { return (int)this.numericUpDown1.Value; } - } + } + + private void label1_Click(object sender, System.EventArgs e) + { + + } } } diff --git a/Plugins/ActivateByMouseHover/SettingForm.resx b/Plugins/ActivateByMouseHover/SettingForm.resx index 29dcb1b..5ea0895 100644 --- a/Plugins/ActivateByMouseHover/SettingForm.resx +++ b/Plugins/ActivateByMouseHover/SettingForm.resx @@ -112,9 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/Plugins/Memo/Resource.cs b/Plugins/Memo/Resource.cs index 6d9cac0..e873698 100644 --- a/Plugins/Memo/Resource.cs +++ b/Plugins/Memo/Resource.cs @@ -1,64 +1,64 @@ -// This file is part of QTTabBar, a shell extension for Microsoft -// Windows Explorer. -// Copyright (C) 2010 Quizo, Paul Accisano -// -// QTTabBar is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// QTTabBar is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with QTTabBar. If not, see . - -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Globalization; -using System.Resources; -using System.Runtime.CompilerServices; - -namespace QuizoPlugins { - [CompilerGenerated, DebuggerNonUserCode, GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - internal class Resource { - private static CultureInfo resourceCulture; - private static ResourceManager resourceMan; - - [EditorBrowsable(EditorBrowsableState.Advanced)] - internal static CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - [EditorBrowsable(EditorBrowsableState.Advanced)] - internal static ResourceManager ResourceManager { - get { - if(ReferenceEquals(resourceMan, null)) { - ResourceManager manager = new ResourceManager("QuizoPlugins.Resource", typeof(Resource).Assembly); - resourceMan = manager; - } - return resourceMan; - } - } - - internal static string str_en { - get { - return ResourceManager.GetString("str_en", resourceCulture); - } - } - - internal static string str_ja { - get { - return ResourceManager.GetString("str_ja", resourceCulture); - } +// This file is part of QTTabBar, a shell extension for Microsoft +// Windows Explorer. +// Copyright (C) 2010 Quizo, Paul Accisano +// +// QTTabBar is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// QTTabBar is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with QTTabBar. If not, see . + +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.Resources; +using System.Runtime.CompilerServices; + +namespace QuizoPlugins { + [CompilerGenerated, DebuggerNonUserCode, GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + internal class Resource { + private static CultureInfo resourceCulture; + private static ResourceManager resourceMan; + + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static ResourceManager ResourceManager { + get { + if(ReferenceEquals(resourceMan, null)) { + ResourceManager manager = new ResourceManager("QuizoPlugins.Resource", typeof(Resource).Assembly); + resourceMan = manager; + } + return resourceMan; + } + } + + internal static string str_en { + get { + return ResourceManager.GetString("str_en", resourceCulture); + } + } + + internal static string str_ja { + get { + return ResourceManager.GetString("str_ja", resourceCulture); + } } internal static string str_zh @@ -67,6 +67,6 @@ internal static string str_zh { return ResourceManager.GetString("str_zh", resourceCulture); } - } - } -} + } + } +} diff --git a/Plugins/QTClock/Properties/AssemblyInfo.cs b/Plugins/QTClock/Properties/AssemblyInfo.cs index 446427e..5571ec5 100644 --- a/Plugins/QTClock/Properties/AssemblyInfo.cs +++ b/Plugins/QTClock/Properties/AssemblyInfo.cs @@ -21,8 +21,8 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("QTClock")] -[assembly: AssemblyDescription("Sample clock plugin")] +[assembly: AssemblyTitle("QTClock")] +[assembly: AssemblyDescription("鏃堕挓鎻掍欢")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("indiff")] [assembly: AssemblyProduct("QTClock")] diff --git a/Plugins/QTFileTools/Properties/AssemblyInfo.cs b/Plugins/QTFileTools/Properties/AssemblyInfo.cs index 5390bb8..996f68a 100644 --- a/Plugins/QTFileTools/Properties/AssemblyInfo.cs +++ b/Plugins/QTFileTools/Properties/AssemblyInfo.cs @@ -21,8 +21,8 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("FileTools")] -[assembly: AssemblyDescription("Plugin set for file operations")] +[assembly: AssemblyTitle("FileTools")] +[assembly: AssemblyDescription("鏂囦欢鎿嶄綔鐨勬彃浠堕泦")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("indiff")] [assembly: AssemblyProduct("QTFileTools")] diff --git a/Plugins/QTFolderButton/Properties/AssemblyInfo.cs b/Plugins/QTFolderButton/Properties/AssemblyInfo.cs index 30066ae..ffe974e 100644 --- a/Plugins/QTFolderButton/Properties/AssemblyInfo.cs +++ b/Plugins/QTFolderButton/Properties/AssemblyInfo.cs @@ -21,8 +21,8 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("QTFolderButton")] -[assembly: AssemblyDescription("Show folder tree for XP")] +[assembly: AssemblyTitle("QTFolderButton")] +[assembly: AssemblyDescription("涓篨P鏄剧ず鏂囦欢澶规爲褰㈢粨鏋")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("indiff")] [assembly: AssemblyProduct("QTFolderButton")] diff --git a/Plugins/QTQuick/QTQuick.cs b/Plugins/QTQuick/QTQuick.cs index 8db01d6..e6ab6f9 100644 --- a/Plugins/QTQuick/QTQuick.cs +++ b/Plugins/QTQuick/QTQuick.cs @@ -25,11 +25,19 @@ using System.Collections.Generic; using System.Diagnostics; using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using System.Security; using QTPlugin; using QTPlugin.Interop; using QTTabBarLib; using System.IO; +using System.Management.Automation; +using System.Management.Automation.Runspaces; +using System.Management; +using System.Threading; + namespace Qwop { /// /// Plugin sample. @@ -227,10 +235,13 @@ public void OnDropDownOpening(ToolStripDropDownMenu menu) { if(fFirstMenuDropDown) { menu.Items.Add(new ToolStripMenuItem("我的文档")); menu.Items.Add(new ToolStripMenuItem("控制面板\\所有控制面板项\\系统")); - menu.Items.Add(new ToolStripMenuItem("控制面板\\所有控制面板项\\个性化")); + menu.Items.Add(new ToolStripMenuItem("控制面板\\所有控制面板项\\个性化")); + menu.Items.Add(new ToolStripMenuItem("控制面板\\所有控制面板项\\网络连接")); menu.Items.Add(new ToolStripMenuItem("设置当前目录JAVA_HOME")); menu.Items.Add(new ToolStripMenuItem("设置当前目录M2_HOME")); menu.Items.Add(new ToolStripMenuItem("查看系统信息")); + menu.Items.Add(new ToolStripMenuItem("重启资源管理器")); + menu.Items.Add(new ToolStripMenuItem("关机")); // menu.Items.Add(new ToolStripMenuItem("Test selection")); fFirstMenuDropDown = false; @@ -296,7 +307,17 @@ public void OnDropDownItemClick(ToolStripItem item, MouseButtons mouseButton) { path = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"; break; } + case 3: + { + // 3. 网络连接 + if (IsWin7) + path = "::{7007ACC7-3202-11D1-AAD2-00805FC1270E}"; + else if (IsXP) + path = "::{7007ACC7-3202-11D1-AAD2-00805FC1270E}"; + break; + } + case 4: { // 3. 设置当前目录JAVA_HOME string selectedPath = pluginServer.SelectedTab.Address.Path; @@ -327,7 +348,7 @@ public void OnDropDownItemClick(ToolStripItem item, MouseButtons mouseButton) { return; } - + /* if(String.IsNullOrEmpty(toolsJar) || !File.Exists(toolsJar)) { MessageBox.Show("toolsJar不存在"); @@ -342,20 +363,48 @@ public void OnDropDownItemClick(ToolStripItem item, MouseButtons mouseButton) { SystemSounds.Hand.Play(); return; } - Environment.SetEnvironmentVariable("JAVA_HOME", selectedPath, EnvironmentVariableTarget.Machine); - Environment.SetEnvironmentVariable("CLASSPATH", @".;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;", EnvironmentVariableTarget.Machine); + */ + + + // Environment.SetEnvironmentVariable("JAVA_HOME", selectedPath, EnvironmentVariableTarget.Machine); + // Environment.SetEnvironmentVariable("CLASSPATH", @".;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;", EnvironmentVariableTarget.Machine); // 去重, 判断是否有 java home 删掉 string oldpath = filterEmpty( "java.exe" ); - Environment.SetEnvironmentVariable("PATH", @"%JAVA_HOME%\bin;" + oldpath, EnvironmentVariableTarget.Machine); - MessageBox.Show("设置JAVA_HOME成功"); + // Environment.SetEnvironmentVariable("PATH", @"%JAVA_HOME%\bin;" + oldpath, EnvironmentVariableTarget.Machine); + + + PowerShell.Create().AddCommand("setx") + .AddParameter("JAVA_HOME", selectedPath) + .AddParameter("/M") + .Invoke(); + Thread.Sleep( 800 ); + + if (File.Exists(toolsJar) && File.Exists(dtJar)) + { + PowerShell.Create().AddCommand("setx") + .AddParameter("CLASSPATH", @".;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;") + .AddParameter("/M") + .Invoke(); + Thread.Sleep(800); + } + + + + PowerShell.Create().AddCommand("setx") + .AddParameter("PATH", @"%JAVA_HOME%\bin;" + oldpath) + .AddParameter("/M") + .Invoke(); + Thread.Sleep(800); + + MessageBox.Show("设置JAVA_HOME成功"); break; } - case 4: + case 5: { - // 4. 设置当前目录M2_HOME + // 5. 设置当前目录M2_HOME - // 3. 设置当前目录JAVA_HOME + // 6. 设置当前目录JAVA_HOME string selectedPath = pluginServer.SelectedTab.Address.Path; string binPath = Path.Combine(selectedPath, "bin"); string mvnCmd = Path.Combine(binPath, "mvn.cmd"); @@ -387,22 +436,61 @@ public void OnDropDownItemClick(ToolStripItem item, MouseButtons mouseButton) { return; } - Environment.SetEnvironmentVariable("M2_HOME", selectedPath, EnvironmentVariableTarget.Machine); + // Environment.SetEnvironmentVariable("M2_HOME", selectedPath, EnvironmentVariableTarget.Machine); + + PowerShell.Create().AddCommand("setx") + .AddParameter("M2_HOME", selectedPath ) + .AddParameter("/M") + .Invoke(); + Thread.Sleep(800); + string oldpath = filterEmpty("mvn.cmd"); - Environment.SetEnvironmentVariable("PATH", @"%M2_HOME%\bin;" + oldpath, EnvironmentVariableTarget.Machine); + // Environment.SetEnvironmentVariable("PATH", @"%M2_HOME%\bin;" + oldpath, EnvironmentVariableTarget.Machine); + + PowerShell.Create().AddCommand("setx") + .AddParameter("PATH", @"%M2_HOME%\bin;" + oldpath) + .AddParameter("/M") + .Invoke(); + Thread.Sleep(800); + MessageBox.Show("设置M2_HOME成功"); break; } - case 5: + case 6: { - // 5. 查看系统信息 + // 6. 查看系统信息 string msinfo32 = Environment.GetEnvironmentVariable("systemroot") + "\\System32\\msinfo32.exe"; Process.Start(msinfo32); break; } - - + case 7: + { + // 7. 重启资源管理器 + /* + foreach (Process p in Process.GetProcesses()) + { + if (p.MainModule.ModuleName.Contains("explorer") == true) + p.Kill(); + } + Process.Start("explorer.exe"); + */ + IntPtr handle = GetWin10ExplorerWnd(); + CloseExplorer(handle, 1); + // PInvoke.PostMessage(hwndExplr, WM.CLOSE, IntPtr.Zero, (IntPtr)nCode) + Thread.Sleep(800); + Process.Start("explorer.exe"); + break; + } + case 8: + { + // 8. 关机 + IntPtr handle = GetShellTrayWnd(); + CloseExplorer(handle, 1); + // PInvoke.PostMessage(hwndExplr, WM.CLOSE, IntPtr.Zero, (IntPtr)nCode) + Thread.Sleep(800); + break; + } } @@ -472,6 +560,46 @@ public void OnDropDownItemClick(ToolStripItem item, MouseButtons mouseButton) { #endregion + // internal static readonly bool IsWin7 = Environment.OSVersion.Version >= new Version(6, 1); + // internal static readonly bool IsXP = Environment.OSVersion.Version.Major <= 5; + + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + public static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); + public const Int32 CLOSE = 0x0010; + + + + // 关闭资源管理器,发送关闭消息 + public static void CloseExplorer(IntPtr hwndExplr, int nCode, bool doAsync = false) + { + if (IsXP && nCode == 0) nCode = 3; + if (IsXP || doAsync) + { + PostMessage(hwndExplr, CLOSE, IntPtr.Zero, (IntPtr)nCode); + } + else + { + SendMessage(hwndExplr, CLOSE, IntPtr.Zero, (IntPtr)nCode); + } + } + + public static IntPtr GetShellTrayWnd() + { + return FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null); + } + + public static IntPtr GetWin10ExplorerWnd() + { + return FindWindowEx(IntPtr.Zero, IntPtr.Zero, "CabinetWClass", null); + } + #region Event handlers diff --git a/Plugins/QTQuick/QTQuick.csproj b/Plugins/QTQuick/QTQuick.csproj index 617de53..9a2d2d3 100644 --- a/Plugins/QTQuick/QTQuick.csproj +++ b/Plugins/QTQuick/QTQuick.csproj @@ -38,7 +38,7 @@ 4 true true - QTQuick.ruleset + MinimumRecommendedRules.ruleset true @@ -75,6 +75,10 @@ + + False + C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\System.Management.Automation.dll + @@ -108,7 +112,6 @@ - diff --git a/Plugins/QTViewModeButton/Properties/AssemblyInfo.cs b/Plugins/QTViewModeButton/Properties/AssemblyInfo.cs index 36dcbc5..5289fbc 100644 --- a/Plugins/QTViewModeButton/Properties/AssemblyInfo.cs +++ b/Plugins/QTViewModeButton/Properties/AssemblyInfo.cs @@ -21,8 +21,8 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("ViewModeButton")] -[assembly: AssemblyDescription("Button to change folder viewmode.")] +[assembly: AssemblyTitle("ViewModeButton")] +[assembly: AssemblyDescription("淇敼鏂囦欢鏄剧ず鏂瑰紡")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("indiff")] [assembly: AssemblyProduct("ViewModeButton")] diff --git a/Plugins/QTWindowManager/Properties/AssemblyInfo.cs b/Plugins/QTWindowManager/Properties/AssemblyInfo.cs index fd95fc6..ebda81e 100644 --- a/Plugins/QTWindowManager/Properties/AssemblyInfo.cs +++ b/Plugins/QTWindowManager/Properties/AssemblyInfo.cs @@ -21,8 +21,8 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("QTWindowManager")] -[assembly: AssemblyDescription("Window manager")] +[assembly: AssemblyTitle("QTWindowManager")] +[assembly: AssemblyDescription("窗口管理器")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("indiff")] [assembly: AssemblyProduct("QTWindowManager")] diff --git a/Plugins/ShowStatusBar/Properties/AssemblyInfo.cs b/Plugins/ShowStatusBar/Properties/AssemblyInfo.cs index 66daaf9..5ab0ce9 100644 --- a/Plugins/ShowStatusBar/Properties/AssemblyInfo.cs +++ b/Plugins/ShowStatusBar/Properties/AssemblyInfo.cs @@ -21,8 +21,8 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("ShowStatusBar")] -[assembly: AssemblyDescription("show status bar by key")] +[assembly: AssemblyTitle("ShowStatusBar")] +[assembly: AssemblyDescription("显示状态栏")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("indiff")] [assembly: AssemblyProduct("ShowStatusBar")] diff --git a/QTPluginLib/CONSTANTS.cs b/QTPluginLib/CONSTANTS.cs index 55d4ada..9da38a0 100644 --- a/QTPluginLib/CONSTANTS.cs +++ b/QTPluginLib/CONSTANTS.cs @@ -1,23 +1,23 @@ -// This file is part of QTTabBar, a shell extension for Microsoft -// Windows Explorer. -// Copyright (C) 2007-2010 Quizo, Paul Accisano -// -// QTTabBar is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// QTTabBar is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with QTTabBar. If not, see . - -namespace QTPlugin { - public static class CONSTANTS { - public const string REGISTRY_PLUGIN = @"Software\Quizo\QTTabBar\Plugins"; - public const string REGISTRY_PLUGINSETTINGS = @"Software\Quizo\QTTabBar\Plugins\Settings"; - } -} +// This file is part of QTTabBar, a shell extension for Microsoft +// Windows Explorer. +// Copyright (C) 2007-2010 Quizo, Paul Accisano +// +// QTTabBar is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// QTTabBar is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with QTTabBar. If not, see . + +namespace QTPlugin { + public static class CONSTANTS { + public const string REGISTRY_PLUGIN = @"Software\QTTabBar\Plugins"; + public const string REGISTRY_PLUGINSETTINGS = @"Software\QTTabBar\Plugins\Settings"; + } +} diff --git a/QTPluginLib/Properties/AssemblyInfo.cs b/QTPluginLib/Properties/AssemblyInfo.cs index a9e20b5..368fd6f 100644 --- a/QTPluginLib/Properties/AssemblyInfo.cs +++ b/QTPluginLib/Properties/AssemblyInfo.cs @@ -28,8 +28,8 @@ [assembly: AssemblyProduct("QTTabBar")] [assembly: AssemblyCopyright("Copyright (C) 2007-2021")] [assembly: AssemblyTrademark("indiff")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyFileVersion("1.5.4.0")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyFileVersion("1.5.5.0")] // ComVisible 銈 false 銇ō瀹氥仚銈嬨仺銆併亾銇偄銈汇兂銉栥儶鍐呫伄鍨嬨伅 COM 銈炽兂銉濄兗銉嶃兂銉堛伀銇 // 鍙傜収涓嶅彲鑳姐伀銇倞銇俱仚銆侰OM 銇嬨倝銇撱伄銈€偦銉炽儢銉唴銇瀷銇偄銈偦銈广仚銈嬪牬鍚堛伅銆 @@ -47,5 +47,5 @@ // Revision // // 銇欍伖銇︺伄鍊ゃ倰鎸囧畾銇欍倠銇嬨佷笅銇倛銇嗐伀 '*' 銈掍娇銇c仸銉儞銈搞儳銉炽亰銈堛伋銉撱儷銉夌暘鍙枫倰 -// 鏃㈠畾鍊ゃ伀銇欍倠銇撱仺銇屻仹銇嶃伨銇: -[assembly: AssemblyVersion("1.5.4.0")] +// 鏃㈠畾鍊ゃ伀銇欍倠銇撱仺銇屻仹銇嶃伨銇: +[assembly: AssemblyVersion("1.5.5.0")] diff --git a/QTTabBar/Config.cs b/QTTabBar/Config.cs index af9f208..8d3d6a4 100644 --- a/QTTabBar/Config.cs +++ b/QTTabBar/Config.cs @@ -213,7 +213,7 @@ public class Config { public static _Keys Keys { get { return ConfigManager.LoadedConfig.keys; } } /*蹇嵎鎿嶄綔*/ public static _Plugin Plugin { get { return ConfigManager.LoadedConfig.plugin; } } /*鎻掍欢绠$悊*/ public static _Lang Lang { get { return ConfigManager.LoadedConfig.lang; } } /*璇█閰嶇疆*/ - public static _Desktop Desktop { get { return ConfigManager.LoadedConfig.desktop; } } + public static _Desktop Desktop { get { return ConfigManager.LoadedConfig.desktop; } } /*鍏充簬淇℃伅*/ public _Window window { get; set; } public _Tabs tabs { get; set; } diff --git a/QTTabBar/OptionsDialog/Options01_Window.xaml b/QTTabBar/OptionsDialog/Options01_Window.xaml index 43d07b2..530ad50 100644 --- a/QTTabBar/OptionsDialog/Options01_Window.xaml +++ b/QTTabBar/OptionsDialog/Options01_Window.xaml @@ -21,6 +21,8 @@ . - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Windows.Forms; -using QTPlugin; -using QTTabBarLib.Interop; - -namespace QTTabBarLib { - public sealed partial class QTTabBarClass { - internal sealed class PluginServer : IPluginServer, IDisposable { - private Dictionary dicLocalizingStrings; - private QTPlugin.Interop.IShellBrowser shellBrowser; - private QTTabBarClass tabBar; - private Dictionary dicPluginInstances = new Dictionary(); - - // todo: are these really necessary? - internal Dictionary dicFullNamesMenuRegistered_Sys = new Dictionary(); - internal Dictionary dicFullNamesMenuRegistered_Tab = new Dictionary(); - - public event PluginEventHandler ExplorerStateChanged; - public event EventHandler MenuRendererChanged; - public event EventHandler MouseEnter; - public event EventHandler MouseLeave; - public event PluginEventHandler NavigationComplete; - public event PluginEventHandler PointedTabChanged; - public event PluginEventHandler SelectionChanged; - public event PluginEventHandler SettingsChanged; - public event PluginEventHandler TabAdded; - public event PluginEventHandler TabChanged; - public event PluginEventHandler TabRemoved; - - public PluginServer(QTTabBarClass tabBar) { - this.tabBar = tabBar; - shellBrowser = (QTPlugin.Interop.IShellBrowser)this.tabBar.ShellBrowser.GetIShellBrowser(); - dicLocalizingStrings = new Dictionary(); - foreach(string file in Config.Lang.PluginLangFiles) { - if(file.Length <= 0 || !File.Exists(file)) continue; - var dict = QTUtility.ReadLanguageFile(file); - if(dict == null) continue; - foreach(var pair in dict) { - dicLocalizingStrings[pair.Key] = pair.Value; - } - } - LoadStartupPlugins(); - } - - public bool AddApplication(string name, ProcessStartInfo startInfo) { - return false; - } - - public bool AddGroup(string groupName, string[] paths) { - if(paths == null || paths.Length == 0) return false; - GroupsManager.AddGroup(groupName, paths); - return true; - } - - internal void ClearEvents() { - TabChanged = null; - TabAdded = null; - TabRemoved = null; - NavigationComplete = null; - SelectionChanged = null; - ExplorerStateChanged = null; - SettingsChanged = null; - MouseEnter = null; - PointedTabChanged = null; - MouseLeave = null; - MenuRendererChanged = null; - } - - public void ClearFilterEngines() { - FilterPlugin = null; - FilterCorePlugin = null; - } - // 鍒涘缓鏂版爣绛 鍦板潃 绱㈠紩 鏄惁閿佸畾 鏄惁閫変腑 - public bool CreateTab(Address address, int index, bool fLocked, bool fSelect) { - using(IDLWrapper wrapper = new IDLWrapper(address)) { - address.ITEMIDLIST = wrapper.IDL; - address.Path = wrapper.Path; - } - if((address.ITEMIDLIST == null) || (address.ITEMIDLIST.Length <= 0)) { - return false; - } - QTabItem tab = new QTabItem(QTUtility2.MakePathDisplayText(address.Path, false), address.Path, tabBar.tabControl1); - tab.NavigatedTo(address.Path, address.ITEMIDLIST, -1, false); - tab.ToolTipText = QTUtility2.MakePathDisplayText(address.Path, true); - tab.TabLocked = fLocked; - if(index < 0) { - tabBar.AddInsertTab(tab); - } - else { - if(index > tabBar.tabControl1.TabCount) { - index = tabBar.tabControl1.TabCount; - } - tabBar.tabControl1.TabPages.Insert(index, tab); - } - if(fSelect) { - tabBar.tabControl1.SelectTab(tab); - } - return true; - } - - public bool CreateWindow(Address address) { - using(IDLWrapper wrapper = new IDLWrapper(address)) { - if(wrapper.Available) { - tabBar.OpenNewWindow(wrapper); - return true; - } - } - return false; - } - - public void Dispose() { - // todo check - ClearEvents(); - foreach(Plugin plugin in dicPluginInstances.Values) { - if(plugin.PluginInformation != null) { - plugin.Close(EndCode.WindowClosed); - } - } - FilterPlugin = null; - FilterCorePlugin = null; - dicPluginInstances.Clear(); - tabBar = null; - shellBrowser = null; - } - - public bool ExecuteCommand(Commands command, object arg) { - if(tabBar != null) { - IntPtr ptr; - switch(command) { - case Commands.GoBack: - case Commands.GoForward: - if(arg is int) { - return tabBar.NavigateToIndex(command == Commands.GoBack, (int)arg); - } - break; - - case Commands.GoUpOneLevel: - tabBar.UpOneLevel(); - return true; - - case Commands.RefreshBrowser: - tabBar.Explorer.Refresh(); - return true; - - case Commands.CloseCurrentTab: - return tabBar.CloseTab(tabBar.CurrentTab); - - case Commands.CloseLeft: - case Commands.CloseRight: - tabBar.CloseLeftRight(command == Commands.CloseLeft, -1); - return true; - - case Commands.CloseAllButCurrent: - tabBar.CloseAllTabsExcept(tabBar.CurrentTab); - return true; - - case Commands.CloseAllButOne: { - TabWrapper wrapper = arg as TabWrapper; - if(wrapper == null) break; - tabBar.CloseAllTabsExcept(wrapper.Tab); - return true; - } +锘// This file is part of QTTabBar, a shell extension for Microsoft +// Windows Explorer. +// Copyright (C) 2007-2010 Quizo, Paul Accisano +// +// QTTabBar is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// QTTabBar is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with QTTabBar. If not, see . + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Windows.Forms; +using QTPlugin; +using QTTabBarLib.Interop; + +namespace QTTabBarLib { + public sealed partial class QTTabBarClass { + internal sealed class PluginServer : IPluginServer, IDisposable { + private Dictionary dicLocalizingStrings; + private QTPlugin.Interop.IShellBrowser shellBrowser; + private QTTabBarClass tabBar; + private Dictionary dicPluginInstances = new Dictionary(); + + // todo: are these really necessary? + internal Dictionary dicFullNamesMenuRegistered_Sys = new Dictionary(); + internal Dictionary dicFullNamesMenuRegistered_Tab = new Dictionary(); + + public event PluginEventHandler ExplorerStateChanged; + public event EventHandler MenuRendererChanged; + public event EventHandler MouseEnter; + public event EventHandler MouseLeave; + public event PluginEventHandler NavigationComplete; + public event PluginEventHandler PointedTabChanged; + public event PluginEventHandler SelectionChanged; + public event PluginEventHandler SettingsChanged; + public event PluginEventHandler TabAdded; + public event PluginEventHandler TabChanged; + public event PluginEventHandler TabRemoved; + + public PluginServer(QTTabBarClass tabBar) { + this.tabBar = tabBar; + shellBrowser = (QTPlugin.Interop.IShellBrowser)this.tabBar.ShellBrowser.GetIShellBrowser(); + dicLocalizingStrings = new Dictionary(); + foreach(string file in Config.Lang.PluginLangFiles) { + if(file.Length <= 0 || !File.Exists(file)) continue; + var dict = QTUtility.ReadLanguageFile(file); + if(dict == null) continue; + foreach(var pair in dict) { + dicLocalizingStrings[pair.Key] = pair.Value; + } + } + LoadStartupPlugins(); + } + + public bool AddApplication(string name, ProcessStartInfo startInfo) { + return false; + } + + public bool AddGroup(string groupName, string[] paths) { + if(paths == null || paths.Length == 0) return false; + GroupsManager.AddGroup(groupName, paths); + return true; + } + + internal void ClearEvents() { + TabChanged = null; + TabAdded = null; + TabRemoved = null; + NavigationComplete = null; + SelectionChanged = null; + ExplorerStateChanged = null; + SettingsChanged = null; + MouseEnter = null; + PointedTabChanged = null; + MouseLeave = null; + MenuRendererChanged = null; + } + + public void ClearFilterEngines() { + FilterPlugin = null; + FilterCorePlugin = null; + } + // 鍒涘缓鏂版爣绛 鍦板潃 绱㈠紩 鏄惁閿佸畾 鏄惁閫変腑 + public bool CreateTab(Address address, int index, bool fLocked, bool fSelect) { + using(IDLWrapper wrapper = new IDLWrapper(address)) { + address.ITEMIDLIST = wrapper.IDL; + address.Path = wrapper.Path; + } + if((address.ITEMIDLIST == null) || (address.ITEMIDLIST.Length <= 0)) { + return false; + } + QTabItem tab = new QTabItem(QTUtility2.MakePathDisplayText(address.Path, false), address.Path, tabBar.tabControl1); + tab.NavigatedTo(address.Path, address.ITEMIDLIST, -1, false); + tab.ToolTipText = QTUtility2.MakePathDisplayText(address.Path, true); + tab.TabLocked = fLocked; + if(index < 0) { + tabBar.AddInsertTab(tab); + } + else { + if(index > tabBar.tabControl1.TabCount) { + index = tabBar.tabControl1.TabCount; + } + tabBar.tabControl1.TabPages.Insert(index, tab); + } + if(fSelect) { + tabBar.tabControl1.SelectTab(tab); + } + return true; + } + + public bool CreateWindow(Address address) { + using(IDLWrapper wrapper = new IDLWrapper(address)) { + if(wrapper.Available) { + tabBar.OpenNewWindow(wrapper); + return true; + } + } + return false; + } + + public void Dispose() { + // todo check + ClearEvents(); + foreach(Plugin plugin in dicPluginInstances.Values) { + if(plugin.PluginInformation != null) { + plugin.Close(EndCode.WindowClosed); + } + } + FilterPlugin = null; + FilterCorePlugin = null; + dicPluginInstances.Clear(); + tabBar = null; + shellBrowser = null; + } + + public bool ExecuteCommand(Commands command, object arg) { + if(tabBar != null) { + IntPtr ptr; + switch(command) { + case Commands.GoBack: + case Commands.GoForward: + if(arg is int) { + return tabBar.NavigateToIndex(command == Commands.GoBack, (int)arg); + } + break; + + case Commands.GoUpOneLevel: + tabBar.UpOneLevel(); + return true; + + case Commands.RefreshBrowser: + tabBar.Explorer.Refresh(); + return true; + + case Commands.CloseCurrentTab: + return tabBar.CloseTab(tabBar.CurrentTab); + + case Commands.CloseLeft: + case Commands.CloseRight: + tabBar.CloseLeftRight(command == Commands.CloseLeft, -1); + return true; + + case Commands.CloseAllButCurrent: + tabBar.CloseAllTabsExcept(tabBar.CurrentTab); + return true; + + case Commands.CloseAllButOne: { + TabWrapper wrapper = arg as TabWrapper; + if(wrapper == null) break; + tabBar.CloseAllTabsExcept(wrapper.Tab); + return true; + } case Commands.CloseWindow: // 鍏抽棴绐楀彛 2 indiff /* using (RegistryKey key = Registry.CurrentUser.CreateSubKey(RegConst.Root)) { @@ -191,656 +191,656 @@ where item2.TabLocked MessageBox.Show(String.Join(",", list)); QTUtility2.WriteRegBinary(list, "TabsLocked", key); - }*/ - WindowUtils.CloseExplorer(tabBar.ExplorerHandle, 2); - return true; - - case Commands.UndoClose: - tabBar.RestoreLastClosed(); - return true; - - case Commands.BrowseFolder: - tabBar.ChooseNewDirectory(); - return true; - - case Commands.ToggleTopMost: - tabBar.ToggleTopMost(); - TryCallButtonBar(bbar => bbar.RefreshButtons()); - return true; - - case Commands.FocusFileList: - tabBar.listView.SetFocus(); - return true; - - case Commands.OpenTabBarOptionDialog: - OptionsDialog.Open(); - return true; - - case Commands.OpenButtonBarOptionDialog: - OptionsDialog.Open(); // todo: open at bbar page - return true; - - case Commands.IsFolderTreeVisible: - return tabBar.ShellBrowser.IsFolderTreeVisible(); - - case Commands.IsButtonBarVisible: - return InstanceManager.TryGetButtonBarHandle(tabBar.ExplorerHandle, out ptr); - - case Commands.ShowFolderTree: - if(!QTUtility.IsXP || !(arg is bool)) { - break; - } - tabBar.ShowFolderTree((bool)arg); - return true; - - case Commands.ShowButtonBar: - if(!InstanceManager.TryGetButtonBarHandle(tabBar.ExplorerHandle, out ptr)) { - } - break; - - case Commands.MD5: - if(!(arg is string[])) { - break; - } - if(md5Form == null) { - md5Form = new FileHashComputerForm(); - } - if(md5Form.InvokeRequired) { - md5Form.Invoke(new FormMethodInvoker(ShowMD5FormCore), new object[] { arg }); - } - else { - ShowMD5FormCore(arg); - } - return true; - - case Commands.ShowProperties: { - if((arg == null) || !(arg is Address)) { - break; - } - Address address = (Address)arg; - using(IDLWrapper wrapper = new IDLWrapper(address)) { - if(!wrapper.Available) break; - ShellMethods.ShowProperties(wrapper.IDL, tabBar.ExplorerHandle); - return true; - } - } - case Commands.SetModalState: - if(((arg == null) || !(arg is bool)) || !((bool)arg)) { - tabBar.NowModalDialogShown = false; - break; - } - tabBar.NowModalDialogShown = true; - break; - - case Commands.SetSearchBoxStr: - return arg != null && arg is string && - TryCallButtonBar(bbar => bbar.SetSearchBarText((string)arg)); - - case Commands.ReorderTabsByName: - case Commands.ReorderTabsByPath: - case Commands.ReorderTabsByActv: - case Commands.ReorderTabsRevers: - if(tabBar.tabControl1.TabCount > 1) { - bool fDescending = ((arg != null) && (arg is bool)) && ((bool)arg); - tabBar.ReorderTab(((int)command) - 0x18, fDescending); - } - break; - } - } - return false; - } - - public ProcessStartInfo[] GetApplications(string name) { - return null; - } - - public string[] GetGroupPaths(string groupName) { - Group g = GroupsManager.GetGroup(groupName); - return g == null ? null : g.Paths.ToArray(); - } - - public ToolStripRenderer GetMenuRenderer() { - return DropDownMenuBase.CurrentRenderer; - } - - public ITab[] GetTabs() { - return (from QTabItem item in tabBar.tabControl1.TabPages - select (ITab)(new TabWrapper(item, tabBar))).ToArray(); - } - - public ITab HitTest(Point pnt) { - QTabItem tabMouseOn = tabBar.tabControl1.GetTabMouseOn(); - return tabMouseOn != null ? new TabWrapper(tabMouseOn, tabBar) : null; - } - - private string InstanceToFullName(IPluginClient pluginClient, bool fTypeFullName) { - Plugin plugin = dicPluginInstances.Values.FirstOrDefault(plugin1 => plugin1.Instance == pluginClient); - return plugin == null - ? null - : fTypeFullName - ? plugin.PluginInformation.TypeFullName - : plugin.PluginInformation.PluginID; - } - - public bool IsPluginInstantialized(string pluginID) { - return dicPluginInstances.ContainsKey(pluginID); - } - - public Plugin Load(PluginInformation pi, PluginAssembly pa) { - try { - if(pa == null && !PluginManager.GetAssembly(pi.Path, out pa)) { - return null; - } - Plugin plugin = pa.Load(pi.PluginID); - if(plugin == null) return null; - dicPluginInstances[pi.PluginID] = plugin; - plugin.Instance.Open(this, shellBrowser); - return plugin; - } - catch(Exception exception) { - PluginManager.HandlePluginException(exception, IntPtr.Zero, pi.Name, "Loading plugin."); - QTUtility2.MakeErrorLog(exception); - } - return null; - } - - private void LoadStartupPlugins() { - foreach(PluginInformation information in PluginManager.PluginInformations.Where(information => information.Enabled)) { - if(information.PluginType == PluginType.Background) { - Plugin plugin = Load(information, null); - if(plugin != null) { - if(FilterPlugin == null) { - FilterPlugin = plugin.Instance as IFilter; - } - if(FilterCorePlugin == null) { - FilterCorePlugin = plugin.Instance as IFilterCore; - } - } - else { - information.Enabled = false; - } - } - else if(information.PluginType != PluginType.Static && Load(information, null) == null) { - information.Enabled = false; - } - } - } - - public void OnExplorerStateChanged(ExplorerWindowActions windowAction) { - if(ExplorerStateChanged != null) { - ExplorerStateChanged(this, new PluginEventArgs(windowAction)); - } - } - - // todo: Menu Renderer does not change anymore. - public void OnMenuRendererChanged() { - if(MenuRendererChanged != null) { - MenuRendererChanged(this, EventArgs.Empty); - } - } - - public void OnMouseEnter() { - if(MouseEnter != null) { - MouseEnter(this, EventArgs.Empty); - } - } - - public void OnMouseLeave() { - if(MouseLeave != null) { - MouseLeave(this, EventArgs.Empty); - } - } - - public void OnNavigationComplete(int index, byte[] idl, string path) { - if(NavigationComplete != null) { - NavigationComplete(this, new PluginEventArgs(index, new Address(idl, path))); - } - } - - public void OnPointedTabChanged(int index, byte[] idl, string path) { - if(PointedTabChanged != null) { - PointedTabChanged(this, new PluginEventArgs(index, new Address(idl, path))); - } - } - - public void OnSelectionChanged(int index, byte[] idl, string path) { - if(SelectionChanged != null) { - SelectionChanged(this, new PluginEventArgs(index, new Address(idl, path))); - } - } - - public void OnSettingsChanged(int iType) { - if(SettingsChanged != null) { - SettingsChanged(this, new PluginEventArgs(iType, new Address())); - } - } - - public void OnTabAdded(int index, byte[] idl, string path) { - if(TabAdded != null) { - TabAdded(this, new PluginEventArgs(index, new Address(idl, path))); - } - } - - public void OnTabChanged(int index, byte[] idl, string path) { - if(TabChanged != null) { - TabChanged(this, new PluginEventArgs(index, new Address(idl, path))); - } - } - - public void OnTabRemoved(int index, byte[] idl, string path) { - if(TabRemoved != null) { - TabRemoved(this, new PluginEventArgs(index, new Address(idl, path))); - } - } - - public void OpenGroup(string[] groupNames) { - foreach(string str in groupNames) { - tabBar.OpenGroup(str, false); - } - } - - public void RefreshPlugins() { - ClearFilterEngines(); - foreach(PluginInformation information in PluginManager.PluginInformations) { - if(!information.Enabled) { - UnloadPluginInstance(information.PluginID, EndCode.Unloaded); - } - else if(information.PluginType == PluginType.Background) { - Plugin plugin; - if(!TryGetPlugin(information.PluginID, out plugin)) { - plugin = Load(information, null); - } - if(plugin != null) { - if(FilterPlugin == null) { - FilterPlugin = plugin.Instance as IFilter; - } - if(FilterCorePlugin == null) { - FilterCorePlugin = plugin.Instance as IFilterCore; - } - } - else { - information.Enabled = false; - } - } - else if(information.PluginType == PluginType.BackgroundMultiple) { - if(!IsPluginInstantialized(information.PluginID) && Load(information, null) == null) { - information.Enabled = false; - } - } - } - } - - public void RegisterMenu(IPluginClient pluginClient, MenuType menuType, string menuText, bool fRegister) { - foreach(Plugin plugin in dicPluginInstances.Values.Where(plugin => plugin.Instance == pluginClient)) { - if(fRegister) { - if((menuType & MenuType.Bar) == MenuType.Bar) { - dicFullNamesMenuRegistered_Sys[plugin.PluginInformation.PluginID] = menuText; - } - if((menuType & MenuType.Tab) == MenuType.Tab) { - dicFullNamesMenuRegistered_Tab[plugin.PluginInformation.PluginID] = menuText; - } - } - else { - if((menuType & MenuType.Bar) == MenuType.Bar) { - dicFullNamesMenuRegistered_Sys.Remove(plugin.PluginInformation.PluginID); - } - if((menuType & MenuType.Tab) == MenuType.Tab) { - dicFullNamesMenuRegistered_Tab.Remove(plugin.PluginInformation.PluginID); - } - } - break; - } - } - - public bool RemoveApplication(string name) { - return false; - } - - internal void RemoveEvents(IPluginClient pluginClient) { - if(TabChanged != null) { - foreach(PluginEventHandler handler in TabChanged.GetInvocationList()) { - if(handler.Target == pluginClient) { - TabChanged = (PluginEventHandler)Delegate.Remove(TabChanged, handler); - } - } - } - if(TabAdded != null) { - foreach(PluginEventHandler handler2 in TabAdded.GetInvocationList()) { - if(handler2.Target == pluginClient) { - TabAdded = (PluginEventHandler)Delegate.Remove(TabAdded, handler2); - } - } - } - if(TabRemoved != null) { - foreach(PluginEventHandler handler3 in TabRemoved.GetInvocationList()) { - if(handler3.Target == pluginClient) { - TabRemoved = (PluginEventHandler)Delegate.Remove(TabRemoved, handler3); - } - } - } - if(NavigationComplete != null) { - foreach(PluginEventHandler handler4 in NavigationComplete.GetInvocationList()) { - if(handler4.Target == pluginClient) { - NavigationComplete = (PluginEventHandler)Delegate.Remove(NavigationComplete, handler4); - } - } - } - if(SelectionChanged != null) { - foreach(PluginEventHandler handler5 in SelectionChanged.GetInvocationList()) { - if(handler5.Target == pluginClient) { - SelectionChanged = (PluginEventHandler)Delegate.Remove(SelectionChanged, handler5); - } - } - } - if(ExplorerStateChanged != null) { - foreach(PluginEventHandler handler6 in ExplorerStateChanged.GetInvocationList()) { - if(handler6.Target == pluginClient) { - ExplorerStateChanged = (PluginEventHandler)Delegate.Remove(ExplorerStateChanged, handler6); - } - } - } - if(SettingsChanged != null) { - foreach(PluginEventHandler handler7 in SettingsChanged.GetInvocationList()) { - if(handler7.Target == pluginClient) { - SettingsChanged = (PluginEventHandler)Delegate.Remove(SettingsChanged, handler7); - } - } - } - if(MouseEnter != null) { - foreach(EventHandler handler8 in MouseEnter.GetInvocationList()) { - if(handler8.Target == pluginClient) { - MouseEnter = (EventHandler)Delegate.Remove(MouseEnter, handler8); - } - } - } - if(PointedTabChanged != null) { - foreach(PluginEventHandler handler9 in PointedTabChanged.GetInvocationList()) { - if(handler9.Target == pluginClient) { - PointedTabChanged = (PluginEventHandler)Delegate.Remove(PointedTabChanged, handler9); - } - } - } - if(MouseLeave != null) { - foreach(EventHandler handler10 in MouseLeave.GetInvocationList()) { - if(handler10.Target == pluginClient) { - MouseLeave = (EventHandler)Delegate.Remove(MouseLeave, handler10); - } - } - } - if(MenuRendererChanged != null) { - foreach(EventHandler handler11 in MenuRendererChanged.GetInvocationList()) { - if(handler11.Target == pluginClient) { - MenuRendererChanged = (EventHandler)Delegate.Remove(MenuRendererChanged, handler11); - } - } - } - } - - public bool RemoveGroup(string groupName) { - return GroupsManager.RemoveGroup(groupName); - } - - public bool TryGetLocalizedStrings(IPluginClient pluginClient, int count, out string[] arrStrings) { - string key = InstanceToFullName(pluginClient, true); - if(key.Length > 0 && dicLocalizingStrings.TryGetValue(key, out arrStrings) && arrStrings != null && arrStrings.Length == count) { - return true; - } - arrStrings = null; - return false; - } - - public bool TryGetPlugin(string pluginID, out Plugin plugin) { - return dicPluginInstances.TryGetValue(pluginID, out plugin); - } - - public bool TryGetSelection(out Address[] adSelectedItems) { - string str; - return tabBar.ShellBrowser.TryGetSelection(out adSelectedItems, out str, false); - } - - public bool TrySetSelection(Address[] itemsToSelect, bool fDeselectOthers) { - return tabBar.ShellBrowser.TrySetSelection(itemsToSelect, null, fDeselectOthers); - } - - public void UpdateItem(IBarButton barItem, bool fEnabled, bool fRefreshImage) { - string pid = InstanceToFullName(barItem, false); - if(pid.Length > 0) TryCallButtonBar(bbar => - bbar.UpdatePluginItem(pid, barItem, fEnabled, fRefreshImage)); - } - - public void UnloadPluginInstance(string pluginID, EndCode code) { - Plugin plugin; - dicFullNamesMenuRegistered_Sys.Remove(pluginID); - dicFullNamesMenuRegistered_Tab.Remove(pluginID); - if(!dicPluginInstances.TryGetValue(pluginID, out plugin)) return; - RemoveEvents(plugin.Instance); - dicPluginInstances.Remove(pluginID); - plugin.Close(code); - } - - public IntPtr ExplorerHandle { - get { - return tabBar.ExplorerHandle; - } - } - - public IFilter FilterPlugin { get; private set; } - - public IFilterCore FilterCorePlugin { get; private set; } - - public string[] Groups { - get { - return GroupsManager.Groups.Select(g => g.Name).ToArray(); - } - } - - public IntPtr Handle { - get { - return tabBar.IsHandleCreated ? tabBar.Handle : IntPtr.Zero; - } - } - - public IEnumerable Plugins { - get { - return new List(dicPluginInstances.Values); - } - } - - public ITab SelectedTab { - get { - return tabBar.CurrentTab != null ? new TabWrapper(tabBar.CurrentTab, tabBar) : null; - } - set { - TabWrapper wrapper = value as TabWrapper; - if((wrapper.Tab != null) && tabBar.tabControl1.TabPages.Contains(wrapper.Tab)) { - tabBar.tabControl1.SelectTab(wrapper.Tab); - } - } - } - - public bool SelectionChangedAttached { - get { - return (SelectionChanged != null); - } - } - - public TabBarOption TabBarOption { - get { - return QTUtility.GetTabBarOption(); - } - set { - QTUtility.SetTabBarOption(value, tabBar); - } - } - - internal sealed class TabWrapper : ITab { - private QTabItem tab; - private QTTabBarClass tabBar; - - public TabWrapper(QTabItem tab, QTTabBarClass tabBar) { - this.tab = tab; - this.tabBar = tabBar; - this.tab.Closed += tab_Closed; - } - - public bool Browse(Address address) { - if(tab != null) { - tabBar.tabControl1.SelectTab(tab); - using(IDLWrapper wrapper = new IDLWrapper(address)) { - return tabBar.ShellBrowser.Navigate(wrapper) == 0; - } - } - return false; - } - - public bool Browse(bool fBack) { - if(tab != null) { - tabBar.tabControl1.SelectTab(tab); - return tabBar.NavigateCurrentTab(fBack); - } - return false; - } - - public void Clone(int index, bool fSelect) { - if(tab != null) { - tabBar.CloneTabButton(tab, null, fSelect, index); - } - } - - public bool Close() { - return (((tab != null) && (tabBar.tabControl1.TabCount > 1)) && tabBar.CloseTab(tab, true)); - } - - public Address[] GetBraches() { - if(tab == null) { - return null; - } - return (from data in tab.Branches - where data.IDL != null || !string.IsNullOrEmpty(data.Path) - select new Address(data.IDL, data.Path)).ToArray(); - } - - public Address[] GetHistory(bool fBack) { - if(tab == null) { - return null; - } - IEnumerable logs = tab.GetLogs(fBack); - return logs.Select(data => new Address(data.IDL, data.Path)).ToArray(); - } - - public bool Insert(int index) { - if(((tab != null) && (-1 < index)) && (index < (tabBar.tabControl1.TabCount + 1))) { - int indexSource = tabBar.tabControl1.TabPages.IndexOf(tab); - if(indexSource > -1) { - tabBar.tabControl1.TabPages.Relocate(indexSource, index); - return true; - } - } - return false; - } - - private void tab_Closed(object sender, EventArgs e) { - tab.Closed -= tab_Closed; - tab = null; - tabBar = null; - } - - public Address Address { - get { - if(tab == null) { - return new Address(); - } - Address address = new Address(tab.CurrentIDL, tab.CurrentPath); - if((address.ITEMIDLIST == null) && !string.IsNullOrEmpty(address.Path)) { - IDLWrapper wrapper; - IntPtr pidl = PInvoke.ILCreateFromPath(address.Path); - if(pidl != IntPtr.Zero) { - address = new Address(pidl, tab.CurrentPath); - PInvoke.CoTaskMemFree(pidl); - return address; - } - if(!IDLWrapper.TryGetCache(address.Path, out wrapper)) { - return address; - } - using(wrapper) { - address.ITEMIDLIST = wrapper.IDL; - } - } - return address; - } - } - - public int Index { - get { - if(tab != null) { - return tabBar.tabControl1.TabPages.IndexOf(tab); - } - return -1; - } - } - - // 璁剧疆涓洪攣瀹 - public bool Locked { - get { - return ((tab != null) && tab.TabLocked); - } - set { - if(tab != null) { - tab.TabLocked = value; - tabBar.tabControl1.Refresh(); - } - } - } - - public bool Selected { - get { - return ((tab != null) && (tabBar.CurrentTab == tab)); - } - set { - if((tab != null) && value) { - tabBar.tabControl1.SelectTab(tab); - } - } - } - - public string SubText { - get { - if(tab != null) { - return tab.Comment; - } - return string.Empty; - } - set { - if((tab != null) && (value != null)) { - tab.Comment = value; - tab.RefreshRectangle(); - tabBar.tabControl1.Refresh(); - } - } - } - - public QTabItem Tab { - get { - return tab; - } - } - - public string Text { - get { - return tab != null ? tab.Text : string.Empty; - } - set { - if(tab != null && !string.IsNullOrEmpty(value)) { - tab.Text = value; - } - } - } - } - } - - public static Dictionary testQTUtilityReadLanguageFile(string path ) - { - return QTUtility.ReadLanguageFile( path ); - } - } -} + }*/ + WindowUtils.CloseExplorer(tabBar.ExplorerHandle, 2); + return true; + + case Commands.UndoClose: + tabBar.RestoreLastClosed(); + return true; + + case Commands.BrowseFolder: + tabBar.ChooseNewDirectory(); + return true; + + case Commands.ToggleTopMost: + tabBar.ToggleTopMost(); + TryCallButtonBar(bbar => bbar.RefreshButtons()); + return true; + + case Commands.FocusFileList: + tabBar.listView.SetFocus(); + return true; + + case Commands.OpenTabBarOptionDialog: + OptionsDialog.Open(); + return true; + + case Commands.OpenButtonBarOptionDialog: + OptionsDialog.Open(); // todo: open at bbar page + return true; + + case Commands.IsFolderTreeVisible: + return tabBar.ShellBrowser.IsFolderTreeVisible(); + + case Commands.IsButtonBarVisible: + return InstanceManager.TryGetButtonBarHandle(tabBar.ExplorerHandle, out ptr); + + case Commands.ShowFolderTree: + if(!QTUtility.IsXP || !(arg is bool)) { + break; + } + tabBar.ShowFolderTree((bool)arg); + return true; + + case Commands.ShowButtonBar: + if(!InstanceManager.TryGetButtonBarHandle(tabBar.ExplorerHandle, out ptr)) { + } + break; + + case Commands.MD5: + if(!(arg is string[])) { + break; + } + if(md5Form == null) { + md5Form = new FileHashComputerForm(); + } + if(md5Form.InvokeRequired) { + md5Form.Invoke(new FormMethodInvoker(ShowMD5FormCore), new object[] { arg }); + } + else { + ShowMD5FormCore(arg); + } + return true; + + case Commands.ShowProperties: { + if((arg == null) || !(arg is Address)) { + break; + } + Address address = (Address)arg; + using(IDLWrapper wrapper = new IDLWrapper(address)) { + if(!wrapper.Available) break; + ShellMethods.ShowProperties(wrapper.IDL, tabBar.ExplorerHandle); + return true; + } + } + case Commands.SetModalState: + if(((arg == null) || !(arg is bool)) || !((bool)arg)) { + tabBar.NowModalDialogShown = false; + break; + } + tabBar.NowModalDialogShown = true; + break; + + case Commands.SetSearchBoxStr: + return arg != null && arg is string && + TryCallButtonBar(bbar => bbar.SetSearchBarText((string)arg)); + + case Commands.ReorderTabsByName: + case Commands.ReorderTabsByPath: + case Commands.ReorderTabsByActv: + case Commands.ReorderTabsRevers: + if(tabBar.tabControl1.TabCount > 1) { + bool fDescending = ((arg != null) && (arg is bool)) && ((bool)arg); + tabBar.ReorderTab(((int)command) - 0x18, fDescending); + } + break; + } + } + return false; + } + + public ProcessStartInfo[] GetApplications(string name) { + return null; + } + + public string[] GetGroupPaths(string groupName) { + Group g = GroupsManager.GetGroup(groupName); + return g == null ? null : g.Paths.ToArray(); + } + + public ToolStripRenderer GetMenuRenderer() { + return DropDownMenuBase.CurrentRenderer; + } + + public ITab[] GetTabs() { + return (from QTabItem item in tabBar.tabControl1.TabPages + select (ITab)(new TabWrapper(item, tabBar))).ToArray(); + } + + public ITab HitTest(Point pnt) { + QTabItem tabMouseOn = tabBar.tabControl1.GetTabMouseOn(); + return tabMouseOn != null ? new TabWrapper(tabMouseOn, tabBar) : null; + } + + private string InstanceToFullName(IPluginClient pluginClient, bool fTypeFullName) { + Plugin plugin = dicPluginInstances.Values.FirstOrDefault(plugin1 => plugin1.Instance == pluginClient); + return plugin == null + ? null + : fTypeFullName + ? plugin.PluginInformation.TypeFullName + : plugin.PluginInformation.PluginID; + } + + public bool IsPluginInstantialized(string pluginID) { + return dicPluginInstances.ContainsKey(pluginID); + } + + public Plugin Load(PluginInformation pi, PluginAssembly pa) { + try { + if(pa == null && !PluginManager.GetAssembly(pi.Path, out pa)) { + return null; + } + Plugin plugin = pa.Load(pi.PluginID); + if(plugin == null) return null; + dicPluginInstances[pi.PluginID] = plugin; + plugin.Instance.Open(this, shellBrowser); + return plugin; + } + catch(Exception exception) { + PluginManager.HandlePluginException(exception, IntPtr.Zero, pi.Name, "Loading plugin."); + QTUtility2.MakeErrorLog(exception); + } + return null; + } + + private void LoadStartupPlugins() { + foreach(PluginInformation information in PluginManager.PluginInformations.Where(information => information.Enabled)) { + if(information.PluginType == PluginType.Background) { + Plugin plugin = Load(information, null); + if(plugin != null) { + if(FilterPlugin == null) { + FilterPlugin = plugin.Instance as IFilter; + } + if(FilterCorePlugin == null) { + FilterCorePlugin = plugin.Instance as IFilterCore; + } + } + else { + information.Enabled = false; + } + } + else if(information.PluginType != PluginType.Static && Load(information, null) == null) { + information.Enabled = false; + } + } + } + + public void OnExplorerStateChanged(ExplorerWindowActions windowAction) { + if(ExplorerStateChanged != null) { + ExplorerStateChanged(this, new PluginEventArgs(windowAction)); + } + } + + // todo: Menu Renderer does not change anymore. + public void OnMenuRendererChanged() { + if(MenuRendererChanged != null) { + MenuRendererChanged(this, EventArgs.Empty); + } + } + + public void OnMouseEnter() { + if(MouseEnter != null) { + MouseEnter(this, EventArgs.Empty); + } + } + + public void OnMouseLeave() { + if(MouseLeave != null) { + MouseLeave(this, EventArgs.Empty); + } + } + + public void OnNavigationComplete(int index, byte[] idl, string path) { + if(NavigationComplete != null) { + NavigationComplete(this, new PluginEventArgs(index, new Address(idl, path))); + } + } + + public void OnPointedTabChanged(int index, byte[] idl, string path) { + if(PointedTabChanged != null) { + PointedTabChanged(this, new PluginEventArgs(index, new Address(idl, path))); + } + } + + public void OnSelectionChanged(int index, byte[] idl, string path) { + if(SelectionChanged != null) { + SelectionChanged(this, new PluginEventArgs(index, new Address(idl, path))); + } + } + + public void OnSettingsChanged(int iType) { + if(SettingsChanged != null) { + SettingsChanged(this, new PluginEventArgs(iType, new Address())); + } + } + + public void OnTabAdded(int index, byte[] idl, string path) { + if(TabAdded != null) { + TabAdded(this, new PluginEventArgs(index, new Address(idl, path))); + } + } + + public void OnTabChanged(int index, byte[] idl, string path) { + if(TabChanged != null) { + TabChanged(this, new PluginEventArgs(index, new Address(idl, path))); + } + } + + public void OnTabRemoved(int index, byte[] idl, string path) { + if(TabRemoved != null) { + TabRemoved(this, new PluginEventArgs(index, new Address(idl, path))); + } + } + + public void OpenGroup(string[] groupNames) { + foreach(string str in groupNames) { + tabBar.OpenGroup(str, false); + } + } + + public void RefreshPlugins() { + ClearFilterEngines(); + foreach(PluginInformation information in PluginManager.PluginInformations) { + if(!information.Enabled) { + UnloadPluginInstance(information.PluginID, EndCode.Unloaded); + } + else if(information.PluginType == PluginType.Background) { + Plugin plugin; + if(!TryGetPlugin(information.PluginID, out plugin)) { + plugin = Load(information, null); + } + if(plugin != null) { + if(FilterPlugin == null) { + FilterPlugin = plugin.Instance as IFilter; + } + if(FilterCorePlugin == null) { + FilterCorePlugin = plugin.Instance as IFilterCore; + } + } + else { + information.Enabled = false; + } + } + else if(information.PluginType == PluginType.BackgroundMultiple) { + if(!IsPluginInstantialized(information.PluginID) && Load(information, null) == null) { + information.Enabled = false; + } + } + } + } + + public void RegisterMenu(IPluginClient pluginClient, MenuType menuType, string menuText, bool fRegister) { + foreach(Plugin plugin in dicPluginInstances.Values.Where(plugin => plugin.Instance == pluginClient)) { + if(fRegister) { + if((menuType & MenuType.Bar) == MenuType.Bar) { + dicFullNamesMenuRegistered_Sys[plugin.PluginInformation.PluginID] = menuText; + } + if((menuType & MenuType.Tab) == MenuType.Tab) { + dicFullNamesMenuRegistered_Tab[plugin.PluginInformation.PluginID] = menuText; + } + } + else { + if((menuType & MenuType.Bar) == MenuType.Bar) { + dicFullNamesMenuRegistered_Sys.Remove(plugin.PluginInformation.PluginID); + } + if((menuType & MenuType.Tab) == MenuType.Tab) { + dicFullNamesMenuRegistered_Tab.Remove(plugin.PluginInformation.PluginID); + } + } + break; + } + } + + public bool RemoveApplication(string name) { + return false; + } + + internal void RemoveEvents(IPluginClient pluginClient) { + if(TabChanged != null) { + foreach(PluginEventHandler handler in TabChanged.GetInvocationList()) { + if(handler.Target == pluginClient) { + TabChanged = (PluginEventHandler)Delegate.Remove(TabChanged, handler); + } + } + } + if(TabAdded != null) { + foreach(PluginEventHandler handler2 in TabAdded.GetInvocationList()) { + if(handler2.Target == pluginClient) { + TabAdded = (PluginEventHandler)Delegate.Remove(TabAdded, handler2); + } + } + } + if(TabRemoved != null) { + foreach(PluginEventHandler handler3 in TabRemoved.GetInvocationList()) { + if(handler3.Target == pluginClient) { + TabRemoved = (PluginEventHandler)Delegate.Remove(TabRemoved, handler3); + } + } + } + if(NavigationComplete != null) { + foreach(PluginEventHandler handler4 in NavigationComplete.GetInvocationList()) { + if(handler4.Target == pluginClient) { + NavigationComplete = (PluginEventHandler)Delegate.Remove(NavigationComplete, handler4); + } + } + } + if(SelectionChanged != null) { + foreach(PluginEventHandler handler5 in SelectionChanged.GetInvocationList()) { + if(handler5.Target == pluginClient) { + SelectionChanged = (PluginEventHandler)Delegate.Remove(SelectionChanged, handler5); + } + } + } + if(ExplorerStateChanged != null) { + foreach(PluginEventHandler handler6 in ExplorerStateChanged.GetInvocationList()) { + if(handler6.Target == pluginClient) { + ExplorerStateChanged = (PluginEventHandler)Delegate.Remove(ExplorerStateChanged, handler6); + } + } + } + if(SettingsChanged != null) { + foreach(PluginEventHandler handler7 in SettingsChanged.GetInvocationList()) { + if(handler7.Target == pluginClient) { + SettingsChanged = (PluginEventHandler)Delegate.Remove(SettingsChanged, handler7); + } + } + } + if(MouseEnter != null) { + foreach(EventHandler handler8 in MouseEnter.GetInvocationList()) { + if(handler8.Target == pluginClient) { + MouseEnter = (EventHandler)Delegate.Remove(MouseEnter, handler8); + } + } + } + if(PointedTabChanged != null) { + foreach(PluginEventHandler handler9 in PointedTabChanged.GetInvocationList()) { + if(handler9.Target == pluginClient) { + PointedTabChanged = (PluginEventHandler)Delegate.Remove(PointedTabChanged, handler9); + } + } + } + if(MouseLeave != null) { + foreach(EventHandler handler10 in MouseLeave.GetInvocationList()) { + if(handler10.Target == pluginClient) { + MouseLeave = (EventHandler)Delegate.Remove(MouseLeave, handler10); + } + } + } + if(MenuRendererChanged != null) { + foreach(EventHandler handler11 in MenuRendererChanged.GetInvocationList()) { + if(handler11.Target == pluginClient) { + MenuRendererChanged = (EventHandler)Delegate.Remove(MenuRendererChanged, handler11); + } + } + } + } + + public bool RemoveGroup(string groupName) { + return GroupsManager.RemoveGroup(groupName); + } + + public bool TryGetLocalizedStrings(IPluginClient pluginClient, int count, out string[] arrStrings) { + string key = InstanceToFullName(pluginClient, true); + if(key.Length > 0 && dicLocalizingStrings.TryGetValue(key, out arrStrings) && arrStrings != null && arrStrings.Length == count) { + return true; + } + arrStrings = null; + return false; + } + + public bool TryGetPlugin(string pluginID, out Plugin plugin) { + return dicPluginInstances.TryGetValue(pluginID, out plugin); + } + + public bool TryGetSelection(out Address[] adSelectedItems) { + string str; + return tabBar.ShellBrowser.TryGetSelection(out adSelectedItems, out str, false); + } + + public bool TrySetSelection(Address[] itemsToSelect, bool fDeselectOthers) { + return tabBar.ShellBrowser.TrySetSelection(itemsToSelect, null, fDeselectOthers); + } + + public void UpdateItem(IBarButton barItem, bool fEnabled, bool fRefreshImage) { + string pid = InstanceToFullName(barItem, false); + if(pid.Length > 0) TryCallButtonBar(bbar => + bbar.UpdatePluginItem(pid, barItem, fEnabled, fRefreshImage)); + } + + public void UnloadPluginInstance(string pluginID, EndCode code) { + Plugin plugin; + dicFullNamesMenuRegistered_Sys.Remove(pluginID); + dicFullNamesMenuRegistered_Tab.Remove(pluginID); + if(!dicPluginInstances.TryGetValue(pluginID, out plugin)) return; + RemoveEvents(plugin.Instance); + dicPluginInstances.Remove(pluginID); + plugin.Close(code); + } + + public IntPtr ExplorerHandle { + get { + return tabBar.ExplorerHandle; + } + } + + public IFilter FilterPlugin { get; private set; } + + public IFilterCore FilterCorePlugin { get; private set; } + + public string[] Groups { + get { + return GroupsManager.Groups.Select(g => g.Name).ToArray(); + } + } + + public IntPtr Handle { + get { + return tabBar.IsHandleCreated ? tabBar.Handle : IntPtr.Zero; + } + } + + public IEnumerable Plugins { + get { + return new List(dicPluginInstances.Values); + } + } + + public ITab SelectedTab { + get { + return tabBar.CurrentTab != null ? new TabWrapper(tabBar.CurrentTab, tabBar) : null; + } + set { + TabWrapper wrapper = value as TabWrapper; + if((wrapper.Tab != null) && tabBar.tabControl1.TabPages.Contains(wrapper.Tab)) { + tabBar.tabControl1.SelectTab(wrapper.Tab); + } + } + } + + public bool SelectionChangedAttached { + get { + return (SelectionChanged != null); + } + } + + public TabBarOption TabBarOption { + get { + return QTUtility.GetTabBarOption(); + } + set { + QTUtility.SetTabBarOption(value, tabBar); + } + } + + internal sealed class TabWrapper : ITab { + private QTabItem tab; + private QTTabBarClass tabBar; + + public TabWrapper(QTabItem tab, QTTabBarClass tabBar) { + this.tab = tab; + this.tabBar = tabBar; + this.tab.Closed += tab_Closed; + } + + public bool Browse(Address address) { + if(tab != null) { + tabBar.tabControl1.SelectTab(tab); + using(IDLWrapper wrapper = new IDLWrapper(address)) { + return tabBar.ShellBrowser.Navigate(wrapper) == 0; + } + } + return false; + } + + public bool Browse(bool fBack) { + if(tab != null) { + tabBar.tabControl1.SelectTab(tab); + return tabBar.NavigateCurrentTab(fBack); + } + return false; + } + + public void Clone(int index, bool fSelect) { + if(tab != null) { + tabBar.CloneTabButton(tab, null, fSelect, index); + } + } + + public bool Close() { + return (((tab != null) && (tabBar.tabControl1.TabCount > 1)) && tabBar.CloseTab(tab, true)); + } + + public Address[] GetBraches() { + if(tab == null) { + return null; + } + return (from data in tab.Branches + where data.IDL != null || !string.IsNullOrEmpty(data.Path) + select new Address(data.IDL, data.Path)).ToArray(); + } + + public Address[] GetHistory(bool fBack) { + if(tab == null) { + return null; + } + IEnumerable logs = tab.GetLogs(fBack); + return logs.Select(data => new Address(data.IDL, data.Path)).ToArray(); + } + + public bool Insert(int index) { + if(((tab != null) && (-1 < index)) && (index < (tabBar.tabControl1.TabCount + 1))) { + int indexSource = tabBar.tabControl1.TabPages.IndexOf(tab); + if(indexSource > -1) { + tabBar.tabControl1.TabPages.Relocate(indexSource, index); + return true; + } + } + return false; + } + + private void tab_Closed(object sender, EventArgs e) { + tab.Closed -= tab_Closed; + tab = null; + tabBar = null; + } + + public Address Address { + get { + if(tab == null) { + return new Address(); + } + Address address = new Address(tab.CurrentIDL, tab.CurrentPath); + if((address.ITEMIDLIST == null) && !string.IsNullOrEmpty(address.Path)) { + IDLWrapper wrapper; + IntPtr pidl = PInvoke.ILCreateFromPath(address.Path); + if(pidl != IntPtr.Zero) { + address = new Address(pidl, tab.CurrentPath); + PInvoke.CoTaskMemFree(pidl); + return address; + } + if(!IDLWrapper.TryGetCache(address.Path, out wrapper)) { + return address; + } + using(wrapper) { + address.ITEMIDLIST = wrapper.IDL; + } + } + return address; + } + } + + public int Index { + get { + if(tab != null) { + return tabBar.tabControl1.TabPages.IndexOf(tab); + } + return -1; + } + } + + // 璁剧疆涓洪攣瀹 + public bool Locked { + get { + return ((tab != null) && tab.TabLocked); + } + set { + if(tab != null) { + tab.TabLocked = value; + tabBar.tabControl1.Refresh(); + } + } + } + + public bool Selected { + get { + return ((tab != null) && (tabBar.CurrentTab == tab)); + } + set { + if((tab != null) && value) { + tabBar.tabControl1.SelectTab(tab); + } + } + } + + public string SubText { + get { + if(tab != null) { + return tab.Comment; + } + return string.Empty; + } + set { + if((tab != null) && (value != null)) { + tab.Comment = value; + tab.RefreshRectangle(); + tabBar.tabControl1.Refresh(); + } + } + } + + public QTabItem Tab { + get { + return tab; + } + } + + public string Text { + get { + return tab != null ? tab.Text : string.Empty; + } + set { + if(tab != null && !string.IsNullOrEmpty(value)) { + tab.Text = value; + } + } + } + } + } + + public static Dictionary testQTUtilityReadLanguageFile(string path ) + { + return QTUtility.ReadLanguageFile( path ); + } + } +} diff --git a/QTTabBar/Properties/AssemblyInfo.cs b/QTTabBar/Properties/AssemblyInfo.cs index c1395a5..634f3ec 100644 --- a/QTTabBar/Properties/AssemblyInfo.cs +++ b/QTTabBar/Properties/AssemblyInfo.cs @@ -55,8 +55,8 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.5.4.0")] -[assembly: AssemblyFileVersion("1.5.4.0")] // edit this +[assembly: AssemblyVersion("1.5.5.0")] +[assembly: AssemblyFileVersion("1.5.5.0")] // edit this // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. diff --git a/QTTabBar/QTButtonBar.cs b/QTTabBar/QTButtonBar.cs index 4efada6..2c158d4 100644 --- a/QTTabBar/QTButtonBar.cs +++ b/QTTabBar/QTButtonBar.cs @@ -1567,9 +1567,17 @@ internal void RefreshButtons() { ddmrUserAppButton.Close(ToolStripDropDownCloseReason.AppClicked); } QTTabBarClass tabbar = InstanceManager.GetThreadTabBar(); - int index = tabbar.SelectedTabIndex; - int count = tabbar.TabCount; + int index = 0; + int count = 0; + // 鍒ゆ柇tabbar涓嶄负绌 + if (null != tabbar && !tabbar.IsDisposed) { + index = tabbar.SelectedTabIndex; + count = tabbar.TabCount; + } + // 鍒ゆ柇 toolStrip Items涓嶄负绌 + if ( null != toolStrip && toolStrip.Items != null && toolStrip.Items.Count > 0 ) foreach(ToolStripItem item in toolStrip.Items) { + if (item == null) continue; if(item.Tag == null) continue; switch((int)item.Tag) { case BII_NAVIGATION_BACK: diff --git a/QTTabBar/QTTabBarClass.cs b/QTTabBar/QTTabBarClass.cs index a17125b..b1e104b 100644 --- a/QTTabBar/QTTabBarClass.cs +++ b/QTTabBar/QTTabBarClass.cs @@ -1171,12 +1171,15 @@ where item2.TabLocked } } } - + + // 控件正在打开时候发生 private void contextMenuSys_Opening(object sender, CancelEventArgs e) { InitializeSysMenu(false); + // 临时挂起控件布局 contextMenuSys.SuspendLayout(); tsmiGroups.DropDown.SuspendLayout(); tsmiUndoClose.DropDown.SuspendLayout(); + MenuUtility.CreateGroupItems(tsmiGroups); MenuUtility.CreateUndoClosedItems(tsmiUndoClose); if((lstActivatedTabs.Count > 1) && tabControl1.TabPages.Contains(lstActivatedTabs[lstActivatedTabs.Count - 2])) { @@ -5697,7 +5700,13 @@ private void tabControl1_MouseMove(object sender, MouseEventArgs e) { } } + // 鼠标在标签上操作 private void tabControl1_MouseUp(object sender, MouseEventArgs e) { + if (null == tabControl1 || tabControl1.IsDisposed) + { + // 如果是最后一个标签,则出现bug + return; + } QTabItem tabMouseOn = tabControl1.GetTabMouseOn(); if(NowTabDragging && e.Button == MouseButtons.Left) { Keys modifierKeys = ModifierKeys; diff --git a/QTTabBar/QTUtility.cs b/QTTabBar/QTUtility.cs index 3c67d55..319d622 100644 --- a/QTTabBar/QTUtility.cs +++ b/QTTabBar/QTUtility.cs @@ -36,7 +36,7 @@ namespace QTTabBarLib { internal static class QTUtility { internal static readonly Version BetaRevision = new Version(0, 3); - internal static readonly Version CurrentVersion = new Version(1, 5, 4, 0); + internal static readonly Version CurrentVersion = new Version(1, 5, 5, 0); internal const int FIRST_MOUSE_ONLY_ACTION = 1000; internal const int FLAG_KEYENABLED = 0x100000; internal const string IMAGEKEY_FOLDER = "folder"; diff --git a/QTTabBar/QTabControl.cs b/QTTabBar/QTabControl.cs index fecfb40..9cba669 100644 --- a/QTTabBar/QTabControl.cs +++ b/QTTabBar/QTabControl.cs @@ -758,6 +758,17 @@ private Rectangle GetItemRectWithInflation(int index) { } public QTabItem GetTabMouseOn() { + if (this == null || this.IsDisposed) + { + if (tabPages.Count == 1) + { + return tabPages[0]; + } + return null; + } + if (tabPages.Count == 1) { + return tabPages[0]; + } Point pt = PointToClient(MousePosition); if(((upDown != null) && upDown.Visible) && upDown.Bounds.Contains(pt)) { return null; diff --git a/QTTabBar/Resource_String_zh_CN.Designer.cs b/QTTabBar/Resource_String_zh_CN.Designer.cs index 0297e80..1235a1f 100644 --- a/QTTabBar/Resource_String_zh_CN.Designer.cs +++ b/QTTabBar/Resource_String_zh_CN.Designer.cs @@ -19,7 +19,7 @@ namespace QTTabBarLib { // 绫婚氳繃绫讳技浜 ResGen 鎴 Visual Studio 鐨勫伐鍏疯嚜鍔ㄧ敓鎴愮殑銆 // 鑻ヨ娣诲姞鎴栫Щ闄ゆ垚鍛橈紝璇风紪杈 .ResX 鏂囦欢锛岀劧鍚庨噸鏂拌繍琛 ResGen // (浠 /str 浣滀负鍛戒护閫夐」)锛屾垨閲嶆柊鐢熸垚 VS 椤圭洰銆 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resource_String_zh_CN { diff --git a/QTTabBar/Resources_Image.Designer.cs b/QTTabBar/Resources_Image.Designer.cs index 42ea8e8..b59ad16 100644 --- a/QTTabBar/Resources_Image.Designer.cs +++ b/QTTabBar/Resources_Image.Designer.cs @@ -19,7 +19,7 @@ namespace QTTabBarLib { // 绫婚氳繃绫讳技浜 ResGen 鎴 Visual Studio 鐨勫伐鍏疯嚜鍔ㄧ敓鎴愮殑銆 // 鑻ヨ娣诲姞鎴栫Щ闄ゆ垚鍛橈紝璇风紪杈 .ResX 鏂囦欢锛岀劧鍚庨噸鏂拌繍琛 ResGen // (浠 /str 浣滀负鍛戒护閫夐」)锛屾垨閲嶆柊鐢熸垚 VS 椤圭洰銆 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources_Image { diff --git a/QTTabBar/Resources_Image.resx b/QTTabBar/Resources_Image.resx index 9561125..ac8fb34 100644 --- a/QTTabBar/Resources_Image.resx +++ b/QTTabBar/Resources_Image.resx @@ -117,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Resources\ButtonStrip24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/QTTabBar/Resources_String.Designer.cs b/QTTabBar/Resources_String.Designer.cs index 93a97bd..768bd21 100644 --- a/QTTabBar/Resources_String.Designer.cs +++ b/QTTabBar/Resources_String.Designer.cs @@ -19,7 +19,7 @@ namespace QTTabBarLib { // 绫婚氳繃绫讳技浜 ResGen 鎴 Visual Studio 鐨勫伐鍏疯嚜鍔ㄧ敓鎴愮殑銆 // 鑻ヨ娣诲姞鎴栫Щ闄ゆ垚鍛橈紝璇风紪杈 .ResX 鏂囦欢锛岀劧鍚庨噸鏂拌繍琛 ResGen // (浠 /str 浣滀负鍛戒护閫夐」)锛屾垨閲嶆柊鐢熸垚 VS 椤圭洰銆 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources_String { diff --git a/QTTabBar/UpdateChecker.cs b/QTTabBar/UpdateChecker.cs index b7eb911..929655c 100644 --- a/QTTabBar/UpdateChecker.cs +++ b/QTTabBar/UpdateChecker.cs @@ -73,8 +73,8 @@ private static int CheckInternal(out string msg) { msg = null; string str = null; // HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Resources_String.SiteURL + "/files/latestversion.txt"); - // HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://raw.githubusercontent.com/indiff/qttabbar/master/latestversion.txt"); - HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://gitee.com/qwop/qttabbar/raw/master/latestversion.txt"); + HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://raw.githubusercontent.com/indiff/qttabbar/master/latestversion.txt"); + // HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://gitee.com/qwop/qttabbar/raw/master/latestversion.txt"); req.Timeout = 5000; diff --git a/Register/Register.bat b/Register/Register.bat index c4d1353..3ffa43c 100644 --- a/Register/Register.bat +++ b/Register/Register.bat @@ -25,7 +25,7 @@ IF EXIST Interop.SHDocVw.dll ( ) cd ..\..\..\QTHookLib\bin\%1 -REG ADD HKLM\SOFTWARE\Quizo\QTTabBar /v InstallPath /t REG_SZ /d "%cd%" /f /reg:32 -REG ADD HKLM\SOFTWARE\Quizo\QTTabBar /v InstallPath /t REG_SZ /d "%cd%" /f /reg:64 +REG ADD HKLM\SOFTWARE\QTTabBar /v InstallPath /t REG_SZ /d "%cd%" /f /reg:32 +REG ADD HKLM\SOFTWARE\QTTabBar /v InstallPath /t REG_SZ /d "%cd%" /f /reg:64 cd ..\..\..\Register \ No newline at end of file diff --git "a/\346\270\205\347\220\206.bat" "b/\346\270\205\347\220\206.bat" index 4c74784..85828de 100644 --- "a/\346\270\205\347\220\206.bat" +++ "b/\346\270\205\347\220\206.bat" @@ -6,4 +6,7 @@ for /f "delims=" %%i in ('dir /ad /b' ) do @if exist "%CD%\%%i\bin" @rmdir /s /q for /f "delims=" %%i in ('dir /ad /b' ) do @if exist "%CD%\%%i\obj" @rmdir /s /q "%CD%\%%i\obj" del /f /s /q *.plg del /f /s /q *.aps +del /f /s /q *.cache +del /f /s /q *.dll + pause \ No newline at end of file