public void TestCancelMethod(Pump pump, SourceFileItem source, MultiTaskReporterBase reporter, params ExtractItem[] items) { DataPumpBase dp = pump.GetDataPump(); DataPumpExecutionContext context = dp.Execute(source, reporter, items); context.Cancel(); }
/// <summary> /// 执行数据泵。 /// </summary> /// <param name="pump">元数据。</param> /// <param name="savePath">保存路径。</param> /// <param name="source">数据源。</param> /// <param name="reporter">异步通知器。</param> /// <param name="items">提取项列表。</param> /// <returns>数据泵任务执行上下文。</returns> public static DataPumpExecutionContext Execute(this Pump pump, String savePath, SourceFileItem source, IAsyncProgress reporter, IEnumerable <ExtractItem> items = null) { DataPumpBase dataPump = pump.GetDataPump(); DataPumpExecutionContext context = dataPump.CreateContext(pump, savePath, source); DataPumpControllableExecutionContext contextEx = context as DataPumpControllableExecutionContext; if (contextEx != null) { contextEx.Reporter = reporter; } dataPump.Execute(context); return(context); }
/// <summary> /// 初始化 /// </summary> /// <param name="pump">提取信息。</param> /// <param name="extractItems">提取项列表。</param> private Boolean Initialization(Pump pump, ExtractItem[] extractItems) { if (pump == null) { return(false); } if (extractItems == null || extractItems.Length == 0) { return(false); } _pluginAdapter = PluginAdapter.Instance; if (_pluginAdapter == null) { return(false); } DataItemsCount = 0; DataPump = pump.GetDataPump(); _extractItems = extractItems; _cancelTokenSource = new CancellationTokenSource(); _cancelToken = _cancelTokenSource.Token; FileHelper.CreateExitsDirectory(pump.SourceStorePath); Reporter?.Reset(); return(true); }
public void Init(Pump pump, IEnumerable <ExtractItem> extractItems, String rootSavePath, IAsyncProgress asyn) { DataPump = pump.GetDataPump(); Context = DataPump.CreateContext(pump, rootSavePath, null, null, asyn); }
public void Init(Pump pump, IEnumerable <ExtractItem> extractItems, String rootSavePath, DefaultMultiTaskReporter asyn) { DataPump = pump.GetDataPump(); Context = DataPump.CreateContext(pump, rootSavePath, null, null, asyn); }