2024-12-20 06:14:48 +00:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using ryCommon;
|
|
|
|
|
using ryControls.Controls;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
2025-01-14 08:21:07 +00:00
|
|
|
|
using System.Windows.Media;
|
2024-12-20 06:14:48 +00:00
|
|
|
|
using System.Xml.Linq;
|
2025-01-14 08:21:07 +00:00
|
|
|
|
using TheArtOfDev.HtmlRenderer.WinForms;
|
2024-12-20 06:14:48 +00:00
|
|
|
|
|
|
|
|
|
namespace SuperDesign.Tools
|
|
|
|
|
{
|
|
|
|
|
public partial class FrmUpdateLog : Form
|
|
|
|
|
{
|
|
|
|
|
public FrmUpdateLog()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
public void ShowLog(string LogJson)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
JArray jarr = JArray.Parse(LogJson);
|
|
|
|
|
for (int i = 0; i < jarr.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var item = jarr[i];
|
|
|
|
|
var ProjectName = item.GetJsonValue("ProjectChsName", "");
|
|
|
|
|
if(ProjectName.Length==0)
|
|
|
|
|
{
|
|
|
|
|
ProjectName = item.GetJsonValue("ProjectName", "");
|
|
|
|
|
}
|
|
|
|
|
TabPage tab = new TabPage()
|
|
|
|
|
{
|
|
|
|
|
Text = ProjectName
|
|
|
|
|
};
|
|
|
|
|
Label label = new Label
|
|
|
|
|
{
|
|
|
|
|
Parent = tab,
|
|
|
|
|
Location = new Point(1, 4),
|
|
|
|
|
AutoSize = true,
|
|
|
|
|
Text = "版本号:" + item.GetJsonValue("VerStr", "")
|
|
|
|
|
};
|
2025-01-13 09:14:17 +00:00
|
|
|
|
var LogTime = item.GetJsonValue("LogTime", "");
|
|
|
|
|
var now_jarr = LogTime.Length==0? new JArray(): JArray.Parse(LogTime);
|
|
|
|
|
Dictionary<string, long> dict = new Dictionary<string, long>();
|
|
|
|
|
for (int j = 0; j < now_jarr.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
var item_jarr = now_jarr[j];
|
|
|
|
|
dict[item_jarr.GetJsonValue("text", "")] = item_jarr.GetJsonValue("time", 0L);
|
|
|
|
|
}
|
|
|
|
|
var LogText_lines = item.GetJsonValue("LogText", "").Replace("\r", "\n").Replace("\n\n", "\n").Split('\n');
|
|
|
|
|
var LogText = "";
|
|
|
|
|
for (int l = 0; l < LogText_lines.Length; l++)
|
|
|
|
|
{
|
|
|
|
|
if (LogText_lines[l].Length == 0) { continue; }
|
2025-01-14 08:21:07 +00:00
|
|
|
|
if (LogText.Length > 0) { LogText += "<br />"; }
|
|
|
|
|
var line = "";
|
|
|
|
|
var log_line_n1 = "";
|
|
|
|
|
var n1_color = "";
|
|
|
|
|
var log_line_n2 = LogText_lines[l];
|
|
|
|
|
if(log_line_n2.StartsWith("*.[新增]"))
|
2025-01-13 09:14:17 +00:00
|
|
|
|
{
|
2025-01-14 08:21:07 +00:00
|
|
|
|
log_line_n1 = "*.[新增]";
|
|
|
|
|
n1_color = "blue";
|
|
|
|
|
log_line_n2 = log_line_n2.Substring(log_line_n1.Length);
|
2025-01-13 09:14:17 +00:00
|
|
|
|
}
|
2025-01-14 08:21:07 +00:00
|
|
|
|
else if (log_line_n2.StartsWith("*.[改进]"))
|
2025-01-13 09:14:17 +00:00
|
|
|
|
{
|
2025-01-14 08:21:07 +00:00
|
|
|
|
log_line_n1 = "*.[改进]";
|
|
|
|
|
n1_color = "green";
|
|
|
|
|
log_line_n2 = log_line_n2.Substring(log_line_n1.Length);
|
2025-01-13 09:14:17 +00:00
|
|
|
|
}
|
2025-01-14 08:21:07 +00:00
|
|
|
|
else if (log_line_n2.StartsWith("*.[修复]"))
|
|
|
|
|
{
|
|
|
|
|
log_line_n1 = "*.[修复]";
|
|
|
|
|
n1_color = "red";
|
|
|
|
|
log_line_n2 = log_line_n2.Substring(log_line_n1.Length);
|
|
|
|
|
}
|
|
|
|
|
line = (log_line_n1.Length==0?"":("<b><span color='"+ n1_color + "'>"+log_line_n1+"</span></b>"))+ System.Web.HttpUtility.HtmlEncode(log_line_n2);
|
|
|
|
|
if (dict.ContainsKey(LogText_lines[l]))
|
|
|
|
|
{
|
|
|
|
|
var dt = dict[LogText_lines[l]].ToDateTime();
|
|
|
|
|
var dt_str= dt.ToString("yyyy-MM-dd HH:mm");
|
|
|
|
|
if(dt.Date==DateTime.Now.Date)
|
|
|
|
|
{ dt_str = "今天 "+ dt.ToString("HH:mm"); }
|
|
|
|
|
else if (dt.Date.AddDays(1) == DateTime.Now.Date)
|
|
|
|
|
{ dt_str = "昨天 " + dt.ToString("HH:mm"); }
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var index = (int)DateTime.Now.DayOfWeek;
|
|
|
|
|
index = index == 0 ? 7 : index;
|
|
|
|
|
//当前周的范围
|
|
|
|
|
DateTime retStartDay = DateTime.Now.Date.AddDays(-(index - 1));
|
|
|
|
|
if(dt >= retStartDay && dt < retStartDay.AddDays(7))
|
|
|
|
|
{
|
|
|
|
|
dt_str = "本周 " + dt.ToString("dd HH:mm");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
line += "<span color='red'>" + System.Web.HttpUtility.HtmlEncode("=>" + dt_str) + "</span>";
|
|
|
|
|
}
|
|
|
|
|
if(line.StartsWith("#### "))
|
|
|
|
|
{
|
|
|
|
|
line ="<b>"+ line + "</b>";
|
|
|
|
|
}
|
|
|
|
|
LogText += line;
|
2025-01-13 09:14:17 +00:00
|
|
|
|
}
|
2025-01-14 08:21:07 +00:00
|
|
|
|
HtmlPanel htmlPanel = new HtmlPanel
|
2024-12-20 06:14:48 +00:00
|
|
|
|
{
|
|
|
|
|
Parent = tab,
|
2025-01-14 08:21:07 +00:00
|
|
|
|
Font = new Font("微软雅黑", 21),
|
2024-12-20 06:14:48 +00:00
|
|
|
|
Dock = DockStyle.Fill,
|
2024-12-20 07:55:25 +00:00
|
|
|
|
Location = new Point(label.Left, label.Top + label.Height + 4),
|
2024-12-20 06:14:48 +00:00
|
|
|
|
Size = new Size(tab.ClientSize.Width, tab.ClientSize.Height - (label.Top + label.Height + 4)),
|
|
|
|
|
Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom,
|
2025-01-14 08:21:07 +00:00
|
|
|
|
BaseStylesheet = "body { font:11pt Consolas }",
|
|
|
|
|
Text = "<body>" + LogText + "</body>"
|
2024-12-20 06:14:48 +00:00
|
|
|
|
};
|
2025-01-14 08:21:07 +00:00
|
|
|
|
//RichTextBox2 rich = new RichTextBox2
|
|
|
|
|
//{
|
|
|
|
|
// Parent = tab,
|
|
|
|
|
// Dock = DockStyle.Fill,
|
|
|
|
|
// Font = new Font("微软雅黑", 11),
|
|
|
|
|
// ReadOnly=true,
|
|
|
|
|
// BackColor=Color.White,
|
|
|
|
|
// ScrollBars= RichTextBoxScrollBars.Both,
|
|
|
|
|
// WordWrap=false,
|
|
|
|
|
// Location = new Point(label.Left, label.Top + label.Height + 4),
|
|
|
|
|
// Size = new Size(tab.ClientSize.Width, tab.ClientSize.Height - (label.Top + label.Height + 4)),
|
|
|
|
|
// Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom,
|
|
|
|
|
// Text= LogText
|
|
|
|
|
//};
|
2024-12-20 06:14:48 +00:00
|
|
|
|
tabControl1.TabPages.Add(tab);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|