Exemplo n.º 1
0
 /// <summary>
 /// 在非异常结束的情况下执行统一的扫尾工作。向前端汇报完成。
 /// </summary>
 /// <param name="t">任务。</param>
 /// <param name="taskId">任务Id。</param>
 private void RoundOffwork(Boolean isCancelled, String taskId)
 {
     Interlocked.Decrement(ref _concurrentCount);
     if (isCancelled)
     {
         Reporter?.Stop(taskId);
     }
     else
     {
         Reporter?.ChangeProgress(taskId, 1);
         Reporter?.Finish(taskId, DataItemsCount.ToString());
     }
 }
Exemplo n.º 2
0
 private void DoExtract(KeyValuePair <ExtractItem, List <DataParsePluginInfo> > item)
 {
     //注意:必须报告一次进度才能使状态切换到Runing
     Reporter?.ChangeProgress(item.Key.GUID, 0);
     if (_cancelToken.IsCancellationRequested)
     {
         return;
     }
     //在此统一检测CancelToken
     DoDataPump(item.Key, item.Value);
     if (!_cancelToken.IsCancellationRequested)
     {
         DoDataPlugin(item.Key, item.Value);
     }
 }
Exemplo n.º 3
0
 private void DoDataPump(ExtractItem extractItem, IEnumerable <DataParsePluginInfo> plugins)
 {
     //执行数据泵服务
     foreach (var plugin in plugins)
     {
         foreach (var s in plugin.SourcePath)
         {
             if (_cancelToken.IsCancellationRequested)
             {
                 return;
             }
             DataPump.Execute(s, null, extractItem);
         }
     }
     Reporter?.ChangeProgress(extractItem.GUID, 0.33);
 }
Exemplo n.º 4
0
        private void DoDataPlugin(ExtractItem extractItem, IEnumerable <DataParsePluginInfo> plugs)
        {
            if (_cancelToken.IsCancellationRequested)
            {
                return;
            }
            //1.匹配插件
            var plug = _pluginAdapter.MatchPluginByApp(plugs, DataPump.Metadata, DataPump.Metadata.SourceStorePath, GetAppVersion(extractItem));

            //2.执行插件
            plug.SaveDbPath = DataPump.Metadata.DbFilePath;
            plug.Phone      = DataPump.Metadata.Source as Device;

            Reporter?.ChangeProgress(extractItem.GUID, 0.45);
            _pluginAdapter.ExecutePlugin(plug, null, (ds) =>
            {
                FinishExtractItem(extractItem, ds);
            });
        }