### 2024-12-20 星期五更新
------ #### SuperDesign V3.0.2412.2002 - *.[新增]新增对.NET5以上项目文件的版本修改支持。 - *.[新增]新增支持双击历史更新记录,查看具体更新日志。 - *.[新增]更新日志新增对项目中文名称的设置和显示。 - *.[改进]当窗口失去焦点时,自动保存更新日志。 - *.[改进]对于同个项目,只允许打开一个实例的开发辅助工具。
This commit is contained in:
1 parent
993f1ca1a9
commit
179f349d8f
29 files changed
+1798
-759
No files matched your search
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using ryCommon;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,6 +10,68 @@ namespace SuperDesign.Manager
|
||||
{
|
||||
public class APIManager
|
||||
{
|
||||
public static string GetMdLogText(JArray jarr, DateTime dt)
|
||||
{
|
||||
string log_text = "### " + DateTime.Now.ToString("yyyy-MM-dd dddd") + "更新";
|
||||
log_text += "\r\n------";
|
||||
for (int i = 0; i < jarr.Count; i++)
|
||||
{
|
||||
var item = jarr[i];
|
||||
log_text += "\r\n#### " + item.GetJsonValue("ProjectName", "") + " V" + item.GetJsonValue("VerStr", "");
|
||||
var logs = item.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_text += "\r\n" + log_item;
|
||||
}
|
||||
else if (log_item.StartsWith("*."))
|
||||
{
|
||||
log_text += "\r\n- " + log_item;
|
||||
}
|
||||
else
|
||||
{
|
||||
log_text += "\r\n- *." + log_item;
|
||||
}
|
||||
}
|
||||
}
|
||||
return log_text;
|
||||
}
|
||||
public static string GetHtmlLogText(JArray jarr, DateTime dt)
|
||||
{
|
||||
string log_text = "";
|
||||
for (int i = 0; i < jarr.Count; i++)
|
||||
{
|
||||
var item = jarr[i];
|
||||
if(log_text.Length!=0)
|
||||
{
|
||||
log_text += "\r\n";
|
||||
}
|
||||
var ProjectName = item.GetJsonValue("ProjectChsName", "");
|
||||
if(ProjectName.Length==0)
|
||||
{
|
||||
ProjectName = item.GetJsonValue("ProjectName", "");
|
||||
}
|
||||
log_text += "<h4>" + System.Web.HttpUtility.HtmlEncode(ProjectName) + "</h4>";
|
||||
var logs = item.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_text += "\r\n<p>" +System.Web.HttpUtility.HtmlEncode(log_item.Substring(2))+"</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
log_text += "\r\n<p>" + System.Web.HttpUtility.HtmlEncode(log_item) + "</p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
return log_text;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取参数翻译名称
|
||||
/// </summary>
|
||||
|
||||
@@ -4,11 +4,13 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using 开发辅助工具.Controls;
|
||||
|
||||
namespace 开发辅助工具
|
||||
{
|
||||
public class Init
|
||||
{
|
||||
static System.Threading.Mutex run;
|
||||
public static void Show(string[] args)
|
||||
{
|
||||
if (args.Length >= 2)
|
||||
@@ -21,7 +23,23 @@ namespace 开发辅助工具
|
||||
else if (args[0] == "get")
|
||||
{
|
||||
string ProjectPath = args[1];
|
||||
Application.Run(new Form1(ProjectPath, "get"));
|
||||
run = new System.Threading.Mutex(true, "SuperDesign_"+rySafe.MD5Sha1.GetMD5(ProjectPath), out bool runone);
|
||||
if (!runone) //已经运行了
|
||||
{
|
||||
var handle = QuickMsg.RyMemoryShare.ReadFromMemory("SuperDesign" + rySafe.MD5Sha1.GetMD5(ProjectPath), 0);
|
||||
if(handle>0)
|
||||
{
|
||||
ryControls.Win32.SendMessage((IntPtr)handle, 17189, 100, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
Application.Run(new Form1(ProjectPath, "get"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Application.Run(new Form1(ProjectPath, "get"));
|
||||
}
|
||||
}
|
||||
else if (args[0] == "open")
|
||||
{
|
||||
|
||||
@@ -4,12 +4,15 @@ using ryCommonDb;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace 开发辅助工具.Manager
|
||||
{
|
||||
@@ -385,29 +388,101 @@ namespace 开发辅助工具.Manager
|
||||
string AssemblyInfo_path = AssemblyInfo_Path;
|
||||
if (System.IO.File.Exists(AssemblyInfo_path))
|
||||
{
|
||||
string[] AssemblyInfo_list = ryCommon.RyFiles.ReadAllLines(AssemblyInfo_path);
|
||||
string text = "";
|
||||
var ext = System.IO.Path.GetExtension(AssemblyInfo_path).ToLower();
|
||||
string Revision_Ver = DateTime.Now.ToString("yyMM");
|
||||
string Build_Ver = DateTime.Now.ToString("dd00");
|
||||
for (int i = 0; i < AssemblyInfo_list.Length; i++)
|
||||
if (ext == ".cs")
|
||||
{
|
||||
string item = AssemblyInfo_list[i];
|
||||
if (item.IndexOf("[assembly: AssemblyVersion(\"") == 0)
|
||||
string[] AssemblyInfo_list = ryCommon.RyFiles.ReadAllLines(AssemblyInfo_path);
|
||||
string text = "";
|
||||
for (int i = 0; i < AssemblyInfo_list.Length; i++)
|
||||
{
|
||||
|
||||
ChangeVer("[assembly: AssemblyVersion(\"");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyFileVersion(\"") == 0)
|
||||
{
|
||||
ChangeVer("[assembly: AssemblyFileVersion(\"");
|
||||
}
|
||||
if (text != "") { text += "\r\n"; }
|
||||
text += item;
|
||||
void ChangeVer(string id)
|
||||
{
|
||||
string ver = item.GetStr(id, "\")]", 0, out _, "");
|
||||
if (ver != "")
|
||||
string item = AssemblyInfo_list[i];
|
||||
if (item.IndexOf("[assembly: AssemblyVersion(\"") == 0)
|
||||
{
|
||||
ChangeVer("[assembly: AssemblyVersion(\"");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyFileVersion(\"") == 0)
|
||||
{
|
||||
ChangeVer("[assembly: AssemblyFileVersion(\"");
|
||||
}
|
||||
if (text != "") { text += "\r\n"; }
|
||||
text += item;
|
||||
void ChangeVer(string id)
|
||||
{
|
||||
string ver = item.GetStr(id, "\")]", 0, out _, "");
|
||||
if (ver != "")
|
||||
{
|
||||
string[] ver_list = ver.Split('.');
|
||||
if (ver_list.Length == 4)
|
||||
{
|
||||
if (ver_list[2] != Revision_Ver)
|
||||
{
|
||||
ver = ver_list[0] + "." + ver_list[1] + "." + Revision_Ver + "." + (Build_Ver.ToInt() + 1).ToString("0000");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ver_list[3].IndexOf(DateTime.Now.ToString("dd")) == 0)
|
||||
{
|
||||
ver = ver_list[0] + "." + ver_list[1] + "." + Revision_Ver + "." + (ver_list[3].ToInt() + 1).ToString("0000");
|
||||
}
|
||||
else
|
||||
{
|
||||
ver = ver_list[0] + "." + ver_list[1] + "." + Revision_Ver + "." + (Build_Ver.ToInt() + 1).ToString("0000");
|
||||
}
|
||||
}
|
||||
item = id + ver + "\")]";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ryCommon.RyFiles.WriteAllText(AssemblyInfo_path, text, Encoding.UTF8);
|
||||
}
|
||||
else if (ext == ".csproj")
|
||||
{
|
||||
System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
|
||||
xml.Load(AssemblyInfo_path);
|
||||
var xmlnsm = new XmlNamespaceManager(xml.NameTable);
|
||||
xmlnsm.AddNamespace("d", xml.DocumentElement.NamespaceURI);
|
||||
var root = @"d:Project//d:PropertyGroup//d:";
|
||||
bool set_result= SetValue("Version");
|
||||
if (!set_result)
|
||||
{
|
||||
var ver = "1.0." + Revision_Ver + "." + (Build_Ver.ToInt() + 1).ToString("0000");
|
||||
XmlNode node_PropertyGroup = xml.CreateNode(XmlNodeType.Element, "PropertyGroup", xml.DocumentElement.NamespaceURI);
|
||||
xml.ChildNodes[0].PrependChild(node_PropertyGroup);
|
||||
SetValue2("Version", ver, "程序集版本号");
|
||||
SetValue2("FileVersion", ver, "文件版本号,通常与程序集版本号相同");
|
||||
SetValue2("ProductVersion", ver, "产品版本号");
|
||||
SetValue2("AssemblyName", System.IO.Path.GetFileNameWithoutExtension(AssemblyInfo_path), "可选:程序集名称");
|
||||
SetValue2("AssemblyTitle", "", "可选:程序集标题");
|
||||
SetValue2("AssemblyDescription", "", "可选:程序集描述");
|
||||
SetValue2("Company", "睿元网络", "可选:程序集公司");
|
||||
SetValue2("Product", "", "可选:程序集产品");
|
||||
SetValue2("Trademark", "紫林软件2008-" + DateTime.Now.Year, "可选:程序集商标");
|
||||
void SetValue2(string name2, string ver2, string desc)
|
||||
{
|
||||
XmlComment tempNode_desc = xml.CreateComment(desc);
|
||||
tempNode_desc.InnerText = desc;
|
||||
XmlElement tempNode_node = xml.CreateElement(name2, xml.DocumentElement.NamespaceURI);
|
||||
tempNode_node.InnerText = ver2;
|
||||
node_PropertyGroup.AppendChild(tempNode_desc);
|
||||
node_PropertyGroup.AppendChild(tempNode_node);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SetValue("FileVersion");
|
||||
SetValue("ProductVersion");
|
||||
}
|
||||
xml.Save(AssemblyInfo_path);
|
||||
bool SetValue(string name)
|
||||
{
|
||||
var node = xml.SelectSingleNode(root + name, xmlnsm);
|
||||
if (node != null)
|
||||
{
|
||||
var ver = node.InnerText;
|
||||
string[] ver_list = ver.Split('.');
|
||||
if (ver_list.Length == 4)
|
||||
{
|
||||
@@ -426,12 +501,13 @@ namespace 开发辅助工具.Manager
|
||||
ver = ver_list[0] + "." + ver_list[1] + "." + Revision_Ver + "." + (Build_Ver.ToInt() + 1).ToString("0000");
|
||||
}
|
||||
}
|
||||
item = id + ver + "\")]";
|
||||
}
|
||||
node.InnerText= ver;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ryCommon.RyFiles.WriteAllText(AssemblyInfo_path, text, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -444,38 +520,70 @@ namespace 开发辅助工具.Manager
|
||||
var ver = new VerInfo();
|
||||
if (System.IO.File.Exists(AssemblyInfo_path))
|
||||
{
|
||||
string[] AssemblyInfo_list = ryCommon.RyFiles.ReadAllLines(AssemblyInfo_path);
|
||||
for (int i = 0; i < AssemblyInfo_list.Length; i++)
|
||||
var ext = System.IO.Path.GetExtension(AssemblyInfo_path).ToLower();
|
||||
if (ext == ".cs")
|
||||
{
|
||||
string item = AssemblyInfo_list[i];
|
||||
if (item.IndexOf("[assembly: AssemblyVersion(\"") == 0)
|
||||
string[] AssemblyInfo_list = ryCommon.RyFiles.ReadAllLines(AssemblyInfo_path);
|
||||
for (int i = 0; i < AssemblyInfo_list.Length; i++)
|
||||
{
|
||||
ver.Version= item.GetStr("[assembly: AssemblyVersion(\"", "\")]", 0, out _, "").Trim();
|
||||
string item = AssemblyInfo_list[i];
|
||||
if (item.IndexOf("[assembly: AssemblyVersion(\"") == 0)
|
||||
{
|
||||
ver.Version = item.GetStr("[assembly: AssemblyVersion(\"", "\")]", 0, out _, "").Trim();
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyFileVersion(\"") == 0)
|
||||
{
|
||||
ver.FileVersion = item.GetStr("[assembly: AssemblyFileVersion(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyTitle(\"") == 0)
|
||||
{
|
||||
ver.Title = item.GetStr("[assembly: AssemblyTitle(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyDescription(\"") == 0)
|
||||
{
|
||||
ver.Description = item.GetStr("[assembly: AssemblyDescription(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyCompany(\"") == 0)
|
||||
{
|
||||
ver.Company = item.GetStr("[assembly: AssemblyCompany(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyProduct(\"") == 0)
|
||||
{
|
||||
ver.Product = item.GetStr("[assembly: AssemblyProduct(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyCopyright(\"") == 0)
|
||||
{
|
||||
ver.Copyright = item.GetStr("[assembly: AssemblyCopyright(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyFileVersion(\"") == 0)
|
||||
}
|
||||
else if (ext == ".csproj")
|
||||
{
|
||||
try
|
||||
{
|
||||
ver.FileVersion = item.GetStr("[assembly: AssemblyFileVersion(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyTitle(\"") == 0)
|
||||
{
|
||||
ver.Title = item.GetStr("[assembly: AssemblyTitle(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyDescription(\"") == 0)
|
||||
{
|
||||
ver.Description = item.GetStr("[assembly: AssemblyDescription(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyCompany(\"") == 0)
|
||||
{
|
||||
ver.Company = item.GetStr("[assembly: AssemblyCompany(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyProduct(\"") == 0)
|
||||
{
|
||||
ver.Product = item.GetStr("[assembly: AssemblyProduct(\"", "\")]", 0, out _, "");
|
||||
}
|
||||
else if (item.IndexOf("[assembly: AssemblyCopyright(\"") == 0)
|
||||
{
|
||||
ver.Copyright = item.GetStr("[assembly: AssemblyCopyright(\"", "\")]", 0, out _, "");
|
||||
System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
|
||||
xml.Load(AssemblyInfo_path);
|
||||
var xmlnsm = new XmlNamespaceManager(xml.NameTable);
|
||||
xmlnsm.AddNamespace("d", xml.DocumentElement.NamespaceURI);
|
||||
var root = @"d:Project//d:PropertyGroup//d:";
|
||||
ver.Version = GetValue("Version");
|
||||
ver.FileVersion = GetValue("FileVersion");
|
||||
ver.Title = GetValue("AssemblyTitle");
|
||||
ver.Description = GetValue("AssemblyDescription");
|
||||
ver.Company = GetValue("Company");
|
||||
ver.Product = GetValue("Product");
|
||||
ver.Copyright = GetValue("Trademark");
|
||||
string GetValue(string name)
|
||||
{
|
||||
var node = xml.SelectSingleNode(root + name, xmlnsm);
|
||||
if (node != null)
|
||||
{
|
||||
return node.InnerText;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
return ver;
|
||||
|
||||
Reference in new issue
Block a user