private void EvalFileRule(FilesRule r)
        {
            var exceptions = Enumerable.Empty<Exception>();
            var files = Enumerable.Empty<IntermediateFileObject>();

            var tempFileRule = new EvaluatedFilesRule(r.Name, r.Destination);
            var inclSplit = from i in r.IncludeDefs
                            group i by i.GetType()
                            into g
                            select g;

            foreach (var g in inclSplit)
            {
                if (g.Key == typeof(LiteralInclExclDef))
                {

                    //get the all the files

                    var actualFiles = g.Aggregate(Enumerable.Empty<string>(), (current, def) =>
                                                                              current.Concat(
                                                                                  def.Value.FindFilesSmarterComplex(
                                                                                      r.Root)));
                    var localMinimalPaths = actualFiles.GetMinimalPaths();

                    var fileToMinimalPaths = actualFiles.Zip(localMinimalPaths,
                                                             (actual, minimal) =>
                                                             new {Actual = actual, Minimal = minimal});

                    files = files.Concat(fileToMinimalPaths.Aggregate((IList<IntermediateFileObject>)new List<IntermediateFileObject>(),
                        (currentFiles, file) =>
                                        currentFiles.LAdd(
                                            new IntermediateFileObject
                                                (tempFileRule,
                                                file.Minimal,
                                                file.Actual))));
                }
                else if (g.Key == typeof(FilesRuleInclExclDef))
                {
                    foreach (var fr in g)
                    {

                        if (!_evaluatedFilesRules.ContainsKey(fr.Value))
                                //Exception; !!!!
                            return;

                        files = files.Concat(_evaluatedFilesRules[fr.Value].Files.Select((i) => i.AddNewParent(tempFileRule)));
                    }
                }
            }

            /*
             *we exclude all the files that AREN'T allowed
             */

            var excludeSplit = from e in r.ExcludeDefs
                               group e by e.GetType()
                               into g
                               select g;

            foreach (var g in excludeSplit) {
                if (g.Key == typeof(LiteralInclExclDef))
                {
                    //for literals, we need to work from the current root and see if the literal matches
                    // a wildcard

                    var g1 = g;
                    files = from f in files
                            where g1.All((e) => !f.File.IsWildcardMatch(e.Value, r.Root.GetFullPath() + Path.DirectorySeparatorChar))
                            select f;
                }
                else if (g.Key == typeof(FilesRuleInclExclDef)) {

                    //for these we just match the original paths straight

                    //get all files in evals
                    var allFiles = from fr in g
                                   from f in _evaluatedFilesRules[fr.Value].Files
                                   select f.File;

                    files = from f in files
                            where !allFiles.Contains(f.File)
                            select f;

                }
            }
            // we've excluded everything, now we have to add the damn prefixes
            files = PerformPathTrimming(files, tempFileRule, r.TrimPath);
            tempFileRule.Files = files;
               // var output = tempFileRule.Files.ToArray();
            _evaluatedFilesRules[r.Name] = tempFileRule;
        }
 private int GetNumberOfUniqueFRInclDefs(FilesRule rule)
 {
     return (from def in rule.IncludeDefs.Concat(rule.ExcludeDefs).OfType<FilesRuleInclExclDef>()
             select def.Value).Distinct().Count();
 }