Example #1
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <ProgramPluginSettings>();
            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.Win32Program> >("Win32"), Settings, _win32ProgramRepositoryHelper.PathsToWatch);

            var a = Task.Run(() =>
            {
                Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _win32ProgramRepository.IndexPrograms);
            });

            var b = Task.Run(() =>
            {
                Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _packageRepository.IndexPrograms);
            });

            Task.WaitAll(a, b);

            Settings.LastIndexTime = DateTime.Today;
        }
Example #2
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <ProgramPluginSettings>();
            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.Win32Program> >("Win32"), Settings, _win32ProgramRepositoryHelper.PathsToWatch);
        }
Example #3
0
        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;
        }