示例#1
0
        public BenchmarksController()
        {
            string root          = HostingEnvironment.ApplicationPhysicalPath;
            string benchmarkData = Path.Combine(root, "benchmarkdata");

            repositoryWatcher = new FileWatchingReloader <BenchmarkRepository>(
                Path.Combine(benchmarkData, "index.txt"),
                () => BenchmarkRepository.Load(benchmarkData),
                ReloadTime);
            string logFile = Path.Combine(root, "hg-log.xml");

            logWatcher = new FileWatchingReloader <MercurialLog>(logFile, () => MercurialLog.Load(logFile), ReloadTime);
        }
        public TrivialDependencyResolver()
        {
            string root          = HostingEnvironment.ApplicationPhysicalPath;
            string benchmarkData = Path.Combine(root, "benchmarkdata");

            /*
             * repositoryWatcher = new FileWatchingReloader<BenchmarkRepository>(
             *  Path.Combine(benchmarkData, "index.txt"),
             *  () => BenchmarkRepository.Load(benchmarkData),
             *  ReloadTime);*/
            repositoryWatcher = new FileWatchingReloader <BenchmarkRepository>(
                Path.Combine(benchmarkData, "benchmarks.xml"),
                () => BenchmarkRepository.LoadSingleFile(Path.Combine(benchmarkData, "benchmarks.xml")),
                ReloadTime);
            string hgLogFile  = Path.Combine(root, "hg-log.xml");
            string gitLogFile = Path.Combine(root, "git-log.txt");
            var    hgWatcher  = new FileWatchingReloader <ImmutableList <SourceLogEntry> >(hgLogFile, () => MercurialLog.Load(hgLogFile), ReloadTime);
            var    gitWatcher = new FileWatchingReloader <ImmutableList <SourceLogEntry> >(gitLogFile, () => GitLog.Load(gitLogFile), ReloadTime);

            logWatcher = new CombiningReloader <ImmutableList <SourceLogEntry> >(new[] { hgWatcher, gitWatcher }.ToImmutableList(), logs => logs.SelectMany(x => x).OrderByDescending(x => x.Date).ToImmutableList());
        }