public LogSourcePreprocessing(
                LogSourcesPreprocessingManager owner,
                IPreprocessingUserRequests userRequests,
                Action <YieldedProvider> providerYieldedCallback,
                IEnumerable <IPreprocessingStep> initialSteps,
                string preprocessingDisplayName,
                PreprocessingOptions options) :
                this(owner, userRequests, providerYieldedCallback)
            {
                this.displayName = preprocessingDisplayName;
                this.options     = options;
                preprocLogic     = async() =>
                {
                    using (var perfop = new Profiling.Operation(trace, displayName))
                    {
                        for (var steps = new Queue <IPreprocessingStep>(initialSteps); steps.Count > 0;)
                        {
                            if (cancellation.IsCancellationRequested)
                            {
                                break;
                            }
                            IPreprocessingStep currentStep = steps.Dequeue();
                            nextSteps = steps;
                            await currentStep.Execute(this).ConfigureAwait(continueOnCapturedContext: !isLongRunning);

                            perfop.Milestone("completed " + currentStep.ToString());
                            nextSteps          = null;
                            currentDescription = genericProcessingDescription;
                        }
                    }
                };
            }
 LogSourcePreprocessing(
     LogSourcesPreprocessingManager owner,
     IPreprocessingUserRequests userRequests,
     Action <YieldedProvider> providerYieldedCallback)
 {
     this.owner = owner;
     this.id    = string.Format("{0}.{1}", owner.trace.Prefix, Interlocked.Increment(ref owner.lastPreprocId));
     this.providerYieldedCallback = providerYieldedCallback;
     // clone formatAutodetect to avoid multithreaded access to the same object from concurrent LogSourcePreprocessing objects
     this.formatAutodetect = owner.formatAutodetect.Clone();
     this.tempFiles        = owner.tempFilesManager;
     this.scopedTempFiles  = new TempFilesCleanupList(tempFiles);
     this.trace            = new LJTraceSource("PreprocessingManager", id);
     this.userRequests     = userRequests;
 }
            public LogSourcePreprocessing(
                LogSourcesPreprocessingManager owner,
                IPreprocessingUserRequests userRequests,
                Action <YieldedProvider> providerYieldedCallback,
                RecentLogEntry recentLogEntry,
                PreprocessingOptions options
                ) :
                this(owner, userRequests, providerYieldedCallback)
            {
                this.options = options;
                preprocLogic = async() =>
                {
                    IConnectionParams            preprocessedConnectParams = null;
                    IFileBasedLogProviderFactory fileBasedFactory          = recentLogEntry.Factory as IFileBasedLogProviderFactory;
                    bool interrupted = false;
                    if (fileBasedFactory != null)
                    {
                        using (var perfop = new Profiling.Operation(trace, recentLogEntry.Factory.GetUserFriendlyConnectionName(recentLogEntry.ConnectionParams)))
                        {
                            PreprocessingStepParams currentParams = null;
                            foreach (var loadedStep in LoadStepsFromConnectionParams(recentLogEntry.ConnectionParams))
                            {
                                currentParams = await ProcessLoadedStep(loadedStep, currentParams).ConfigureAwait(continueOnCapturedContext: !isLongRunning);

                                perfop.Milestone(string.Format("completed {0} {1}", loadedStep.Action, loadedStep.Param));
                                if (currentParams == null)
                                {
                                    interrupted = true;
                                    break;
                                }
                                currentDescription = genericProcessingDescription;
                            }
                            if (currentParams != null)
                            {
                                preprocessedConnectParams = fileBasedFactory.CreateParams(currentParams.Uri);
                                currentParams.DumpToConnectionParams(preprocessedConnectParams);
                            }
                        }
                    }
                    if (!interrupted)
                    {
                        var provider = new YieldedProvider(recentLogEntry.Factory, preprocessedConnectParams ?? recentLogEntry.ConnectionParams, "",
                                                           (this.options & PreprocessingOptions.MakeLogHidden) != 0);
                        ((IPreprocessingStepCallback)this).YieldLogProvider(provider);
                    }
                };
            }
 void ILogSourcesPreprocessingManager.SetUserRequestsHandler(IPreprocessingUserRequests userRequests)
 {
     this.userRequests = userRequests;
 }