コード例 #1
0
ファイル: GlobVisitor.cs プロジェクト: trial-org-6/cake
        public IEnumerable <IFileSystemInfo> Walk(GlobNode node, GlobberSettings settings)
        {
            var context = new GlobVisitorContext(_fileSystem, _environment, settings.Predicate);

            node.Accept(this, context);
            return(context.Results);
        }
コード例 #2
0
ファイル: GlobVisitor.cs プロジェクト: samvik/cake
        public IEnumerable <IFileSystemInfo> Walk(GlobNode node)
        {
            var context = new GlobVisitorContext(_fileSystem, _environment);

            node.Accept(this, context);
            return(context.Results);
        }
コード例 #3
0
ファイル: GlobVisitor.cs プロジェクト: jnm2/cake
        public IEnumerable <IFileSystemInfo> Walk(GlobNode node, Func <IDirectory, bool> predicate)
        {
            var context = new GlobVisitorContext(_fileSystem, _environment, predicate);

            node.Accept(this, context);
            return(context.Results);
        }
コード例 #4
0
        public static void Validate(GlobPattern pattern, GlobNode node)
        {
            var previous = (GlobNode)null;
            var current  = node;

            while (current != null)
            {
                if (previous is RecursiveWildcardNode)
                {
                    if (current is ParentDirectoryNode)
                    {
                        throw new NotSupportedException("Visiting a parent that is a recursive wildcard is not supported.");
                    }
                }

                if (current is UncRootNode unc)
                {
                    if (string.IsNullOrWhiteSpace(unc.Server))
                    {
                        throw new CakeException($"The pattern '{pattern}' has no server part specified.");
                    }
                }

                previous = current;
                current  = current.Next;
            }
        }
コード例 #5
0
 private static GlobNode RewriteUncRoot(string pattern, GlobNode root)
 {
     if (root is UncRootNode unc && unc.Server == null)
     {
         var next = unc.Next;
         if (next == null)
         {
             throw new CakeException($"The pattern '{pattern}' has no server part specified.");
         }
         else if (next is PathNode path && path.IsIdentifier)
         {
             // Rewrite the root node.
             return(new UncRootNode(path.GetPath())
             {
                 Next = next.Next
             });
         }
コード例 #6
0
        public static void Validate(GlobNode node)
        {
            var previous = (GlobNode)null;
            var current  = node;

            while (current != null)
            {
                if (previous is RecursiveWildcardNode)
                {
                    if (current is ParentDirectoryNode)
                    {
                        throw new NotSupportedException("Visiting a parent that is a recursive wildcard is not supported.");
                    }
                }
                previous = current;
                current  = current.Next;
            }
        }