protected override void JustDoIt() { try { if (string.IsNullOrEmpty(_outputFormat)) { ConvertResult = DataConvertAppService.FormatConvert(ConvertFileList, ErrorInfo, ConvertService); } else { ConvertResult = ConvertService.DataConvert(ConvertFileList.ToList(), "", "NULL", false); } } catch (Exception ex) { throw; } }
/// <summary> /// 文件转换和检查 /// </summary> /// <param name="FolderPath">要素文件夹中路径</param> /// <returns>错误信息</returns> private void ConvertAndCheckFile(string FolderPath) { string[] files = Directory.GetFiles(FolderPath, "*.*", SearchOption.AllDirectories); // 格式转换 try { ConvertedResult = DataConvertAppService.FormatConvert(files.Select(p => new ConvertFileList { PhysicsFilePath = p }), ErrorInfo, _dataConvertAppService); } catch (Exception ex) { ErrorInfo.Add("格式转换失败: " + ex.Message); return; } // 坐标转换 try { ConvertedResult = DataConvertAppService.CoordinateConvert(ConvertedResult.fileList, ErrorInfo, _dataConvertAppService); } catch (Exception ex) { ErrorInfo.Add("坐标转换失败: " + ex.Message); return; } #region 投影转换 // 投影转换 try { ConvertedResult = DataConvertAppService.ProjectionConvert(ConvertedResult.fileList, ErrorInfo, _dataConvertAppService); } catch (Exception ex) { ErrorInfo.Add("投影转换失败: " + ex.Message); return; } #endregion //// 属性检查 //List<string> CheckFile = new List<string>(); //foreach (var f in result.fileList) //{ // if (f.ConvertResult == 0) // { // ErrorInfo.Add("坐标转换失败: " + f.ConvertMsg + " 文件:" + f.PhysicsFilePath); // return ErrorInfo; // } // CheckFile.Add(f.ConvertFilePath); //} //DataCheckResult dcResult = DataConvert.DataCheck(CheckFile, false); //foreach (var cl in dcResult.CheckInfoList) //{ // if (cl.Log.Count > 0) // { // FileInfo ff = new FileInfo(cl.FileName); // ErrorInfo.Add(ff.Name + " " + cl.Log[0]); // } //} }