frmCaseFileCompare.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. using ICSharpCode.SharpZipLib.Tar;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.IO;
  8. using System.IO.Compression;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. using wispro.sp.utility;
  14. using SharpCompress.Archives;
  15. using SharpCompress.Archives.Rar;
  16. using SharpCompress.Common;
  17. using System.Collections;
  18. namespace wispro.sp.winClient
  19. {
  20. public partial class frmCaseFileCompare : Form
  21. {
  22. private CompareDocx draft_fristReturn;
  23. private CompareDocx fristReturn_Finally;
  24. public frmCaseFileCompare()
  25. {
  26. InitializeComponent();
  27. }
  28. private void label1_Click(object sender, EventArgs e)
  29. {
  30. }
  31. private void button1_Click(object sender, EventArgs e)
  32. {
  33. if (string.IsNullOrEmpty(this.txtCaseNo.Text))
  34. {
  35. MessageBox.Show("请输入案号!", "提示框", MessageBoxButtons.OK);
  36. this.txtCaseNo.Focus();
  37. return;
  38. }
  39. var retObj1 = IPEasyUtility.DownloadCaseFiles(this.txtCaseNo.Text);
  40. string draftFile = null;
  41. string firstReFile = null;
  42. string finallyFile = null;
  43. if (((IDictionary<string, object>)retObj1).ContainsKey("finallyFile"))
  44. {
  45. if (!string.IsNullOrEmpty(retObj1.finallyFile))
  46. {
  47. if (retObj1.finallyFile.EndsWith(".zip"))
  48. {
  49. ExtractZip(retObj1.finallyFile, $"c:\\temp\\{retObj1.CaseNo}\\finallyFile");
  50. foreach (string f in Directory.GetFiles($"c:\\temp\\{retObj1.CaseNo}\\finallyFile", "*.*", SearchOption.AllDirectories))
  51. {
  52. if (f.IndexOf("定稿", StringComparison.OrdinalIgnoreCase) > 0)
  53. {
  54. finallyFile = f;
  55. break;
  56. }
  57. }
  58. }
  59. else
  60. {
  61. finallyFile = retObj1.finallyFile;
  62. }
  63. }
  64. }
  65. if (((IDictionary<string, object>)retObj1).ContainsKey("firstReturnFile"))
  66. {
  67. if (!string.IsNullOrEmpty(retObj1.firstReturnFile))
  68. {
  69. if (retObj1.firstReturnFile.EndsWith(".zip"))
  70. {
  71. ExtractZip(retObj1.firstReturnFile, $"c:\\temp\\{retObj1.CaseNo}\\firstReturnFile");
  72. foreach (string f in Directory.GetFiles($"c:\\temp\\{retObj1.CaseNo}\\firstReturnFile", "*.*", SearchOption.AllDirectories))
  73. {
  74. if (f.IndexOf("v1F", StringComparison.OrdinalIgnoreCase) > 0)
  75. {
  76. firstReFile = f;
  77. break;
  78. }
  79. }
  80. }
  81. else
  82. {
  83. firstReFile = retObj1.firstReturnFile;
  84. }
  85. }
  86. }
  87. if (((IDictionary<string, object>)retObj1).ContainsKey("draftFile"))
  88. {
  89. if (!string.IsNullOrEmpty(retObj1.draftFile))
  90. {
  91. if (retObj1.draftFile.EndsWith(".zip"))
  92. {
  93. ExtractZip(retObj1.draftFile, $"c:\\temp\\{retObj1.CaseNo}\\draftFile");
  94. foreach (string f in Directory.GetFiles($"c:\\temp\\{retObj1.CaseNo}\\draftFile", "*.*", SearchOption.AllDirectories))
  95. {
  96. if (f.IndexOf("v1r0", StringComparison.OrdinalIgnoreCase) > 0)
  97. {
  98. draftFile = f;
  99. break;
  100. }
  101. }
  102. }
  103. else
  104. {
  105. draftFile = retObj1.draftFile;
  106. }
  107. }
  108. }
  109. if (!string.IsNullOrEmpty(firstReFile) && !string.IsNullOrEmpty(draftFile))
  110. {
  111. draft_fristReturn = new CompareDocx();
  112. draft_fristReturn.Compare(draftFile, firstReFile);
  113. }
  114. if (!string.IsNullOrEmpty(firstReFile) && !string.IsNullOrEmpty(finallyFile))
  115. {
  116. fristReturn_Finally = new CompareDocx();
  117. fristReturn_Finally.Compare(firstReFile, finallyFile);
  118. }
  119. return;
  120. try
  121. {
  122. if (!string.IsNullOrEmpty(retObj1.finallyFile))
  123. File.Delete(retObj1.finallyFile);
  124. }
  125. catch { }
  126. try
  127. {
  128. if (!string.IsNullOrEmpty(retObj1.draftFile))
  129. File.Delete(retObj1.draftFile);
  130. }
  131. catch { }
  132. try
  133. {
  134. if (!string.IsNullOrEmpty(retObj1.draftFile))
  135. File.Delete(retObj1.firstReturnFile);
  136. }
  137. catch { }
  138. if (Directory.Exists($"c:\\temp\\{retObj1.CaseNo}"))
  139. {
  140. Directory.Delete($"c:\\temp\\{retObj1.CaseNo}", true);
  141. }
  142. lblMsg.Text = string.Empty;
  143. if (string.IsNullOrEmpty(draftFile))
  144. {
  145. lblMsg.Text = "初稿文件没有找到";
  146. }
  147. if (string.IsNullOrEmpty(firstReFile))
  148. {
  149. lblMsg.Text = $"{lblMsg.Text},第一次返稿文件没有找到!";
  150. }
  151. if (string.IsNullOrEmpty(finallyFile))
  152. {
  153. lblMsg.Text = $"{lblMsg.Text},定稿文件没有找到!";
  154. }
  155. comboBox1.SelectedIndex = 0;
  156. }
  157. private void ExtractZip(string zipFilePath, string extractPath)
  158. {
  159. Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
  160. // 确保提取目录存在
  161. Directory.CreateDirectory(extractPath);
  162. // 使用 ZipArchive 解压缩 ZIP 文件
  163. using (FileStream zipToOpen = new FileStream(zipFilePath, FileMode.Open))
  164. {
  165. using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Read, true, Encoding.GetEncoding("GB2312")))
  166. {
  167. foreach (ZipArchiveEntry entry in archive.Entries)
  168. {
  169. if (entry.FullName.EndsWith("/", StringComparison.Ordinal) || entry.FullName.EndsWith("\\", StringComparison.Ordinal))
  170. {
  171. Console.WriteLine($"目录: {entry.FullName}");
  172. }
  173. else
  174. {
  175. string entryPath = Path.Combine(extractPath, entry.FullName);
  176. Directory.CreateDirectory(new System.IO.FileInfo(entryPath).Directory.FullName);
  177. entry.ExtractToFile(entryPath, true);
  178. }
  179. }
  180. }
  181. }
  182. }
  183. public static void ExtractRarFile(string rarPath, string outputPath)
  184. {
  185. try
  186. {
  187. // 确保输出目录存在
  188. Directory.CreateDirectory(outputPath);
  189. // 打开RAR文件
  190. using (var archive = RarArchive.Open(rarPath))
  191. {
  192. // 遍历所有文件
  193. foreach (var entry in archive.Entries)
  194. {
  195. if (!entry.IsDirectory)
  196. {
  197. // 构建完整输出路径
  198. string outputFilePath = Path.Combine(outputPath, entry.Key);
  199. // 确保输出文件的目录存在
  200. Directory.CreateDirectory(Path.GetDirectoryName(outputFilePath));
  201. // 解压文件
  202. entry.WriteToFile(outputFilePath, new ExtractionOptions
  203. {
  204. ExtractFullPath = true,
  205. Overwrite = true
  206. });
  207. }
  208. }
  209. }
  210. }
  211. catch (Exception ex)
  212. {
  213. throw new Exception($"解压RAR文件时出错: {ex.Message}");
  214. }
  215. }
  216. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  217. {
  218. if (draft_fristReturn != null || fristReturn_Finally != null)
  219. {
  220. richTextBox1.Clear();
  221. string strHtml = string.Empty;
  222. switch (comboBox1.SelectedIndex)
  223. {
  224. case 0:
  225. if (draft_fristReturn != null)
  226. {
  227. strHtml = $"<b>所有文字比较:</b><br/><p>初稿与第一次返稿比较结果:</p><p>初稿文件字数:{draft_fristReturn.AllStringResult.oldWordCount}</p><p>删除文字数量:{draft_fristReturn.AllStringResult.DeleteCount}</p><p>插入文字数量:{draft_fristReturn.AllStringResult.InsertCount}</p><p>修改比率:{(draft_fristReturn.AllStringResult.diffRate * 100).ToString("0.0000")}%</p><p>文档语义相似度:{(draft_fristReturn.AllStringResult.TextSimilarity*100).ToString("0.0000")}%</p>";
  228. }
  229. if (fristReturn_Finally != null)
  230. {
  231. strHtml = strHtml + $"<p></p><p>第一次返稿与定稿比较结果:</p><p>第一次返稿文件字数:{fristReturn_Finally.AllStringResult.oldWordCount}</p><p>删除文字数量:{fristReturn_Finally.AllStringResult.DeleteCount}</p><p>插入文字数量:{fristReturn_Finally.AllStringResult.InsertCount}</p><p>修改比率:{(fristReturn_Finally.AllStringResult.diffRate * 100).ToString("0.0000")}%</p><p>文档语义相似度:{(fristReturn_Finally.AllStringResult.TextSimilarity * 100).ToString("0.0000")}%</p>";
  232. }
  233. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(strHtml);
  234. break;
  235. case 1:
  236. if (draft_fristReturn != null)
  237. {
  238. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(draft_fristReturn.AllStringResult.CompareResultString);
  239. }
  240. break;
  241. case 2:
  242. if (fristReturn_Finally != null)
  243. {
  244. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(fristReturn_Finally.AllStringResult.CompareResultString);
  245. }
  246. break;
  247. case 3:
  248. if (draft_fristReturn != null)
  249. {
  250. strHtml = $"<b>摘要比较:</b><br/><p>初稿与第一次返稿比较结果:</p><p>初稿文件字数:{draft_fristReturn.AbstractResult.oldWordCount}</p><p>删除文字数量:{draft_fristReturn.AbstractResult.DeleteCount}</p><p>插入文字数量:{draft_fristReturn.AbstractResult.InsertCount}</p><p>修改比率:{(draft_fristReturn.AbstractResult.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(draft_fristReturn.AbstractResult.TextSimilarity * 100).ToString("0.0000")}%</p>";
  251. }
  252. if (fristReturn_Finally != null)
  253. {
  254. strHtml = strHtml + $"<p></p><p>第一次返稿与定稿比较结果:</p><p>第一次返稿文件字数:{fristReturn_Finally.AbstractResult.oldWordCount}</p><p>删除文字数量:{fristReturn_Finally.AbstractResult.DeleteCount}</p><p>插入文字数量:{fristReturn_Finally.AbstractResult.InsertCount}</p><p>修改比率:{(fristReturn_Finally.AbstractResult.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(fristReturn_Finally.AbstractResult.TextSimilarity * 100).ToString("0.0000")}%</p>";
  255. }
  256. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(strHtml);
  257. break;
  258. case 4:
  259. if (draft_fristReturn != null)
  260. {
  261. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(draft_fristReturn.AbstractResult.CompareResultString);
  262. }
  263. break;
  264. case 5:
  265. if (fristReturn_Finally != null)
  266. {
  267. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(fristReturn_Finally.AbstractResult.CompareResultString);
  268. }
  269. break;
  270. case 6:
  271. if (draft_fristReturn != null)
  272. {
  273. strHtml = $"<b>权力要求比较:</b><br/><p>初稿与第一次返稿比较结果:</p><p>初稿文件字数:{draft_fristReturn.ClaimResult.oldWordCount}</p><p>删除文字数量:{draft_fristReturn.ClaimResult.DeleteCount}</p><p>插入文字数量:{draft_fristReturn.ClaimResult.InsertCount}</p><p>修改比率:{(draft_fristReturn.ClaimResult.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(draft_fristReturn.ClaimResult.TextSimilarity * 100).ToString("0.0000")}%</p>";
  274. }
  275. if (fristReturn_Finally != null)
  276. {
  277. strHtml = strHtml + $"<p></p><p>第一次返稿与定稿比较结果:</p><p>第一次返稿文件字数:{fristReturn_Finally.ClaimResult.oldWordCount}</p><p>删除文字数量:{fristReturn_Finally.ClaimResult.DeleteCount}</p><p>插入文字数量:{fristReturn_Finally.ClaimResult.InsertCount}</p><p>修改比率:{(fristReturn_Finally.ClaimResult.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(fristReturn_Finally.ClaimResult.TextSimilarity * 100).ToString("0.0000")}%</p>";
  278. }
  279. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(strHtml);
  280. break;
  281. case 7:
  282. if (draft_fristReturn != null)
  283. {
  284. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(draft_fristReturn.ClaimResult.CompareResultString);
  285. }
  286. break;
  287. case 8:
  288. if (fristReturn_Finally != null)
  289. {
  290. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(fristReturn_Finally.ClaimResult.CompareResultString);
  291. }
  292. break;
  293. case 9:
  294. if (draft_fristReturn != null)
  295. {
  296. strHtml = $"<b>说明书比较:</b><br/><p>初稿与第一次返稿比较结果:</p><p>初稿文件字数:{draft_fristReturn.FulltextResult.oldWordCount}</p><p>删除文字数量:{draft_fristReturn.FulltextResult.DeleteCount}</p><p>插入文字数量:{draft_fristReturn.FulltextResult.InsertCount}</p><p>修改比率:{(draft_fristReturn.FulltextResult.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(draft_fristReturn.FulltextResult.TextSimilarity * 100).ToString("0.0000")}%</p>";
  297. }
  298. if (fristReturn_Finally != null)
  299. {
  300. strHtml = strHtml + $"<p></p><p>第一次返稿与定稿比较结果:</p><p>第一次返稿文件字数:{fristReturn_Finally.FulltextResult.oldWordCount}</p><p>删除文字数量:{fristReturn_Finally.FulltextResult.DeleteCount}</p><p>插入文字数量:{fristReturn_Finally.FulltextResult.InsertCount}</p><p>修改比率:{(fristReturn_Finally.FulltextResult.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(fristReturn_Finally.FulltextResult.TextSimilarity * 100).ToString("0.0000")}%</p>";
  301. }
  302. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(strHtml);
  303. break;
  304. case 10:
  305. if (draft_fristReturn != null)
  306. {
  307. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(draft_fristReturn.FulltextResult.CompareResultString);
  308. }
  309. break;
  310. case 11:
  311. if (fristReturn_Finally != null)
  312. {
  313. richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(fristReturn_Finally.FulltextResult.CompareResultString);
  314. }
  315. break;
  316. }
  317. }
  318. }
  319. private void button2_Click(object sender, EventArgs e)
  320. {
  321. new Form1().ShowDialog();
  322. return;
  323. var caseInfo = IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件",true);
  324. return;
  325. var retData = IPEasyUtility.GetFinished3FilesCases(1);
  326. return;
  327. OpenFileDialog openFileDialog = new OpenFileDialog();
  328. if(openFileDialog.ShowDialog() == DialogResult.OK)
  329. {
  330. string strPath = openFileDialog.FileName.ToLower().Replace(".rar", "").Replace(".zip","");
  331. if(openFileDialog.FileName.Contains(".rar"))
  332. {
  333. ExtractRarFile(openFileDialog.FileName, strPath);
  334. }
  335. else
  336. {
  337. ExtractZip(openFileDialog.FileName,strPath);
  338. }
  339. string[] files = Directory.EnumerateFiles(strPath, "*.*", SearchOption.AllDirectories).ToArray<string>();
  340. Array.Sort(files);
  341. Array.Reverse(files);
  342. draft_fristReturn = new CompareDocx();
  343. draft_fristReturn.Compare(files[0], files[1]);
  344. if (files.Length > 2)
  345. {
  346. fristReturn_Finally = new CompareDocx();
  347. fristReturn_Finally.Compare(files[1], files[2]);
  348. }
  349. SaveResult(strPath,draft_fristReturn);
  350. SaveResult(strPath, fristReturn_Finally);
  351. }
  352. }
  353. private void SaveResult(string strPath,CompareDocx draft_fristReturn)
  354. {
  355. string strHtml = @"<!DOCTYPE html>
  356. <html lang=""en"">
  357. <head>
  358. <meta charset=""utf-8"">
  359. <meta http-equiv=""X-UA-Compatible"" content=""IE=edge"">
  360. <meta name=""description"" content=""email code"">
  361. <meta name=""viewport"" content=""width=device-width, initial-scale=1"">
  362. <title>对比结果</title>
  363. <script>
  364. function toggleDiv() {
  365. var radio = document.querySelector('input[name=""options""]:checked');
  366. if(!radio){
  367. return
  368. }
  369. var value = radio.value
  370. var div = document.getElementById('resultContent');
  371. var childrenDom = div.children
  372. if(!childrenDom || childrenDom.length==0){
  373. return
  374. }
  375. for(var i = 0;i<childrenDom.length;i++){
  376. var dom = childrenDom[i]
  377. if(dom.id == value){
  378. dom.className = 'checked'
  379. }else{
  380. dom.className = ''
  381. }
  382. }
  383. }
  384. </script>
  385. </head>
  386. <!--对比结果模板-->
  387. <body>
  388. <div class=""contrastResult"">
  389. <form action="""">
  390. <div>
  391. <label for=""originalFile"">原文件:</label>
  392. <span id=""originalFile"">{0}</span>
  393. </div>
  394. <div>
  395. <label for=""contrastFile"">对比文件:</label>
  396. <span id=""contrastFile"">{1}</span>
  397. </div>
  398. <div>
  399. <label for=""result"">对比结果:</label>
  400. <div id=""result"">
  401. <table>
  402. <thead>
  403. <tr>
  404. <td></td>
  405. <td>全部对比</td>
  406. <td>摘要</td>
  407. <td>权利要求</td>
  408. <td>说明书</td>
  409. </tr>
  410. </thead>
  411. <tbody>
  412. <tr>
  413. <td>原文字数</td>
  414. <td>{2}</td>
  415. <td>{3}</td>
  416. <td>{4}</td>
  417. <td>{5}</td>
  418. </tr>
  419. <tr>
  420. <td>删除字数</td>
  421. <td>{6}</td>
  422. <td>{7}</td>
  423. <td>{8}</td>
  424. <td>{9}</td>
  425. </tr>
  426. <tr>
  427. <td>插入字数</td>
  428. <td>{10}</td>
  429. <td>{11}</td>
  430. <td>{12}</td>
  431. <td>{13}</td>
  432. </tr>
  433. <tr>
  434. <td>修改比例</td>
  435. <td>{14}</td>
  436. <td>{15}</td>
  437. <td>{16}</td>
  438. <td>{17}</td>
  439. </tr>
  440. <tr>
  441. <td>语义相似度</td>
  442. <td>{18}</td>
  443. <td>{19}</td>
  444. <td>{20}</td>
  445. <td>{21}</td>
  446. </tr>
  447. </tbody>
  448. </table>
  449. </div>
  450. </div>
  451. <div class=""resultType"">
  452. <label for="""">结果:</label>
  453. <input type=""radio"" name=""options"" value=""allContrast"" id=""allContrast"" checked onchange=""toggleDiv()"">
  454. <label for=""allContrast"">全部对比</label>
  455. <input type=""radio"" name=""options"" value=""abstract"" id=""abstract"" onchange=""toggleDiv()"">
  456. <label for=""abstract"">摘要</label>
  457. <input type=""radio"" name=""options"" value=""claim"" id=""claim"" onchange=""toggleDiv()"">
  458. <label for=""claim"">权利要求</label>
  459. <input type=""radio"" name=""options"" value=""instructions"" id=""instructions"" onchange=""toggleDiv()"">
  460. <label for=""instructions"">说明书</label>
  461. </div>
  462. <div id=""resultContent"">
  463. <div id=""allContrast"">{22}</div>
  464. <div id=""abstract"">{23}</div>
  465. <div id=""claim"">{24}</div>
  466. <div id=""instructions"">{25}</div>
  467. </div>
  468. </form>
  469. </div>
  470. <script>
  471. toggleDiv();
  472. </script>
  473. </body>
  474. <style>
  475. .contrastResult{
  476. width: 1000px;
  477. margin: 0 auto;
  478. padding: 50px 0;
  479. }
  480. div{
  481. margin: 20px 0 ;
  482. }
  483. table{
  484. width: 100%;
  485. table-layout: fixed;
  486. border-collapse: collapse;
  487. }
  488. table td{
  489. border: 1px solid black;
  490. padding: 10px;
  491. }
  492. table thead td{
  493. text-align: center;
  494. }
  495. table tr>td:first-child{
  496. width: 120px;
  497. }
  498. #resultContent>div{
  499. display: none;
  500. overflow:auto;
  501. height:400px;
  502. }
  503. .checked{
  504. display: block !important;
  505. }
  506. </style>
  507. </html>";
  508. if (draft_fristReturn != null)
  509. {
  510. var temHtml = strHtml
  511. .Replace("{0}", new FileInfo(draft_fristReturn.oldDocument.FilePath).Name)
  512. .Replace("{1}", new FileInfo(draft_fristReturn.newDocument.FilePath).Name)
  513. .Replace("{2}", draft_fristReturn.AllStringResult.oldWordCount.ToString())
  514. .Replace("{3}", draft_fristReturn.AbstractResult.oldWordCount.ToString())
  515. .Replace("{4}", draft_fristReturn.ClaimResult.oldWordCount.ToString())
  516. .Replace("{5}", draft_fristReturn.FulltextResult.oldWordCount.ToString())
  517. .Replace("{6}", draft_fristReturn.AllStringResult.DeleteCount.ToString())
  518. .Replace("{7}", draft_fristReturn.AbstractResult.DeleteCount.ToString())
  519. .Replace("{8}", draft_fristReturn.ClaimResult.DeleteCount.ToString())
  520. .Replace("{9}", draft_fristReturn.FulltextResult.DeleteCount.ToString())
  521. .Replace("{10}", draft_fristReturn.AllStringResult.InsertCount.ToString())
  522. .Replace("{11}", draft_fristReturn.AbstractResult.InsertCount.ToString())
  523. .Replace("{12}", draft_fristReturn.ClaimResult.InsertCount.ToString())
  524. .Replace("{13}", draft_fristReturn.FulltextResult.InsertCount.ToString())
  525. .Replace("{14}", (draft_fristReturn.AllStringResult.diffRate * 100).ToString("0.0000") + "%")
  526. .Replace("{15}", (draft_fristReturn.AbstractResult.diffRate * 100).ToString("0.0000") + "%")
  527. .Replace("{16}", (draft_fristReturn.ClaimResult.diffRate * 100).ToString("0.0000") + "%")
  528. .Replace("{17}", (draft_fristReturn.FulltextResult.diffRate * 100).ToString("0.0000") + "%")
  529. .Replace("{18}", (draft_fristReturn.AllStringResult.TextSimilarity * 100).ToString("0.0000") + "%")
  530. .Replace("{19}", (draft_fristReturn.AbstractResult.TextSimilarity * 100).ToString("0.0000") + "%")
  531. .Replace("{20}", (draft_fristReturn.ClaimResult.TextSimilarity * 100).ToString("0.0000") + "%")
  532. .Replace("{21}", (draft_fristReturn.FulltextResult.TextSimilarity * 100).ToString("0.0000") + "%")
  533. .Replace("{22}", draft_fristReturn.AllStringResult.CompareResultString)
  534. .Replace("{23}", draft_fristReturn.AbstractResult.CompareResultString)
  535. .Replace("{24}", draft_fristReturn.ClaimResult.CompareResultString)
  536. .Replace("{25}", draft_fristReturn.FulltextResult.CompareResultString);
  537. string fileName = $"{new FileInfo(draft_fristReturn.oldDocument.FilePath).Name}_{new FileInfo(draft_fristReturn.newDocument.FilePath).Name}.html";
  538. using (var f = File.CreateText(Path.Combine(strPath, fileName)))
  539. {
  540. f.Write(temHtml);
  541. }
  542. }
  543. }
  544. }
  545. }