|
@@ -0,0 +1,85 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
+using System.Web;
|
|
|
+using MySystem.Models;
|
|
|
+using LitJson;
|
|
|
+using Library;
|
|
|
+using System.IO.Compression;
|
|
|
+using System.IO;
|
|
|
+
|
|
|
+namespace MySystem.Areas.Api.Controllers.v1
|
|
|
+{
|
|
|
+ [Area("Api")]
|
|
|
+ [Route("Api/v1/[controller]/[action]")]
|
|
|
+ public class OutApiController : BaseController
|
|
|
+ {
|
|
|
+ public OutApiController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ [Route("/reg")]
|
|
|
+ public IActionResult Register(string c, string v = "", string url = "app-manager.kexiaoshuang.com")
|
|
|
+ {
|
|
|
+ string kind = "creater";
|
|
|
+ string appini = function.GetWebRequest("http://" + url + "/noauth/SystemSet/makeAppInitData?kind=" + kind + "&appVersion=" + v);
|
|
|
+ if (!string.IsNullOrEmpty(appini))
|
|
|
+ {
|
|
|
+ if (appini.Contains("#cut#"))
|
|
|
+ {
|
|
|
+ string[] appinidata = appini.Split(new string[] { "#cut#" }, StringSplitOptions.None);
|
|
|
+ string AppInfoList = appinidata[0];
|
|
|
+ string SystemSet = appinidata[1];
|
|
|
+ string PageInfoList = appinidata[2];
|
|
|
+ string GotoPages = appinidata[3];
|
|
|
+ string LibFile = appinidata[4];
|
|
|
+ AppInfoList = System.Text.RegularExpressions.Regex.Unescape(AppInfoList);
|
|
|
+ SystemSet = System.Text.RegularExpressions.Regex.Unescape(SystemSet);
|
|
|
+ PageInfoList = System.Text.RegularExpressions.Regex.Unescape(PageInfoList);
|
|
|
+ GotoPages = System.Text.RegularExpressions.Regex.Unescape(GotoPages);
|
|
|
+ LibFile = System.Text.RegularExpressions.Regex.Unescape(LibFile);
|
|
|
+
|
|
|
+ string startPath = "";
|
|
|
+ string zipPath = "";
|
|
|
+ if(c == "ios")
|
|
|
+ {
|
|
|
+ function.WritePage("ini", "AppInfoList.ini", AppInfoList);
|
|
|
+ function.WritePage("ini", "SystemSet.ini", SystemSet);
|
|
|
+ function.WritePage("ini", "PageInfoList.ini", PageInfoList);
|
|
|
+ function.WritePage("ini", "GotoPages.ini", GotoPages);
|
|
|
+ function.WritePage("ini", "LibFile.ini", LibFile);
|
|
|
+ startPath = function.getPath("ini");
|
|
|
+ zipPath = function.getPath("ini.zip");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ function.WritePage("txt", "AppInfoList.txt", AppInfoList);
|
|
|
+ function.WritePage("txt", "SystemSet.txt", SystemSet);
|
|
|
+ function.WritePage("txt", "PageInfoList.txt", PageInfoList);
|
|
|
+ function.WritePage("txt", "GotoPages.txt", GotoPages);
|
|
|
+ function.WritePage("txt", "LibFile.txt", LibFile);
|
|
|
+ startPath = function.getPath(path_str: "txt");
|
|
|
+ zipPath = function.getPath("txt.zip");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(System.IO.File.Exists(zipPath))
|
|
|
+ {
|
|
|
+ System.IO.File.Delete(zipPath);
|
|
|
+ }
|
|
|
+ ZipFile.CreateFromDirectory(startPath, zipPath);
|
|
|
+
|
|
|
+ var stream = System.IO.File.OpenRead(zipPath);
|
|
|
+ return File(stream, "text/plain", Path.GetFileName(zipPath));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|