public Main() { _settingsStorage = new PluginJsonStorage <Settings>(); _settings = _settingsStorage.Load(); Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Preload programs cost", () => { _win32Storage = new BinaryStorage <Programs.Win32[]>("Win32"); _win32s = _win32Storage.TryLoad(new Programs.Win32[] { }); _packageRepository.Load(); }); Log.Info($"|Microsoft.Plugin.Program.Main|Number of preload win32 programs <{_win32s.Length}>"); var a = Task.Run(() => { if (IsStartupIndexProgramsRequired || !_win32s.Any()) { Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", IndexWin32Programs); } }); var b = Task.Run(() => { if (IsStartupIndexProgramsRequired || !_packageRepository.Any()) { Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _packageRepository.IndexPrograms); } }); Task.WaitAll(a, b); _settings.LastIndexTime = DateTime.Today; }
public Main() { _settingsStorage = new PluginJsonStorage <Settings>(); _settings = _settingsStorage.Load(); // This helper class initializes the file system watchers based on the locations to watch _win32ProgramRepositoryHelper = new Win32ProgramFileSystemWatchers(); // Initialize the Win32ProgramRepository with the settings object _win32ProgramRepository = new Win32ProgramRepository(_win32ProgramRepositoryHelper._fileSystemWatchers.Cast <IFileSystemWatcherWrapper>().ToList(), new BinaryStorage <IList <Programs.Win32> >("Win32"), _settings, _win32ProgramRepositoryHelper._pathsToWatch); Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Preload programs cost", () => { _win32ProgramRepository.Load(); _packageRepository.Load(); }); Log.Info($"|Microsoft.Plugin.Program.Main|Number of preload win32 programs <{_win32ProgramRepository.Count()}>"); var a = Task.Run(() => { if (IsStartupIndexProgramsRequired || !_win32ProgramRepository.Any()) { Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _win32ProgramRepository.IndexPrograms); } }); var b = Task.Run(() => { if (IsStartupIndexProgramsRequired || !_packageRepository.Any()) { Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _packageRepository.IndexPrograms); } }); Task.WaitAll(a, b); _settings.LastIndexTime = DateTime.Today; }