diff --git a/.gitignore b/.gitignore index 6ef991c..397112f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ Res/ **/dcu *.dcu /Source/.vs +/Bin/Debug/SuperDesign/UserDb/Win.dat diff --git a/Bin/Debug/SuperDesign/SuperDesign.exe b/Bin/Debug/SuperDesign/SuperDesign.exe deleted file mode 100644 index 4812a99..0000000 Binary files a/Bin/Debug/SuperDesign/SuperDesign.exe and /dev/null differ diff --git a/Bin/Debug/SuperDesign/SysDb/.gitignore b/Bin/Debug/SuperDesign/SysDb/.gitignore index 58f8c3f..29d3d4c 100644 --- a/Bin/Debug/SuperDesign/SysDb/.gitignore +++ b/Bin/Debug/SuperDesign/SysDb/.gitignore @@ -4,4 +4,5 @@ Res/ *.pdb **/dcu *.dcu -**/Secure \ No newline at end of file +**/Secure +*/.vs \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fc21390..da83ce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,14 @@ -### 2024-12-20 星期五更新 +### 2024-12-21 星期六更新 +------ +#### SuperDesign V3.0.2412.2101 +- *.[新增]新增支持多选更新日志列表,合并生成Html日志。 +- *.[改进]支持设置解决方案中的哪些项目日志不显示在Html日志列表里。 +- *.[改进]打开时默认选中主项目的更新日志Tab。 +- *.[修复]修复创建项目时的版权日期不会随着当前日期更新的BUG。 +- *.[修复]修复创建项目时引用的RaUI项目文件无法转换成RaUI.dll的BUG。 +- *.[修复]修复连续快速打开项目,会导致软件多开的BUG。 + +### 2024-12-20 星期五更新 ------ #### SuperDesign V3.0.2412.2003 - *.[新增]新增支持更新日志发布时自动调用起TortoiseGit。 diff --git a/Source/开发辅助工具/Manager/APIManager.cs b/Source/开发辅助工具/Manager/APIManager.cs index a6df205..81e87d6 100644 --- a/Source/开发辅助工具/Manager/APIManager.cs +++ b/Source/开发辅助工具/Manager/APIManager.cs @@ -41,20 +41,26 @@ namespace SuperDesign.Manager } return log_text; } - public static string GetHtmlLogText(JArray jarr, DateTime dt) + 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]; - if(log_text.Length!=0) + 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 = item.GetJsonValue("ProjectName", ""); + ProjectName = eng_name; } log_text += "

" + System.Web.HttpUtility.HtmlEncode(ProjectName) + "

"; var logs = item.GetJsonValue("LogText", "").Replace("\r", "\n").Replace("\n\n", "\n").Split('\n'); diff --git a/Source/开发辅助工具/Manager/Init.cs b/Source/开发辅助工具/Manager/Init.cs index 00c06a6..3fe8749 100644 --- a/Source/开发辅助工具/Manager/Init.cs +++ b/Source/开发辅助工具/Manager/Init.cs @@ -1,4 +1,5 @@ -using System; +using ryCommon; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -23,17 +24,25 @@ namespace 开发辅助工具 else if (args[0] == "get") { string ProjectPath = args[1]; - run = new System.Threading.Mutex(true, "SuperDesign_"+rySafe.MD5Sha1.GetMD5(ProjectPath), out bool runone); + run = new System.Threading.Mutex(true, "S_"+rySafe.MD5Sha1.GetMD5(ProjectPath), out bool runone); if (!runone) //已经运行了 { - var handle = QuickMsg.RyMemoryShare.ReadFromMemory("SuperDesign" + rySafe.MD5Sha1.GetMD5(ProjectPath), 0); + Ini ini = new Ini(Application.StartupPath + "\\UserDb\\Win.dat"); + var handle = ini.ReadIni("ProjectHwnd", rySafe.MD5Sha1.GetMD5(ProjectPath),0); ; if(handle>0) { - ryControls.Win32.SendMessage((IntPtr)handle, 17189, 100, 100); + if (RyForm.GetWinText((IntPtr)handle).Length > 0) + { + ryControls.Win32.SendMessage((IntPtr)handle, 17189, 100, 100); + } + else + { + Application.Run(new Form1(ProjectPath, "get")); + } } else { - Application.Run(new Form1(ProjectPath, "get")); + // Application.Run(new Form1(ProjectPath, "get")); } } else diff --git a/Source/开发辅助工具/Manager/RyProject.cs b/Source/开发辅助工具/Manager/RyProject.cs index d201fe6..f05402d 100644 --- a/Source/开发辅助工具/Manager/RyProject.cs +++ b/Source/开发辅助工具/Manager/RyProject.cs @@ -291,7 +291,9 @@ namespace 开发辅助工具.Manager { var Reference_FileName = IncludePath.Substring(iPos + 1).ToLower();//引用的项目文件名称 string dll_name = ""; - if (Reference_FileName == "MyDbV4.csproj".ToLower()) + if (Reference_FileName == "RaUIV4.csproj".ToLower()) + { dll_name = "RaUI.dll"; } + else if (Reference_FileName == "MyDbV4.csproj".ToLower()) { dll_name = "MyDb.dll"; } else if (Reference_FileName == "MyDb_SQLiteV4.csproj".ToLower()) { dll_name = "MyDb_SQLite.dll"; } diff --git a/Source/开发辅助工具/Program.cs b/Source/开发辅助工具/Program.cs index e2d31b5..2a6fe30 100644 --- a/Source/开发辅助工具/Program.cs +++ b/Source/开发辅助工具/Program.cs @@ -4,21 +4,30 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; +using System.Windows.Documents; using System.Windows.Forms; namespace 开发辅助工具 { static class Program { + static System.Threading.Mutex run; /// /// 应用程序的主入口点。 /// [STAThread] static void Main(string[] args) { + //run = new System.Threading.Mutex(true, "SuperDesign", out bool runone); + //if(!runone) + //{ + // return; + //} AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + //run.ReleaseMutex(); + //run.Close(); Init.Show(args); } static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) diff --git a/Source/开发辅助工具/Properties/AssemblyInfo.cs b/Source/开发辅助工具/Properties/AssemblyInfo.cs index be44b9c..8ff41c8 100644 --- a/Source/开发辅助工具/Properties/AssemblyInfo.cs +++ b/Source/开发辅助工具/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("开发辅助工具")] -[assembly: AssemblyCopyright("Copyright © 2018-2021")] +[assembly: AssemblyCopyright("Copyright © 2018-2024")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2412.2003")] -[assembly: AssemblyFileVersion("3.0.2412.2003")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.2412.2101")] +[assembly: AssemblyFileVersion("3.0.2412.2101")] \ No newline at end of file diff --git a/Source/开发辅助工具/SuperDesign.csproj.user b/Source/开发辅助工具/SuperDesign.csproj.user index 17827e6..62c4d01 100644 --- a/Source/开发辅助工具/SuperDesign.csproj.user +++ b/Source/开发辅助工具/SuperDesign.csproj.user @@ -1,7 +1,7 @@ - get "E:\My Datas\My Codes\毕方项目\CSharp\HttpServer\Source\HttpServer\DyAPI_Web\DyWebAPI.csproj" + get "E:\My Datas\My Codes\毕方项目\CSharp\SuperDesign\Source\开发辅助工具\SuperDesign.csproj" ShowAllFiles diff --git a/Source/开发辅助工具/Tools/FrmCreateProject.cs b/Source/开发辅助工具/Tools/FrmCreateProject.cs index 92a42ca..56c6763 100644 --- a/Source/开发辅助工具/Tools/FrmCreateProject.cs +++ b/Source/开发辅助工具/Tools/FrmCreateProject.cs @@ -194,7 +194,7 @@ namespace 开发辅助工具.Tools var AssemblyInfo = ryCommon.RyFiles.ReadAllText(Application.StartupPath + "\\SysDb\\AssemblyInfo.cs"); AssemblyInfo = AssemblyInfo.Replace("@AssemblyTitle", project_Eng_name); AssemblyInfo = AssemblyInfo.Replace("@AssemblyProduct", project_Eng_name); - AssemblyInfo = AssemblyInfo.Replace("@Copyright", "Copyright 2010-2021"); + AssemblyInfo = AssemblyInfo.Replace("@Copyright", "Copyright 2010-"+DateTime.Now.Year); ryCommon.RyFiles.WriteAllText(source_folder + "\\Properties\\AssemblyInfo.cs", AssemblyInfo, Encoding.UTF8); #endregion #region 替换命名空间 diff --git a/Source/开发辅助工具/Tools/FrmProject.Designer.cs b/Source/开发辅助工具/Tools/FrmProject.Designer.cs index 9f020cd..d8e561e 100644 --- a/Source/开发辅助工具/Tools/FrmProject.Designer.cs +++ b/Source/开发辅助工具/Tools/FrmProject.Designer.cs @@ -86,6 +86,7 @@ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.设为正式版本ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.BtnPublishLogs = new ryControls.ButtonEx(); + this.生成Html日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.table1)).BeginInit(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -721,12 +722,14 @@ // 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.BaseColor = System.Drawing.Color.Green; + this.BtnSubmitGit.ColorGradient = true; 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.UseDefSkin = false; this.BtnSubmitGit.UseVisualStyleBackColor = true; this.BtnSubmitGit.Click += new System.EventHandler(this.BtnSubmitGit_Click); // @@ -787,30 +790,40 @@ // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.设为正式版本ToolStripMenuItem}); + this.设为正式版本ToolStripMenuItem, + this.生成Html日志ToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48); + this.contextMenuStrip1.Size = new System.Drawing.Size(181, 70); 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.Size = new System.Drawing.Size(148, 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))); - this.BtnPublishLogs.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95))))); + this.BtnPublishLogs.BaseColor = System.Drawing.Color.Green; + this.BtnPublishLogs.ColorGradient = true; this.BtnPublishLogs.Location = new System.Drawing.Point(822, 3); this.BtnPublishLogs.Name = "BtnPublishLogs"; this.BtnPublishLogs.Size = new System.Drawing.Size(75, 33); this.BtnPublishLogs.TabIndex = 9; this.BtnPublishLogs.Text = "发布日志"; + this.BtnPublishLogs.UseDefSkin = false; this.BtnPublishLogs.UseVisualStyleBackColor = true; this.BtnPublishLogs.Click += new System.EventHandler(this.BtnPublishLogs_Click); // + // 生成Html日志ToolStripMenuItem + // + this.生成Html日志ToolStripMenuItem.Name = "生成Html日志ToolStripMenuItem"; + this.生成Html日志ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.生成Html日志ToolStripMenuItem.Text = "生成Html日志"; + this.生成Html日志ToolStripMenuItem.Click += new System.EventHandler(this.生成Html日志ToolStripMenuItem_Click); + // // FrmProject // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -829,6 +842,7 @@ this.Deactivate += new System.EventHandler(this.FrmProject_Deactivate); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmProject_FormClosing); this.Load += new System.EventHandler(this.FrmProject_Load); + this.Shown += new System.EventHandler(this.FrmProject_Shown); ((System.ComponentModel.ISupportInitialize)(this.table1)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); @@ -908,5 +922,6 @@ private ryControls.ButtonEx BtnSubmitGit; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem 设为正式版本ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 生成Html日志ToolStripMenuItem; } } \ No newline at end of file diff --git a/Source/开发辅助工具/Tools/FrmProject.cs b/Source/开发辅助工具/Tools/FrmProject.cs index 11adf67..1a39a58 100644 --- a/Source/开发辅助工具/Tools/FrmProject.cs +++ b/Source/开发辅助工具/Tools/FrmProject.cs @@ -384,155 +384,8 @@ namespace 开发辅助工具.Tools } private void FrmProject_Load(object sender, EventArgs e) { - var k=QuickMsg.RyMemoryShare.WriteToMemory(this.Handle.ToInt32(),"SuperDesign" + rySafe.MD5Sha1.GetMD5(_ProjectPath)); - var _path = GetBFFolderPath(); - if (_path.Length>0) - { - IDbInterface db = new SQLiteDataProvider(); - if (db.ConnDb(_path+ "\\Res\\Setting\\UpdateLogs.dat") == 1) - { - RyQuickSQL mySQL = new RyQuickSQL("UpdateLogs"); - 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); - #region 项目当前日志表 - mySQL.Clear(); - mySQL.TableName = "ProjectNowLogs"; - mySQL.AddField("Name", ""); - mySQL.AddField("ChsName", "");//值 - mySQL.AddField("Value", "");//值 - mySQL.AddField("editTime", DateTime.Now.ToInt64()); - mySQL.AddField("addTime", DateTime.Now.ToInt64()); - if (db.CreateDb(mySQL) == 1) - { - db.ExecuteNonQuery("CREATE INDEX index_Name ON ProjectNowLogs(Name); "); - } - #endregion - #region 设置表 - mySQL.Clear(); - mySQL.TableName = "Settings"; - mySQL.AddField("Name", ""); - mySQL.AddField("Value", "");//值 - mySQL.AddField("addTime", DateTime.Now); - if (db.CreateDb(mySQL) == 1) - { - db.ExecuteNonQuery("CREATE INDEX index_Name ON Settings(Name); "); - } - #endregion - var ds_logs = db.ReadData("select * from UpdateLogs order by addTime desc"); - if(ds_logs.HaveData()) - { - List list = new List(); - for (int i = 0; i < ds_logs.RowCount(); i++) - { - 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(), - }); - } - LvUpdateLogList.AddObjects(list); - OlvUpVer.Text = "版本(" + list.Count + ")"; - tabPage4.Text = "更新日志("+ list.Count + ")"; - } - ds_logs?.Dispose(); - var all_project_path= GetAllProjectFiles(); - for (int i = 0; i < all_project_path.Count; i++) - { - var p_name = ""; - try - { - System.Xml.XmlDocument xml = new System.Xml.XmlDocument(); - xml.Load(all_project_path[i]); - var xmlnsm = new XmlNamespaceManager(xml.NameTable); - xmlnsm.AddNamespace("d", xml.DocumentElement.NamespaceURI); - var root = @"d:Project//d:PropertyGroup//d:"; - p_name = GetValue("AssemblyName"); - if(p_name.Length==0) - { - p_name = System.IO.Path.GetFileNameWithoutExtension(all_project_path[i]); - } - string GetValue(string name) - { - var node = xml.SelectSingleNode(root + name, xmlnsm); - if (node != null) - { - return node.InnerText; - } - return ""; - } - } - catch { } - if (p_name.Length == 0) { continue; } - ProjectLogItem projectLogItem = new ProjectLogItem - { - ProjectName = p_name, - ProjectPath = all_project_path[i], - VersionPath= System.IO.Path.GetDirectoryName(all_project_path[i]) + "\\Properties\\AssemblyInfo.cs", - }; - if(!System.IO.File.Exists(projectLogItem.VersionPath)) - { - projectLogItem.VersionPath = all_project_path[i]; - } - TabPage tab = new TabPage() - { - Text = p_name, - Tag= projectLogItem - }; - Label label_title = new Label - { - Parent = tab, - Location = new Point(1, 10), - AutoSize = true, - Tag = "title", - Text = "中文名:" - }; - ryControls.TextBoxEx2 txt_title = new ryControls.TextBoxEx2 - { - Parent = tab, - Location = new Point(label_title.Left+ label_title.Width+1, 4), - Width = 200, - Height= 25, - Tag = "", - Text = "" - }; - Label label = new Label - { - Parent = tab, - Location = new Point(txt_title.Left+ txt_title.Width+2, 10), - AutoSize=true, - Tag="version", - Text = "版本号:" + projectLogItem.Version - }; - RichTextBox2 rich = new RichTextBox2 - { - Parent = tab, - Dock = DockStyle.Fill, - Font=new Font("微软雅黑",11), - Location = new Point(label_title.Left, label_title.Top + label_title.Height+10), - Size = new Size(tab.ClientSize.Width,tab.ClientSize.Height-(label_title.Top + label_title.Height+8)), - Anchor= AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom - }; - var ds_now_up = db.ReadData("select * from ProjectNowLogs where Name='" + p_name + "'"); - if (ds_now_up.HaveData()) - { - txt_title.Text = ds_now_up.GetRow(0)["ChsName"].ToString(); - rich.Text = ds_now_up.GetRow(0)["Value"].ToString(); - } - ds_now_up?.Dispose(); - tabControl1.TabPages.Add(tab); - } - } - db.Free(); - } + Ini ini = new Ini(Application.StartupPath+"\\UserDb\\Win.dat"); + ini.WriteIni("ProjectHwnd", rySafe.MD5Sha1.GetMD5(_ProjectPath), this.Handle.ToInt32()); } class ProjectLogItem { @@ -1074,7 +927,9 @@ namespace 开发辅助工具.Tools private void FrmProject_FormClosing(object sender, FormClosingEventArgs e) { SaveUpdateLog(); - QuickMsg.RyMemoryShare.DelMemory("SuperDesign" + rySafe.MD5Sha1.GetMD5(_ProjectPath)); + Ini ini = new Ini(Application.StartupPath + "\\UserDb\\Win.dat"); + ini.DelKey("ProjectHwnd", rySafe.MD5Sha1.GetMD5(_ProjectPath)); + //QuickMsg.RyMemoryShare.DelMemory("S" + rySafe.MD5Sha1.GetMD5(_ProjectPath)); } private void BtnPublishLogs_Click(object sender, EventArgs e) { @@ -1302,6 +1157,310 @@ namespace 开发辅助工具.Tools 设为正式版本ToolStripMenuItem.Text = "设为正式版本"; } } + + private void FrmProject_Shown(object sender, EventArgs e) + { + var _path = GetBFFolderPath(); + if (_path.Length > 0) + { + Ini ini = new Ini(_path + "\\查看项目.ryp"); + var Main_Project = ini.ReadIni("project", "MainProject", ""); + IDbInterface db = new SQLiteDataProvider(); + if (db.ConnDb(_path + "\\Res\\Setting\\UpdateLogs.dat") == 1) + { + RyQuickSQL mySQL = new RyQuickSQL("UpdateLogs"); + 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); + #region 项目当前日志表 + mySQL.Clear(); + mySQL.TableName = "ProjectNowLogs"; + mySQL.AddField("Name", ""); + mySQL.AddField("ChsName", "");//值 + mySQL.AddField("Value", "");//值 + mySQL.AddField("editTime", DateTime.Now.ToInt64()); + mySQL.AddField("addTime", DateTime.Now.ToInt64()); + if (db.CreateDb(mySQL) == 1) + { + db.ExecuteNonQuery("CREATE INDEX index_Name ON ProjectNowLogs(Name); "); + } + #endregion + #region 设置表 + mySQL.Clear(); + mySQL.TableName = "Settings"; + mySQL.AddField("Name", ""); + mySQL.AddField("Value", "");//值 + mySQL.AddField("addTime", DateTime.Now); + if (db.CreateDb(mySQL) == 1) + { + db.ExecuteNonQuery("CREATE INDEX index_Name ON Settings(Name); "); + } + #endregion + var ds_logs = db.ReadData("select * from UpdateLogs order by addTime desc"); + if (ds_logs.HaveData()) + { + List list = new List(); + for (int i = 0; i < ds_logs.RowCount(); i++) + { + 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(), + }); + } + LvUpdateLogList.AddObjects(list); + OlvUpVer.Text = "版本(" + list.Count + ")"; + tabPage4.Text = "更新日志(" + list.Count + ")"; + } + ds_logs?.Dispose(); + var all_project_path = GetAllProjectFiles(); + for (int i = 0; i < all_project_path.Count; i++) + { + var p_name = ""; + try + { + System.Xml.XmlDocument xml = new System.Xml.XmlDocument(); + xml.Load(all_project_path[i]); + var xmlnsm = new XmlNamespaceManager(xml.NameTable); + xmlnsm.AddNamespace("d", xml.DocumentElement.NamespaceURI); + var root = @"d:Project//d:PropertyGroup//d:"; + p_name = GetValue("AssemblyName"); + if (p_name.Length == 0) + { + p_name = System.IO.Path.GetFileNameWithoutExtension(all_project_path[i]); + } + string GetValue(string name) + { + var node = xml.SelectSingleNode(root + name, xmlnsm); + if (node != null) + { + return node.InnerText; + } + return ""; + } + } + catch { } + if (p_name.Length == 0) { continue; } + ProjectLogItem projectLogItem = new ProjectLogItem + { + ProjectName = p_name, + ProjectPath = all_project_path[i], + VersionPath = System.IO.Path.GetDirectoryName(all_project_path[i]) + "\\Properties\\AssemblyInfo.cs", + }; + if (!System.IO.File.Exists(projectLogItem.VersionPath)) + { + projectLogItem.VersionPath = all_project_path[i]; + } + TabPage tab = new TabPage() + { + Text = p_name, + Tag = projectLogItem + }; + Label label_title = new Label + { + Parent = tab, + Location = new Point(1, 10), + AutoSize = true, + Tag = "title", + Text = "中文名:" + }; + ryControls.TextBoxEx2 txt_title = new ryControls.TextBoxEx2 + { + Parent = tab, + Location = new Point(label_title.Left + label_title.Width + 1, 4), + Width = 200, + Height = 25, + Tag = "", + Text = "" + }; + Label label = new Label + { + Parent = tab, + Location = new Point(txt_title.Left + txt_title.Width + 2, 10), + AutoSize = true, + Tag = "version", + Text = "版本号:" + projectLogItem.Version + }; + RichTextBox2 rich = new RichTextBox2 + { + Parent = tab, + Dock = DockStyle.Fill, + Font = new Font("微软雅黑", 11), + Location = new Point(label_title.Left, label_title.Top + label_title.Height + 10), + Size = new Size(tab.ClientSize.Width, tab.ClientSize.Height - (label_title.Top + label_title.Height + 8)), + Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom + }; + var ds_now_up = db.ReadData("select * from ProjectNowLogs where Name='" + p_name + "'"); + if (ds_now_up.HaveData()) + { + txt_title.Text = ds_now_up.GetRow(0)["ChsName"].ToString(); + rich.Text = ds_now_up.GetRow(0)["Value"].ToString(); + } + ds_now_up?.Dispose(); + tabControl1.TabPages.Add(tab); + if (p_name == Main_Project) + { + tabControl1.SelectedTab = tab; + } + } + } + db.Free(); + } + } + class UpContentInfo + { + public List AddInfo { get; set; } = new List(); + public List DelInfo { get; set; } = new List(); + /// + /// 改进信息 + /// + public List BetterInfo { get; set; } = new List(); + /// + /// 修复信息 + /// + public List FixInfo { get; set; } = new List(); + public List OtherInfo { get; set; } = new List(); + } + private void 生成Html日志ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (LvUpdateLogList.SelectedObjects.Count==0) { return; } + ryCommon.Ini ini = new Ini(GetBFFolderPath() + "\\查看项目.ryp"); + var list = LvUpdateLogList.SelectedObjects; + List list2 = new List(); + for (int i = 0; i < list.Count; i++) + { + var item = (UpLogItem)list[i]; + list2.Add(item); + } + list2.Sort((x, y) => x.CompareTo(y)); + var Main_Project = ini.ReadIni("project", "MainProject", ""); + Dictionary dict_up = new Dictionary(); + Dictionary dict_eng_to_chs = new Dictionary(); + for (int i = 0; i < list2.Count; i++) + { + var item =list2[i]; + try + { + JArray jarr = JArray.Parse(item.LogJson); + for (int j = 0; j < jarr.Count; j++) + { + var item_json = jarr[j]; + var eng_name = item_json.GetJsonValue("ProjectName", ""); + if (ini.ReadIni("NoVerHtml", eng_name, 0) == 1) + { + continue; + } + var ProjectChsName = item_json.GetJsonValue("ProjectChsName", ""); + if (ProjectChsName.Length> 0) + { + if (!dict_eng_to_chs.ContainsKey(eng_name)) + { dict_eng_to_chs[eng_name] = ProjectChsName; } + } + if(!dict_up.ContainsKey(eng_name)) + { + dict_up[eng_name] = new UpContentInfo(); + } + var up_content = dict_up[eng_name]; + var logs = item_json.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.StartsWith("- *.")) + { + log_item=log_item.Substring(2); + } + #region 更新日志 + var name = log_item.GetStr("[", "]"); + if (name == "新增") + { + up_content.AddInfo.Add(log_item); + } + else if (name == "改进" || name == "优化") + { + up_content.BetterInfo.Add(log_item); + } + else if (name == "删除") + { + up_content.DelInfo.Add(log_item); + } + else if (name == "修复") + { + up_content.FixInfo.Add(log_item); + } + else + { + up_content.OtherInfo.Add(log_item); + } + #endregion + } + } + } + catch { } + } + string log_text = ""; + if (dict_up.ContainsKey(Main_Project)) + { + log_text += "

" + System.Web.HttpUtility.HtmlEncode(dict_eng_to_chs.ContainsKey(Main_Project)? dict_eng_to_chs[Main_Project]:Main_Project) + "

"; + var main_info = dict_up[Main_Project]; + for (int i = 0; i < main_info.AddInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.AddInfo[i]) + "

"; + } + for (int i = 0; i < main_info.BetterInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.BetterInfo[i]) + "

"; + } + for (int i = 0; i < main_info.DelInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.DelInfo[i]) + "

"; + } + for (int i = 0; i < main_info.FixInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.FixInfo[i]) + "

"; + } + for (int i = 0; i < main_info.OtherInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.OtherInfo[i]) + "

"; + } + } + foreach (var item in dict_up) + { + if (item.Key == Main_Project) { continue; } + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(dict_eng_to_chs.ContainsKey(item.Key) ? dict_eng_to_chs[item.Key] : item.Key) + "

"; + var main_info = item.Value; + for (int i = 0; i < main_info.AddInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.AddInfo[i]) + "

"; + } + for (int i = 0; i < main_info.BetterInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.BetterInfo[i]) + "

"; + } + for (int i = 0; i < main_info.DelInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.DelInfo[i]) + "

"; + } + for (int i = 0; i < main_info.FixInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.FixInfo[i]) + "

"; + } + for (int i = 0; i < main_info.OtherInfo.Count; i++) + { + log_text += "\r\n

" + System.Web.HttpUtility.HtmlEncode(main_info.OtherInfo[i]) + "

"; + } + } + RyFiles.CopyToClip(log_text.Trim()); + } } class UpLogItem { @@ -1311,5 +1470,9 @@ namespace 开发辅助工具.Tools public string LogText { get; set; } = ""; public string LogJson { get; set; } = ""; public long AddTime { get; set; } = 0; + public int CompareTo(UpLogItem other) + { + return RySoft.CompareVer(Version, other.Version); + } } } diff --git a/Source/开发辅助工具/Tools/FrmProject.resx b/Source/开发辅助工具/Tools/FrmProject.resx index 9d3a98e..91b9b63 100644 --- a/Source/开发辅助工具/Tools/FrmProject.resx +++ b/Source/开发辅助工具/Tools/FrmProject.resx @@ -126,6 +126,9 @@ 285, 17 + + 285, 17 + 388, 17 diff --git a/Source/开发辅助工具/Tools/UpLog/FrmPublishLogs.cs b/Source/开发辅助工具/Tools/UpLog/FrmPublishLogs.cs index 00ebd9e..8820a3d 100644 --- a/Source/开发辅助工具/Tools/UpLog/FrmPublishLogs.cs +++ b/Source/开发辅助工具/Tools/UpLog/FrmPublishLogs.cs @@ -28,7 +28,7 @@ namespace SuperDesign.Tools.UpLog { JArray jarr = JArray.Parse(LogJson); MdLog = SuperDesign.Manager.APIManager.GetMdLogText(jarr, DateTime.Now); - HtmlLog = SuperDesign.Manager.APIManager.GetHtmlLogText(jarr, DateTime.Now); + HtmlLog = SuperDesign.Manager.APIManager.GetHtmlLogText(BFFolderPath, jarr, DateTime.Now); } catch { } }