private static extern int SHFileOperation(ref SHFILEOPSTRUCT lpFileOp);
public static bool MoveSelectedToParent(IPluginServer pluginServer) { try { Address[] addresses; if(!pluginServer.TryGetSelection(out addresses) || addresses.Length == 0) return false; string currentPath = pluginServer.SelectedTab.Address.Path; string sourcePaths = FileOps.MakeSourcePaths(addresses); if(sourcePaths.Length < 2 || currentPath.Length < 4) return false; string targetDir = Path.GetDirectoryName(currentPath); if(!String.IsNullOrEmpty(targetDir)) { const int FO_MOVE = 0x0001; const int FO_COPY = 0x0002; const short FOF_ALLOWUNDO = 0x0040; bool fInCompressedFolder = File.Exists(currentPath); // or unknown virtual folder?? TENUKI here bool fCopy = fInCompressedFolder ^ Control.ModifierKeys == Keys.Control; SHFILEOPSTRUCT sfo = new SHFILEOPSTRUCT(); sfo.hwnd = pluginServer.ExplorerHandle; sfo.wFunc = fCopy ? FO_COPY : FO_MOVE; sfo.pFrom = sourcePaths; sfo.pTo = targetDir + "\0"; sfo.fFlags = FOF_ALLOWUNDO; SHFileOperation(ref sfo); pluginServer.ExecuteCommand(Commands.RefreshBrowser, null); return true; } } catch { } return false; }