Program.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. using DocTools;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.IO;
  5. namespace DocDemo
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. var strPath = @"D:\Project\git\New_Wing_Solution\WingInterfaceLibrary\src\bin\Debug\net6.0\";
  12. LoadData.SetInterfaceConfigToCache(strPath);
  13. CreateDocHtml doc = new CreateDocHtml();
  14. var resEntity = doc.CreateDocProjectString();
  15. var json = JsonConvert.SerializeObject(resEntity).Replace("\"Event\":", "\"event\":");
  16. var readXMLPath = AppDomain.CurrentDomain.BaseDirectory + "/XML.htm";
  17. var htmlContent = File.ReadAllText(readXMLPath);
  18. var resultHtml = htmlContent.Replace("$GetExportDocHtml()", json);
  19. var resPath = @"D:\Project\git\swaggerui\dist\demoHtml.html";
  20. if (File.Exists(resPath))
  21. {
  22. File.Delete(resPath);
  23. }
  24. byte[] myByte = System.Text.Encoding.UTF8.GetBytes(resultHtml);
  25. using (FileStream fsWrite = new FileStream(resPath, FileMode.Append))
  26. {
  27. fsWrite.Write(myByte, 0, myByte.Length);
  28. };
  29. Console.WriteLine("");
  30. Console.ReadLine();
  31. }
  32. }
  33. }