internal FormatDetectionStep(PreprocessingStepParams srcFile, IExtensionsRegistry extentions, IStepsFactory preprocessingStepsFactory, IFileSystem fileSystem) { this.sourceFile = srcFile; this.preprocessingStepsFactory = preprocessingStepsFactory; this.extentions = extentions; this.fileSystem = fileSystem; }
async Task <PreprocessingStepParams> IPreprocessingStep.ExecuteLoadedStep(IPreprocessingStepCallback callback, string param) { PreprocessingStepParams ret = null; await ExecuteInternal(callback, param, x => { ret = x; return(false); }); return(ret); }
IPreprocessingStep CreateStepByName(string name, PreprocessingStepParams param) { return (extensions .Items .Select(e => e.CreateStepByName(name, param)) .FirstOrDefault(s => s != null)); }
internal UntarStep( PreprocessingStepParams srcFile, Progress.IProgressAggregator progressAggregator, IStepsFactory preprocessingStepsFactory) { this.@params = srcFile; this.preprocessingStepsFactory = preprocessingStepsFactory; this.progressAggregator = progressAggregator; }
internal GunzippingStep( PreprocessingStepParams srcFile, Progress.IProgressAggregator progressAggregator, IPreprocessingStepsFactory preprocessingStepsFactory) { this.sourceFile = srcFile; this.preprocessingStepsFactory = preprocessingStepsFactory; this.progressAggregator = progressAggregator; }
static PreprocessingStepParams SetArgument(PreprocessingStepParams p, string argument) { return(new PreprocessingStepParams( p?.Location, p?.FullPath, p?.PreprocessingHistory, p?.DisplayName, argument )); }
internal UnpackingStep( PreprocessingStepParams srcFile, Progress.IProgressAggregator progressAggregator, ICredentialsCache credCache, IPreprocessingStepsFactory preprocessingStepsFactory) { this.sourceFile = srcFile; this.preprocessingStepsFactory = preprocessingStepsFactory; this.progressAggregator = progressAggregator; this.credCache = credCache; }
internal TimeAnomalyFixingStep( PreprocessingStepParams srcFile, Progress.IProgressAggregator progressAggregator, ILogProviderFactoryRegistry logProviderFactoryRegistry, IPreprocessingStepsFactory preprocessingStepsFactory) { this.sourceFile = srcFile; this.preprocessingStepsFactory = preprocessingStepsFactory; this.progressAggregator = progressAggregator; this.logProviderFactoryRegistry = logProviderFactoryRegistry; }
static bool IsGzip(PreprocessingStepParams fileInfo, IStreamHeader header) { if (HasGzExtension(fileInfo.Location) || HasGzExtension(fileInfo.FullPath)) { if (header.Header.Take(2).SequenceEqual(new byte[] { 0x1f, 0x8b })) { return(IsGzipFile(fileInfo.Location)); } } return(false); }
static bool IsZip(PreprocessingStepParams fileInfo, IStreamHeader header) { if (HasZipExtension(fileInfo.Location) || HasZipExtension(fileInfo.FullPath)) { if (header.Header.Take(4).SequenceEqual(new byte[] { 0x50, 0x4b, 0x03, 0x04 })) { return(Ionic.Zip.ZipFile.IsZipFile(fileInfo.Location, false)); } } return(false); }
internal UnpackingStep( PreprocessingStepParams srcFile, Progress.IProgressAggregator progressAggregator, ICredentialsCache credCache, IStepsFactory preprocessingStepsFactory, IFileSystem fileSystem) { this.@params = srcFile; this.preprocessingStepsFactory = preprocessingStepsFactory; this.progressAggregator = progressAggregator; this.credCache = credCache; this.fileSystem = fileSystem; }
internal TimeAnomalyFixingStep( PreprocessingStepParams srcFile, Progress.IProgressAggregator progressAggregator, ILogProviderFactoryRegistry logProviderFactoryRegistry, IStepsFactory preprocessingStepsFactory, RegularExpressions.IRegexFactory regexFactory) { this.@params = srcFile; this.preprocessingStepsFactory = preprocessingStepsFactory; this.progressAggregator = progressAggregator; this.logProviderFactoryRegistry = logProviderFactoryRegistry; this.regexFactory = regexFactory; }
internal URLTypeDetectionStep( PreprocessingStepParams srcFile, IStepsFactory preprocessingStepsFactory, Workspaces.IWorkspacesManager workspacesManager, AppLaunch.ILaunchUrlParser appLaunch, IExtensionsRegistry extensions ) { this.sourceFile = srcFile; this.preprocessingStepsFactory = preprocessingStepsFactory; this.workspacesManager = workspacesManager; this.appLaunch = appLaunch; this.extensions = extensions; }
public static void DumpToConnectionParams(this PreprocessingStepParams prepParams, IConnectionParams connectParams) { int stepIdx = 0; foreach (var step in prepParams.PreprocessingHistory) { connectParams[$"{ConnectionParamsKeys.PreprocessingStepParamPrefix}{stepIdx}"] = step.ToString(); ++stepIdx; } connectParams[ConnectionParamsKeys.IdentityConnectionParam] = prepParams.FullPath.ToLower(); if (!string.IsNullOrEmpty(prepParams.DisplayName)) { connectParams[ConnectionParamsKeys.DisplayNameConnectionParam] = prepParams.DisplayName; } }
public static void DumpToConnectionParams(this PreprocessingStepParams prepParams, IConnectionParams connectParams) { int stepIdx = 0; foreach (var step in prepParams.PreprocessingSteps) { connectParams[string.Format("{0}{1}", ConnectionParamsUtils.PreprocessingStepParamPrefix, stepIdx)] = step; ++stepIdx; } connectParams[ConnectionParamsUtils.IdentityConnectionParam] = prepParams.FullPath.ToLower(); if (!string.IsNullOrEmpty(prepParams.DisplayName)) { connectParams[ConnectionParamsUtils.DisplayNameConnectionParam] = prepParams.DisplayName; } }
async Task <PreprocessingStepParams> IPreprocessingStepCallback.ReplayHistory(ImmutableArray <PreprocessingHistoryItem> history) { PreprocessingStepParams currentParams = null; foreach (var loadedStep in history) { currentParams = await ProcessLoadedStep(loadedStep, currentParams).ConfigureAwait(continueOnCapturedContext: !isLongRunning); if (currentParams == null) { return(null); } } return(currentParams); }
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); } }; }
static bool IsTar(PreprocessingStepParams fileInfo, IStreamHeader header) { var tarHeader = new ICSharpCode.SharpZipLib.Tar.TarHeader { Magic = "xxxxx" }; try { tarHeader.ParseBuffer(header.Header); } catch (Exception) { return(false); } return(tarHeader.IsChecksumValid || tarHeader.Magic?.Contains(ICSharpCode.SharpZipLib.Tar.TarHeader.TMAGIC) == true); }
internal DownloadingStep( PreprocessingStepParams srcFile, Progress.IProgressAggregator progressAgg, Persistence.IWebContentCache cache, ICredentialsCache credCache, WebViewTools.IWebViewTools webBrowserDownloader, ILogsDownloaderConfig config, IStepsFactory preprocessingStepsFactory ) { this.sourceFile = srcFile; this.preprocessingStepsFactory = preprocessingStepsFactory; this.progressAggregator = progressAgg; this.cache = cache; this.credCache = credCache; this.webBrowserDownloader = webBrowserDownloader; this.config = config; }
static void AutodetectFormatAndYield(PreprocessingStepParams file, IPreprocessingStepCallback callback) { callback.SetStepDescription(string.Format("Detecting format: {0}", file.FullPath)); var progressHandler = new ProgressHandler() { callback = callback }; var detectedFormat = callback.FormatAutodetect.DetectFormat(file.Location, file.FullPath, progressHandler.cancellation.Token, progressHandler); if (detectedFormat != null) { file.DumpToConnectionParams(detectedFormat.ConnectParams); callback.YieldLogProvider(new YieldedProvider() { Factory = detectedFormat.Factory, ConnectionParams = detectedFormat.ConnectParams, DisplayName = file.FullPath, IsHiddenLog = false }); } }
IPreprocessingStep IPreprocessingManagerExtension.CreateStepByName(string stepName, PreprocessingStepParams stepParams) { switch (stepName) { case GetPreprocessingStep.name: return(new GetPreprocessingStep(stepParams)); case DownloadingStep.name: return(stepsFactory.CreateDownloadingStep(stepParams)); case UnpackingStep.name: return(stepsFactory.CreateUnpackingStep(stepParams)); case GunzippingStep.name: return(stepsFactory.CreateGunzippingStep(stepParams)); case TimeAnomalyFixingStep.name: return(stepsFactory.CreateTimeAnomalyFixingStep(stepParams)); default: return(null); } }
IPreprocessingStep IPreprocessingManagerExtension.DetectFormat(PreprocessingStepParams param, IStreamHeader header) { return(null); }
IPreprocessingStep IStepsFactory.CreateUntarStep(PreprocessingStepParams p) { return(new UntarStep(p, progressAggregator, this)); }
IPreprocessingStep IStepsFactory.CreateTimeAnomalyFixingStep(PreprocessingStepParams p) { return(new TimeAnomalyFixingStep(p, progressAggregator, logProviderFactoryRegistry, this, regexFactory)); }
IPreprocessingStep IStepsFactory.CreateLocationTypeDetectionStep(PreprocessingStepParams p) { return(new LocationTypeDetectionStep(p, this)); }
IPreprocessingStep IStepsFactory.CreateOpenWorkspaceStep(PreprocessingStepParams p) { return(new OpenWorkspaceStep(p, workspacesManager, invoke)); }
IPreprocessingStep IStepsFactory.CreateURLTypeDetectionStep(PreprocessingStepParams p) { return(new URLTypeDetectionStep(p, this, workspacesManager, appLaunch, extentions)); }
IPreprocessingStep IStepsFactory.CreateUnpackingStep(PreprocessingStepParams p) { return(new UnpackingStep(p, progressAggregator, credCache, this)); }
IPreprocessingStep IStepsFactory.CreateDownloadingStep(PreprocessingStepParams p) { return(new DownloadingStep(p, progressAggregator, cache, credCache, webViewTools, logsDownloaderConfig, this)); }
IPreprocessingStep IStepsFactory.CreateFormatDetectionStep(PreprocessingStepParams p) { return(new FormatDetectionStep(p, extentions, this)); }