コード例 #1
0
ファイル: ShellMethods.cs プロジェクト: uvbs/test-code-backup
 public static bool PasteFile(string pathTarget, IntPtr hwnd)
 {
     try {
         List <string> paths = ClipboardGetFileDropList(hwnd);
         if (paths.Count == 0)
         {
             return(false);
         }
         string s = MakeFILEOPPATHS(paths);
         if (s.Length > 1)
         {
             bool flag;
             if (pathTarget.Length != 3)
             {
                 pathTarget = pathTarget.TrimEnd(new char[] { '\\' });
             }
             pathTarget = QTTabBarClass.GetTargetIfFolderLink(new DirectoryInfo(pathTarget), out flag).FullName;
             if (flag)
             {
                 bool  prefferdDropEffect = GetPrefferdDropEffect(hwnd);
                 short num = 0x40;
                 if (IsTargetPathContained(paths, pathTarget))
                 {
                     num = (short)(num | 8);
                 }
                 SHFILEOPSTRUCT lpFileOp = new SHFILEOPSTRUCT();
                 lpFileOp.hwnd   = hwnd;
                 lpFileOp.wFunc  = prefferdDropEffect ? 1 : 2;
                 lpFileOp.pFrom  = Marshal.StringToHGlobalUni(s);
                 lpFileOp.pTo    = Marshal.StringToHGlobalUni(pathTarget + '\0');
                 lpFileOp.fFlags = num;
                 try {
                     if (PInvoke.SHFileOperation(ref lpFileOp) == 0)
                     {
                         return(!lpFileOp.fAnyOperationsAborted);
                     }
                 }
                 catch (Exception exception) {
                     QTUtility2.MakeErrorLog(exception, null);
                 }
                 finally {
                     if (lpFileOp.pFrom != IntPtr.Zero)
                     {
                         Marshal.FreeHGlobal(lpFileOp.pFrom);
                     }
                     if (lpFileOp.pTo != IntPtr.Zero)
                     {
                         Marshal.FreeHGlobal(lpFileOp.pTo);
                     }
                 }
             }
         }
     }
     catch (Exception exception2) {
         QTUtility2.MakeErrorLog(exception2, null);
     }
     return(false);
 }
コード例 #2
0
        public void OnButtonClick()
        {
            // user clicked the plugin button.

            /*Address[] addresses;
             * if(pluginServer.TryGetSelection(out addresses)) {
             *  int c = addresses.Length;
             *
             *  string str = c + " items\r\n\r\n";
             *  for(int i = 0; i < c; i++) {
             *      str += addresses[i].Path + "\r\n";
             *  }
             *
             *  MessageBox.Show(str);
             *
             *  lstSelectedItems.Clear();
             *  lstSelectedItems.AddRange(addresses);
             * }*/

            QTTabBarClass.OpenOptionDialog();
        }
コード例 #3
0
 public InstancePair(QTTabBarClass tabBar, IntPtr hwnd)
 {
     this.tabBar = tabBar;
     this.hwnd   = hwnd;
 }