SuperDesign/Source/开发辅助工具/Tools/UpLog/FrmPublishLogs.cs
zilinsoft 9d3c5a384f ### 2025-01-14 星期二更新
----
#### SuperDesign    V3.0.2501.1401
#### 项目功能
- *.[新增]生成列表Html日志支持分组显示。
- *.[新增]更新日志新增支持显示距离最近一次更新的用时。
- *.[改进]优化双击更新日志时的日志展示。
- *.[改进]右键插入更新日志时,支持识别分组并插入。
- *.[修复]修复更新日志如果包含####,生成的MD日志格式不正确的BUG。
#### 网页抓取工具
- *.[新增]新增提交时间显示。
2025-01-14 16:21:28 +08:00

78 lines
2.6 KiB
C#

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.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SuperDesign.Tools.UpLog
{
public partial class FrmPublishLogs : Form
{
public FrmPublishLogs()
{
InitializeComponent();
}
private string MdLog { get; set; } = "";
private string HtmlLog { get; set; } = "";
public void ShowLog(string LogJson)
{
try
{
JArray jarr = JArray.Parse(LogJson);
MdLog = SuperDesign.Manager.APIManager.GetMdLogText(jarr, DateTime.Now);
HtmlLog = SuperDesign.Manager.APIManager.GetHtmlLogText(BFFolderPath, jarr, DateTime.Now);
}
catch { }
}
public string BFFolderPath { get; set; } = "";
int index = 0;
private void BtnCopyMD_Click(object sender, EventArgs e)
{
RyFiles.CopyToClip(MdLog.Replace("\r\n\r\n","\r\n"));
var git_path= SuperDesign.Manager.APIManager.GetTortoiseGitProcPath();
if(git_path.Length>0 && BFFolderPath.Length>0)
{
index = 0;
RyFiles.RunFile(git_path, "/command:commit", BFFolderPath);
new Thread(Start).Start();
void Start()
{
while (index < 10 && !this.IsDisposed)
{
System.Threading.Thread.Sleep(1000);
var handle = RyForm.GetForegroundWindow();
var path = ryCommon.ProcessExt.GetPath(RyForm.GetProcessId(handle));
index++;
if (path != null && path.Length > 0)
{
var filename = System.IO.Path.GetFileName(path);
if (filename == "TortoiseGitProc.exe")
{
this.Invoke(new Action(() =>
{
SendKeys.Send("^v");
}));
break;
}
}
}
}
}
}
private void BtnCopyHtml_Click(object sender, EventArgs e)
{
RyFiles.CopyToClip(HtmlLog);
}
}
}