ProgressAggregator(ProgressAggregator parent)
 {
     this.parent  = parent;
     this.invoker = parent.invoker;
     this.root    = parent.root;
     parent.Add(this);
 }
Exemple #2
0
        public LogSource(ILogSourcesManagerInternal owner, int id,
                         ILogProviderFactory providerFactory, IConnectionParams connectionParams,
                         IModelThreads threads, ITempFilesManager tempFilesManager, Persistence.IStorageManager storageManager,
                         IInvokeSynchronization invoker, Settings.IGlobalSettingsAccessor globalSettingsAccess, IBookmarks bookmarks)
        {
            this.owner                = owner;
            this.tracer               = new LJTraceSource("LogSource", string.Format("ls{0:D2}", id));
            this.tempFilesManager     = tempFilesManager;
            this.invoker              = invoker;
            this.globalSettingsAccess = globalSettingsAccess;
            this.bookmarks            = bookmarks;

            try
            {
                this.logSourceThreads              = new LogSourceThreads(this.tracer, threads, this);
                this.timeGaps                      = new TimeGapsDetector(tracer, invoker, new LogSourceGapsSource(this));
                this.timeGaps.OnTimeGapsChanged   += timeGaps_OnTimeGapsChanged;
                this.logSourceSpecificStorageEntry = CreateLogSourceSpecificStorageEntry(providerFactory, connectionParams, storageManager);

                var extendedConnectionParams = connectionParams.Clone(true);
                this.LoadPersistedSettings(extendedConnectionParams);
                this.provider = providerFactory.CreateFromConnectionParams(this, extendedConnectionParams);
            }
            catch (Exception e)
            {
                tracer.Error(e, "Failed to initialize log source");
                ((ILogSource)this).Dispose();
                throw;
            }

            this.owner.Container.Add(this);
            this.owner.FireOnLogSourceAdded(this);

            this.LoadBookmarks();
        }
        public PostprocessorsManager(
            ILogSourcesManager logSources,
            Telemetry.ITelemetryCollector telemetry,
            IInvokeSynchronization modelInvoke,
            IHeartBeatTimer heartbeat,
            Progress.IProgressAggregator progressAggregator,
            IPostprocessorsManagerUserInteractions userInteractions,
            Settings.IGlobalSettingsAccessor settingsAccessor
            )
        {
            this.userInteractions   = userInteractions;
            this.logSources         = logSources;
            this.telemetry          = telemetry;
            this.progressAggregator = progressAggregator;
            this.settingsAccessor   = settingsAccessor;

            logSources.OnLogSourceAdded             += (sender, args) => { lazyUpdateTracker.Invalidate(); };
            logSources.OnLogSourceRemoved           += (sender, args) => { lazyUpdateTracker.Invalidate(); };
            logSources.OnLogSourceAnnotationChanged += (sender, args) => { lazyUpdateTracker.Invalidate(); };
            logSources.OnLogSourceStatsChanged      += (object sender, LogSourceStatsEventArgs e) =>
            {
                if ((e.Flags & LogProviderStatsFlag.ContentsEtag) != 0)
                {
                    modelInvoke.Invoke(() => RefreshInternal(assumeSourceChanged: sender as ILogSource));
                }
            };
            heartbeat.OnTimer += (sender, args) =>
            {
                if (lazyUpdateTracker.Validate())
                {
                    RefreshInternal();
                }
            };
            RefreshInternal();
        }
        public PresenterFactory(
            IHeartBeatTimer heartbeat,
            IPresentersFacade presentationFacade,
            IClipboardAccess clipboard,
            IBookmarksFactory bookmarksFactory,
            Telemetry.ITelemetryCollector telemetry,
            ILogSourcesManager logSources,
            IInvokeSynchronization modelInvoke,
            IModelThreads modelThreads,
            IFiltersList hlFilters,
            IBookmarks bookmarks,
            Settings.IGlobalSettingsAccessor settings,
            ISearchManager searchManager,
            IFiltersFactory filtersFactory
            )
        {
            this.heartbeat          = heartbeat;
            this.presentationFacade = presentationFacade;
            this.clipboard          = clipboard;
            this.bookmarksFactory   = bookmarksFactory;
            this.telemetry          = telemetry;

            this.logSources     = logSources;
            this.modelInvoke    = modelInvoke;
            this.modelThreads   = modelThreads;
            this.hlFilters      = hlFilters;
            this.bookmarks      = bookmarks;
            this.settings       = settings;
            this.searchManager  = searchManager;
            this.filtersFactory = filtersFactory;
        }
Exemple #5
0
 public SharedMemory(string name, long capacity, IInvokeSynchronization eventsThreadingContext)
 {
     try
     {
         this.eventsThreadingContext = eventsThreadingContext;
         bool createdNew;
         mmfLock         = new Mutex(false, "LogJoint-SharedMemLock-" + name, out createdNew);
         mmf             = MemoryMappedFile.CreateOrOpen("LogJoint-SharedMem-" + name, capacity);
         changeEvent     = new EventWaitHandle(false, EventResetMode.ManualReset, "LogJoint-SharedMemChange-" + name, out createdNew);
         changeEventWait = ThreadPool.RegisterWaitForSingleObject(changeEvent,
                                                                  (state, timedOut) => {
             var eventRef = OnChanged;
             if (eventRef != null)
             {
                 eventsThreadingContext.Invoke(eventRef, new object[] { this, EventArgs.Empty });
             }
         },
                                                                  null, -1, false);
     }
     catch
     {
         Dispose();
         throw;
     }
 }
 public Helper(TimeGapsDetector owner)
 {
     this.owner  = owner;
     this.invoke = owner.syncInvoke;
     this.trace  = new LJTraceSource("GapsDetector",
                                     string.Format("{0}.h{1}", owner.trace.Prefix, ++owner.lastHelperId));
     this.source = owner.source;
 }
 public AsyncInvokeHelper(IInvokeSynchronization invoker, Delegate method,
                          params object[] args)
 {
     this.invoker        = invoker;
     this.method         = method;
     this.args           = args;
     this.methodToInvoke = (SimpleDelegate)InvokeInternal;
 }
        public Presenter(
            ILogSourcesManager sourcesManager,
            Preprocessing.ILogSourcesPreprocessingManager preprocessingManager,
            IInvokeSynchronization invoker,
            IHeartBeatTimer heartbeat,
            IPresentersFacade presentersFacade,
            StatusReports.IPresenter statusReports
            )
        {
            this.preprocessingManager = preprocessingManager;
            this.presentersFacade     = presentersFacade;
            this.statusReports        = statusReports;

            this.updateInvokeHelper = new AsyncInvokeHelper(invoker, Update)
            {
                ForceAsyncInvocation = true
            };

            sourcesManager.OnLogSourceStatsChanged += (sender, e) =>
            {
                bool?logSourceNeedsFixing = null;
                if ((e.Flags & LogProviderStatsFlag.FirstMessageWithTimeConstraintViolation) != 0 ||
                    (e.Flags & LogProviderStatsFlag.Error) != 0)
                {
                    var badMsg = ((ILogSource)sender).Provider.Stats.FirstMessageWithTimeConstraintViolation;
                    var failedWithBoundaryDates = ((ILogSource)sender).Provider.Stats.Error is BadBoundaryDatesException;

                    logSourceNeedsFixing = badMsg != null || failedWithBoundaryDates;
                }
                if (logSourceNeedsFixing != null)
                {
                    bool updated;
                    if (logSourceNeedsFixing.Value)
                    {
                        updated = logSourcesRequiringReordering.Add((ILogSource)sender);
                    }
                    else
                    {
                        updated = logSourcesRequiringReordering.Remove((ILogSource)sender);
                    }
                    if (updated)
                    {
                        updateFlag.Invalidate();
                    }
                }
            };
            sourcesManager.OnLogSourceRemoved += (sender, e) =>
            {
                updateFlag.Invalidate();
            };
            heartbeat.OnTimer += (sender, e) =>
            {
                if (e.IsNormalUpdate && updateFlag.Validate())
                {
                    Update();
                }
            };
        }
 public PreprocessingCredentialsCache(
     NSWindow parentWindow,
     Persistence.IStorageEntry credentialsCacheStorage,
     IInvokeSynchronization uiInvoke)
 {
     this.credentialsCacheStorage = credentialsCacheStorage;
     this.parentWindow            = parentWindow;
     this.uiInvoke = uiInvoke;
 }
Exemple #10
0
 public Model(
     IInvokeSynchronization threadSync,
     Telemetry.ITelemetryCollector telemetryCollector,
     Persistence.IWebContentCache webCache,
     Persistence.IContentCache contentCache,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     ILogSourcesManager sourcesManager,
     IModelThreads threads,
     ITempFilesManager tempFilesManager,
     Preprocessing.IPreprocessingManagerExtensionsRegistry preprocessingManagerExtentionsRegistry,
     Preprocessing.ILogSourcesPreprocessingManager logSourcesPreprocessingManager,
     Preprocessing.IPreprocessingStepsFactory preprocessingStepsFactory,
     Progress.IProgressAggregator progressAggregator,
     ILogProviderFactoryRegistry logProviderFactoryRegistry,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     MRU.IRecentlyUsedEntities mru,
     Progress.IProgressAggregatorFactory progressAggregatorsFactory,
     IHeartBeatTimer heartbeat,
     ILogSourcesController logSourcesController,
     IShutdown shutdown,
     WebBrowserDownloader.IDownloader webBrowserDownloader,
     AppLaunch.ICommandLineHandler commandLineHandler,
     Postprocessing.IPostprocessorsManager postprocessorsManager,
     Postprocessing.IUserNamesProvider analyticsShortNames,
     Analytics.TimeSeries.ITimeSeriesTypesAccess timeSeriesTypes,
     Postprocessing.IAggregatingLogSourceNamesProvider logSourceNamesProvider
     )
 {
     this.ModelThreadSynchronization = threadSync;
     this.Telemetry        = telemetryCollector;
     this.WebContentCache  = webCache;
     this.ContentCache     = contentCache;
     this.StorageManager   = storageManager;
     this.Bookmarks        = bookmarks;
     this.SourcesManager   = sourcesManager;
     this.Threads          = threads;
     this.TempFilesManager = tempFilesManager;
     this.PreprocessingManagerExtensionsRegistry = preprocessingManagerExtentionsRegistry;
     this.PreprocessingStepsFactory      = preprocessingStepsFactory;
     this.LogSourcesPreprocessingManager = logSourcesPreprocessingManager;
     this.ProgressAggregator             = progressAggregator;
     this.LogProviderFactoryRegistry     = logProviderFactoryRegistry;
     this.UserDefinedFormatsManager      = userDefinedFormatsManager;
     this.ProgressAggregatorsFactory     = progressAggregatorsFactory;
     this.MRU                    = mru;
     this.Heartbeat              = heartbeat;
     this.LogSourcesController   = logSourcesController;
     this.Shutdown               = shutdown;
     this.WebBrowserDownloader   = webBrowserDownloader;
     this.CommandLineHandler     = commandLineHandler;
     this.PostprocessorsManager  = postprocessorsManager;
     this.ShortNames             = analyticsShortNames;
     this.TimeSeriesTypes        = timeSeriesTypes;
     this.LogSourceNamesProvider = logSourceNamesProvider;
 }
        public TimeGapsDetector(LJTraceSource tracer, IInvokeSynchronization modelThreadInvoke, ITimeGapsSource source)
        {
            this.trace = new LJTraceSource("GapsDetector", tracer.Prefix + ".gaps");
            using (trace.NewFrame)
            {
                this.syncInvoke = modelThreadInvoke;
                this.source     = source;

                trace.Info("starting worker thread");
                thread = Task.Run((Func <Task>)ThreadProc);
            }
        }
 ProgressAggregator(IHeartBeatTimer timer, IInvokeSynchronization invoker)
 {
     this.invoker   = invoker;
     this.root      = this;
     timer.OnTimer += (s, e) =>
     {
         if (e.IsNormalUpdate)
         {
             RootUpdate();
         }
     };
 }
 public SearchObjectsFactory(
     Progress.IProgressAggregatorFactory progressAggregatorFactory,
     IInvokeSynchronization modelSynchronization,
     Settings.IGlobalSettingsAccessor settings,
     Telemetry.ITelemetryCollector telemetryCollector
     )
 {
     this.progressAggregatorFactory = progressAggregatorFactory;
     this.modelSynchronization      = modelSynchronization;
     this.settings           = settings;
     this.telemetryCollector = telemetryCollector;
 }
Exemple #14
0
 public LogSourcesManager(
     IHeartBeatTimer heartbeat,
     IInvokeSynchronization invoker,
     IModelThreads threads,
     ITempFilesManager tempFilesManager,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     Settings.IGlobalSettingsAccessor globalSettingsAccess
     ) : this(heartbeat,
              new LogSourceFactory(threads, bookmarks, invoker, storageManager, tempFilesManager, globalSettingsAccess))
 {
 }
Exemple #15
0
 public void Init()
 {
     timer  = Substitute.For <IHeartBeatTimer>();
     invoke = Substitute.For <IInvokeSynchronization>();
     invoke.Invoke(null).ReturnsForAnyArgs(callInfo =>
     {
         Assert.IsNull(lastInvokedAction);
         lastInvokedAction    = callInfo.Arg <Action>();
         lastActionCompletion = new TaskCompletionSource <int>();
         return(lastActionCompletion.Task);
     });
     agg       = ((IProgressAggregatorFactory) new ProgressAggregator.Factory(timer, invoke)).CreateProgressAggregator();
     outEvents = MakeOutEventsMock(agg);
 }
Exemple #16
0
 public SearchManager(
     ILogSourcesManager sources,
     Progress.IProgressAggregatorFactory progressAggregatorFactory,
     IInvokeSynchronization modelSynchronization,
     Settings.IGlobalSettingsAccessor settings,
     Telemetry.ITelemetryCollector telemetryCollector,
     IHeartBeatTimer heartBeat
     ) : this(
         sources,
         modelSynchronization,
         heartBeat,
         new SearchObjectsFactory(progressAggregatorFactory, modelSynchronization, settings, telemetryCollector)
         )
 {
 }
Exemple #17
0
 public void Init(IPresenter mainWindowPresenter, AppLaunch.ICommandLineHandler commandLineHandler,
                  IInvokeSynchronization invoke)
 {
     this.commandLineHandler     = commandLineHandler;
     this.invoke                 = invoke;
     mainWindowPresenter.Loaded += (sender, e) =>
     {
         if (isLoaded)
         {
             return;
         }
         isLoaded = true;
         LoadPassedUrl();
     };
 }
        public UserDefinedSearchesManager(
            Persistence.IStorageManager storage,
            IFiltersFactory filtersFactory,
            IInvokeSynchronization modelThreadSynchronization
            )
        {
            this.filtersFactory       = filtersFactory;
            this.storageEntry         = new Lazy <Persistence.IStorageEntry>(() => storage.GetEntry("UserDefinedSearches"));
            this.changeHandlerInvoker = new AsyncInvokeHelper(modelThreadSynchronization, (Action)HandleChange)
            {
                ForceAsyncInvocation = true
            };

            LoadItems();
        }
 public LogSourceFactory(
     IModelThreads threads,
     IBookmarks bookmarks,
     IInvokeSynchronization invoker,
     Persistence.IStorageManager storageManager,
     ITempFilesManager tempFilesManager,
     Settings.IGlobalSettingsAccessor globalSettingsAccess
     )
 {
     this.threads              = threads;
     this.bookmarks            = bookmarks;
     this.invoker              = invoker;
     this.storageManager       = storageManager;
     this.tempFilesManager     = tempFilesManager;
     this.globalSettingsAccess = globalSettingsAccess;
 }
Exemple #20
0
        public Presenter(
            IView view,
            IInvokeSynchronization uiInvokeSynchronization,
            Persistence.IWebContentCache cache,
            IShutdown shutdown
            )
        {
            this.downloaderForm          = view;
            this.uiInvokeSynchronization = uiInvokeSynchronization;
            this.tracer = new LJTraceSource("BrowserDownloader", "web.dl");
            this.cache  = cache;

            shutdown.Cleanup += Shutdown;

            downloaderForm.SetEventsHandler(this);
        }
Exemple #21
0
        public PresentationModel(
            ILogSourcesManager logSources,
            IInvokeSynchronization modelInvoke,
            IModelThreads modelThreads,
            IFiltersList hlFilters,
            IBookmarks bookmarks,
            Settings.IGlobalSettingsAccessor settings
            )
        {
            this.logSources   = logSources;
            this.modelThreads = modelThreads;
            this.hlFilters    = hlFilters;
            this.bookmarks    = bookmarks;
            this.settings     = settings;

            updateSourcesInvoker = new AsyncInvokeHelper(modelInvoke, UpdateSources);

            logSources.OnLogSourceColorChanged += (s, e) =>
            {
                if (OnLogSourceColorChanged != null)
                {
                    OnLogSourceColorChanged(s, e);
                }
            };
            logSources.OnLogSourceAdded += (s, e) =>
            {
                updateSourcesInvoker.Invoke();
            };
            logSources.OnLogSourceRemoved += (s, e) =>
            {
                updateSourcesInvoker.Invoke();
            };
            logSources.OnLogSourceStatsChanged += (s, e) =>
            {
                if ((e.Flags & LogProviderStatsFlag.PositionsRange) != 0)
                {
                    if ((e.Flags & LogProviderStatsFlag.AvailableTimeUpdatedIncrementallyFlag) == 0)
                    {
                        updateSourcesInvoker.Invoke();
                    }
                    else if (OnSourceMessagesChanged != null)
                    {
                        OnSourceMessagesChanged(this, EventArgs.Empty);
                    }
                }
            };
        }
Exemple #22
0
        internal SearchManager(
            ILogSourcesManager sources,
            IInvokeSynchronization modelSynchronization,
            IHeartBeatTimer heartBeat,
            ISearchObjectsFactory factory
            )
        {
            this.sources = sources;
            this.factory = factory;

            this.combinedSearchResult        = factory.CreateCombinedSearchResult(this);
            this.combinedResultUpdateInvoker = new AsyncInvokeHelper(
                modelSynchronization, (Action)UpdateCombinedResult);
            this.combinedResultNeedsLazyUpdateFlag = new LazyUpdateFlag();

            sources.OnLogSourceAdded += (s, e) =>
            {
                results.ForEach(r => r.FireChangeEventIfContainsSourceResults(s as ILogSource));
            };
            sources.OnLogSourceRemoved += (s, e) =>
            {
                results.ForEach(r => r.FireChangeEventIfContainsSourceResults(s as ILogSource));

                // Search result is fully disposed if it contains messages
                // only from disposed log sources.
                // Fully disposed results are automatically dropped.
                var toBeDropped = results.Where(
                    r => r.Results.All(sr => sr.Source.IsDisposed)).ToHashSet();
                var nrOfFullyDisposedResults = DisposeResults(toBeDropped);
                if (nrOfFullyDisposedResults > 0 && SearchResultsChanged != null)
                {
                    SearchResultsChanged(this, EventArgs.Empty);
                }
                if (nrOfFullyDisposedResults > 0)
                {
                    combinedResultNeedsLazyUpdateFlag.Invalidate();
                }
            };
            heartBeat.OnTimer += (s, e) =>
            {
                if (e.IsNormalUpdate && combinedResultNeedsLazyUpdateFlag.Validate())
                {
                    combinedResultUpdateInvoker.Invoke();
                }
            };
        }
Exemple #23
0
        public TelemetryCollector(
            Persistence.IStorageManager storage,
            ITelemetryUploader telemetryUploader,
            IInvokeSynchronization synchronization,
            MultiInstance.IInstancesCounter instancesCounter,
            IShutdown shutdown,
            ILogSourcesManager logSourcesManager,
            IMemBufferTraceAccess traceAccess
            )
        {
            this.telemetryUploader = telemetryUploader;
            this.synchronization   = synchronization;
            this.traceAccess       = traceAccess;

            this.telemetryStorageEntry = storage.GetEntry("telemetry");
            this.sessionStartedMillis  = Environment.TickCount;

            this.currentSessionId = telemetryUploader.IsTelemetryConfigured ?
                                    ("session" + Guid.NewGuid().ToString("n")) : null;

            this.transactionInvoker = new AsyncInvokeHelper(synchronization,
                                                            (Action)(() => DoSessionsRegistryTransaction(TransactionFlag.Default)), new object[0]);

            shutdown.Cleanup += (s, e) => shutdown.AddCleanupTask(DisposeAsync());

            if (currentSessionId != null)
            {
                CreateCurrentSessionSection();
                InitStaticTelemetryProperties();

                logSourcesManager.OnLogSourceAdded += (s, e) =>
                {
                    ++totalNfOfLogs;
                    var nfOfSimultaneousLogs = logSourcesManager.Items.Count();
                    maxNfOfSimultaneousLogs = Math.Max(maxNfOfSimultaneousLogs, nfOfSimultaneousLogs);
                };
            }

            if (telemetryUploader.IsTelemetryConfigured && instancesCounter.IsPrimaryInstance)
            {
                this.workerCancellation     = new CancellationTokenSource();
                this.workerCancellationTask = new TaskCompletionSource <int>();
                this.worker = TaskUtils.StartInThreadPoolTaskScheduler(Worker);
            }
        }
Exemple #24
0
        public SearchResult(
            ISearchManagerInternal owner,
            SearchAllOptions options,
            IFilter optionsFilter,
            IList <ILogSourceSearchWorkerInternal> workers,
            Progress.IProgressAggregatorFactory progressAggregatorFactory,
            IInvokeSynchronization modelSynchronization,
            Settings.IGlobalSettingsAccessor settings,
            int id,
            ISearchObjectsFactory factory
            )
        {
            this.owner                = owner;
            this.options              = options;
            this.optionsFilter        = optionsFilter;
            this.factory              = factory;
            this.modelSynchronization = modelSynchronization;
            this.id                     = id;
            this.cancellation           = new CancellationTokenSource();
            this.results                = new List <ISourceSearchResultInternal>();
            this.progressAggregator     = progressAggregatorFactory.CreateProgressAggregator();
            this.updateInvokationHelper = new AsyncInvokeHelper(modelSynchronization, (Action)UpdateStatus);
            this.hitsLimit              = settings.MaxNumberOfHitsInSearchResultsView;
            this.visible                = true;
            this.trace                  = new LJTraceSource("SearchManager", "sr." + id.ToString());
            this.timeGapsDetector       = new TimeGapsDetector(trace, modelSynchronization, this);

            this.timeGapsDetector.OnTimeGapsChanged += (s, e) =>
            {
                owner.OnResultChanged(this, SearchResultChangeFlag.TimeGapsChanged);
            };

            this.progressAggregator.ProgressChanged += HandleProgressChanged;

            this.searchTime = Stopwatch.StartNew();
            this.results.AddRange(workers.Select(w => factory.CreateSourceSearchResults(w, this, cancellation.Token, progressAggregator)));
            if (results.Count == 0)
            {
                status = SearchResultStatus.Finished;
                HandleFinalStateTransition();
            }
        }
Exemple #25
0
        public StateInspectorVisualizerModel(
            IPostprocessorsManager postprocessorsManager,
            ILogSourcesManager logSourcesManager,
            IInvokeSynchronization invokeSync,
            IUserNamesProvider shortNamesManager)
        {
            this.postprocessorsManager   = postprocessorsManager;
            this.outputsUpdateInvocation = new AsyncInvokeHelper(invokeSync, (Action)UpdateOutputs)
            {
                ForceAsyncInvocation = true
            };
            this.shortNamesManager = shortNamesManager;

            postprocessorsManager.Changed += (sender, args) =>
            {
                outputsUpdateInvocation.Invoke();
            };
            logSourcesManager.OnLogSourceVisiblityChanged += (sender, args) =>
            {
                outputsUpdateInvocation.Invoke();
            };

            UpdateOutputs();
        }
        public LogSourcesPreprocessingManager(
            IInvokeSynchronization invokeSynchronize,
            IFormatAutodetect formatAutodetect,
            IPreprocessingManagerExtensionsRegistry extensions,
            IPreprocessingManagerExtension builtinStepsExtension,
            Telemetry.ITelemetryCollector telemetry,
            ITempFilesManager tempFilesManager)
        {
            this.trace                   = new LJTraceSource("PreprocessingManager", "prepr");
            this.invokeSynchronize       = invokeSynchronize;
            this.formatAutodetect        = formatAutodetect;
            this.providerYieldedCallback = prov =>
            {
                if (ProviderYielded != null)
                {
                    ProviderYielded(this, prov);
                }
            };
            this.extensions       = extensions;
            this.telemetry        = telemetry;
            this.tempFilesManager = tempFilesManager;

            extensions.Register(builtinStepsExtension);
        }
Exemple #27
0
 public PreprocessingStepsFactory(
     Workspaces.IWorkspacesManager workspacesManager,
     AppLaunch.ILaunchUrlParser appLaunch,
     IInvokeSynchronization invoke,
     IPreprocessingManagerExtensionsRegistry extentions,
     Progress.IProgressAggregator progressAggregator,
     Persistence.IWebContentCache cache,
     ICredentialsCache credCache,
     ILogProviderFactoryRegistry logProviderFactoryRegistry,
     WebBrowserDownloader.IDownloader webBrowserDownloader,
     ILogsDownloaderConfig logsDownloaderConfig
     )
 {
     this.workspacesManager  = workspacesManager;
     this.appLaunch          = appLaunch;
     this.invoke             = invoke;
     this.extentions         = extentions;
     this.progressAggregator = progressAggregator;
     this.cache     = cache;
     this.credCache = credCache;
     this.logProviderFactoryRegistry = logProviderFactoryRegistry;
     this.webBrowserDownloader       = webBrowserDownloader;
     this.logsDownloaderConfig       = logsDownloaderConfig;
 }
        public AutoUpdater(
            MultiInstance.IInstancesCounter mutualExecutionCounter,
            IUpdateDownloader updateDownloader,
            ITempFilesManager tempFiles,
            IShutdown shutdown,
            IInvokeSynchronization eventInvoker,
            IFirstStartDetector firstStartDetector,
            Telemetry.ITelemetryCollector telemetry,
            Persistence.IStorageManager storage
            )
        {
            this.mutualExecutionCounter = mutualExecutionCounter;
            this.updateDownloader       = updateDownloader;
            this.tempFiles            = tempFiles;
            this.manualCheckRequested = new TaskCompletionSource <int>();
            this.firstStartDetector   = firstStartDetector;

            this.managedAssembliesPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            this.updateInfoFilePath    = Path.Combine(managedAssembliesPath, updateInfoFileName);
            this.installationDir       = Path.GetFullPath(
                Path.Combine(managedAssembliesPath, installationPathRootRelativeToManagedAssembliesLocation));

            this.eventInvoker = eventInvoker;
            this.telemetry    = telemetry;
            this.storage      = storage;

            shutdown.Cleanup += (s, e) => ((IDisposable)this).Dispose();

            this.updatesStorageEntry = storage.GetEntry("updates");

            bool isFirstInstance        = mutualExecutionCounter.IsPrimaryInstance;
            bool isDownloaderConfigured = updateDownloader.IsDownloaderConfigured;

            if (!isDownloaderConfigured)
            {
                trace.Info("autoupdater is disabled - update downloader not configured");
                isActiveAutoUpdaterInstance = false;

                state = AutoUpdateState.Disabled;
            }
            else if (!isFirstInstance)
            {
                trace.Info("autoupdater is deactivated - not a first instance of logjoint");
                isActiveAutoUpdaterInstance = false;

                state = AutoUpdateState.Inactive;
            }
            else
            {
                trace.Info("autoupdater is enabled");
                isActiveAutoUpdaterInstance = true;

                state = AutoUpdateState.Idle;

                workerCancellation      = new CancellationTokenSource();
                workerCancellationToken = workerCancellation.Token;
                workerCancellationTask  = new TaskCompletionSource <int>();

                worker = TaskUtils.StartInThreadPoolTaskScheduler(Worker);
            }
        }
 public Factory(IHeartBeatTimer timer, IInvokeSynchronization invoker)
 {
     this.timer   = timer;
     this.invoker = invoker;
 }
 public SynchronizedLazy(Func <T> factory, IInvokeSynchronization sync)
 {
     this.lazy = new Lazy <T>(factory);
     this.sync = sync;
 }