private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { var files = FileOperationHelper.GetFilesPath(txbWLPath.Text); if (streamExport && import.IsText) //流转换,只有文本类型的才支持。 { mainBody.StreamConvert(files, exportPath); timer1.Enabled = false; return; } if (mergeTo1File) { if (!streamExport) { try { fileContent = mainBody.Convert(files); } catch (Exception ex) { mainBody.Dispose(); RichTextBoxShow(ex.Message); throw ex; } } } else { mainBody.Convert(files, outputDir); } timer1.Enabled = false; }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string[] files = txbWLPath.Text.Split('|'); if (streamExport && import.IsText) //流转换,只有文本类型的才支持。 { mainBody.StreamConvert(files, exportPath); timer1.Enabled = false; return; } //foreach (string file in files) //{ // //cbxFrom.Text+"转"+cbxTo.Text+"_"+ // exportFileName = Path.GetFileNameWithoutExtension(file); // string path = file.Trim(); //} if (mergeTo1File) { if (!streamExport) { fileContent = mainBody.Convert(files); } } else { mainBody.Convert(files, outputDir); } timer1.Enabled = false; }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { var files = FileOperationHelper.GetFilesPath(txbWLPath.Text); if (streamExport && import.IsText) //流转换,只有文本类型的才支持。 { mainBody.StreamConvert(files, exportPath); timer1.Enabled = false; return; } if (mergeTo1File) { if (!streamExport) { fileContent = mainBody.Convert(files); } } else { mainBody.Convert(files, outputDir); } timer1.Enabled = false; }
public void Run() { for (int i = 0; i < Args.Length; i++) { string arg = Args[i]; type = RunCommand(arg); } if (!string.IsNullOrEmpty(format)) { if ((!(wordLibraryExport is SelfDefining)) && (!(wordLibraryImport is SelfDefining))) { Console.WriteLine("-f参数用于自定义格式时设置格式样式用,导入导出词库格式均不是自定义格式,该参数无效!"); return; } } if (!string.IsNullOrEmpty(codingFile)) { if (!(wordLibraryExport is SelfDefining)) { Console.WriteLine("-f参数用于自定义格式输出时设置编码用,导出词库格式不是自定义格式,该参数无效!"); return; } } if (wordLibraryImport is SelfDefining) { ((SelfDefining)wordLibraryImport).UserDefiningPattern = pattern; } if (wordLibraryExport is SelfDefining) { ((SelfDefining)wordLibraryExport).UserDefiningPattern = pattern; } if (importPaths.Count > 0 && exportPath != "") { MainBody mainBody = new MainBody(); mainBody.Export = wordLibraryExport; mainBody.Import = wordLibraryImport; Console.WriteLine("转换开始..."); //foreach (string importPath in importPaths) //{ // Console.WriteLine("开始转换文件:" + importPath); // wordLibraryList.AddWordLibraryList(wordLibraryImport.Import(importPath)); //} //string str = wordLibraryExport.Export(wordLibraryList); string str = mainBody.Convert(importPaths); FileOperationHelper.WriteFile(exportPath, wordLibraryExport.Encoding, str); Console.WriteLine("转换完成,共转换" + mainBody.Count + "个"); return; } else { Console.WriteLine("输入 -? 可获取帮助"); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string[] files = txbWLPath.Text.Split('|'); foreach (string file in files) { exportFileName = Path.GetFileNameWithoutExtension(file); string path = file.Trim(); if (streamExport && import.IsText) //流转换,只有文本类型的才支持。 { mainBody.StreamConvert(files, exportFileName); } else { fileContent = mainBody.Convert(files); } } timer1.Enabled = false; //简繁体转换 }
public void Run() { for (int i = 0; i < Args.Length; i++) { string arg = Args[i]; type = RunCommand(arg); } if (!string.IsNullOrEmpty(format)) { if ((!(wordLibraryExport is SelfDefining)) && (!(wordLibraryImport is SelfDefining))) { Console.WriteLine("-f参数用于自定义格式时设置格式样式用,导入导出词库格式均不是自定义格式,该参数无效!"); return; } } if (!string.IsNullOrEmpty(codingFile)) { if (!(wordLibraryExport is SelfDefining)) { Console.WriteLine("-f参数用于自定义格式输出时设置编码用,导出词库格式不是自定义格式,该参数无效!"); return; } } if (wordLibraryImport is SelfDefining) { ((SelfDefining) wordLibraryImport).UserDefiningPattern = pattern; } if (wordLibraryExport is SelfDefining) { ((SelfDefining) wordLibraryExport).UserDefiningPattern = pattern; } if (wordLibraryImport is LingoesLd2) { var ld2Import = ((LingoesLd2) wordLibraryImport); ld2Import.WordEncoding = wordEncoding; if (xmlEncoding != null) { ld2Import.XmlEncoding = xmlEncoding; ld2Import.IncludeMeaning = true; } } if (importPaths.Count > 0 && exportPath != "") { MainBody mainBody = new MainBody(); mainBody.Export = wordLibraryExport; mainBody.Import = wordLibraryImport; Console.WriteLine("转换开始..."); //foreach (string importPath in importPaths) //{ // Console.WriteLine("开始转换文件:" + importPath); // wordLibraryList.AddWordLibraryList(wordLibraryImport.Import(importPath)); //} //string str = wordLibraryExport.Export(wordLibraryList); string str = mainBody.Convert(importPaths); FileOperationHelper.WriteFile(exportPath, wordLibraryExport.Encoding, str); Console.WriteLine("转换完成,共转换" + mainBody.Count + "个"); return; } else { Console.WriteLine("输入 -? 可获取帮助"); } }
public void Run() { if (Args.Length == 0) { Console.WriteLine("输入 -? 可获取帮助"); return; } for (int i = 0; i < Args.Length; i++) { string arg = Args[i]; type = RunCommand(arg); } if (!string.IsNullOrEmpty(format)) { if ((!(wordLibraryExport is SelfDefining)) && (!(wordLibraryImport is SelfDefining))) { Console.WriteLine("-f参数用于自定义格式时设置格式样式用,导入导出词库格式均不是自定义格式,该参数无效!"); return; } } if (!string.IsNullOrEmpty(codingFile)) { if (!(wordLibraryExport is SelfDefining)) { Console.WriteLine("-f参数用于自定义格式输出时设置编码用,导出词库格式不是自定义格式,该参数无效!"); return; } } if (wordLibraryImport is SelfDefining) { ((SelfDefining)wordLibraryImport).UserDefiningPattern = pattern; } if (wordLibraryExport is SelfDefining) { ((SelfDefining)wordLibraryExport).UserDefiningPattern = pattern; } if (wordLibraryExport is Rime) { ((Rime)wordLibraryExport).CodeType = pattern.CodeType; ((Rime)wordLibraryExport).OS = pattern.OS; } if (wordLibraryImport is LingoesLd2) { var ld2Import = ((LingoesLd2)wordLibraryImport); ld2Import.WordEncoding = wordEncoding; if (xmlEncoding != null) { ld2Import.XmlEncoding = xmlEncoding; ld2Import.IncludeMeaning = true; } } if (importPaths.Count > 0 && exportPath != "") { var mainBody = new MainBody(); mainBody.Export = wordLibraryExport; mainBody.Import = wordLibraryImport; mainBody.SelectedWordRankGenerater = this.wordRankGenerater; mainBody.Filters = this.filters; mainBody.ProcessNotice += MainBody_ProcessNotice; Console.WriteLine("转换开始..."); //foreach (string importPath in importPaths) //{ // Console.WriteLine("开始转换文件:" + importPath); // wordLibraryList.AddWordLibraryList(wordLibraryImport.Import(importPath)); //} //string str = wordLibraryExport.Export(wordLibraryList); if (exportPath.EndsWith("*")) { mainBody.Convert(importPaths, exportPath.Substring(0, exportPath.Length - 1)); } else { string str = mainBody.Convert(importPaths); FileOperationHelper.WriteFile(exportPath, wordLibraryExport.Encoding, str); } Console.WriteLine("转换完成,共转换" + mainBody.Count + "个"); } Console.WriteLine("输入 -? 可获取帮助"); }