Task IPreprocessingStep.Execute(IPreprocessingStepCallback callback) { if (Uri.IsWellFormedUriString(sourceFile.Location, UriKind.Absolute)) { callback.YieldNextStep(preprocessingStepsFactory.CreateURLTypeDetectionStep(sourceFile)); } else { callback.YieldNextStep(preprocessingStepsFactory.CreateFormatDetectionStep(sourceFile)); } return(Task.FromResult(0)); }
async void AcceptDragDrop(IDataObject dataObject, bool controlKeyHeld) { if (UrlDragDropUtils.IsUriDataPresent(dataObject)) { if (controlKeyHeld) { await DeleteAllLogsAndPreprocessings(); } var urls = UrlDragDropUtils.GetURLs(dataObject).ToArray(); await preprocessingManager.Preprocess( urls.Select(url => preprocessingStepsFactory.CreateURLTypeDetectionStep(new PreprocessingStepParams(url))), urls.Length == 1?urls[0] : "Urls drag&drop" ); } else if (dataObject.GetDataPresent(DataFormats.FileDrop, false)) { if (controlKeyHeld) { await DeleteAllLogsAndPreprocessings(); } ((dataObject.GetData(DataFormats.FileDrop) as string[]) ?? new string[0]).Select(file => preprocessingManager.Preprocess( Enumerable.Repeat(preprocessingStepsFactory.CreateFormatDetectionStep(new PreprocessingStepParams(file)), 1), file ) ).ToArray(); } }