Esempio n. 1
0
        public override Explorer ExploreLocation(ExploreLocationEventArgs args)
        {
            var dirs = args.Location.Replace(this.Location, string.Empty).Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
            var exp  = this;

            foreach (var dir in dirs)
            {
                var file = exp._files.Where(f => f.IsDirectory && f.Name == dir).SingleOrDefault();
                if (file != null && file.Data is PakExplorer found)
                {
                    exp = found;
                }
                else if (dir == "..")
                {
                    exp = exp.ExploreParent(new ExploreParentEventArgs(args.Mode)) as PakExplorer;
                    if (exp == null)
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            return(exp == this ? null : exp);
        }
Esempio n. 2
0
        IList <XPathObjectNode> ActivateSuperFileElements()
        {
            var file = (SuperFile)_target;             //????

            if (!file.IsDirectory)
            {
                _elements.Target = _emptyElements;
                return(_emptyElements);
            }

            // progress
            if (_context.IncrementDirectoryCount != null)
            {
                _context.IncrementDirectoryCount(1);
            }

            var elements = new List <XPathObjectNode>();

            Explorer explorer;

            if (file.Explorer.CanExploreLocation)
            {
                var argsExplore = new ExploreLocationEventArgs(ExplorerModes.Find, file.File.Name);
                explorer = file.Explorer.ExploreLocation(argsExplore);
            }
            else
            {
                var argsExplore = new ExploreDirectoryEventArgs(ExplorerModes.Find, file.File);
                explorer = file.Explorer.ExploreDirectory(argsExplore);
            }

            if (explorer != null)
            {
                var argsFiles = new GetFilesEventArgs(ExplorerModes.Find);
                foreach (var it in explorer.GetFiles(argsFiles))
                {
                    // filter out a leaf
                    if (_context.Filter != null && !it.IsDirectory && !_context.Filter(explorer, it))
                    {
                        continue;
                    }

                    // add
                    elements.Add(new XPathObjectNode(_context, new SuperFile(explorer, it), null, this, elements, elements.Count));
                }
            }

            if (elements.Count == 0)
            {
                _elements.Target = _emptyElements;
            }
            else
            {
                _elements.Target = elements;
            }

            return(elements);
        }
Esempio n. 3
0
 /// <include file='doc.xml' path='doc/ScriptFork/*'/>
 /// <param name="args">.</param>
 public sealed override Explorer ExploreLocation(ExploreLocationEventArgs args)
 {
     if (AsExploreLocation == null)
     {
         return(DoExploreLocation(args));
     }
     else
     {
         return(InvokeExplorerScript(AsExploreLocation, args));
     }
 }
Esempio n. 4
0
 /// <summary>
 /// <see cref="Explorer.ExploreLocation"/> worker.
 /// </summary>
 /// <param name="args">.</param>
 public virtual Explorer DoExploreLocation(ExploreLocationEventArgs args)
 {
     return(null);
 }
Esempio n. 5
0
 /// <include file='doc.xml' path='doc/ScriptFork/*'/>
 /// <param name="args">.</param>
 public override sealed Explorer ExploreLocation(ExploreLocationEventArgs args)
 {
     if (AsExploreLocation == null)
         return DoExploreLocation(args);
     else
         return InvokeExplorerScript(AsExploreLocation, args);
 }
Esempio n. 6
0
 /// <summary>
 /// <see cref="Explorer.ExploreLocation"/> worker.
 /// </summary>
 /// <param name="args">.</param>
 public virtual Explorer DoExploreLocation(ExploreLocationEventArgs args)
 {
     return null;
 }
Esempio n. 7
0
 /// <summary>
 /// Calls <see cref="FarNet.Explorer.ExploreLocation"/>.
 /// </summary>
 /// <param name="args">.</param>
 public virtual Explorer UIExploreLocation(ExploreLocationEventArgs args)
 {
     return Explorer.ExploreLocation(args);
 }