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); 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); } } }