OutApiController.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.Extensions.Logging;
  7. using Microsoft.Extensions.Options;
  8. using Microsoft.AspNetCore.Authorization;
  9. using System.Web;
  10. using MySystem.Models;
  11. using LitJson;
  12. using Library;
  13. using System.IO.Compression;
  14. using System.IO;
  15. namespace MySystem.Areas.Api.Controllers.v1
  16. {
  17. [Area("Api")]
  18. [Route("Api/v1/[controller]/[action]")]
  19. public class OutApiController : BaseController
  20. {
  21. public OutApiController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
  22. {
  23. }
  24. // [Route("/reg")]
  25. // public IActionResult Register(string c, string v = "", string k = "creater", string url = "app-manager.kexiaoshuang.com")
  26. // {
  27. // string appini = function.GetWebRequest("http://" + url + "/noauth/SystemSet/makeAppInitData?kind=" + k + "&appVersion=" + v);
  28. // if (!string.IsNullOrEmpty(appini))
  29. // {
  30. // if (appini.Contains("#cut#"))
  31. // {
  32. // string[] appinidata = appini.Split(new string[] { "#cut#" }, StringSplitOptions.None);
  33. // string AppInfoList = appinidata[0];
  34. // string SystemSet = appinidata[1];
  35. // string PageInfoList = appinidata[2];
  36. // string GotoPages = appinidata[3];
  37. // string LibFile = appinidata[4];
  38. // AppInfoList = System.Text.RegularExpressions.Regex.Unescape(AppInfoList);
  39. // SystemSet = System.Text.RegularExpressions.Regex.Unescape(SystemSet);
  40. // PageInfoList = System.Text.RegularExpressions.Regex.Unescape(PageInfoList);
  41. // GotoPages = System.Text.RegularExpressions.Regex.Unescape(GotoPages);
  42. // LibFile = System.Text.RegularExpressions.Regex.Unescape(LibFile);
  43. // string startPath = "";
  44. // string zipPath = "";
  45. // if(c == "ios")
  46. // {
  47. // function.WritePage("ini", "AppInfoList.ini", AppInfoList);
  48. // function.WritePage("ini", "SystemSet.ini", SystemSet);
  49. // function.WritePage("ini", "PageInfoList.ini", PageInfoList);
  50. // function.WritePage("ini", "GotoPages.ini", GotoPages);
  51. // function.WritePage("ini", "LibFile.ini", LibFile);
  52. // startPath = function.getPath("ini");
  53. // zipPath = function.getPath("ini.zip");
  54. // }
  55. // else
  56. // {
  57. // function.WritePage("txt", "AppInfoList.txt", AppInfoList);
  58. // function.WritePage("txt", "SystemSet.txt", SystemSet);
  59. // function.WritePage("txt", "PageInfoList.txt", PageInfoList);
  60. // function.WritePage("txt", "GotoPages.txt", GotoPages);
  61. // function.WritePage("txt", "LibFile.txt", LibFile);
  62. // startPath = function.getPath(path_str: "txt");
  63. // zipPath = function.getPath("txt.zip");
  64. // }
  65. // if(System.IO.File.Exists(zipPath))
  66. // {
  67. // System.IO.File.Delete(zipPath);
  68. // }
  69. // ZipFile.CreateFromDirectory(startPath, zipPath);
  70. // var stream = System.IO.File.OpenRead(zipPath);
  71. // return File(stream, "text/plain", Path.GetFileName(zipPath));
  72. // }
  73. // }
  74. // return View();
  75. // }
  76. }
  77. }