コード例 #1
0
 public override void CloseDW(uint dwReserved) {
     if(iContextMenu2 != null) {
         Marshal.ReleaseComObject(iContextMenu2);
         iContextMenu2 = null;
     }
     if(ShellBrowser != null) {
         ShellBrowser.Dispose();
         ShellBrowser = null;
     }
     lock(this) {
         if(listView != null) {
             listView.RemoteDispose();
             listView = null;
         }
     }
     DisposeInvoker method = disposable => disposable.Dispose();
     if(hashForm != null) {
         hashForm.Invoke(method, new object[] { hashForm });
         hashForm = null;
     }
     if(hHook_MsgDesktop != IntPtr.Zero) {
         PInvoke.UnhookWindowsHookEx(hHook_MsgDesktop);
         hHook_MsgDesktop = IntPtr.Zero;
     }
     if(hHook_MsgShell_TrayWnd != IntPtr.Zero) {
         PInvoke.UnhookWindowsHookEx(hHook_MsgShell_TrayWnd);
         hHook_MsgShell_TrayWnd = IntPtr.Zero;
     }
     if(hHook_KeyDesktop != IntPtr.Zero) {
         PInvoke.UnhookWindowsHookEx(hHook_KeyDesktop);
         hHook_KeyDesktop = IntPtr.Zero;
     }
     base.CloseDW(dwReserved);
 }
コード例 #2
0
        private void DoFileTools(int index) {
            try {
                switch(index) {
                    case 0:
                    case 1: {
                        bool flag = index == 0;
                        string str = ShellBrowser.GetItems()
                                .Select(wrapper2 => flag ? wrapper2.ParseName : wrapper2.DisplayName)
                                .Where(name => name.Length > 0).StringJoin("\r\n");
                        if(str.Length > 0) {
                            QTTabBarClass.SetStringClipboard(str);
                        }
                        break;
                    }

                    case 2:
                    case 3: {
                        string folderPath = string.Empty;
                        if(index == 2) {
                            folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                        }
                        else {
                            byte[] idl = new byte[2];
                            using(IDLWrapper wrapper = new IDLWrapper(idl)) {
                                if(wrapper.Available) {
                                    folderPath = ShellMethods.GetDisplayName(wrapper.PIDL, true);
                                }
                            }
                        }
                        if(folderPath.Length > 0) {
                            QTTabBarClass.SetStringClipboard(folderPath);
                        }
                        break;
                    }

                    case 4: {
                        List<string> list2 = new List<string>();
                        foreach(IDLWrapper wrapper2 in ShellBrowser.GetItems(true)) {
                            if(wrapper2.IsLink) {
                                string linkTargetPath = ShellMethods.GetLinkTargetPath(wrapper2.Path);
                                if(File.Exists(linkTargetPath)) {
                                    list2.Add(linkTargetPath);
                                }
                            }
                            else if(wrapper2.IsFileSystemFile) {
                                list2.Add(wrapper2.Path);
                            }
                        }
                        if(hashForm == null) {
                            hashForm = new FileHashComputerForm();
                        }
                        hashForm.ShowFileHashForm(list2.ToArray());
                        break;
                    }

                    case 5:
                        listView.ShowAndClickSubDirTip();
                        break;
                }
            }
            catch(Exception exception) {
                QTUtility2.MakeErrorLog(exception);
            }
        }
コード例 #3
0
 public override void CloseDW(uint dwReserved) {
     if(iContextMenu2 != null) {
         Marshal.ReleaseComObject(iContextMenu2);
         iContextMenu2 = null;
     }
     if(this.folderView != null) {
         Marshal.ReleaseComObject(this.folderView);
         this.folderView = null;
     }
     if(this.shellBrowser != null) {
         Marshal.ReleaseComObject(this.shellBrowser);
         this.shellBrowser = null;
     }
     DisposeInvoker method = new DisposeInvoker(this.InvokeDispose);
     if(this.thumbnailTooltip != null) {
         this.thumbnailTooltip.Invoke(method, new object[] { this.thumbnailTooltip });
         this.thumbnailTooltip = null;
     }
     if(this.subDirTip != null) {
         this.subDirTip.Invoke(method, new object[] { this.subDirTip });
         this.subDirTip = null;
     }
     if(this.hashForm != null) {
         this.hashForm.Invoke(method, new object[] { this.hashForm });
         this.hashForm = null;
     }
     if(this.hHook_MsgDesktop != IntPtr.Zero) {
         PInvoke.UnhookWindowsHookEx(this.hHook_MsgDesktop);
         this.hHook_MsgDesktop = IntPtr.Zero;
     }
     if(this.hHook_MsgShell_TrayWnd != IntPtr.Zero) {
         PInvoke.UnhookWindowsHookEx(this.hHook_MsgShell_TrayWnd);
         this.hHook_MsgShell_TrayWnd = IntPtr.Zero;
     }
     if(this.hHook_KeyDesktop != IntPtr.Zero) {
         PInvoke.UnhookWindowsHookEx(this.hHook_KeyDesktop);
         this.hHook_KeyDesktop = IntPtr.Zero;
     }
     if(this.shellViewController != null) {
         this.shellViewController.ReleaseHandle();
         this.shellViewController = null;
     }
     base.CloseDW(dwReserved);
 }
コード例 #4
0
 private void DoFileTools(int index) {
     try {
         if((index == 2) || (index == 3)) {
             string folderPath = string.Empty;
             if(index == 2) {
                 folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
             }
             else {
                 byte[] idl = new byte[2];
                 using(IDLWrapper wrapper = new IDLWrapper(idl)) {
                     if(wrapper.Available) {
                         folderPath = ShellMethods.GetDisplayName(wrapper.PIDL, true);
                     }
                 }
             }
             if(folderPath.Length > 0) {
                 QTTabBarClass.SetStringClipboard(folderPath);
             }
         }
         else if(this.folderView != null) {
             int num;
             int iItem = -1;
             if((this.folderView.ItemCount(2, out num) == 0) && (num > 0)) {
                 List<IntPtr> list = new List<IntPtr>();
                 for(int i = 0; i < num; i++) {
                     IntPtr ptr;
                     if(((2 == ((int)PInvoke.SendMessage(this.hwndListView, 0x102c, (IntPtr)i, (IntPtr)2))) && (this.folderView.Item(i, out ptr) == 0)) && (ptr != IntPtr.Zero)) {
                         iItem = i;
                         list.Add(ptr);
                     }
                 }
                 if(index == 4) {
                     List<string> list2 = new List<string>();
                     foreach(IntPtr ptr2 in list) {
                         using(IDLWrapper wrapper2 = new IDLWrapper(ptr2)) {
                             if(wrapper2.IsLink) {
                                 string linkTargetPath = ShellMethods.GetLinkTargetPath(wrapper2.Path);
                                 if(File.Exists(linkTargetPath)) {
                                     list2.Add(linkTargetPath);
                                 }
                             }
                             else if(wrapper2.IsFileSystemFile) {
                                 list2.Add(wrapper2.Path);
                             }
                             continue;
                         }
                     }
                     if(this.hashForm == null) {
                         this.hashForm = new FileHashComputerForm();
                     }
                     this.hashForm.ShowFileHashForm(list2.ToArray());
                 }
                 else if(index == 5) {
                     if(list.Count == 1) {
                         if(this.ShowSubDirTip(list[0], iItem, this.hwndListView, false)) {
                             this.subDirTip.PerformClickByKey();
                         }
                         else {
                             this.HideSubDirTip();
                         }
                     }
                     foreach(IntPtr ptr3 in list) {
                         PInvoke.CoTaskMemFree(ptr3);
                     }
                 }
                 else if((index == 0) || (index == 1)) {
                     bool flag = index == 0;
                     string str = string.Empty;
                     foreach(IntPtr ptr4 in list) {
                         string displayName = ShellMethods.GetDisplayName(ptr4, !flag);
                         if(displayName.Length > 0) {
                             str = str + ((str.Length == 0) ? string.Empty : "\r\n") + displayName;
                         }
                         PInvoke.CoTaskMemFree(ptr4);
                     }
                     if(str.Length > 0) {
                         QTTabBarClass.SetStringClipboard(str);
                     }
                 }
             }
         }
     }
     catch(Exception exception) {
         QTUtility2.MakeErrorLog(exception, null);
     }
 }
コード例 #5
0
ファイル: PluginServer.cs プロジェクト: svn2github/QTTabBar
            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:
                            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;
            }
コード例 #6
0
            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))
                         * {
                         *   string[] list = (from QTabItem item2 in tabControl1.TabPages
                         *                    where item2.TabLocked
                         *                    select item2.CurrentPath).ToArray();
                         *
                         *   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);
            }
コード例 #7
0
            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:
                            if(tabBar.tabControl1.TabCount > 1) {
                                foreach(QTabItem item in tabBar.tabControl1.TabPages) {
                                    if(item != tabBar.CurrentTab) {
                                        tabBar.CloseTab(item);
                                    }
                                }
                            }
                            return true;

                        case Commands.CloseAllButOne: {
                                TabWrapper wrapper = arg as TabWrapper;
                                if(wrapper == null) {
                                    break;
                                }
                                foreach(QTabItem item2 in tabBar.tabControl1.TabPages) {
                                    if(item2 != wrapper.Tab) {
                                        tabBar.CloseTab(item2);
                                    }
                                }
                                return true;
                            }
                        case Commands.CloseWindow:
                            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();
                            tabBar.SyncButtonBarCurrent(0x40);
                            return true;

                        case Commands.FocusFileList:
                            tabBar.listView.SetFocus();
                            return true;

                        case Commands.OpenTabBarOptionDialog:
                            tabBar.OpenOptionsDialog();
                            return true;

                        case Commands.OpenButtonBarOptionDialog:
                            if(!QTUtility.instanceManager.TryGetButtonBarHandle(tabBar.ExplorerHandle, out ptr)) {
                                break;
                            }
                            QTUtility2.SendCOPYDATASTRUCT(ptr, (IntPtr)12, "showop", IntPtr.Zero);
                            return true;

                        case Commands.IsFolderTreeVisible:
                            return tabBar.ShellBrowser.IsFolderTreeVisible();

                        case Commands.IsButtonBarVisible:
                            return QTUtility.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(!QTUtility.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;
                                IntPtr pv = AddressToPIDL(address);
                                if(!(pv != IntPtr.Zero)) {
                                    break;
                                }
                                SHELLEXECUTEINFO structure = new SHELLEXECUTEINFO();
                                structure.cbSize = Marshal.SizeOf(structure);
                                structure.hwnd = tabBar.ExplorerHandle;
                                structure.fMask = 0x40c;
                                structure.lpVerb = Marshal.StringToHGlobalUni("properties");
                                structure.lpIDList = pv;
                                PInvoke.ShellExecuteEx(ref structure);
                                PInvoke.CoTaskMemFree(pv);
                                if(structure.lpVerb != IntPtr.Zero) {
                                    Marshal.FreeHGlobal(structure.lpVerb);
                                }
                                return true;
                            }
                        case Commands.SetModalState:
                            if(((arg == null) || !(arg is bool)) || !((bool)arg)) {
                                tabBar.NowModalDialogShown = false;
                                break;
                            }
                            tabBar.NowModalDialogShown = true;
                            break;

                        case Commands.SetSearchBoxStr:
                            if(((arg == null) || !(arg is string)) || !QTUtility.instanceManager.TryGetButtonBarHandle(tabBar.ExplorerHandle, out ptr)) {
                                break;
                            }
                            return (IntPtr.Zero == QTUtility2.SendCOPYDATASTRUCT(ptr, (IntPtr)0x10, (string)arg, IntPtr.Zero));

                        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;
            }
コード例 #8
0
 public override void CloseDW(uint dwReserved) {
     try {
         if(treeViewWrapper != null) {
             treeViewWrapper.Dispose();
             treeViewWrapper = null;
         }
         if(listViewManager != null) {
             listViewManager.Dispose();
             listViewManager = null;
         }
         if(subDirTip_Tab != null) {
             subDirTip_Tab.Dispose();
             subDirTip_Tab = null;
         }
         if(IsShown) {
             if(pluginManager != null) {
                 pluginManager.Close(false);
                 pluginManager = null;
             }
             if(hHook_Key != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(hHook_Key);
                 hHook_Key = IntPtr.Zero;
             }
             if(hHook_Mouse != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(hHook_Mouse);
                 hHook_Mouse = IntPtr.Zero;
             }
             if(hHook_Msg != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(hHook_Msg);
                 hHook_Msg = IntPtr.Zero;
             }
             if(explorerController != null) {
                 explorerController.ReleaseHandle();
                 explorerController = null;
             }
             if(rebarController != null) {
                 rebarController.ReleaseHandle();
                 rebarController = null;
             }
             if(!QTUtility.IsXP && (travelBtnController != null)) {
                 travelBtnController.ReleaseHandle();
                 travelBtnController = null;
             }
             if(dicNotifyIcon != null) {
                 dicNotifyIcon.Remove(ExplorerHandle);
             }
             if((hwndNotifyIconParent == ExplorerHandle) && (notifyIcon != null)) {
                 notifyIcon.Dispose();
                 notifyIcon = null;
                 contextMenuNotifyIcon.Dispose();
                 contextMenuNotifyIcon = null;
                 hwndNotifyIconParent = IntPtr.Zero;
                 if(dicNotifyIcon.Count > 0) {
                     foreach(IntPtr ptr in dicNotifyIcon.Keys) {
                         IntPtr tabBarHandle = QTUtility.instanceManager.GetTabBarHandle(ptr);
                         if(1 == ((int)QTUtility2.SendCOPYDATASTRUCT(tabBarHandle, (IntPtr)0x30, "createNI", IntPtr.Zero))) {
                             break;
                         }
                     }
                 }
             }
             using(RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) {
                 if(!QTUtility.CheckConfig(Settings.NoHistory)) {
                     foreach(QTabItem item in tabControl1.TabPages) {
                         AddToHistory(item);
                     }
                     QTUtility.SaveRecentlyClosed(key);
                 }
                 if(!QTUtility.CheckConfig(Settings.NoRecentFiles) && QTUtility.CheckConfig(Settings.AllRecentFiles)) {
                     QTUtility.SaveRecentFiles(key);
                 }
                 string[] list = (from QTabItem item2 in tabControl1.TabPages
                         where item2.TabLocked
                         select item2.CurrentPath).ToArray();
                 QTUtility2.WriteRegBinary(list, "TabsLocked", key);
                 key.SetValue("StartUpGroups", QTUtility.StartUpGroupList.StringJoin(";"));
                 if(QTUtility.instanceManager.RemoveInstance(ExplorerHandle, this)) {
                     QTUtility.instanceManager.NextInstanceExists();
                     QTUtility2.WriteRegHandle("Handle", key, QTUtility.instanceManager.CurrentHandle);
                 }
                 if(QTUtility.CheckConfig(Settings.SaveTransparency)) {
                     if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000))) {
                         QTUtility.WindowAlpha = 0xff;
                     }
                     else {
                         byte num;
                         int num2;
                         int num3;
                         if(PInvoke.GetLayeredWindowAttributes(ExplorerHandle, out num2, out num, out num3)) {
                             QTUtility.WindowAlpha = num;
                         }
                         else {
                             QTUtility.WindowAlpha = 0xff;
                         }
                     }
                     key.SetValue("WindowAlpha", QTUtility.WindowAlpha);
                 }
                 IDLWrapper.SaveCache(key);
             }
             if((md5Form != null) && !md5Form.InvokeRequired) {
                 md5Form.SaveMD5FormStat();
                 md5Form.Dispose();
                 md5Form = null;
             }
             Cursor = Cursors.Default;
             if((curTabDrag != null) && (curTabDrag != Cursors.Default)) {
                 PInvoke.DestroyIcon(curTabDrag.Handle);
                 GC.SuppressFinalize(curTabDrag);
                 curTabDrag = null;
             }
             if((curTabCloning != null) && (curTabCloning != Cursors.Default)) {
                 PInvoke.DestroyIcon(curTabCloning.Handle);
                 GC.SuppressFinalize(curTabCloning);
                 curTabCloning = null;
             }
             if(dropTargetWrapper != null) {
                 dropTargetWrapper.Dispose();
                 dropTargetWrapper = null;
             }
             if((optionsDialog != null) && fOptionDialogCreated) {
                 fOptionDialogCreated = false;
                 try {
                     optionsDialog.Invoke(new MethodInvoker(odCallback_Close));
                 }
                 catch(Exception exception) {
                     QTUtility2.MakeErrorLog(exception, "optionDialogDisposing");
                 }
             }
             if(tabSwitcher != null) {
                 tabSwitcher.Dispose();
                 tabSwitcher = null;
             }
         }
         QTUtility.InstancesCount--;
         if(TravelLog != null) {
             Marshal.FinalReleaseComObject(TravelLog);
             TravelLog = null;
         }
         if(iContextMenu2 != null) {
             Marshal.FinalReleaseComObject(iContextMenu2);
             iContextMenu2 = null;
         }
         if(ShellBrowser != null) {
             ShellBrowser.Dispose();
             ShellBrowser = null;
         }
         foreach(ITravelLogEntry entry in LogEntryDic.Values) {
             if(entry != null) {
                 Marshal.FinalReleaseComObject(entry);
             }
         }
         LogEntryDic.Clear();
         if(bmpRebar != null) {
             bmpRebar.Dispose();
             bmpRebar = null;
         }
         if(textureBrushRebar != null) {
             textureBrushRebar.Dispose();
             textureBrushRebar = null;
         }
         fFinalRelease = true;
         base.CloseDW(dwReserved);
     }
     catch(Exception exception2) {
         QTUtility2.MakeErrorLog(exception2, "tabbar closing");
     }
 }
コード例 #9
0
 internal static void ShowMD5(string[] paths) {
     if(md5Form == null) {
         md5Form = new FileHashComputerForm();
     }
     List<string> list = new List<string>();
     if(paths != null) {
         list.AddRange(paths.Where(File.Exists));
     }
     string[] strArray = null;
     if(list.Count > 0) {
         strArray = list.ToArray();
     }
     if(md5Form.InvokeRequired) {
         md5Form.Invoke(new FormMethodInvoker(ShowMD5FormCore), new object[] { strArray });
     }
     else {
         ShowMD5FormCore(strArray);
     }
 }
コード例 #10
0
 public override void CloseDW(uint dwReserved) {
     try {
         if(this.thumbnailTooltip != null) {
             this.thumbnailTooltip.Dispose();
             this.thumbnailTooltip = null;
         }
         if(this.subDirTip != null) {
             this.subDirTip.Dispose();
             this.subDirTip = null;
         }
         if(this.subDirTip_Tab != null) {
             this.subDirTip_Tab.Dispose();
             this.subDirTip_Tab = null;
         }
         if(this.IsShown) {
             if(this.pluginManager != null) {
                 this.pluginManager.Close(false);
                 this.pluginManager = null;
             }
             if(this.hHook_Key != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(this.hHook_Key);
                 this.hHook_Key = IntPtr.Zero;
             }
             if(this.hHook_Mouse != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(this.hHook_Mouse);
                 this.hHook_Mouse = IntPtr.Zero;
             }
             if(this.hHook_Msg != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(this.hHook_Msg);
                 this.hHook_Msg = IntPtr.Zero;
             }
             if(this.explorerController != null) {
                 this.explorerController.ReleaseHandle();
                 this.explorerController = null;
             }
             if(this.shellViewController != null) {
                 this.shellViewController.ReleaseHandle();
                 this.shellViewController = null;
             }
             if(this.rebarController != null) {
                 this.rebarController.ReleaseHandle();
                 this.rebarController = null;
             }
             if(QTUtility.IsVista && (this.travelBtnController != null)) {
                 this.travelBtnController.ReleaseHandle();
                 this.travelBtnController = null;
             }
             if(dicNotifyIcon != null) {
                 dicNotifyIcon.Remove(this.ExplorerHandle);
             }
             if((hwndNotifyIconParent == this.ExplorerHandle) && (notifyIcon != null)) {
                 notifyIcon.Dispose();
                 notifyIcon = null;
                 contextMenuNotifyIcon.Dispose();
                 contextMenuNotifyIcon = null;
                 hwndNotifyIconParent = IntPtr.Zero;
                 if(dicNotifyIcon.Count > 0) {
                     foreach(IntPtr ptr in dicNotifyIcon.Keys) {
                         IntPtr tabBarHandle = QTUtility.instanceManager.GetTabBarHandle(ptr);
                         if(1 == ((int)QTUtility2.SendCOPYDATASTRUCT(tabBarHandle, (IntPtr)0x30, "createNI", IntPtr.Zero))) {
                             break;
                         }
                     }
                 }
             }
             using(RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) {
                 if(!QTUtility.CheckConfig(Settings.NoHistory)) {
                     foreach(QTabItem item in this.tabControl1.TabPages) {
                         AddToHistory(item);
                     }
                     QTUtility.SaveRecentlyClosed(key);
                 }
                 if(!QTUtility.CheckConfig(Settings.NoRecentFiles) && QTUtility.CheckConfig(Settings.AllRecentFiles)) {
                     QTUtility.SaveRecentFiles(key);
                 }
                 List<string> list = new List<string>();
                 foreach(QTabItem item2 in this.tabControl1.TabPages) {
                     if(item2.TabLocked) {
                         list.Add(item2.CurrentPath);
                     }
                 }
                 QTUtility2.WriteRegBinary<string>(list.ToArray(), "TabsLocked", key);
                 string str = string.Empty;
                 foreach(string str2 in QTUtility.StartUpGroupList) {
                     str = str + str2 + ";";
                 }
                 str = str.TrimEnd(QTUtility.SEPARATOR_CHAR);
                 key.SetValue("StartUpGroups", str);
                 if(QTUtility.instanceManager.RemoveInstance(this.ExplorerHandle, this)) {
                     QTUtility.instanceManager.NextInstanceExists();
                     QTUtility2.WriteRegHandle("Handle", key, QTUtility.instanceManager.CurrentHandle);
                 }
                 if(QTUtility.CheckConfig(Settings.SaveTransparency)) {
                     if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(this.ExplorerHandle, -20), 0x80000))) {
                         QTUtility.WindowAlpha = 0xff;
                     }
                     else {
                         byte num;
                         int num2;
                         int num3;
                         if(PInvoke.GetLayeredWindowAttributes(this.ExplorerHandle, out num2, out num, out num3)) {
                             QTUtility.WindowAlpha = num;
                         }
                         else {
                             QTUtility.WindowAlpha = 0xff;
                         }
                     }
                     key.SetValue("WindowAlpha", QTUtility.WindowAlpha);
                 }
                 IDLWrapper.SaveCache(key);
             }
             if((md5Form != null) && !md5Form.InvokeRequired) {
                 md5Form.SaveMD5FormStat();
                 md5Form.Dispose();
                 md5Form = null;
             }
             this.Cursor = Cursors.Default;
             if((this.curTabDrag != null) && (this.curTabDrag != Cursors.Default)) {
                 PInvoke.DestroyIcon(this.curTabDrag.Handle);
                 GC.SuppressFinalize(this.curTabDrag);
                 this.curTabDrag = null;
             }
             if((this.curTabCloning != null) && (this.curTabCloning != Cursors.Default)) {
                 PInvoke.DestroyIcon(this.curTabCloning.Handle);
                 GC.SuppressFinalize(this.curTabCloning);
                 this.curTabCloning = null;
             }
             if(this.dropTargetWrapper != null) {
                 this.dropTargetWrapper.Dispose();
                 this.dropTargetWrapper = null;
             }
             if((optionsDialog != null) && this.fOptionDialogCreated) {
                 this.fOptionDialogCreated = false;
                 try {
                     optionsDialog.Invoke(new MethodInvoker(this.odCallback_Close));
                 }
                 catch(Exception exception) {
                     QTUtility2.MakeErrorLog(exception, "optionDialogDisposing");
                 }
             }
             if(this.tabSwitcher != null) {
                 this.tabSwitcher.Dispose();
                 this.tabSwitcher = null;
             }
         }
         QTUtility.InstancesCount--;
         if(this.TravelLog != null) {
             Marshal.FinalReleaseComObject(this.TravelLog);
             this.TravelLog = null;
         }
         if(this.iContextMenu2 != null) {
             Marshal.FinalReleaseComObject(this.iContextMenu2);
             this.iContextMenu2 = null;
         }
         if(this.ShellBrowser != null) {
             Marshal.FinalReleaseComObject(this.ShellBrowser);
             this.ShellBrowser = null;
         }
         foreach(ITravelLogEntry entry in this.LogEntryDic.Values) {
             if(entry != null) {
                 Marshal.FinalReleaseComObject(entry);
             }
         }
         this.LogEntryDic.Clear();
         if(this.bmpRebar != null) {
             this.bmpRebar.Dispose();
             this.bmpRebar = null;
         }
         if(this.textureBrushRebar != null) {
             this.textureBrushRebar.Dispose();
             this.textureBrushRebar = null;
         }
         base.fFinalRelease = true;
         base.CloseDW(dwReserved);
     }
     catch(Exception exception2) {
         QTUtility2.MakeErrorLog(exception2, "tabbar closing");
     }
 }
コード例 #11
0
 internal static void ShowMD5(string[] paths) {
     if(md5Form == null) {
         md5Form = new FileHashComputerForm();
     }
     List<string> list = new List<string>();
     if(paths != null) {
         for(int i = 0; i < paths.Length; i++) {
             if(File.Exists(paths[i])) {
                 list.Add(paths[i]);
             }
         }
     }
     string[] strArray = null;
     if(list.Count > 0) {
         strArray = list.ToArray();
     }
     if(md5Form.InvokeRequired) {
         md5Form.Invoke(new FormMethodInvoker(QTTabBarClass.ShowMD5FormCore), new object[] { strArray });
     }
     else {
         ShowMD5FormCore(strArray);
     }
 }
コード例 #12
0
ファイル: QTTabBarClass.cs プロジェクト: Nicologies/QTTabBar
        public override void CloseDW(uint dwReserved)
        {
            try {
                if(treeViewWrapper != null) {
                    treeViewWrapper.Dispose();
                    treeViewWrapper = null;
                }
                if(listViewManager != null) {
                    listViewManager.Dispose();
                    listViewManager = null;
                }
                if(subDirTip_Tab != null) {
                    subDirTip_Tab.Dispose();
                    subDirTip_Tab = null;
                }
                if(IsShown) {
                    if(pluginServer != null) {
                        pluginServer.Dispose();
                        pluginServer = null;
                    }
                    if(hHook_Key != IntPtr.Zero) {
                        PInvoke.UnhookWindowsHookEx(hHook_Key);
                        hHook_Key = IntPtr.Zero;
                    }
                    if(hHook_Mouse != IntPtr.Zero) {
                        PInvoke.UnhookWindowsHookEx(hHook_Mouse);
                        hHook_Mouse = IntPtr.Zero;
                    }
                    if(hHook_Msg != IntPtr.Zero) {
                        PInvoke.UnhookWindowsHookEx(hHook_Msg);
                        hHook_Msg = IntPtr.Zero;
                    }
                    if(explorerController != null) {
                        explorerController.ReleaseHandle();
                        explorerController = null;
                    }
                    if(rebarController != null) {
                        rebarController.Dispose();
                        rebarController = null;
                    }
                    if(!QTUtility.IsXP && (travelBtnController != null)) {
                        travelBtnController.ReleaseHandle();
                        travelBtnController = null;
                    }
                    InstanceManager.RemoveFromTrayIcon(Handle);

                    // TODO: check this
                    using(RegistryKey key = Registry.CurrentUser.CreateSubKey(RegConst.Root)) {
                        if(Config.Misc.KeepHistory) {
                            foreach(QTabItem item in tabControl1.TabPages) {
                                AddToHistory(item);
                            }
                            QTUtility.SaveRecentlyClosed(key);
                        }
                        if(Config.Misc.KeepRecentFiles) {
                            QTUtility.SaveRecentFiles(key);
                        }
                        string[] list = (from QTabItem item2 in tabControl1.TabPages
                                where item2.TabLocked
                                select item2.CurrentPath).ToArray();
                        QTUtility2.WriteRegBinary(list, "TabsLocked", key);
                        InstanceManager.UnregisterTabBar();
                        if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000))) {
                            QTUtility.WindowAlpha = 0xff;
                        }
                        else {
                            byte num;
                            int num2;
                            int num3;
                            if(PInvoke.GetLayeredWindowAttributes(ExplorerHandle, out num2, out num, out num3)) {
                                QTUtility.WindowAlpha = num;
                            }
                            else {
                                QTUtility.WindowAlpha = 0xff;
                            }
                        }
                        key.SetValue("WindowAlpha", QTUtility.WindowAlpha);
                        IDLWrapper.SaveCache(key);
                    }
                    if((md5Form != null) && !md5Form.InvokeRequired) {
                        md5Form.SaveMD5FormStat();
                        md5Form.Dispose();
                        md5Form = null;
                    }
                    Cursor = Cursors.Default;
                    if((curTabDrag != null) && (curTabDrag != Cursors.Default)) {
                        PInvoke.DestroyIcon(curTabDrag.Handle);
                        GC.SuppressFinalize(curTabDrag);
                        curTabDrag = null;
                    }
                    if((curTabCloning != null) && (curTabCloning != Cursors.Default)) {
                        PInvoke.DestroyIcon(curTabCloning.Handle);
                        GC.SuppressFinalize(curTabCloning);
                        curTabCloning = null;
                    }
                    if(dropTargetWrapper != null) {
                        dropTargetWrapper.Dispose();
                        dropTargetWrapper = null;
                    }
                    OptionsDialog.ForceClose();
                    if(tabSwitcher != null) {
                        tabSwitcher.Dispose();
                        tabSwitcher = null;
                    }
                }
                if(TravelLog != null) {
                    Marshal.FinalReleaseComObject(TravelLog);
                    TravelLog = null;
                }
                if(shellContextMenu != null) {
                    shellContextMenu.Dispose();
                    shellContextMenu = null;
                }
                if(ShellBrowser != null) {
                    ShellBrowser.Dispose();
                    ShellBrowser = null;
                }
                foreach(ITravelLogEntry entry in LogEntryDic.Values) {
                    if(entry != null) {
                        Marshal.FinalReleaseComObject(entry);
                    }
                }
                LogEntryDic.Clear();
                fFinalRelease = true;
                base.CloseDW(dwReserved);
            }
            catch(Exception exception2) {
                QTUtility2.MakeErrorLog(exception2, "tabbar closing");
            }
        }
コード例 #13
0
 public FileHashStream(string path, FileHashComputerForm.ReportProgressCallback callbackCancelAsync, DataGridViewProgressBarCell cell) {
     this.fs = new FileStream(path, FileMode.Open, FileAccess.Read);
     long length = this.fs.Length;
     this.fEnoughSize = length > 0x200000L;
     this.callbackCancelAsync = callbackCancelAsync;
     this.cell = cell;
     this.cell.FileSize = length;
 }