### 2024-12-20 星期五更新

------
#### SuperDesign    V3.0.2412.2003
- *.[新增]新增支持更新日志发布时自动调用起TortoiseGit。
- *.[新增]版本列表新增支持设置正式版本。
- *.[改进]自定义对话框针对单选函数返回值,则使用if而不是switch语句。
- *.[改进]点击发布日志按钮弹出确认框,避免误点击。
- *.[改进]更新版本列表的更新时间支持昨天、今天的简短显示。
This commit is contained in:
zilinsoft committed 2024-12-20 15:55:33 +08:00
1 parent 179f349d8f
commit a0cbe0a68f
36 files changed
+245 -1770

No files matched your search

+37
View File
@@ -77,11 +77,14 @@
this.BtnSave2 = new ryControls.ButtonEx();
this.panel1 = new System.Windows.Forms.Panel();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.BtnSubmitGit = new ryControls.ButtonEx();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.BtnSaveLog = new ryControls.ButtonEx();
this.LvUpdateLogList = new BrightIdeasSoftware.ObjectListView();
this.OlvUpVer = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.OlvUpdateDate = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.设为正式版本ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.BtnPublishLogs = new ryControls.ButtonEx();
((System.ComponentModel.ISupportInitialize)(this.table1)).BeginInit();
this.groupBox1.SuspendLayout();
@@ -93,6 +96,7 @@
this.panel1.SuspendLayout();
this.tabPage4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.LvUpdateLogList)).BeginInit();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// BtnCustomMessageBox
@@ -701,6 +705,7 @@
//
// tabPage4
//
this.tabPage4.Controls.Add(this.BtnSubmitGit);
this.tabPage4.Controls.Add(this.tabControl1);
this.tabPage4.Controls.Add(this.BtnSaveLog);
this.tabPage4.Controls.Add(this.LvUpdateLogList);
@@ -713,6 +718,18 @@
this.tabPage4.Text = "更新日志";
this.tabPage4.UseVisualStyleBackColor = true;
//
// BtnSubmitGit
//
this.BtnSubmitGit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BtnSubmitGit.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
this.BtnSubmitGit.Location = new System.Drawing.Point(741, 3);
this.BtnSubmitGit.Name = "BtnSubmitGit";
this.BtnSubmitGit.Size = new System.Drawing.Size(75, 33);
this.BtnSubmitGit.TabIndex = 13;
this.BtnSubmitGit.Text = "提交Git";
this.BtnSubmitGit.UseVisualStyleBackColor = true;
this.BtnSubmitGit.Click += new System.EventHandler(this.BtnSubmitGit_Click);
//
// tabControl1
//
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -745,6 +762,7 @@
this.LvUpdateLogList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.OlvUpVer,
this.OlvUpdateDate});
this.LvUpdateLogList.ContextMenuStrip = this.contextMenuStrip1;
this.LvUpdateLogList.Cursor = System.Windows.Forms.Cursors.Default;
this.LvUpdateLogList.FullRowSelect = true;
this.LvUpdateLogList.HideSelection = false;
@@ -766,6 +784,21 @@
this.OlvUpdateDate.Text = "更新时间";
this.OlvUpdateDate.Width = 150;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.设为正式版本ToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
//
// 设为正式版本ToolStripMenuItem
//
this.设为正式版本ToolStripMenuItem.Name = "设为正式版本ToolStripMenuItem";
this.设为正式版本ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.设为正式版本ToolStripMenuItem.Text = "设为正式版本";
this.设为正式版本ToolStripMenuItem.Click += new System.EventHandler(this.设为正式版本ToolStripMenuItem_Click);
//
// BtnPublishLogs
//
this.BtnPublishLogs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -810,6 +843,7 @@
this.panel1.PerformLayout();
this.tabPage4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.LvUpdateLogList)).EndInit();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -871,5 +905,8 @@
private BrightIdeasSoftware.OLVColumn OlvUpVer;
private BrightIdeasSoftware.OLVColumn OlvUpdateDate;
private System.Windows.Forms.TabControl tabControl1;
private ryControls.ButtonEx BtnSubmitGit;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem 设为正式版本ToolStripMenuItem;
}
}
+115 -4
View File
@@ -1,4 +1,5 @@
using Microsoft.Win32;
using BrightIdeasSoftware;
using Microsoft.Win32;
using Newtonsoft.Json.Linq;
using ryCommon;
using ryCommonDb;
@@ -8,9 +9,11 @@ using SuperDesign.Tools;
using SuperDesign.Tools.UpLog;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Threading;
using System.Windows.Documents;
@@ -85,7 +88,49 @@ namespace 开发辅助工具.Tools
}
catch { }
OlvUpVer.AspectGetter = delegate (object x) { return ((UpLogItem)x).Version; };
OlvUpdateDate.AspectGetter = delegate (object x) { return ((UpLogItem)x).AddTime.ToDateTime().ToString(); };
OlvUpdateDate.AspectGetter = delegate (object x) {
var dt = ((UpLogItem)x).AddTime.ToDateTime();
if(dt.Date==DateTime.Now.Date)
{
return "今天 "+dt.ToString("HH:mm:ss");
}
if (dt.Date.AddDays(1) == DateTime.Now.Date)
{
return "昨天 " + dt.ToString("HH:mm:ss");
}
return dt.ToString();
};
OlvUpVer.Renderer = new VerRenderer();
}
class VerRenderer : BaseRenderer
{
public VerRenderer()
{
UseGdiTextRendering = false;
}
//
// 摘要:
// Draw the flags
//
// 参数:
// g:
//
// r:
public override void Render(Graphics g, Rectangle r)
{
DrawBackground(g, r);
if (!(base.Aspect is IConvertible convertible))
{
return;
}
r = ApplyCellPadding(r);
if (base.RowObject is UpLogItem item1)
{
var start_x = 2;
if (item1.VerType=="main") { start_x += DrawImage2(g, r, start_x,SuperDesign.Properties.Resources.fav); }
start_x += DrawText2(g, r, start_x, item1.Version);
}
}
}
/// <summary>
/// 获取毕方标准项目根路径
@@ -350,6 +395,7 @@ namespace 开发辅助工具.Tools
mySQL.AddField("VerStr", "");
mySQL.AddField("LogText", "");
mySQL.AddField("LogJson", "");
mySQL.AddField("VerType", "");//版本类型(main表示主线版本,beta表示测试版)
mySQL.AddField("editTime", DateTime.Now.ToInt64());
mySQL.AddField("addTime", DateTime.Now.ToInt64());
db.CreateDb(mySQL);
@@ -385,7 +431,9 @@ namespace 开发辅助工具.Tools
{
var row = ds_logs.GetRow(i);
list.Add(new UpLogItem() {
Id = row["id"].ToInt(),
Version = row["VerStr"].ToString(),
VerType = row["VerType"].ToString(),
LogJson = row["LogJson"].ToString(),
LogText = row["LogText"].ToString(),
AddTime = row["addTime"].ToInt64(),
@@ -1030,6 +1078,13 @@ namespace 开发辅助工具.Tools
}
private void BtnPublishLogs_Click(object sender, EventArgs e)
{
switch (MessageBox.Show("是否确认要发布更新日志?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2))
{
case DialogResult.OK:
break;
default:
return;
}
var _path = GetBFFolderPath();
if (_path.Length > 0)
{
@@ -1146,7 +1201,9 @@ namespace 开发辅助工具.Tools
var row = ds_logs.GetRow(i);
list.Add(new UpLogItem()
{
Id= row["id"].ToInt(),
Version = row["VerStr"].ToString(),
VerType = row["VerType"].ToString(),
LogText = row["LogText"].ToString(),
LogJson = row["LogJson"].ToString(),
AddTime = row["addTime"].ToInt64(),
@@ -1163,8 +1220,11 @@ namespace 开发辅助工具.Tools
}
ds_logs?.Dispose();
MessageBox.Show("发布成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
FrmPublishLogs frm = new FrmPublishLogs();
frm.Icon = Icon;
FrmPublishLogs frm = new FrmPublishLogs
{
Icon = Icon
};
frm.BFFolderPath = GetBFFolderPath();
frm.ShowLog(jarr.ToString());
frm.ShowDialog();
frm.Dispose();
@@ -1193,10 +1253,61 @@ namespace 开发辅助工具.Tools
}
frm.Dispose();
}
private void BtnSubmitGit_Click(object sender, EventArgs e)
{
var git_path = SuperDesign.Manager.APIManager.GetTortoiseGitProcPath();
if (git_path.Length > 0)
{
RyFiles.RunFile(git_path, "/command:commit", GetBFFolderPath());
}
}
private void 设为正式版本ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (LvUpdateLogList.SelectedObject == null) { return; }
var item = (UpLogItem)LvUpdateLogList.SelectedObject;
var _path = GetBFFolderPath();
if (_path.Length > 0)
{
var VerType = item.VerType == "main"?"beta": "main";
IDbInterface db = new SQLiteDataProvider();
if (db.ConnDb(_path + "\\Res\\Setting\\UpdateLogs.dat") == 1)
{
RyQuickSQL mySQL = new RyQuickSQL("UpdateLogs");
mySQL.AddField("VerType", VerType);
db.Update(mySQL,"id="+item.Id);
item.VerType = VerType;
LvUpdateLogList.RefreshObject(item);
}
db.Free();
}
}
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
{
if (LvUpdateLogList.SelectedObject == null) {
设为正式版本ToolStripMenuItem.Enabled = false;
return;
}
设为正式版本ToolStripMenuItem.Enabled = true;
var item = (UpLogItem)LvUpdateLogList.SelectedObject;
if(item.VerType=="main")
{
设为正式版本ToolStripMenuItem.Text = "设为测试版本";
}
else
{
设为正式版本ToolStripMenuItem.Text = "设为正式版本";
}
}
}
class UpLogItem
{
public int Id { get; set; } = 0;
public string Version { get; set; } = "";
public string VerType { get; set; } = "";
public string LogText { get; set; } = "";
public string LogJson { get; set; } = "";
public long AddTime { get; set; } = 0;
@@ -126,7 +126,7 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>285, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>285, 17</value>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>388, 17</value>
</metadata>
</root>
@@ -40,7 +40,7 @@
this.BtnCopyMD.Name = "BtnCopyMD";
this.BtnCopyMD.Size = new System.Drawing.Size(157, 46);
this.BtnCopyMD.TabIndex = 27;
this.BtnCopyMD.Text = "复制GIT更新日志(MD)";
this.BtnCopyMD.Text = "复制Git更新日志(MD)";
this.BtnCopyMD.UseDefSkin = false;
this.BtnCopyMD.UseVisualStyleBackColor = true;
this.BtnCopyMD.Click += new System.EventHandler(this.BtnCopyMD_Click);
@@ -7,6 +7,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -31,9 +32,42 @@ namespace SuperDesign.Tools.UpLog
}
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)
{
RyFiles.RunFile(git_path, "/command:commit", BFFolderPath);
using (var bg = new BackgroundWorker())
{
bg.DoWork += delegate { System.Threading.Thread.Sleep(1000); };//180秒后,3分钟
bg.RunWorkerCompleted += delegate {
var handle = RyForm.GetForegroundWindow();
var path = ryCommon.ProcessExt.GetPath(RyForm.GetProcessId(handle));
if (path != null && path.Length > 0)
{
var filename = System.IO.Path.GetFileName(path);
if (filename == "TortoiseGitProc.exe")
{
SendKeys.Send("^v");
}
}
else
{
index++;
if(index>10 || this.IsDisposed)
{
return;
}
System.Threading.Thread.Sleep(1000);
}
}; // 线程执行完成后会执行 RunWorkerCompleted 事伯的代码块
bg.RunWorkerAsync();
}
}
}
private void BtnCopyHtml_Click(object sender, EventArgs e)
@@ -51,7 +51,7 @@ namespace SuperDesign.Tools
Font = new Font("微软雅黑", 11),
ReadOnly=true,
BackColor=Color.White,
Location = new Point(label.Left, label.Top + label.Height + 2),
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= item.GetJsonValue("LogText", "")