private async Task RunAsync() { await SetupAsync(); Console.WriteLine("Generating files to hash..."); ISourceFileGenerator fileGenerator = CreateSourceFileGenerator(); await fileGenerator.CleanupSourceFilesAsync(mAppConfiguration); ISourceFileRepository sourceFileRepository = await fileGenerator .GenerateSourceFilesAsync(mAppConfiguration); Console.WriteLine("Generated {0} files to hash.", sourceFileRepository.TotalFileCount); IProcessingWatcher processingWatcher = CreateProcessingWatcher(sourceFileRepository); ISourceFileScheduler sourceFileScheduler = CreateSourceFileScheduler(); IFileHashRepository fileHashRepository = CreatFileHashRepository(); ISourceFileProcessor processor = CreateSourceFileProcessor(sourceFileScheduler); Console.WriteLine("Begin processing files..."); await processor.StartProcesingFilesAsync(sourceFileRepository, fileHashRepository, processingWatcher); await processingWatcher.WaitForCompletionAsync(); Console.WriteLine("Processing files completed. Number of hashed files: {0}. Shutting down...", fileHashRepository.TotalHashCount); await processor.StopProcessingFilesAsync(); Console.WriteLine("Successfully shut down. Press any key to continue..."); Console.ReadKey(); }
public async Task StartProcesingFilesAsync(ISourceFileRepository sourceFileRepository, IFileHashRepository fileHashRepository, IProcessingWatcher processingWatcher) { mStakhanovise = await Stakhanovise .CreateForTheMotherland(new NetCoreConfigurationStakhanoviseDefaultsProvider()) .SetupWorkingPeoplesCommittee(setup => { setup.SetupBuiltInTaskExecutorRegistryDependencies(depSetup => { depSetup.BindToInstance <IFileHashRepository>(fileHashRepository); depSetup.BindToInstance <ISourceFileRepository>(sourceFileRepository); depSetup.BindToInstance <IProcessingWatcher>(processingWatcher); }); }) .StartFulfillingFiveYearPlanAsync(); await mSourceFileScheduler.ScheduleFilesAsync(sourceFileRepository, processingWatcher); }