Task IPreprocessingStep.Execute(IPreprocessingStepCallback callback) { var header = new StreamHeader(sourceFile.Location); var detectedFormatStep = extentions.Items.Select(d => d.DetectFormat(sourceFile, header)).FirstOrDefault(x => x != null); if (detectedFormatStep != null) { callback.YieldNextStep(detectedFormatStep); } else if (IsZip(sourceFile, header)) { callback.YieldNextStep(preprocessingStepsFactory.CreateUnpackingStep(sourceFile)); } else if (IsGzip(sourceFile, header)) { callback.YieldNextStep(preprocessingStepsFactory.CreateGunzippingStep(sourceFile)); } else if (IsTar(sourceFile, header)) { callback.YieldNextStep(preprocessingStepsFactory.CreateUntarStep(sourceFile)); } else { AutodetectFormatAndYield(sourceFile, callback); } return(Task.FromResult(0)); }
Task IPreprocessingStep.Execute(IPreprocessingStepCallback callback) { if (Uri.IsWellFormedUriString(sourceFile.Uri, UriKind.Absolute)) { callback.YieldNextStep(preprocessingStepsFactory.CreateURLTypeDetectionStep(sourceFile)); } else { callback.YieldNextStep(preprocessingStepsFactory.CreateFormatDetectionStep(sourceFile)); } return(Task.FromResult(0)); }
async Task IPreprocessingStep.Execute(IPreprocessingStepCallback callback) { await ExecuteInternal(callback, null, p => { callback.YieldNextStep(preprocessingStepsFactory.CreateFormatDetectionStep(p)); return(true); }); }
Task IPreprocessingStep.Execute(IPreprocessingStepCallback callback) { if (Uri.IsWellFormedUriString(sourceFile.Location, UriKind.Absolute)) { var uri = new Uri(sourceFile.Location); string localFilePath; AppLaunch.LaunchUriData launchUriData; IPreprocessingStep extensionStep; if ((localFilePath = TryDetectLocalFileUri(uri)) != null) { callback.YieldNextStep(preprocessingStepsFactory.CreateFormatDetectionStep( new PreprocessingStepParams(localFilePath, localFilePath, sourceFile.PreprocessingHistory))); } else if (workspacesManager.IsWorkspaceUri(uri)) { callback.YieldNextStep(preprocessingStepsFactory.CreateOpenWorkspaceStep(sourceFile)); } else if (appLaunch.TryParseLaunchUri(uri, out launchUriData)) { if (launchUriData.SingleLogUri != null) { callback.YieldNextStep(preprocessingStepsFactory.CreateURLTypeDetectionStep(new PreprocessingStepParams(launchUriData.SingleLogUri))); } else if (launchUriData.WorkspaceUri != null) { callback.YieldNextStep(preprocessingStepsFactory.CreateOpenWorkspaceStep(new PreprocessingStepParams(launchUriData.WorkspaceUri))); } } else if (TryExtensions(uri, out extensionStep)) { callback.YieldNextStep(extensionStep); } else { callback.YieldNextStep(preprocessingStepsFactory.CreateDownloadingStep(sourceFile)); } } return(Task.FromResult(0)); }
async Task IPreprocessingStep.Execute(IPreprocessingStepCallback callback) { callback.YieldNextStep(preprocessingStepsFactory.CreateFormatDetectionStep(await ExecuteInternal(callback))); }
async Task IPreprocessingStep.Execute(IPreprocessingStepCallback callback) { var l = await ExecuteInternal(callback); callback.YieldNextStep(preprocessingStepsFactory.CreateUnpackingStep(l)); }