private void Update() { Address[] addresses; if (pluginServer.TryGetSelection(out addresses)) { pluginServer.UpdateItem(this, addresses.Length > 0, false); } }
public void OnButtonClick() { Address[] addresses; if (pluginServer.TryGetSelection(out addresses)) { if (addresses.Length > 0) { FileOps.FileOperation(FileOpActions.Properties, pluginServer.ExplorerHandle, null); } else { FileOps.ShowProperties(pluginServer); } } }
private void Update() { try { string currentPath = pluginServer.SelectedTab.Address.Path; Address[] addresses; if (pluginServer.TryGetSelection(out addresses)) { bool fEnabled = currentPath != null && currentPath.Length > 3 && !currentPath.StartsWith("::") && addresses.Length > 0; pluginServer.UpdateItem(this, fEnabled, false); } } catch { pluginServer.UpdateItem(this, false, false); } }
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); }
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); } }
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; }