コード例 #1
0
 private static void GetCheckedItem(DropDownMenuDropTarget ddmdtRoot, List <string> lstPaths, bool fCut, bool fSetCut)
 {
     foreach (ToolStripItem item in ddmdtRoot.Items)
     {
         QMenuItem item2 = item as QMenuItem;
         if (item2 != null)
         {
             if (item2.Checked)
             {
                 if (!string.IsNullOrEmpty(item2.Path))
                 {
                     lstPaths.Add(item2.Path);
                     if (fSetCut)
                     {
                         item2.IsCut = fCut;
                     }
                 }
                 else if (fSetCut)
                 {
                     item2.IsCut = false;
                 }
                 continue;
             }
             if (fSetCut)
             {
                 item2.IsCut = false;
             }
             if (item2.HasDropDownItems)
             {
                 GetCheckedItem((DropDownMenuDropTarget)item2.DropDown, lstPaths, fCut, fSetCut);
             }
         }
     }
 }
コード例 #2
0
        private void CopyCutFiles(bool fCut)
        {
            List <string>          lstPaths = new List <string>();
            DropDownMenuDropTarget root     = GetRoot(this);

            if (root != null)
            {
                GetCheckedItem(root, lstPaths, fCut, true);
                if (lstPaths.Count == 0)
                {
                    foreach (ToolStripItem item in this.DisplayedItems)
                    {
                        if (item.Selected)
                        {
                            QMenuItem item2 = item as QMenuItem;
                            if ((item2 != null) && !string.IsNullOrEmpty(item2.Path))
                            {
                                item2.IsCut = fCut;
                                lstPaths.Add(item2.Path);
                            }
                            break;
                        }
                    }
                }
                if (ShellMethods.SetClipboardFileDropPaths(lstPaths, fCut, this.hwndDialogParent))
                {
                    fContainsFileDropList = true;
                }
            }
        }
コード例 #3
0
        private void DeleteFiles(bool fShiftKey)
        {
            List <string>          lstPaths = new List <string>();
            DropDownMenuDropTarget root     = GetRoot(this);

            if (root != null)
            {
                GetCheckedItem(root, lstPaths, false, false);
                if (lstPaths.Count == 0)
                {
                    foreach (ToolStripItem item in this.DisplayedItems)
                    {
                        if (item.Selected)
                        {
                            QMenuItem item2 = item as QMenuItem;
                            if ((item2 != null) && !string.IsNullOrEmpty(item2.Path))
                            {
                                lstPaths.Add(item2.Path);
                            }
                            break;
                        }
                    }
                }
                ShellMethods.DeleteFile(lstPaths, fShiftKey, this.hwndDialogParent);
                if (!QTUtility.IsVista)
                {
                    root.Close(ToolStripDropDownCloseReason.ItemClicked);
                }
            }
        }
コード例 #4
0
        private void PasteFiles()
        {
            string path = null;

            if (fKeyTargetIsThis)
            {
                path = Path;
            }
            else
            {
                foreach (QMenuItem item in from ToolStripItem item in DisplayedItems
                         where item.Selected select item as QMenuItem)
                {
                    if (item != null)
                    {
                        if (item is SubDirTipForm.ToolStripMenuItemEx)
                        {
                            bool flag2;
                            if (PathIsExecutable(item.Path, out flag2) && !flag2)
                            {
                                StringCollection fileDropList = Clipboard.GetFileDropList();
                                if ((fileDropList != null) && (fileDropList.Count > 0))
                                {
                                    string            str2 = "\"" + fileDropList.StringJoin("\" \"") + "\"";
                                    MenuItemArguments mia  = new MenuItemArguments(item.Path, MenuTarget.File, MenuGenre.Application);
                                    mia.Argument = str2;
                                    AppLauncher.Execute(mia, fIsRootMenu ? Handle : IntPtr.Zero);
                                }
                                return;
                            }
                        }
                        else if (Directory.Exists(item.TargetPath))
                        {
                            path = item.TargetPath;
                        }
                    }
                    break;
                }
            }
            if (!string.IsNullOrEmpty(path))
            {
                ShellMethods.PasteFile(path, hwndDialogParent);
                if (QTUtility.IsXP)
                {
                    DropDownMenuDropTarget root = GetRoot(this);
                    if (root != null)
                    {
                        root.Close(ToolStripDropDownCloseReason.ItemClicked);
                    }
                }
            }
        }
コード例 #5
0
        private static DropDownMenuDropTarget GetRoot(DropDownMenuDropTarget ddmdt)
        {
            if (ddmdt.fIsRootMenu)
            {
                return(ddmdt);
            }
            ToolStripItem ownerItem = ddmdt.OwnerItem;

            if (ownerItem != null)
            {
                ToolStrip owner = ownerItem.Owner;
                if (owner != null)
                {
                    DropDownMenuDropTarget target = owner as DropDownMenuDropTarget;
                    if (target != null)
                    {
                        return(GetRoot(target));
                    }
                }
            }
            return(null);
        }
コード例 #6
0
        private void PasteFiles()
        {
            string pathTarget = fKeyTargetIsThis
                    ? Path
                    : (from ToolStripItem item in DisplayedItems
                       where item.Selected && item is QMenuItem
                       select((QMenuItem)item).Path).FirstOrDefault();

            if (pathTarget == null)
            {
                return;
            }
            ShellMethods.PasteFile(pathTarget, hwndDialogParent);
            if (!QTUtility.IsXP)
            {
                return;
            }
            DropDownMenuDropTarget ddmdtRoot = GetRoot(this);

            if (ddmdtRoot != null)
            {
                ddmdtRoot.Close(ToolStripDropDownCloseReason.ItemClicked);
            }
        }
コード例 #7
0
        private void PasteFiles()
        {
            string path = null;

            if (this.fKeyTargetIsThis)
            {
                path = base.Path;
            }
            else
            {
                foreach (ToolStripItem item in this.DisplayedItems)
                {
                    if (!item.Selected)
                    {
                        continue;
                    }
                    QMenuItem item2 = item as QMenuItem;
                    if (item2 != null)
                    {
                        if (item2 is SubDirTipForm.ToolStripMenuItemEx)
                        {
                            bool flag2;
                            if (PathIsExecutable(item2.Path, out flag2) && !flag2)
                            {
                                StringCollection fileDropList = Clipboard.GetFileDropList();
                                if ((fileDropList != null) && (fileDropList.Count > 0))
                                {
                                    string str2 = string.Empty;
                                    foreach (string str3 in fileDropList)
                                    {
                                        str2 = str2 + "\"" + str3 + "\" ";
                                    }
                                    str2 = str2.Trim();
                                    if (str2.Length > 0)
                                    {
                                        MenuItemArguments mia = new MenuItemArguments(item2.Path, MenuTarget.File, MenuGenre.Application);
                                        mia.Argument = str2;
                                        AppLauncher.Execute(mia, this.fIsRootMenu ? base.Handle : IntPtr.Zero);
                                    }
                                }
                                return;
                            }
                        }
                        else if (Directory.Exists(item2.TargetPath))
                        {
                            path = item2.TargetPath;
                        }
                    }
                    break;
                }
            }
            if (!string.IsNullOrEmpty(path))
            {
                ShellMethods.PasteFile(path, this.hwndDialogParent);
                if (!QTUtility.IsVista)
                {
                    DropDownMenuDropTarget root = GetRoot(this);
                    if (root != null)
                    {
                        root.Close(ToolStripDropDownCloseReason.ItemClicked);
                    }
                }
            }
        }
コード例 #8
0
        private void CopyFileNames(bool fPath)
        {
            List <string>          lstPaths = new List <string>();
            DropDownMenuDropTarget root     = GetRoot(this);

            if (root != null)
            {
                GetCheckedItem(root, lstPaths, false, true);
            }
            if (lstPaths.Count == 0)
            {
                foreach (ToolStripItem item in this.DisplayedItems)
                {
                    if (!item.Selected)
                    {
                        continue;
                    }
                    QMenuItem item2 = item as QMenuItem;
                    if ((item2 != null) && !string.IsNullOrEmpty(item2.Path))
                    {
                        string path = item2.Path;
                        if (!fPath)
                        {
                            try {
                                path = System.IO.Path.GetFileName(path);
                            }
                            catch {
                            }
                        }
                        if (!string.IsNullOrEmpty(path))
                        {
                            QTTabBarClass.SetStringClipboard(path);
                            fContainsFileDropList         = false;
                            this.itemKeyInsertionMarkPrev = null;
                            base.Invalidate();
                        }
                    }
                    break;
                }
            }
            else
            {
                string str = string.Empty;
                foreach (string str3 in lstPaths)
                {
                    if (fPath)
                    {
                        str = str + str3 + Environment.NewLine;
                    }
                    else
                    {
                        try {
                            str = str + System.IO.Path.GetFileName(str3) + Environment.NewLine;
                            continue;
                        }
                        catch {
                            continue;
                        }
                    }
                }
                if (str.Length > 0)
                {
                    QTTabBarClass.SetStringClipboard(str);
                    fContainsFileDropList         = false;
                    this.itemKeyInsertionMarkPrev = null;
                    base.Invalidate();
                }
            }
        }
コード例 #9
0
 private static DropDownMenuDropTarget GetRoot(DropDownMenuDropTarget ddmdt) {
     if(ddmdt.fIsRootMenu) {
         return ddmdt;
     }
     ToolStripItem ownerItem = ddmdt.OwnerItem;
     if(ownerItem != null) {
         ToolStrip owner = ownerItem.Owner;
         if(owner != null) {
             DropDownMenuDropTarget target = owner as DropDownMenuDropTarget;
             if(target != null) {
                 return GetRoot(target);
             }
         }
     }
     return null;
 }
コード例 #10
0
 private static void GetCheckedItem(DropDownMenuDropTarget ddmdtRoot, List<string> lstPaths, bool fCut, bool fSetCut) {
     foreach(QMenuItem item2 in ddmdtRoot.Items.OfType<QMenuItem>()) {
         if(item2.Checked) {
             if(!string.IsNullOrEmpty(item2.Path)) {
                 lstPaths.Add(item2.Path);
                 if(fSetCut) {
                     item2.IsCut = fCut;
                 }
             }
             else if(fSetCut) {
                 item2.IsCut = false;
             }
             continue;
         }
         if(fSetCut) {
             item2.IsCut = false;
         }
         if(item2.HasDropDownItems) {
             GetCheckedItem((DropDownMenuDropTarget)item2.DropDown, lstPaths, fCut, fSetCut);
         }
     }
 }