/// <inheritdoc/> public override Explorer ExploreParent(ExploreParentEventArgs args) { if (args == null) { return(null); } string newLocation = My.PathEx.GetDirectoryName(Location); //???? GetDirectoryName to add '\' for the root like IO.Path does if (newLocation.Length == 0) { return(null); } if (newLocation.EndsWith(":", StringComparison.Ordinal)) { newLocation += "\\"; } if (newLocation.Equals(Location, StringComparison.OrdinalIgnoreCase)) { return(null); } args.PostName = My.PathEx.GetFileName(Location); return(new FolderExplorer(newLocation)); }
/// <include file='doc.xml' path='doc/ScriptFork/*'/> /// <param name="args">.</param> public sealed override Explorer ExploreParent(ExploreParentEventArgs args) { if (AsExploreParent == null) { return(DoExploreParent(args)); } else { return(InvokeExplorerScript(AsExploreParent, args)); } }
public override Explorer ExploreParent(ExploreParentEventArgs args) { if (Parent != null) { args.PostData = this; } else { args.PostName = InspectedFile.OriginalFileName; InspectedFile.Close(); PakViewPanel.Close(); } return(Parent); }
/// <inheritdoc/> public override Explorer ExploreParent(ExploreParentEventArgs args) { if (args == null) return null; string newLocation = My.PathEx.GetDirectoryName(Location); //???? GetDirectoryName to add '\' for the root like IO.Path does if (newLocation.Length == 0) return null; if (newLocation.EndsWith(":", StringComparison.Ordinal)) newLocation += "\\"; if (newLocation.Equals(Location, StringComparison.OrdinalIgnoreCase)) return null; args.PostName = My.PathEx.GetFileName(Location); return new FolderExplorer(newLocation); }
/// <inheritdoc/> public override Explorer DoExploreParent(ExploreParentEventArgs args) { if (args == null) { return(null); } /* * We might use 'cd ..' but we have to be sure that the current location is in sync * with the panel path. It looks more reliable to build the parent path from the panel * path. This way is good for some not standard cases. This way is bad if current * location is problematic: * ?? * cd HKCU:\Software\Far2\PluginHotkeys * cd Plugins/Brackets/Brackets.dll * [..] --> error; it is rather PS issue though... */ var path = Location; // 090814 use ":\\" instead of "\\", [_090814_130836] if (path.EndsWith(":\\", StringComparison.Ordinal)) { return(null); } // 090814 [_090814_130836] PS V2 may get paths with extra '\' in the end path = path.TrimEnd(new char[] { '\\' }); // find name int iSlash = path.LastIndexOf('\\'); if (iSlash < 0) { // no slashes, split by :: int iProvider = path.IndexOf("::", StringComparison.Ordinal); if (iProvider > 0) { // FarMacro args.PostName = path.Substring(iProvider + 2); path = path.Substring(0, iProvider + 2); return(Explore(path)); } else { return(null); } } //! Issue with names z:|z, Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER - Far doesn't set cursor there if (path.Length > iSlash + 2) { args.PostName = path.Substring(iSlash + 1); } // remove name path = path.Substring(0, iSlash); // skip network path root ("\\ComputerName") if (path.StartsWith("\\\\", StringComparison.Ordinal) && path.LastIndexOf('\\') <= 1) { return(null); } // add \, else we can't step to the root from level 1 if (path.EndsWith(":", StringComparison.Ordinal)) { path += "\\"; } return(Explore(path)); }
/// <summary> /// <see cref="Explorer.ExploreParent"/> worker. /// </summary> /// <param name="args">.</param> public virtual Explorer DoExploreParent(ExploreParentEventArgs args) { return(null); }
/// <include file='doc.xml' path='doc/ScriptFork/*'/> /// <param name="args">.</param> public override sealed Explorer ExploreParent(ExploreParentEventArgs args) { if (AsExploreParent == null) return DoExploreParent(args); else return InvokeExplorerScript(AsExploreParent, args); }
/// <summary> /// <see cref="Explorer.ExploreParent"/> worker. /// </summary> /// <param name="args">.</param> public virtual Explorer DoExploreParent(ExploreParentEventArgs args) { return null; }
/// <summary> /// Calls <see cref="FarNet.Explorer.ExploreParent"/>. /// </summary> /// <param name="args">.</param> public virtual Explorer UIExploreParent(ExploreParentEventArgs args) { return Explorer.ExploreParent(args); }
/// <inheritdoc/> public override Explorer DoExploreParent(ExploreParentEventArgs args) { if (args == null) return null; /* We might use 'cd ..' but we have to be sure that the current location is in sync with the panel path. It looks more reliable to build the parent path from the panel path. This way is good for some not standard cases. This way is bad if current location is problematic: ?? cd HKCU:\Software\Far2\PluginHotkeys cd Plugins/Brackets/Brackets.dll [..] --> error; it is rather PS issue though... */ var path = Location; // 090814 use ":\\" instead of "\\", [_090814_130836] if (path.EndsWith(":\\", StringComparison.Ordinal)) return null; // 090814 [_090814_130836] PS V2 may get paths with extra '\' in the end path = path.TrimEnd(new char[] { '\\' }); // find name int iSlash = path.LastIndexOf('\\'); if (iSlash < 0) { // no slashes, split by :: int iProvider = path.IndexOf("::", StringComparison.Ordinal); if (iProvider > 0) { // FarMacro args.PostName = path.Substring(iProvider + 2); path = path.Substring(0, iProvider + 2); return Explore(path); } else { return null; } } //! Issue with names z:|z, Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER - Far doesn't set cursor there if (path.Length > iSlash + 2) args.PostName = path.Substring(iSlash + 1); path = path.Substring(0, iSlash); if (path.StartsWith("\\\\", StringComparison.Ordinal)) //HACK network path { iSlash = path.LastIndexOf('\\'); if (iSlash <= 1) { // show computer shares menu string computer = path.Substring(2); string share = UI.SelectMenu.SelectShare(computer); //???? kill? if (share == null) return null; else path += "\\" + share; } } // add \, else we can't step to the root from level 1 if (path != null && path.EndsWith(":", StringComparison.Ordinal)) path += "\\"; return Explore(path); }