Exemplo n.º 1
0
        public override IEnumerable <IPathNode> GetNodeChildren(CodeOwls.PowerShell.Provider.PathNodeProcessors.IProviderContext providerContext)
        {
            var index = 0;

            Children.Clear();
            var visitor = new SimpleVisitor(this);

            _ast.Visit(visitor);
            return(from child in Children
                   select new AstPathNode(child, ++index));
        }
Exemplo n.º 2
0
        public override IEnumerable <IPathNode> ResolvePath(CodeOwls.PowerShell.Provider.PathNodeProcessors.IProviderContext providerContext, string path)
        {
            if (null == _script)
            {
                var script = Regex.Replace(path, @"^(.+?\.ps1).*$", "$1");
                _script = script;

                Token[]      _tokens;
                ParseError[] _errors;
                _ast = Parser.ParseFile(_script, out _tokens, out _errors);
            }
            path = path.Replace(_script, String.Empty);
            return(base.ResolvePath(providerContext, path));
        }
Exemplo n.º 3
0
        public override IEnumerable <IPathNode> GetNodeChildren(CodeOwls.PowerShell.Provider.PathNodeProcessors.IProviderContext providerContext)
        {
            var color = providerContext.Path.Split(new[] { '\\' }, 2).Last();
            var mode  = providerContext.Path.StartsWith("RgbColor::Background:\\") ? RgbColorMode.Background : RgbColorMode.Foreground;

            if (string.IsNullOrEmpty(color) || color.Contains("*"))
            {
                //if (Enum.TryParse(color, true, out X11ColorName x11Color) && string.Equals(color, x11Color.ToString(), StringComparison.OrdinalIgnoreCase))
                return(Enum.GetValues(typeof(X11ColorName)).Cast <X11ColorName>().Select(name => new RgbColorItem(RgbColor.X11Palette[(int)name], mode, name.ToString())));
                //return new X11Palette().Distinct().Select(xColor => new RgbColorItem(xColor, mode));
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(color, "clear"))
            {
                return(new[] {
                    new RgbColorItem(null, mode, color)
                });
            }
            else
            {
                return(new[] {
                    new RgbColorItem(new RgbColor(color), mode, color)
                });
            }
        }
Exemplo n.º 4
0
        public override System.Collections.Generic.IEnumerable <IPathNode> GetNodeChildren(CodeOwls.PowerShell.Provider.PathNodeProcessors.IProviderContext context)
        {
            var children = _scale.Scale.Ranges;

            foreach (var child in children)
            {
                yield return(new RangeNodeFactory(_scale.Scale, child));
            }
        }
Exemplo n.º 5
0
 public override IEnumerable <IPathNode> GetNodeChildren(CodeOwls.PowerShell.Provider.PathNodeProcessors.IProviderContext providerContext)
 {
     return(from type in _assembly.GetExportedTypes()
            select new TypePathNode(type) as IPathNode);
 }
Exemplo n.º 6
0
 public override IEnumerable <IPathNode> GetNodeChildren(CodeOwls.PowerShell.Provider.PathNodeProcessors.IProviderContext providerContext)
 {
     return(from assembly in AppDomain.CurrentDomain.GetAssemblies()
            select new AssemblyPathNode(assembly) as IPathNode);
 }