------ #### SuperDesign V3.0.2501.1301 - *.[新增]更新日志新增支持显示开发周期。 - *.[改进]上传项目到服务端判断本地根目录默认为输出目录,不存在才为毕方输出目录。 - *.[改进]更新日志右键菜单新增日志时自动按位置插入到指定行。 - *.[改进]当日志里包含[开发]时,就不会发布到Html日志里。
155 lines
5.4 KiB
C#
155 lines
5.4 KiB
C#
using Newtonsoft.Json.Linq;
|
|
using ryCommon;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using 开发辅助工具;
|
|
|
|
namespace SuperDesign.Manager
|
|
{
|
|
public class APIManager
|
|
{
|
|
public static string GetMdLogText(JArray jarr, DateTime dt)
|
|
{
|
|
string log_text = "### " + DateTime.Now.ToString("yyyy-MM-dd dddd") + "更新";
|
|
log_text += "\r\n------";
|
|
for (int i = 0; i < jarr.Count; i++)
|
|
{
|
|
var item = jarr[i];
|
|
log_text += "\r\n#### " + item.GetJsonValue("ProjectName", "") + " V" + item.GetJsonValue("VerStr", "");
|
|
var logs = item.GetJsonValue("LogText", "").Replace("\r", "\n").Replace("\n\n", "\n").Split('\n');
|
|
for (int m = 0; m < logs.Length; m++)
|
|
{
|
|
if (logs[m].Length == 0) { continue; }
|
|
var log_item = logs[m].Replace("[开发]","");
|
|
if (log_item.StartsWith("- *."))
|
|
{
|
|
log_text += "\r\n" + log_item;
|
|
}
|
|
else if (log_item.StartsWith("*."))
|
|
{
|
|
log_text += "\r\n- " + log_item;
|
|
}
|
|
else
|
|
{
|
|
log_text += "\r\n- *." + log_item;
|
|
}
|
|
}
|
|
}
|
|
return log_text;
|
|
}
|
|
public static string GetHtmlLogText(string bf_folder, JArray jarr, DateTime dt)
|
|
{
|
|
ryCommon.Ini ini = new Ini(bf_folder + "\\查看项目.ryp");
|
|
string log_text = "";
|
|
for (int i = 0; i < jarr.Count; i++)
|
|
{
|
|
var item = jarr[i];
|
|
var eng_name= item.GetJsonValue("ProjectName", "");
|
|
if(ini.ReadIni("NoVerHtml", eng_name,0)==1)
|
|
{
|
|
continue;
|
|
}
|
|
if (log_text.Length != 0)
|
|
{
|
|
log_text += "\r\n";
|
|
}
|
|
var ProjectName = item.GetJsonValue("ProjectChsName", "");
|
|
if(ProjectName.Length==0)
|
|
{
|
|
ProjectName = eng_name;
|
|
}
|
|
log_text += "<h4>" + System.Web.HttpUtility.HtmlEncode(ProjectName) + "</h4>";
|
|
var logs = item.GetJsonValue("LogText", "").Replace("\r", "\n").Replace("\n\n", "\n").Split('\n');
|
|
for (int m = 0; m < logs.Length; m++)
|
|
{
|
|
if (logs[m].Length == 0) { continue; }
|
|
var log_item = logs[m];
|
|
if (log_item.IndexOfEx("[开发]") >= 0) { continue; }
|
|
if (log_item.StartsWith("- *."))
|
|
{
|
|
log_text += "\r\n<p>" +System.Web.HttpUtility.HtmlEncode(log_item.Substring(2))+"</p>";
|
|
}
|
|
else
|
|
{
|
|
log_text += "\r\n<p>" + System.Web.HttpUtility.HtmlEncode(log_item) + "</p>";
|
|
}
|
|
}
|
|
}
|
|
return log_text;
|
|
}
|
|
public static string GetTortoiseGitProcPath()
|
|
{
|
|
DriveInfo[] driveInfo = DriveInfo.GetDrives();
|
|
for (int i = 0; i < driveInfo.Length; i++)
|
|
{
|
|
var path = driveInfo[i].Name + "Program Files\\TortoiseGit\\bin\\TortoiseGitProc.exe";
|
|
if (System.IO.File.Exists(path))
|
|
{
|
|
return path;
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
/// <summary>
|
|
/// 获取参数翻译名称
|
|
/// </summary>
|
|
/// <param name="ParamName"></param>
|
|
/// <returns></returns>
|
|
public static string GetParamTitle(string ParamName)
|
|
{
|
|
var title = "";
|
|
switch (ParamName.ToLower())
|
|
{
|
|
case "starttime":
|
|
title = "开始时间";
|
|
break;
|
|
case "endtime":
|
|
title = "结束时间";
|
|
break;
|
|
case "page":
|
|
title = "页码";
|
|
break;
|
|
case "pagesize":
|
|
title = "每页数量";
|
|
break;
|
|
case "title":
|
|
title = "标题";
|
|
break;
|
|
case "name":
|
|
title = "名称";
|
|
break;
|
|
case "id":
|
|
title = "id编号";
|
|
break;
|
|
case "modelid":
|
|
title = "资源类型";
|
|
break;
|
|
case "packagename":
|
|
case "pkgname":
|
|
title = "包名";
|
|
break;
|
|
case "filename":
|
|
title = "文件名";
|
|
break;
|
|
case "url":
|
|
title = "网址";
|
|
break;
|
|
case "username":
|
|
title = "用户名";
|
|
break;
|
|
case "realname":
|
|
title = "真实姓名";
|
|
break;
|
|
case "cooperid":
|
|
title = "合作包id";
|
|
break;
|
|
}
|
|
return title;
|
|
}
|
|
}
|
|
}
|