public IResult BuildController() { dpz3.db.Connection dbc = Host.Connection; // 生成程序相关路径 string hostWorkFolder = Host.WorkFolder.Replace("\\", "/"); if (!hostWorkFolder.EndsWith("/")) { hostWorkFolder += "/"; } // 获取参数 string groupName = Request.Str["Group"]; string itemName = Request.Str["Item"]; string name = Request.Str["Name"]; string pathXml = $"{hostWorkFolder}conf/projects.xml"; string folderTemplete = $"{hostWorkFolder}template/{groupName}"; // 读取项目配置 string szXml = dpz3.File.UTF8File.ReadAllText(pathXml); dpz3.Xml.XmlDocument doc = dpz3.Xml.Parser.GetDocument(szXml); var xml = doc["xml"]; dpz3.Xml.XmlNode group = xml.GetNodeByAttr("name", groupName, false); dpz3.Xml.XmlNode item = null; if (group != null) { item = group.GetNodeByAttr("name", itemName, false); } if (item == null) { return(Fail("未发现项目信息")); } // 获取路径信息 string workFolder = item.Attr["path"]; // 将路径进行处理 if (!workFolder.EndsWith("/")) { workFolder += "/"; } string pathCfg = $"{workFolder}modular.json"; if (!System.IO.File.Exists(pathCfg)) { return(Fail("未找到配置文件")); } // 读取包配置文件 string szJson = dpz3.File.UTF8File.ReadAllText(pathCfg); using (var json = dpz3.Json.Parser.ParseJson(szJson)) { // 生成文件控制器 try { PageBuilder.BuildClass(json, folderTemplete, workFolder, name); PageBuilder.BuildControllerClass(json, folderTemplete, workFolder, name); } catch (Exception ex) { return(Error(ex.Message, 0, ex.ToString())); } } return(Success("构架类生成成功")); }
public IResult BuildController() { dpz3.db.Connection dbc = Host.Connection; string path = Host.WorkFolder.Replace("\\", "/"); // 获取参数 string groupName = Request.Str["Group"]; string itemName = Request.Str["Item"]; if (!path.EndsWith("/")) { path += "/"; } string pathXml = $"{path}conf/projects.xml"; string szXml = dpz3.File.UTF8File.ReadAllText(pathXml); dpz3.Xml.XmlDocument doc = dpz3.Xml.Parser.GetDocument(szXml); var xml = doc["xml"]; dpz3.Xml.XmlNode group = xml.GetNodeByAttr("name", groupName, false); dpz3.Xml.XmlNode item = null; if (group != null) { item = group.GetNodeByAttr("name", itemName, false); } if (item == null) { return(Fail("未发现项目信息")); } // 获取路径信息 string workFolder = item.Attr["path"]; // 生成文件控制器 string pathController = $"{workFolder}/controller/bin/Debug/netcoreapp3.1/controller.dll"; if (System.IO.File.Exists(pathController)) { try { System.IO.File.Delete(pathController); } catch (Exception ex) { return(Error(ex.Message, 0, ex.ToString())); } } // 存储登录信息 System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(); info.WorkingDirectory = $"{workFolder}/controller"; info.FileName = "dotnet"; info.Arguments = "build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary"; System.Diagnostics.Process pro = new System.Diagnostics.Process(); pro.StartInfo = info; pro.Start(); pro.WaitForExit(); if (!System.IO.File.Exists(pathController)) { return(Fail("编译失败")); } return(Success("控制器编译成功")); }
public IResult BuildPackage() { dpz3.db.Connection dbc = Host.Connection; string workFolder = Host.WorkFolder.Replace("\\", "/"); // 获取参数 string groupName = Request.Str["Group"]; string itemName = Request.Str["Item"]; if (!workFolder.EndsWith("/")) { workFolder += "/"; } string pathXml = $"{workFolder}conf/projects.xml"; string szXml = dpz3.File.UTF8File.ReadAllText(pathXml); dpz3.Xml.XmlDocument doc = dpz3.Xml.Parser.GetDocument(szXml); var xml = doc["xml"]; dpz3.Xml.XmlNode group = xml.GetNodeByAttr("name", groupName, false); dpz3.Xml.XmlNode item = null; if (group != null) { item = group.GetNodeByAttr("name", itemName, false); } if (item == null) { return(Fail("未发现项目信息")); } // 获取路径信息 // string workFolder = item.Attr["path"]; string path = item.Attr["path"].Replace("\\", "/"); // 判断路径是否指定 if (path.IsNoneOrNull()) { // Console.WriteLine($"[!] 未指定路径"); return(Fail("未指定路径")); } // 将路径进行处理 if (!path.EndsWith("/")) { path += "/"; } string pathCfg = $"{path}modular.json"; if (!System.IO.File.Exists(pathCfg)) { //Console.WriteLine($"[!] 未找到配置文件"); return(Fail("未找到配置文件")); } // 读取配置文件 // Console.WriteLine($"[*] 读取配置文件 {pathCfg} ..."); string szJson = dpz3.File.UTF8File.ReadAllText(pathCfg); string name; string version; using (var json = dpz3.Json.Parser.ParseJson(szJson)) { name = json.Str["name"]; version = json.Str["version"]; // Console.WriteLine($"[*] 当前版本 {version}"); var ver = new dpz3.TimeVersion(version); version = ver.GetNextVersion().ToString(); // Console.WriteLine($"[*] 新版本 {version}"); json.Str["version"] = version; dpz3.File.UTF8File.WriteAllText(pathCfg, json.ToJsonString()); } // 创建临时输出目录 string pathOutput = $"{path}output"; if (!System.IO.Directory.Exists(pathOutput)) { // Console.WriteLine($"[+] 创建目录 {pathOutput} ..."); System.IO.Directory.CreateDirectory(pathOutput); } // 复制配置文件 string pathOutputCfg = $"{pathOutput}/modular.json"; Console.WriteLine($"[+] 增加拷贝文件 {pathOutputCfg} ..."); System.IO.File.Copy(pathCfg, pathOutputCfg, true); // 复制静态页面 string pathRoot = $"{path}wwwroot"; if (System.IO.Directory.Exists(pathRoot)) { string pathOutputRoot = $"{pathOutput}/wwwroot"; if (!System.IO.Directory.Exists(pathOutputRoot)) { //Console.WriteLine($"[+] 创建目录 {pathOutputRoot} ..."); System.IO.Directory.CreateDirectory(pathOutputRoot); } // 复制需要打包的文件到临时文件夹中 CopyFolder(pathRoot, pathOutputRoot); } // 复制数据库定义文件夹 string pathXorm = $"{path}xorm"; if (System.IO.Directory.Exists(pathXorm)) { string pathOutputXorm = $"{pathOutput}/xorm"; if (!System.IO.Directory.Exists(pathOutputXorm)) { Console.WriteLine($"[+] 创建目录 {pathOutputXorm} ..."); System.IO.Directory.CreateDirectory(pathOutputXorm); } // 复制需要打包的文件到临时文件夹中 CopyFolder(pathXorm, pathOutputXorm); } // 复制控制器 string pathController = $"{path}controller/bin/Debug/netcoreapp3.1"; if (System.IO.Directory.Exists(pathController)) { // 复制需要打包的文件到临时文件夹中 CopyFolder(pathController, pathOutput); } // 建立包文件夹 string pathPackage = $"{path}package"; if (!System.IO.Directory.Exists(pathPackage)) { //Console.WriteLine($"[+] 创建目录 {pathPackage} ..."); System.IO.Directory.CreateDirectory(pathPackage); } // 打包文件 string pathPackageFile = $"{pathPackage}/{name}-{version}.zip"; //Console.WriteLine($"[+] 输出包文件 {pathPackageFile} ..."); ZipFile.CreateFromDirectory(pathOutput, pathPackageFile); // 清理临时目录 if (System.IO.Directory.Exists(pathOutput)) { //Console.WriteLine($"[-] 清理目录 {pathOutput} ..."); System.IO.Directory.Delete(pathOutput, true); } // 生成脚本文件 string pathBatFile = $"{pathPackage}/{name}.bat"; string cmd = $"@echo off\r\n" + $"cd ..\r\n" + $".\\pm /name {name} /version {version}\r\n" + $"cd downloads\r\n" + $"del {name}.bat\r\n" + $"pause"; dpz3.File.TextFile.WriteAllBytes(pathBatFile, System.Text.Encoding.ASCII.GetBytes(cmd)); return(Success("生成MP包成功")); }
public IResult BuildPages() { dpz3.db.Connection dbc = Host.Connection; string workFolder = Host.WorkFolder.Replace("\\", "/"); // 获取参数 string groupName = Request.Str["Group"]; string itemName = Request.Str["Item"]; if (!workFolder.EndsWith("/")) { workFolder += "/"; } string pathXml = $"{workFolder}conf/projects.xml"; string szXml = dpz3.File.UTF8File.ReadAllText(pathXml); dpz3.Xml.XmlDocument doc = dpz3.Xml.Parser.GetDocument(szXml); var xml = doc["xml"]; dpz3.Xml.XmlNode group = xml.GetNodeByAttr("name", groupName, false); dpz3.Xml.XmlNode item = null; if (group != null) { item = group.GetNodeByAttr("name", itemName, false); } if (item == null) { return(Fail("未发现项目信息")); } // 获取路径信息 // string workFolder = item.Attr["path"]; string path = item.Attr["path"].Replace("\\", "/"); // 判断路径是否指定 if (path.IsNoneOrNull()) { //Console.WriteLine($"[!] 未指定路径"); return(Fail("未指定路径")); } // 将路径进行处理 if (!path.EndsWith("/")) { path += "/"; } // 判断页面文件夹 string pathPages = $"{path}pages"; if (!System.IO.Directory.Exists(pathPages)) { //Console.WriteLine($"[!] 未找到pages文件夹"); return(Fail("未找到pages文件夹")); } // 判断并创建控制器工程文件夹 string pathController = $"{path}controller/pages"; if (!System.IO.Directory.Exists(pathController)) { Console.WriteLine($"[+] 创建文件夹 {pathController} ..."); System.IO.Directory.CreateDirectory(pathController); return(Fail("未找到pages文件夹")); } MakerController(pathPages, pathController, "pages", ""); return(Success("控制器页面代码生成成功")); }
public IResult OpenPages() { dpz3.db.Connection dbc = Host.Connection; string path = Host.WorkFolder.Replace("\\", "/"); // 获取参数 string groupName = Request.Str["Group"]; string itemName = Request.Str["Item"]; if (!path.EndsWith("/")) { path += "/"; } string pathXml = $"{path}conf/projects.xml"; string szXml = dpz3.File.UTF8File.ReadAllText(pathXml); dpz3.Xml.XmlDocument doc = dpz3.Xml.Parser.GetDocument(szXml); var xml = doc["xml"]; dpz3.Xml.XmlNode group = xml.GetNodeByAttr("name", groupName, false); dpz3.Xml.XmlNode item = null; if (group != null) { item = group.GetNodeByAttr("name", itemName, false); } if (item == null) { return(Fail("未发现项目信息")); } // 获取路径信息 string workFolder = item.Attr["path"]; string slnPath = $"{workFolder}/pages/pages.sln"; // 读取工具配置 pathXml = $"{path}conf/tools.xml"; szXml = dpz3.File.UTF8File.ReadAllText(pathXml); dpz3.Xml.XmlDocument docTools = dpz3.Xml.Parser.GetDocument(szXml); var tools = docTools["tools"]; if (tools == null) { return(Fail("未发现visualstudio配置信息")); } var tool = tools.GetNodeByAttr("name", "visualstudio", false); if (tool == null) { return(Fail("未发现visualstudio配置信息")); } string toolPath = tool.Attr["path"]; if (toolPath.IsNoneOrNull()) { return(Fail("未发现visualstudio配置信息")); } // 存储登录信息 System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(); info.FileName = toolPath; info.Arguments = slnPath; System.Diagnostics.Process.Start(info); return(Success()); }
public IResult Dir() { StringBuilder sb = new StringBuilder(); dpz3.db.Connection dbc = Host.Connection; var session = Host.Session; var request = Host.Context.Request; var response = Host.Context.Response; string hostWorkFolder = Host.WorkFolder.Replace("\\", "/"); // 获取参数 string groupName = $"{request.Query["group"]}"; string itemName = $"{request.Query["item"]}"; string path = $"{request.Query["path"]}"; path = path.Replace("//", "/"); if (!hostWorkFolder.EndsWith("/")) { hostWorkFolder += "/"; } string pathXml = $"{hostWorkFolder}conf/projects.xml"; string szXml = dpz3.File.UTF8File.ReadAllText(pathXml); dpz3.Xml.XmlDocument doc = dpz3.Xml.Parser.GetDocument(szXml); var xml = doc["xml"]; dpz3.Xml.XmlNode group = xml.GetNodeByAttr("name", groupName, false); dpz3.Xml.XmlNode item = null; if (group != null) { item = group.GetNodeByAttr("name", itemName, false); } sb.Append("<!DOCTYPE html>\n"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"); sb.Append("<head>\n"); sb.Append("<meta charset=\"utf-8\" />\n"); sb.Append("<title>模块化网站项目管理器</title>\n"); sb.Append("<link rel=\"icon\" href=\"/modular-project-common/manager.ico\" type=\"image/x-icon\" />\n"); sb.Append("<script src=\"/modular-project-common/js/jquery-3.4.1.min.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/vue.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/dpz2.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/host.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/jttp.js\"></script>\n"); sb.Append("<script src=\"/modular-project-manage/dir/page.js\"></script>\n"); sb.Append("<link rel=\"stylesheet\" href=\"/modular-project-manage/dir/page.css\" />\n"); sb.Append("</head>\n"); sb.Append("<body>\n"); sb.Append("<div class=\"info\" style=\"display: none;\">正在处理,请稍等...</div>\n"); if (item != null) { // 获取路径段 string[] paths = path.Split('/'); // 获取工作目录 string workFolder = item.Attr["path"]; string workFolderXorm = $"{workFolder}/xorm"; string workFolderModular = $"{workFolder}/modular.json"; sb.Append("<div class=\"list\">\n"); sb.Append("<dl>\n"); sb.Append("<dd>\n"); sb.Append("<s><a href=\"/modular-project-manage/index?group="); sb.Append(groupName); sb.Append("&item="); sb.Append(itemName); sb.Append("\">返回</a></s> \n"); sb.Append("<i><a href=\"/modular-project-manage/dir?group="); sb.Append(groupName); sb.Append("&item="); sb.Append(itemName); sb.Append("&path=/\">根目录</a></i>\n"); string pathPart = ""; for (int i = 1; i < paths.Length; i++) { pathPart += $"/{paths[i]}"; sb.Append("<i>/</i>\n"); sb.Append("<i><a href=\"/modular-project-manage/dir?group="); sb.Append(groupName); sb.Append("&item="); sb.Append(itemName); sb.Append("&path="); sb.Append(pathPart); sb.Append("\">"); sb.Append(paths[i]); sb.Append("</a></i>\n"); } sb.Append("</dd>\n"); // 获取所有文件夹 string[] dirs = System.IO.Directory.GetDirectories($"{workFolder}{path}"); for (int i = 0; i < dirs.Length; i++) { string fileName = System.IO.Path.GetFileName(dirs[i]); sb.Append("<dd>\n"); sb.Append("<img src=\"/modular-project-manage/dir/image/folder.png\" /><i><a href=\"/modular-project-manage/dir?group="); sb.Append(groupName); sb.Append("&item="); sb.Append(itemName); sb.Append("&path="); sb.Append(path); sb.Append("/"); sb.Append(fileName); sb.Append("\">"); sb.Append(fileName); sb.Append("</a></i></dd>\n"); } // 获取所有文件 string[] files = System.IO.Directory.GetFiles($"{workFolder}{path}"); for (int i = 0; i < files.Length; i++) { string fileName = System.IO.Path.GetFileName(files[i]); if (fileName == "config.json") { sb.Append("<dd>\n"); sb.Append("<img src=\"/modular-project-manage/dir/image/file.png\" /><i>"); sb.Append(fileName); sb.Append("</i> | <i><a href=\"javascript:;\" onclick=\"pg.buildMainPage('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("','"); sb.Append(path); sb.Append("');\">构建页面</a></i></dd>\n"); } else { sb.Append("<dd>\n"); sb.Append("<img src=\"/modular-project-manage/dir/image/file.png\" /><i>"); sb.Append(fileName); sb.Append("</i></dd>\n"); } } sb.Append("</dl>\n"); sb.Append("</div>\n"); } else { sb.Append("<div>未发现项目信息</div>\n"); } sb.Append("</body>\n"); sb.Append("</html>\n"); return(Html(sb.ToString())); }
public IResult Xorm() { StringBuilder sb = new StringBuilder(); dpz3.db.Connection dbc = Host.Connection; var session = Host.Session; var request = Host.Context.Request; var response = Host.Context.Response; string hostWorkFolder = Host.WorkFolder.Replace("\\", "/"); // 获取参数 string groupName = $"{request.Query["group"]}"; string itemName = $"{request.Query["item"]}"; string name = $"{request.Query["name"]}"; if (!hostWorkFolder.EndsWith("/")) { hostWorkFolder += "/"; } string pathXml = $"{hostWorkFolder}conf/projects.xml"; string szXml = dpz3.File.UTF8File.ReadAllText(pathXml); dpz3.Xml.XmlDocument doc = dpz3.Xml.Parser.GetDocument(szXml); var xml = doc["xml"]; dpz3.Xml.XmlNode group = xml.GetNodeByAttr("name", groupName, false); dpz3.Xml.XmlNode item = null; if (group != null) { item = group.GetNodeByAttr("name", itemName, false); } sb.Append("<!DOCTYPE html>\n"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"); sb.Append("<head>\n"); sb.Append("<meta charset=\"utf-8\" />\n"); sb.Append("<title>模块化网站项目管理器</title>\n"); sb.Append("<link rel=\"icon\" href=\"/modular-project-common/manager.ico\" type=\"image/x-icon\" />\n"); sb.Append("<script src=\"/modular-project-common/js/jquery-3.4.1.min.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/vue.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/dpz2.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/host.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/jttp.js\"></script>\n"); sb.Append("<script src=\"/modular-project-manage/xorm/page.js\"></script>\n"); sb.Append("<link rel=\"stylesheet\" href=\"/modular-project-manage/xorm/page.css\" />\n"); sb.Append("</head>\n"); sb.Append("<body>\n"); sb.Append("<div class=\"info\" style=\"display: none;\">正在处理,请稍等...</div>\n"); if (item != null) { // 获取工作目录 string workFolder = item.Attr["path"]; string workFolderXorm = $"{workFolder}/xorm"; string pathXorm = $"{workFolderXorm}/{name}.xml"; string folderTemplete = $"{hostWorkFolder}template/{groupName}"; if (!System.IO.Directory.Exists(folderTemplete)) { System.IO.Directory.CreateDirectory(folderTemplete); } string fileContent = dpz3.File.UTF8File.ReadAllText(pathXorm); using (var fileDoc = dpz3.Xml.Parser.GetDocument(fileContent)) { var table = fileDoc["table"]; var fields = table.GetNodesByTagName("field", false); sb.Append("<div class=\"list\">\n"); sb.Append("<dl>\n"); sb.Append("<dt>相关信息</dt>\n"); sb.Append("<dd>名称:"); sb.Append(table.Attr["name"]); sb.Append("</dd>\n"); sb.Append("<dd>标题:"); sb.Append(table.Attr["title"]); sb.Append("</dd>\n"); sb.Append("<dd>版本:"); sb.Append(table.Attr["version"]); sb.Append("</dd>\n"); sb.Append("<dt>快捷操作</dt>\n"); sb.Append("<dd>\n"); sb.Append("<s><a href=\"/modular-project-manage/index?group="); sb.Append(groupName); sb.Append("&item="); sb.Append(itemName); sb.Append("\">返回主界面</a></s> \n"); sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.buildController('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("','"); sb.Append(name); sb.Append("');\">创建类构造代码</a></s> \n"); sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.buildList('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("','"); sb.Append(name); sb.Append("');\">创建列表代码</a></s> \n"); sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.buildSelector('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("','"); sb.Append(name); sb.Append("');\">创建选择器代码</a></s> \n"); sb.Append("</dd>\n"); sb.Append("<dd>\n"); sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.buildAddForm('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("','"); sb.Append(name); sb.Append("');\">创建添加对话框代码</a></s> \n"); sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.buildEditForm('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("','"); sb.Append(name); sb.Append("');\">创建编辑对话框代码</a></s> \n"); sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.buildViewForm('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("','"); sb.Append(name); sb.Append("');\">创建视图对话框代码</a></s> \n"); sb.Append("</dd>\n"); sb.Append("<dt>字段一览</dt>\n"); foreach (var field in fields) { var data = field["data"]; sb.Append("<dd>"); sb.Append(field.Attr["title"]); sb.Append("("); sb.Append(field.Attr["name"]); sb.Append(") - "); sb.Append(data.Attr["type"]); sb.Append("("); sb.Append(data.Attr["size"]); sb.Append(","); sb.Append(data.Attr["float"]); sb.Append(")</dd>\n"); } sb.Append("</dl>\n"); sb.Append("</div>\n"); } } else { sb.Append("<div>未发现项目信息</div>\n"); } sb.Append("</body>\n"); sb.Append("</html>\n"); return(Html(sb.ToString())); }
public IResult index() { StringBuilder sb = new StringBuilder(); dpz3.db.Connection dbc = Host.Connection; var session = Host.Session; var request = Host.Context.Request; var response = Host.Context.Response; string path = Host.WorkFolder.Replace("\\", "/"); // 获取参数 string groupName = $"{request.Query["group"]}"; string itemName = $"{request.Query["item"]}"; if (!path.EndsWith("/")) { path += "/"; } string pathXml = $"{path}conf/projects.xml"; string szXml = dpz3.File.UTF8File.ReadAllText(pathXml); dpz3.Xml.XmlDocument doc = dpz3.Xml.Parser.GetDocument(szXml); var xml = doc["xml"]; dpz3.Xml.XmlNode group = xml.GetNodeByAttr("name", groupName, false); dpz3.Xml.XmlNode item = null; if (group != null) { item = group.GetNodeByAttr("name", itemName, false); } sb.Append("<!DOCTYPE html>\n"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"); sb.Append("<head>\n"); sb.Append("<meta charset=\"utf-8\" />\n"); sb.Append("<title>模块化网站项目管理器</title>\n"); sb.Append("<link rel=\"icon\" href=\"/modular-project-common/manager.ico\" type=\"image/x-icon\" />\n"); sb.Append("<script src=\"/modular-project-common/js/jquery-3.4.1.min.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/vue.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/dpz2.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/host.js\"></script>\n"); sb.Append("<script src=\"/modular-project-common/js/jttp.js\"></script>\n"); sb.Append("<script src=\"/modular-project-manage/index/page.js\"></script>\n"); sb.Append("<link rel=\"stylesheet\" href=\"/modular-project-manage/index/page.css\" />\n"); sb.Append("</head>\n"); sb.Append("<body>\n"); sb.Append("<div class=\"info\" style=\"display: none;\">正在处理,请稍等...</div>\n"); if (item != null) { string workFolder = item.Attr["path"]; string workFolderXorm = $"{workFolder}/xorm"; string workFolderModular = $"{workFolder}/modular.json"; // 读取包信息 string content = dpz3.File.UTF8File.ReadAllText(workFolderModular); var package = dpz3.Json.Parser.ParseJson(content); // 读取所有的配置文件 string[] files = null; if (System.IO.Directory.Exists(workFolderXorm)) { files = System.IO.Directory.GetFiles(workFolderXorm, "*.xml"); } else { files = new string[0]; } sb.Append("<div class=\"list\">\n"); sb.Append("<dl>\n"); sb.Append("<dt>包信息</dt>\n"); sb.Append("<dd>名称:"); sb.Append(package.Str["name"]); sb.Append("</dd>\n"); sb.Append("<dd>版本:"); sb.Append(package.Str["version"]); sb.Append("</dd>\n"); sb.Append("<dd>描述:"); sb.Append(package.Str["description"]); sb.Append("</dd>\n"); sb.Append("<dt>快捷操作</dt>\n"); sb.Append("<dd>\n"); if (System.IO.File.Exists($"{workFolder}/pages/pages.sln")) { sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.buildPages('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("');\">生成页面控制器</a></s> \n"); } if (System.IO.File.Exists($"{workFolder}/controller/controller.sln")) { sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.buildController('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("');\">编译控制器</a></s> \n"); } sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.buildPackage('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("');\">生成MP包</a></s> \n"); sb.Append("</dd>\n"); sb.Append("<dd>\n"); if (System.IO.File.Exists($"{workFolder}/pages/pages.sln")) { sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.openPages('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("');\">使用VS编辑Pages</a></s> \n"); } if (System.IO.File.Exists($"{workFolder}/controller/controller.sln")) { sb.Append("<s><a href=\"javascript:;\" onclick=\"pg.openController('"); sb.Append(groupName); sb.Append("','"); sb.Append(itemName); sb.Append("');\">使用VS编辑Controller</a></s> \n"); } sb.Append("<s><a href=\"/modular-project-manage/dir?group="); sb.Append(groupName); sb.Append("&item="); sb.Append(itemName); sb.Append("&path=/\">浏览文件</a></s> \n"); sb.Append("</dd>\n"); sb.Append("<dt>对象映射信息</dt>\n"); if (files.Length > 0) { foreach (var file in files) { string fileContent = dpz3.File.UTF8File.ReadAllText(file); using (var fileDoc = dpz3.Xml.Parser.GetDocument(fileContent)) { var table = fileDoc["table"]; if (table != null) { sb.Append("<dd><i><a href=\"/modular-project-manage/Xorm?group="); sb.Append(groupName); sb.Append("&item="); sb.Append(itemName); sb.Append("&name="); sb.Append(table.Attr["name"]); sb.Append("\">"); sb.Append(table.Attr["title"]); sb.Append(" ["); sb.Append(table.Attr["name"]); sb.Append(":"); sb.Append(table.Attr["version"]); sb.Append("]</a></i></dd>\n"); } else { sb.Append("<dd>文件"); sb.Append(file); sb.Append("读取错误</dd>\n"); } } } } else { sb.Append("<dd>未发现对象映射信息</dd>\n"); } sb.Append("</dl>\n"); sb.Append("</div>\n"); } else { sb.Append("<div>未发现项目信息</div>\n"); } sb.Append("</body>\n"); sb.Append("</html>\n"); return(Html(sb.ToString())); }