Example #1
0
 public static List <Benchmark> LoadAllFrom(string directory, string[] names)
 {
     return(Directory.EnumerateFiles(directory)
            .Where(f => f.EndsWith(".benchmark"))
            .Where(f => names.Length == 0 ? true : names.Any(n => Path.GetFileNameWithoutExtension(f) == n))
            .Select(f => Benchmark.LoadFrom(f))
            .ToList());
 }
Example #2
0
        public static List <Benchmark> LoadAllFrom(string directory, string[] names)
        {
            var allPaths = Directory.EnumerateFiles(directory)
                           .Where(f => f.EndsWith(".benchmark"));

            if (names != null)
            {
                foreach (var name in names)
                {
                    if (!allPaths.Any(p => Path.GetFileNameWithoutExtension(p) == name))
                    {
                        return(null);
                    }
                }
                allPaths = allPaths
                           .Where(f => names.Any(n => Path.GetFileNameWithoutExtension(f) == n));
            }
            return(allPaths
                   .Select(f => Benchmark.LoadFrom(f))
                   .ToList());
        }