12345678910111213141516171819202122232425262728293031323334 |
- using DocTools;
- using Newtonsoft.Json;
- using System;
- using System.IO;
- namespace DocDemo
- {
- class Program
- {
- static void Main(string[] args)
- {
- var strPath = @"D:\Project\git\New_Wing_Solution\WingInterfaceLibrary\src\bin\Debug\net6.0\";
- LoadData.SetInterfaceConfigToCache(strPath);
- CreateDocHtml doc = new CreateDocHtml();
- var resEntity = doc.CreateDocProjectString();
- var json = JsonConvert.SerializeObject(resEntity).Replace("\"Event\":", "\"event\":");
- var readXMLPath = AppDomain.CurrentDomain.BaseDirectory + "/XML.htm";
- var htmlContent = File.ReadAllText(readXMLPath);
- var resultHtml = htmlContent.Replace("$GetExportDocHtml()", json);
- var resPath = @"D:\Project\git\swaggerui\dist\demoHtml.html";
- if (File.Exists(resPath))
- {
- File.Delete(resPath);
- }
- byte[] myByte = System.Text.Encoding.UTF8.GetBytes(resultHtml);
- using (FileStream fsWrite = new FileStream(resPath, FileMode.Append))
- {
- fsWrite.Write(myByte, 0, myByte.Length);
- };
- Console.WriteLine("");
- Console.ReadLine();
- }
- }
- }
|