Example #1
0
 public bool TryGetHotTrackPath(int iItem, out string path, string matchName)
 {
     path = null;
     try {
         using (IDLWrapper wrapper = GetItem(iItem, true)) {
             if (wrapper.Available)
             {
                 if (!string.IsNullOrEmpty(matchName) && matchName != wrapper.ParseName)
                 {
                     return(false);
                 }
                 using (IDLWrapper wrapper2 = ILAppend(wrapper.PIDL)) {
                     path = wrapper2.ParseName;
                     if (!string.IsNullOrEmpty(path) && path.IndexOfAny(Path.GetInvalidPathChars()) < 0)
                     {
                         return(true);
                     }
                     path = null;
                 }
             }
         }
     }
     catch (Exception exception) {
         QTUtility2.MakeErrorLog(exception);
     }
     return(false);
 }
 protected override void WndProc(ref Message m) {
     if((MessageParent != IntPtr.Zero) && (((m.Msg == WM.INITMENUPOPUP) || (m.Msg == WM.DRAWITEM)) || (m.Msg == WM.MEASUREITEM))) {
         PInvoke.SendMessage(MessageParent, (uint)m.Msg, m.WParam, m.LParam);
     }
     else {
         if(m.Msg == WM.MOUSELEAVE) {
             if(fCancelClosingAncestors) {
                 return;
             }
         }
         else if(m.Msg == WM.MOUSEFIRST) {
             if(fSuppressMouseMove_Scroll) {
                 m.Result = IntPtr.Zero;
                 return;
             }
             if(fSuppressMouseMove) {
                 if(MouseDragMove != null) {
                     MouseDragMove(this, new MouseEventArgs(MouseButtons, 0, QTUtility2.GET_X_LPARAM(m.LParam), QTUtility2.GET_Y_LPARAM(m.LParam), 0));
                 }
                 return;
             }
             if(fSuppressMouseMoveOnce) {
                 fSuppressMouseMoveOnce = false;
                 return;
             }
         }
         base.WndProc(ref m);
     }
 }
Example #3
0
            public _Tweaks()
            {
                /* AlwaysShowHeaders = !QTUtility.IsXP && !QTUtility.IsWin7;
                 * KillExtWhileRenaming = true;
                 * RedirectLibraryFolders = false;
                 * F2Selection = true;
                 * WrapArrowKeySelection = false;
                 * BackspaceUpLevel = QTUtility.IsXP;
                 * HorizontalScroll = true;
                 * ForceSysListView = false;
                 * ToggleFullRowSelect = false;
                 * DetailsGridLines = false;
                 * AlternateRowColors = false;
                 * AltRowForegroundColor = SystemColors.WindowText;
                 * AltRowBackgroundColor = QTUtility2.MakeColor(0xfaf5f1); */

                /* qwop's default value.*/
                AlwaysShowHeaders      = true;
                KillExtWhileRenaming   = true;
                RedirectLibraryFolders = true;
                F2Selection            = false;
                WrapArrowKeySelection  = true;
                BackspaceUpLevel       = true;
                HorizontalScroll       = true;
                ForceSysListView       = true;
                ToggleFullRowSelect    = QTUtility.IsXP;
                DetailsGridLines       = true;
                AlternateRowColors     = true;
                AltRowForegroundColor  = SystemColors.WindowText;
                AltRowBackgroundColor  = QTUtility2.MakeColor(0xfaf5f1);
            }
Example #4
0
        public void RefreshBG()
        {
            if (Config.Skin.UseRebarBGColor)
            {
                // Save the default color and set the new one
                if (DefaultRebarCOLORREF == -1)
                {
                    DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero);
                }
                int c = QTUtility2.MakeCOLORREF(Config.Skin.RebarColor);
                PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)c);
            }
            else if (DefaultRebarCOLORREF != -1)
            {
                // Restore the default BG color
                PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)DefaultRebarCOLORREF);
                DefaultRebarCOLORREF = -1;
            }

            // Refresh the rebar
            IntPtr hWnd = PInvoke.GetWindowLongPtr(Handle, -8);

            if (hWnd != IntPtr.Zero)
            {
                PInvoke.RedrawWindow(hWnd, IntPtr.Zero, IntPtr.Zero, 0x289);
            }
            if (Config.Skin.UseRebarImage)
            {
                CreateRebarImage();
            }
        }
Example #5
0
            // 创建新标签 地址  索引 是否锁定  是否选中
            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);
            }
Example #6
0
 public static void MakeErrorLog(Exception ex, string optional, bool fCritical)
 {
     if (QTUtility.NowDebugging || fCritical)
     {
         try {
             string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\QTTabBarException.log";
             bool   flag = File.Exists(path);
             using (StreamWriter writer = new StreamWriter(path, true)) {
                 if (!flag)
                 {
                     writer.WriteLine("This file was created by QTTabBar for debugging. Sorry for inconvenients. You can delete this without any harm.");
                     writer.WriteLine("--------------");
                     writer.WriteLine();
                 }
                 writer.WriteLine(DateTime.Now.ToString());
                 writer.WriteLine("OS ver: " + Environment.OSVersion.Version.ToString());
                 writer.WriteLine("QT ver: " + QTUtility2.MakeVersionString());
                 writer.WriteLine((ex == null) ? "Exception : N/A" : ex.ToString());
                 if (!string.IsNullOrEmpty(optional))
                 {
                     writer.WriteLine("Optional information : " + optional);
                 }
                 writer.WriteLine("--------------");
                 writer.WriteLine();
             }
             SystemSounds.Exclamation.Play();
         }
         catch {
         }
     }
 }
        private bool TreeControl_MessageCaptured(ref Message msg)
        {
            switch (msg.Msg)
            {
            case WM.USER:
                fPreventSelChange = false;
                break;

            case WM.MBUTTONUP:
                if (treeControl != null && TreeViewClicked != null)
                {
                    HandleClick(QTUtility2.PointFromLPARAM(msg.LParam), Control.ModifierKeys, true);
                }
                break;

            case WM.DESTROY:
                if (treeControl != null)
                {
                    Marshal.ReleaseComObject(treeControl);
                    treeControl = null;
                }
                break;
            }
            return(false);
        }
Example #8
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == WM.MOUSEACTIVATE)
     {
         fMA = false;
         if (0x201 == QTUtility2.GET_Y_LPARAM(m.LParam))
         {
             base.WndProc(ref m);
             if (2 == ((int)m.Result))
             {
                 fMA = true;
             }
             return;
         }
     }
     else if (m.Msg == WM.LBUTTONUP)
     {
         if (fMA && (MouseActivated != null))
         {
             base.WndProc(ref m);
             MouseActivated(this, EventArgs.Empty);
             fMA = false;
             return;
         }
         fMA = false;
     }
     base.WndProc(ref m);
 }
        internal static bool LoadExternalImage(string path, out Bitmap bmpLarge, out Bitmap bmpSmall)
        {
            bmpLarge = (bmpSmall = null);
            if (File.Exists(path))
            {
                try
                {
                    using (Bitmap bitmap = new Bitmap(path))
                    {
                        // if ((bitmap.Width >= 0x1b0) && (bitmap.Height >= 40))

                        /* if ((bitmap.Width >= 0x1b0) && (bitmap.Height >= 0x18))
                         * {
                         *   bmpLarge = bitmap.Clone(new Rectangle(0, 0, 0x1b0, 0x18), PixelFormat.Format32bppArgb);
                         *   bmpSmall = bitmap.Clone(new Rectangle(0, 0x18, 0x120, 0x10), PixelFormat.Format32bppArgb);
                         *   return true;
                         * }*/

                        if ((bitmap.Width >= 504) && (bitmap.Height >= 24))
                        {
                            bmpLarge = bitmap.Clone(new Rectangle(0, 0, 504, 24), PixelFormat.Format32bppArgb);
                            // bmpSmall = bitmap.Clone(new Rectangle(0, 0x18, 0x120, 0x10), PixelFormat.Format32bppArgb);
                            bmpSmall = (Bitmap)ResizeBitMap(bmpLarge, 336, 16);
                            return(true);
                        }
                    }
                }
                catch (Exception ex)
                {
                    QTUtility2.MakeErrorLog(ex);
                }
            }
            return(false);
        }
Example #10
0
        private bool TreeControl_MessageCaptured(ref Message msg)
        {
            switch (msg.Msg)
            {
            case WM.USER:
                fPreventSelChange = false;
                break;

            case WM.MBUTTONUP:
                // TODO
                if (/*!QTUtility.CheckConfig(Settings.NoMidClickTree) &&*/ treeControl != null && TreeViewMiddleClicked != null)
                {
                    HandleClick(QTUtility2.PointFromLPARAM(msg.LParam));
                }
                break;

            case WM.DESTROY:
                if (treeControl != null)
                {
                    Marshal.ReleaseComObject(treeControl);
                    treeControl = null;
                }
                break;
            }
            return(false);
        }
 public override void InitializeConfig()
 {
     lblVersion.Content       = "QTTabBar " + QTUtility2.MakeVersionString();
     runSite.Text             = Resources_String.SiteURL;
     hypSite.NavigateUri      = new Uri(Resources_String.SiteURL);
     hypSite.RequestNavigate += (sender, args) => Process.Start(Resources_String.SiteURL);
 }
Example #12
0
        // todo: check vs quizo's
        public static List <ToolStripItem> CreateRecentFilesItems()
        {
            List <ToolStripItem> ret      = new List <ToolStripItem>();
            List <string>        toRemove = new List <string>();

            if (StaticReg.ExecutedPathsList.Count > 0)
            {
                foreach (string path in StaticReg.ExecutedPathsList.Reverse())
                {
                    if (QTUtility2.IsNetworkPath(path) || File.Exists(path))
                    {
                        QMenuItem item = new QMenuItem(QTUtility2.MakeNameEllipsis(Path.GetFileName(path)), MenuGenre.RecentFile);
                        item.Path = item.ToolTipText = path;
                        item.SetImageReservationKey(path, Path.GetExtension(path));
                        ret.Add(item);
                    }
                    else
                    {
                        toRemove.Add(path);
                    }
                }
            }
            foreach (string str in toRemove)
            {
                StaticReg.ExecutedPathsList.Remove(str);
            }
            return(ret);
        }
Example #13
0
        public static List <ToolStripItem> CreateRecentFilesItems()
        {
            List <ToolStripItem> list  = new List <ToolStripItem>();
            List <string>        list2 = new List <string>();

            if (QTUtility.ExecutedPathsList.Count > 0)
            {
                for (int i = QTUtility.ExecutedPathsList.Count - 1; i >= 0; i--)
                {
                    string path = QTUtility.ExecutedPathsList[i];
                    if (path.StartsWith(@"\\") || File.Exists(path))
                    {
                        bool      flag;
                        QMenuItem item = new QMenuItem(QTUtility2.MakeNameEllipsis(Path.GetFileName(path), out flag), MenuGenre.RecentFile);
                        item.Path = item.ToolTipText = path;
                        item.SetImageReservationKey(path, Path.GetExtension(path));
                        list.Add(item);
                    }
                    else
                    {
                        list2.Add(path);
                    }
                }
            }
            foreach (string str2 in list2)
            {
                QTUtility.ExecutedPathsList.Remove(str2);
            }
            return(list);
        }
Example #14
0
        public void RefreshBG(bool fRebarBGCanceled)
        {
            if (fRebarBGCanceled && QTUtility.DefaultRebarCOLORREF != -1)
            {
                // Restore the default BG color
                PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)QTUtility.DefaultRebarCOLORREF);
            }
            else if (QTUtility.CheckConfig(Settings.ToolbarBGColor))
            {
                // Save the default color and set the new one
                if (QTUtility.DefaultRebarCOLORREF == -1)
                {
                    QTUtility.DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero);
                }
                int c = QTUtility2.MakeCOLORREF(QTUtility.RebarBGColor);
                PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)c);
            }
            // Refresh the rebar
            IntPtr hWnd = PInvoke.GetWindowLongPtr(Handle, -8);

            if (hWnd != IntPtr.Zero)
            {
                PInvoke.RedrawWindow(hWnd, IntPtr.Zero, IntPtr.Zero, 0x289);
            }
            if (QTUtility.CheckConfig(Settings.RebarImage))
            {
                CreateRebarImage();
            }
        }
Example #15
0
        // TODO: this is absent from Quizo's sources.  Figure out why.
        private static void AddChildrenOnOpening(DirectoryMenuItem parentItem)
        {
            bool          fTruncated;
            DirectoryInfo info      = new DirectoryInfo(parentItem.Path);
            EventPack     eventPack = parentItem.EventPack;

            foreach (DirectoryInfo info2 in info.GetDirectories()
                     .Where(info2 => (info2.Attributes & FileAttributes.Hidden) == 0))
            {
                string text = QTUtility2.MakeNameEllipsis(info2.Name, out fTruncated);
                DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);
                reorderable.MessageParent     = eventPack.MessageParentHandle;
                reorderable.ItemRightClicked += eventPack.ItemRightClickEventHandler;
                reorderable.ImageList         = QTUtility.ImageListGlobal;
                DirectoryMenuItem item = new DirectoryMenuItem(text);
                item.SetImageReservationKey(info2.FullName, null);
                item.Path         = info2.FullName;
                item.EventPack    = eventPack;
                item.ModifiedDate = info2.LastWriteTime;
                if (fTruncated)
                {
                    item.ToolTipText = info2.Name;
                }
                item.DropDown           = reorderable;
                item.DoubleClickEnabled = true;
                item.DropDownItems.Add(new ToolStripMenuItem());
                item.DropDownItemClicked += realDirectory_DropDownItemClicked;
                item.DropDownOpening     += realDirectory_DropDownOpening;
                item.DoubleClick         += eventPack.DirDoubleClickEventHandler;
                parentItem.DropDownItems.Add(item);
            }
            foreach (FileInfo info3 in info.GetFiles()
                     .Where(info3 => (info3.Attributes & FileAttributes.Hidden) == 0))
            {
                string fileNameWithoutExtension;
                string ext = info3.Extension.ToLower();
                switch (ext)
                {
                case ".lnk":
                case ".url":
                    fileNameWithoutExtension = Path.GetFileNameWithoutExtension(info3.Name);
                    break;

                default:
                    fileNameWithoutExtension = info3.Name;
                    break;
                }
                string    str4  = fileNameWithoutExtension;
                QMenuItem item2 = new QMenuItem(QTUtility2.MakeNameEllipsis(fileNameWithoutExtension, out fTruncated), MenuTarget.File, MenuGenre.Application);
                item2.Path = info3.FullName;
                item2.SetImageReservationKey(info3.FullName, ext);
                item2.MouseMove += qmi_File_MouseMove;
                if (fTruncated)
                {
                    item2.ToolTipText = str4;
                }
                parentItem.DropDownItems.Add(item2);
            }
        }
Example #16
0
 protected override void OnKeyDown(KeyEventArgs e)
 {
     base.OnKeyDown(e);
     if (e.KeyData == (Keys.Control | Keys.C))
     {
         QTUtility2.SetStringClipboard(Text + Environment.NewLine + Environment.NewLine + labelMessage.Text);
     }
 }
Example #17
0
 public static void SavePluginShortcutKeys()
 {
     using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar\Plugins")) {
         QTUtility2.WriteRegBinary(QTUtility.dicPluginShortcutKeys.Keys
                                   .Select(str => new PluginKey(str, QTUtility.dicPluginShortcutKeys[str])).ToArray(),
                                   "ShortcutKeys", key);
     }
 }
Example #18
0
 public PluginAssembly(string path)
 {
     Path  = path;
     Title = Author = Description = Version = Name = string.Empty;
     if (File.Exists(path))
     {
         try {
             assembly = Assembly.Load(File.ReadAllBytes(path));
             AssemblyName                 name            = assembly.GetName();
             AssemblyTitleAttribute       customAttribute = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute));
             AssemblyCompanyAttribute     attribute2      = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute));
             AssemblyDescriptionAttribute attribute3      = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute));
             Version = name.Version.ToString();
             if (customAttribute != null)
             {
                 Title = customAttribute.Title;
             }
             if (attribute2 != null)
             {
                 Author = attribute2.Company;
             }
             if (attribute3 != null)
             {
                 Description = attribute3.Description;
             }
             Name = Title + Version + "(" + path.GetHashCode().ToString("X") + ")";
             foreach (Type type in assembly.GetTypes())
             {
                 try {
                     if (ValidateType(type))
                     {
                         PluginAttribute pluginAtt = Attribute.GetCustomAttribute(type, T_PLUGINATTRIBUTE) as PluginAttribute;
                         if (pluginAtt != null)
                         {
                             string            pluginID = Name + "+" + type.FullName;
                             PluginInformation info     = new PluginInformation(pluginAtt, path, pluginID, type.FullName);
                             GetImageFromAssembly(assembly, type, info);
                             dicPluginInformations[pluginID] = info;
                         }
                         else
                         {
                             QTUtility2.MakeErrorLog(null, "failed attribute");
                         }
                     }
                 }
                 catch {
                 }
             }
         }
         catch (ReflectionTypeLoadException exception) {
             QTUtility2.MakeErrorLog(exception, "Failed to load plugin assembly.\r\n"
                                     + exception.LoaderExceptions.StringJoin("\r\n") + "\r\n" + path);
         }
         catch (Exception exception) {
             QTUtility2.MakeErrorLog(exception, "Failed to load plugin assembly.\r\n" + path);
         }
     }
 }
Example #19
0
        public override void HandleF2()
        {
            IntPtr hWnd = GetEditControl();

            if (hWnd == IntPtr.Zero)
            {
                return;
            }
            string str;

            using (SafePtr lParam = new SafePtr(520)) {
                if (0 >= ((int)PInvoke.SendMessage(hWnd, 13, (IntPtr)260, lParam)))
                {
                    return;
                }
                str = Marshal.PtrToStringUni(lParam);
            }
            if (str.Length <= 2)
            {
                return;
            }
            int num = str.LastIndexOf(".");

            if (num != -1)
            {
                IntPtr ptr3   = PInvoke.SendMessage(hWnd, 0xb0, IntPtr.Zero, IntPtr.Zero);
                int    start  = QTUtility2.GET_X_LPARAM(ptr3);
                int    length = QTUtility2.GET_Y_LPARAM(ptr3);
                if ((length - start) >= 0)
                {
                    if ((start == 0) && (length == num))
                    {
                        start = length = num;
                    }
                    else if ((start == length) && (length == num))
                    {
                        start  = num + 1;
                        length = str.Length;
                    }
                    else if ((start == (num + 1)) && (length == str.Length))
                    {
                        start  = 0;
                        length = -1;
                    }
                    else if ((start == 0) && (length == str.Length))
                    {
                        start  = 0;
                        length = 0;
                    }
                    else
                    {
                        start  = 0;
                        length = num;
                    }
                    PInvoke.SendMessage(hWnd, 0xb1, (IntPtr)start, (IntPtr)length);
                }
            }
        }
Example #20
0
 public static void SaveButtonOrder()
 {
     using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar\Plugins")) {
         if (key != null)
         {
             QTUtility2.WriteRegBinary <string>(lstPluginButtonsOrder.ToArray(), "Buttons_Order", key);
         }
     }
 }
Example #21
0
 public void Execute(byte[] encodedAction)
 {
     try {
         ByteToDel(encodedAction).DynamicInvoke();
     }
     catch (Exception ex) {
         QTUtility2.MakeErrorLog(ex);
     }
 }
Example #22
0
        private static ToolStripItem CreateMenuItem_AppLauncher(string key, string[] appVals, EventPack ep)
        {
            string name = appVals[0];

            try {
                name = Environment.ExpandEnvironmentVariables(name);
            }
            catch {
            }
            MenuItemArguments mia = new MenuItemArguments(name, appVals[1], appVals[2], 0, MenuGenre.Application);

            if ((appVals[0].Length == 0) || string.Equals(appVals[0], "separator", StringComparison.OrdinalIgnoreCase))
            {
                ToolStripSeparator separator = new ToolStripSeparator();
                separator.Name = "appSep";
                return(separator);
            }
            if (appVals.Length == 4)
            {
                int.TryParse(appVals[3], out mia.KeyShortcut);
            }
            if ((name.StartsWith(@"\\") || name.StartsWith("::")) || !Directory.Exists(name))
            {
                mia.Target = MenuTarget.File;
                QMenuItem item = new QMenuItem(key, mia);
                item.Name = key;
                item.SetImageReservationKey(name, Path.GetExtension(name));
                item.MouseMove += new MouseEventHandler(MenuUtility.qmi_File_MouseMove);
                if (!ep.FromTaskBar && (mia.KeyShortcut > 0x100000))
                {
                    int num = mia.KeyShortcut & -1048577;
                    item.ShortcutKeyDisplayString = QTUtility2.MakeKeyString((Keys)num).Replace(" ", string.Empty);
                }
                return(item);
            }
            mia.Target = MenuTarget.Folder;
            DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);

            reorderable.MessageParent     = ep.MessageParentHandle;
            reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
            reorderable.ImageList         = QTUtility.ImageListGlobal;
            DirectoryMenuItem item2 = new DirectoryMenuItem(key);

            item2.SetImageReservationKey(name, null);
            item2.Name = key;
            item2.Path = name;
            item2.MenuItemArguments  = mia;
            item2.EventPack          = ep;
            item2.ModifiiedDate      = Directory.GetLastWriteTime(name);
            item2.DropDown           = reorderable;
            item2.DoubleClickEnabled = true;
            item2.DropDownItems.Add(new ToolStripMenuItem());
            item2.DropDownItemClicked += new ToolStripItemClickedEventHandler(MenuUtility.realDirectory_DropDownItemClicked);
            item2.DropDownOpening     += new EventHandler(MenuUtility.realDirectory_DropDownOpening);
            item2.DoubleClick         += ep.DirDoubleClickEventHandler;
            return(item2);
        }
 private void UpdateOptions()
 {
     foreach (OptionsDialogTab tab in tabbedPanel.Items)
     {
         tab.CommitConfig();
     }
     ConfigManager.LoadedConfig = QTUtility2.DeepClone(WorkingConfig);
     ConfigManager.WriteConfig();
     ConfigManager.UpdateConfig();
 }
Example #24
0
        private void ShowExplorerWindow(IntPtr tabBarHandle, bool fShow)
        {
            if (contextMenuNotifyIcon.InvokeRequired)
            {
                contextMenuNotifyIcon.Invoke(new Action(() => ShowExplorerWindow(tabBarHandle, fShow)));
                return;
            }
            Instance inst;

            if (!dicNotifyIcon.TryGetValue(tabBarHandle, out inst))
            {
                return;
            }
            ITaskbarList o = null;

            try {
                object obj2;
                Guid   rclsid = ExplorerGUIDs.CLSID_TaskbarList;
                Guid   riid   = ExplorerGUIDs.IID_ITaskbarList;
                PInvoke.CoCreateInstance(ref rclsid, IntPtr.Zero, 1, ref riid, out obj2);
                o = (ITaskbarList)obj2;
                o.HrInit();
                if (fShow)
                {
                    dicNotifyIcon.Remove(tabBarHandle);
                    o.AddTab(inst.ExplorerHandle);
                    PInvoke.ShowWindow(inst.ExplorerHandle, inst.ShowWindowCode);
                    PInvoke.SetForegroundWindow(inst.ExplorerHandle);
                    notifyIcon.Visible = dicNotifyIcon.Count > 0;
                }
                else
                {
                    PInvoke.ShowWindow(inst.ExplorerHandle, 0);
                    o.DeleteTab(inst.ExplorerHandle);
                    notifyIcon.Visible = true;
                }
                UpdateContextMenu();
                if (notifyIcon.Visible)
                {
                    int count = dicNotifyIcon.Count;
                    notifyIcon.Text = count == 1
                        ? QTUtility.TextResourcesDic["TrayIcon"][0]
                        : string.Format(QTUtility.TextResourcesDic["TrayIcon"][1], count);
                }
            }
            catch (Exception exception) {
                QTUtility2.MakeErrorLog(exception);
            }
            finally {
                if (o != null)
                {
                    Marshal.ReleaseComObject(o);
                }
            }
        }
 private void buildinCbx_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (true != radUseLangFileYes.IsChecked)
     {
         WorkingConfig.lang.BuiltInLangSelectedIndex = buildinCbx.SelectedIndex;
         ConfigManager.LoadedConfig = QTUtility2.DeepClone(WorkingConfig);
         ConfigManager.WriteConfig();
         ConfigManager.UpdateConfig();
         //QTUtility.ValidateTextResources
     }
 }
Example #26
0
 public PluginAssembly(string path)
 {
     this.Path  = path;
     this.Title = this.Author = this.Description = this.Version = this.Name = string.Empty;
     if (File.Exists(path))
     {
         try {
             this.assembly = Assembly.Load(File.ReadAllBytes(path));
             AssemblyName                 name            = this.assembly.GetName();
             AssemblyTitleAttribute       customAttribute = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(this.assembly, typeof(AssemblyTitleAttribute));
             AssemblyCompanyAttribute     attribute2      = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(this.assembly, typeof(AssemblyCompanyAttribute));
             AssemblyDescriptionAttribute attribute3      = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(this.assembly, typeof(AssemblyDescriptionAttribute));
             this.Version = name.Version.ToString();
             if (customAttribute != null)
             {
                 this.Title = customAttribute.Title;
             }
             if (attribute2 != null)
             {
                 this.Author = attribute2.Company;
             }
             if (attribute3 != null)
             {
                 this.Description = attribute3.Description;
             }
             this.Name = this.Title + this.Version + "(" + path.GetHashCode().ToString("X") + ")";
             foreach (Type type in this.assembly.GetTypes())
             {
                 try {
                     if (ValidateType(type))
                     {
                         PluginAttribute pluginAtt = Attribute.GetCustomAttribute(type, T_PLUGINATTRIBUTE) as PluginAttribute;
                         if (pluginAtt != null)
                         {
                             string            pluginID = this.Name + "+" + type.FullName;
                             PluginInformation info     = new PluginInformation(pluginAtt, path, pluginID, type.FullName);
                             GetImageFromAssembly(this.assembly, type, info);
                             this.dicPluginInformations[pluginID] = info;
                         }
                         else
                         {
                             QTUtility2.MakeErrorLog(null, "failed attribute");
                         }
                     }
                 }
                 catch {
                 }
             }
         }
         catch (Exception exception) {
             QTUtility2.MakeErrorLog(exception, "failed get asm\r\n" + path);
         }
     }
 }
Example #27
0
 public static void SaveCache(RegistryKey rkUser)
 {
     try {
         if (fCacheDirty && (rkUser != null))
         {
             rkUser.DeleteSubKey("Cache", false);
             using (RegistryKey key = rkUser.CreateSubKey("Cache")) {
                 if (key != null)
                 {
                     int           num  = dicCacheIDLs.Count - 0x30;
                     List <string> list = new List <string>();
                     if (num > 0)
                     {
                         foreach (string str in dicCacheIDLs.Keys)
                         {
                             if (num <= 0)
                             {
                                 break;
                             }
                             byte[] buffer = dicCacheIDLs[str];
                             if (buffer == null || buffer.Length == 0 || buffer[0] != 20)
                             {
                                 list.Add(str);
                                 num--;
                             }
                         }
                         foreach (string str2 in list)
                         {
                             dicCacheIDLs.Remove(str2);
                         }
                         if (num > 0)
                         {
                             list.Clear();
                             list.AddRange(dicCacheIDLs.Keys.Take(num));
                             foreach (string str4 in list)
                             {
                                 dicCacheIDLs.Remove(str4);
                             }
                         }
                     }
                     foreach (string str5 in dicCacheIDLs.Keys)
                     {
                         key.SetValue(str5, dicCacheIDLs[str5]);
                     }
                 }
             }
         }
         fCacheDirty = false;
     }
     catch (Exception exception) {
         QTUtility2.MakeErrorLog(exception);
     }
 }
Example #28
0
 public void SaveMD5FormStat()
 {
     using (RegistryKey key = Registry.CurrentUser.CreateSubKey(RegConst.Root)) {
         key.SetValue("MD5FormLocation", QTUtility2.Make_INT(Left, Top));
         key.SetValue("MD5FormSize", Width | (Height << 0x10));
         key.SetValue("HashType", cmbHashType.SelectedIndex);
         key.SetValue("MD5FormFullPath", chbFullPath.Checked ? 1 : 0);
         key.SetValue("MD5FormClearOnClose", chbClearOnClose.Checked ? 1 : 0);
         key.SetValue("MD5FormShowResult", chbShowResult.Checked ? 1 : 0);
         key.SetValue("MD5FormTopMost", chbTopMost.Checked ? 1 : 0);
     }
 }
Example #29
0
 public CreateNewGroupForm(string currentPath, QTabControl.QTabCollection tabs)
 {
     newPath = currentPath;
     Tabs    = tabs;
     InitializeComponent();
     textBox1.Text = QTUtility2.MakePathDisplayText(newPath, false);
     string[] strArray = QTUtility.TextResourcesDic["TabBar_NewGroup"];
     Text            = strArray[0];
     label1.Text     = strArray[1];
     chkAllTabs.Text = strArray[2];
     ActiveControl   = textBox1;
 }
Example #30
0
        public static void SavePluginShortcutKeys()
        {
            List <PluginKey> list = new List <PluginKey>();

            foreach (string str in QTUtility.dicPluginShortcutKeys.Keys)
            {
                list.Add(new PluginKey(str, QTUtility.dicPluginShortcutKeys[str]));
            }
            using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar\Plugins")) {
                QTUtility2.WriteRegBinary <PluginKey>(list.ToArray(), "ShortcutKeys", key);
            }
        }