*.将打包功能移植到RyProject.cs。
This commit is contained in:
parent
59677e1a85
commit
d32f91ab95
Bin/Debug/SuperDesign
Source
.vs/开发辅助工具/v16
开发辅助工具
Binary file not shown.
Binary file not shown.
|
@ -1,2 +1,3 @@
|
|||
VS2019项目目录|E:\SysDoc\Documents\Visual Studio 2019\Projects\
|
||||
程序开发源码|E:\我的代码\毕方项目\C#
|
||||
程序开发源码|E:\My Datas\毕方项目\C#
|
Binary file not shown.
|
@ -2,8 +2,11 @@
|
|||
using ryCommonDb;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
|
||||
namespace 开发辅助工具.Manager
|
||||
|
@ -31,6 +34,12 @@ namespace 开发辅助工具.Manager
|
|||
/// 是否修改输出路径
|
||||
/// </summary>
|
||||
public bool ChangedOutputPath { get; set; } =true;
|
||||
public delegate void StringEventHandler(object sender, string e);
|
||||
/// <summary>
|
||||
/// 状态变化时激发
|
||||
/// </summary>
|
||||
[Description("状态变化时激发")]
|
||||
public event StringEventHandler OnStateChanged;
|
||||
public RyProject()
|
||||
{
|
||||
UpdateSetting();
|
||||
|
@ -399,5 +408,120 @@ namespace 开发辅助工具.Manager
|
|||
ryCommon.RyFiles.WriteAllText(AssemblyInfo_path, text, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 等待进程执行完毕
|
||||
/// </summary>
|
||||
/// <param name="cmd_text"></param>
|
||||
/// <returns></returns>
|
||||
public string Read_Prog(string exe, string cmd_text)
|
||||
{
|
||||
String cmd = exe;
|
||||
Process p = new Process
|
||||
{
|
||||
StartInfo = new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = cmd,//设定程序名
|
||||
Arguments = cmd_text,
|
||||
UseShellExecute = false, //关闭shell的使用
|
||||
RedirectStandardInput = true, //重定向标准输入
|
||||
RedirectStandardOutput = true, //重定向标准输出
|
||||
RedirectStandardError = false, //重定向错误输出
|
||||
CreateNoWindow = true//设置不显示窗口
|
||||
}
|
||||
};
|
||||
p.Start();
|
||||
string result = p.StandardOutput.ReadToEnd();
|
||||
p.WaitForExit(20000);
|
||||
p.Close();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 进行打包
|
||||
/// </summary>
|
||||
/// <param name="project_folder">项目根目录</param>
|
||||
public void Pack(string project_folder)
|
||||
{
|
||||
var com_mode = "Debug";
|
||||
DataProvider mydb = new DataProvider();
|
||||
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
|
||||
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
|
||||
{
|
||||
var ds = db.ReadData("select * from Settings where name='Setting'");
|
||||
if (mydb.HaveData(ds))
|
||||
{
|
||||
var row = mydb.GetData(ds);
|
||||
ryCommon.Storage mStor = new ryCommon.Storage(row["value"].ToString());
|
||||
mStor.SelectNodeBySet();
|
||||
var ReactorPath = mStor.GetAttrValue("ReactorPath");
|
||||
var WinRARPath = mStor.GetAttrValue("WinRARPath");
|
||||
if (WinRARPath == "")
|
||||
{
|
||||
if (System.IO.File.Exists(@"C:\Program Files\WinRAR\WinRAR.exe"))
|
||||
{
|
||||
WinRARPath = @"C:\Program Files\WinRAR\WinRAR.exe";
|
||||
}
|
||||
}
|
||||
var bf_folder = project_folder;
|
||||
if (bf_folder != "")
|
||||
{
|
||||
ryCommon.Ini ini = new ryCommon.Ini(bf_folder + "\\查看项目.ryp");
|
||||
var eng_name = ini.ReadIni("project", "engname");
|
||||
var proglang = ini.ReadIni("project", "proglang");
|
||||
var ouput_folder = bf_folder + "\\Bin\\" + com_mode + "\\" + eng_name;
|
||||
var file_ver = "";
|
||||
if (System.IO.File.Exists(ouput_folder + "\\" + eng_name + ".exe"))
|
||||
{
|
||||
FileVersionInfo fileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(ouput_folder + "\\" + eng_name + ".exe");
|
||||
file_ver = fileVerInfo.ProductVersion;
|
||||
}
|
||||
if (proglang == "c#")
|
||||
{
|
||||
ShowState("正在进行混淆...");
|
||||
if (System.IO.File.Exists(bf_folder + "\\Bin\\混淆_" + com_mode + ".nrproj"))
|
||||
{
|
||||
var cmd = Read_Prog(ReactorPath, "-project \"" + bf_folder + "\\Bin\\混淆_" + com_mode + ".nrproj\"");
|
||||
MessageBox.Show(cmd, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
ShowState("正在清理不重要的缓存...");
|
||||
ryCommon.RyFiles.DeleteFile(ouput_folder + "\\Secure\\*.pdb");
|
||||
ShowState("复制混淆文件到底包目录...");
|
||||
ryCommon.RyFiles.CopyFile(ouput_folder + "\\Secure\\*", bf_folder + "\\Publish\\OriginalFiles\\");
|
||||
#region 复制自定义规则文件到底包目录
|
||||
ShowState("复制自定义规则文件到底包目录...");
|
||||
var Publish = ryCommon.RyFiles.ReadAllLines(bf_folder + "\\Publish\\Publish.set");
|
||||
for (int m = 0; m < Publish.Length; m++)
|
||||
{
|
||||
var line = Publish[m].Trim();
|
||||
if (line == "" || line.IndexOf("#") == 0) { continue; }
|
||||
if (line.IndexOfEx("del:") == 0)
|
||||
{
|
||||
ryCommon.RyFiles.DeleteFile(bf_folder + "\\Publish\\OriginalFiles\\" + line.Substring(4));
|
||||
}
|
||||
else if (line.IndexOfEx("copy:") == 0)
|
||||
{
|
||||
var from_to = line.Substring(5).Replace("->", "|").Split('|');
|
||||
if (from_to.Length == 2)
|
||||
{
|
||||
var from_path = from_to[0];
|
||||
var to_path = from_to[1];
|
||||
ryCommon.RyFiles.CopyFile(ouput_folder + "\\" + from_path, bf_folder + "\\Publish\\OriginalFiles\\" + to_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
ShowState("正在打包...");
|
||||
var cmd2 = Read_Prog(WinRARPath, "-r -ep1 a \"" + bf_folder + "\\Publish\\Green\\" + eng_name + ".zip\" \"" + bf_folder + "\\Publish\\OriginalFiles\\\"");
|
||||
RyFiles.CopyFile(bf_folder + "\\Publish\\Green\\" + eng_name + ".zip", bf_folder + "\\Publish\\Green\\HistoryVer\\" + eng_name + "_" + file_ver + ".zip");
|
||||
ShowState("打包完成...");
|
||||
}
|
||||
}
|
||||
}
|
||||
db.Free();
|
||||
void ShowState(string text)
|
||||
{
|
||||
OnStateChanged?.Invoke(this,text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace 开发辅助工具.Tools
|
|||
if (!System.IO.File.Exists(full_path + "\\CHANGELOG.md"))
|
||||
{ ryCommon.RyFiles.WriteAllText(full_path + "\\CHANGELOG.md", "", Encoding.UTF8); }
|
||||
if (!System.IO.File.Exists(full_path + "\\README.md"))
|
||||
{ ryCommon.RyFiles.WriteAllText(full_path + "\\README.md", "", Encoding.UTF8); }
|
||||
{ ryCommon.RyFiles.WriteAllText(full_path + "\\README.md", "# "+ project_name+ "\r\n\r\n#### 介绍\r\n", Encoding.UTF8); }
|
||||
if (!System.IO.File.Exists(full_path + "\\Publish\\Publish.set"))
|
||||
{
|
||||
ryCommon.RyFiles.WriteAllText(full_path + "\\Publish\\Publish.set", "#del表示删除文件;copy表示复制文件;" +
|
||||
|
@ -157,15 +157,14 @@ namespace 开发辅助工具.Tools
|
|||
#endregion
|
||||
}
|
||||
#region 设置项目配置文件
|
||||
if (!System.IO.File.Exists(full_path + "\\查看项目.ryp"))
|
||||
{
|
||||
ryCommon.Ini ini = new ryCommon.Ini(full_path + "\\查看项目.ryp");
|
||||
ini.WriteIni("project", "name", project_name);//项目名称
|
||||
ini.WriteIni("project", "engname", project_Eng_name);//英文项目名称
|
||||
ini.WriteIni("project", "usqver", 2.1);//使用的标准版本,新毕方项目标准基于USQ 2.1
|
||||
ini.WriteIni("project", "proglang", prog_lang);//项目使用的语言
|
||||
ini.WriteIni("project", "progID", Guid.NewGuid().ToString("D"));//项目唯一ID,用于区分不同项目
|
||||
}
|
||||
var guid = ini.ReadIni("project", "progID", Guid.NewGuid().ToString("D"));
|
||||
ini.WriteIni("project", "progID", guid);//项目唯一ID,用于区分不同项目
|
||||
|
||||
if (!System.IO.File.Exists(full_path + "\\.gitignore")) //复制git忽略规则
|
||||
{
|
||||
RyFiles.CopyFile(Application.StartupPath+ "\\SysDb\\.gitignore", full_path + "\\.gitignore");
|
||||
|
|
|
@ -239,95 +239,24 @@ namespace 开发辅助工具.Tools
|
|||
th.Start();
|
||||
void Start()
|
||||
{
|
||||
var com_mode = "Debug";
|
||||
DataProvider mydb = new DataProvider();
|
||||
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
|
||||
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
|
||||
{
|
||||
var ds = db.ReadData("select * from Settings where name='Setting'");
|
||||
if (mydb.HaveData(ds))
|
||||
{
|
||||
var row = mydb.GetData(ds);
|
||||
ryCommon.Storage mStor = new ryCommon.Storage(row["value"].ToString());
|
||||
mStor.SelectNodeBySet();
|
||||
var ReactorPath = mStor.GetAttrValue("ReactorPath");
|
||||
var WinRARPath = mStor.GetAttrValue("WinRARPath");
|
||||
if (WinRARPath == "")
|
||||
{
|
||||
if (System.IO.File.Exists(@"C:\Program Files\WinRAR\WinRAR.exe"))
|
||||
{
|
||||
WinRARPath = @"C:\Program Files\WinRAR\WinRAR.exe";
|
||||
}
|
||||
}
|
||||
var bf_folder = GetBFFolderPath();
|
||||
if (bf_folder != "")
|
||||
{
|
||||
ryCommon.Ini ini = new Ini(bf_folder + "\\查看项目.ryp");
|
||||
var eng_name = ini.ReadIni("project", "engname");
|
||||
var proglang = ini.ReadIni("project", "proglang");
|
||||
var ouput_folder = bf_folder + "\\Bin\\" + com_mode + "\\" + eng_name;
|
||||
var file_ver = "";
|
||||
if (System.IO.File.Exists(ouput_folder + "\\" + eng_name + ".exe"))
|
||||
{
|
||||
FileVersionInfo fileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(ouput_folder + "\\" + eng_name + ".exe");
|
||||
file_ver = fileVerInfo.ProductVersion;
|
||||
}
|
||||
if (proglang == "c#")
|
||||
{
|
||||
ShowState("正在进行混淆...");
|
||||
if (System.IO.File.Exists(bf_folder + "\\Bin\\混淆_" + com_mode + ".nrproj"))
|
||||
{
|
||||
var cmd = Read_Prog(ReactorPath, "-project \"" + bf_folder + "\\Bin\\混淆_" + com_mode + ".nrproj\"");
|
||||
}
|
||||
}
|
||||
ShowState("正在清理不重要的缓存...");
|
||||
ryCommon.RyFiles.DeleteFile(ouput_folder + "\\Secure\\*.pdb");
|
||||
ShowState("复制混淆文件到底包目录...");
|
||||
ryCommon.RyFiles.CopyFile(ouput_folder + "\\Secure\\*", bf_folder + "\\Publish\\OriginalFiles\\");
|
||||
#region 复制自定义规则文件到底包目录
|
||||
ShowState("复制自定义规则文件到底包目录...");
|
||||
var Publish = ryCommon.RyFiles.ReadAllLines(bf_folder + "\\Publish\\Publish.set");
|
||||
for (int m = 0; m < Publish.Length; m++)
|
||||
{
|
||||
var line = Publish[m].Trim();
|
||||
if (line == "" || line.IndexOf("#") == 0) { continue; }
|
||||
if (line.IndexOfEx("del:") == 0)
|
||||
{
|
||||
ryCommon.RyFiles.DeleteFile(bf_folder + "\\Publish\\OriginalFiles\\" + line.Substring(4));
|
||||
}
|
||||
else if (line.IndexOfEx("copy:") == 0)
|
||||
{
|
||||
var from_to = line.Substring(5).Replace("->", "|").Split('|');
|
||||
if (from_to.Length == 2)
|
||||
{
|
||||
var from_path = from_to[0];
|
||||
var to_path = from_to[1];
|
||||
ryCommon.RyFiles.CopyFile(ouput_folder + "\\" + from_path, bf_folder + "\\Publish\\OriginalFiles\\" + to_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
ShowState("正在打包...");
|
||||
var cmd2 = Read_Prog(WinRARPath, "-r -ep1 a \"" + bf_folder + "\\Publish\\Green\\" + eng_name + ".zip\" \"" + bf_folder + "\\Publish\\OriginalFiles\\\"");
|
||||
RyFiles.CopyFile(bf_folder + "\\Publish\\Green\\" + eng_name + ".zip", bf_folder + "\\Publish\\Green\\HistoryVer\\" + eng_name + "_" + file_ver + ".zip");
|
||||
ShowState("打包完成...");
|
||||
}
|
||||
}
|
||||
}
|
||||
db.Free();
|
||||
void ShowState(string text)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
LblState.Text = "状态:" + text;
|
||||
}));
|
||||
}
|
||||
RyProject project = new RyProject();
|
||||
project.OnStateChanged += Project_OnStateChanged;
|
||||
project.Pack(GetBFFolderPath());
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
BtnBatchZip.Enabled = true;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private void Project_OnStateChanged(object sender, string e)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
LblState.Text = "状态:" + e;
|
||||
}));
|
||||
}
|
||||
|
||||
private void GetVersBySln(string path)
|
||||
{
|
||||
RyProject project = new RyProject();
|
||||
|
|
37
Source/开发辅助工具/Tools/FrmProject.Designer.cs
generated
37
Source/开发辅助工具/Tools/FrmProject.Designer.cs
generated
|
@ -49,6 +49,7 @@
|
|||
this.BtnUpdateDllVer = new ryControls.ButtonEx();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.BtnRepairFolder = new ryControls.ButtonEx();
|
||||
((System.ComponentModel.ISupportInitialize)(this.table1)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
|
@ -145,25 +146,29 @@
|
|||
//
|
||||
// BtnClean
|
||||
//
|
||||
this.BtnClean.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
|
||||
this.BtnClean.BaseColor = System.Drawing.Color.Green;
|
||||
this.BtnClean.ColorGradient = true;
|
||||
this.BtnClean.Location = new System.Drawing.Point(216, 20);
|
||||
this.BtnClean.Name = "BtnClean";
|
||||
this.BtnClean.Size = new System.Drawing.Size(99, 34);
|
||||
this.BtnClean.TabIndex = 22;
|
||||
this.BtnClean.Text = "清理垃圾";
|
||||
this.toolTip1.SetToolTip(this.BtnClean, "清理debug目录下的pdb、dcu文件");
|
||||
this.BtnClean.UseDefSkin = false;
|
||||
this.BtnClean.UseVisualStyleBackColor = true;
|
||||
this.BtnClean.Click += new System.EventHandler(this.BtnClean_Click);
|
||||
//
|
||||
// BtnBatchZip
|
||||
//
|
||||
this.BtnBatchZip.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
|
||||
this.BtnBatchZip.Location = new System.Drawing.Point(531, 20);
|
||||
this.BtnBatchZip.BaseColor = System.Drawing.Color.Navy;
|
||||
this.BtnBatchZip.ColorGradient = true;
|
||||
this.BtnBatchZip.Location = new System.Drawing.Point(648, 20);
|
||||
this.BtnBatchZip.Name = "BtnBatchZip";
|
||||
this.BtnBatchZip.Size = new System.Drawing.Size(99, 34);
|
||||
this.BtnBatchZip.TabIndex = 23;
|
||||
this.BtnBatchZip.Text = "一键打包";
|
||||
this.toolTip1.SetToolTip(this.BtnBatchZip, "一键混淆并打包当前项目生成的文件。");
|
||||
this.BtnBatchZip.UseDefSkin = false;
|
||||
this.BtnBatchZip.UseVisualStyleBackColor = true;
|
||||
this.BtnBatchZip.Click += new System.EventHandler(this.BtnBatchZip_Click);
|
||||
//
|
||||
|
@ -190,37 +195,43 @@
|
|||
//
|
||||
// BtnUpdateDll
|
||||
//
|
||||
this.BtnUpdateDll.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
|
||||
this.BtnUpdateDll.BaseColor = System.Drawing.Color.Green;
|
||||
this.BtnUpdateDll.ColorGradient = true;
|
||||
this.BtnUpdateDll.Location = new System.Drawing.Point(6, 20);
|
||||
this.BtnUpdateDll.Name = "BtnUpdateDll";
|
||||
this.BtnUpdateDll.Size = new System.Drawing.Size(99, 34);
|
||||
this.BtnUpdateDll.TabIndex = 26;
|
||||
this.BtnUpdateDll.Text = "更新引用dll";
|
||||
this.toolTip1.SetToolTip(this.BtnUpdateDll, "将当前输出文件夹里的dll文件更新到最新版\r\n将当前项目文件里的引用dll位置修改至输出目录。");
|
||||
this.BtnUpdateDll.UseDefSkin = false;
|
||||
this.BtnUpdateDll.UseVisualStyleBackColor = true;
|
||||
this.BtnUpdateDll.Click += new System.EventHandler(this.BtnUpdateDll_Click);
|
||||
//
|
||||
// BtnUpdateVer
|
||||
//
|
||||
this.BtnUpdateVer.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
|
||||
this.BtnUpdateVer.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
|
||||
this.BtnUpdateVer.ColorGradient = true;
|
||||
this.BtnUpdateVer.Location = new System.Drawing.Point(426, 20);
|
||||
this.BtnUpdateVer.Name = "BtnUpdateVer";
|
||||
this.BtnUpdateVer.Size = new System.Drawing.Size(99, 34);
|
||||
this.BtnUpdateVer.TabIndex = 27;
|
||||
this.BtnUpdateVer.Text = "更新版本号";
|
||||
this.toolTip1.SetToolTip(this.BtnUpdateVer, "每点一次自动更新一下版本号。");
|
||||
this.BtnUpdateVer.UseDefSkin = false;
|
||||
this.BtnUpdateVer.UseVisualStyleBackColor = true;
|
||||
this.BtnUpdateVer.Click += new System.EventHandler(this.BtnUpdateVer_Click);
|
||||
//
|
||||
// BtnUpdateDllVer
|
||||
//
|
||||
this.BtnUpdateDllVer.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
|
||||
this.BtnUpdateDllVer.BaseColor = System.Drawing.Color.Green;
|
||||
this.BtnUpdateDllVer.ColorGradient = true;
|
||||
this.BtnUpdateDllVer.Location = new System.Drawing.Point(111, 20);
|
||||
this.BtnUpdateDllVer.Name = "BtnUpdateDllVer";
|
||||
this.BtnUpdateDllVer.Size = new System.Drawing.Size(99, 34);
|
||||
this.BtnUpdateDllVer.TabIndex = 29;
|
||||
this.BtnUpdateDllVer.Text = "更新dll版本";
|
||||
this.toolTip1.SetToolTip(this.BtnUpdateDllVer, "将当前输出文件夹里的dll文件更新到最新版");
|
||||
this.BtnUpdateDllVer.UseDefSkin = false;
|
||||
this.BtnUpdateDllVer.UseVisualStyleBackColor = true;
|
||||
this.BtnUpdateDllVer.Click += new System.EventHandler(this.BtnUpdateDllVer_Click);
|
||||
//
|
||||
|
@ -228,6 +239,7 @@
|
|||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.BtnRepairFolder);
|
||||
this.groupBox1.Controls.Add(this.BtnUpdateDllVer);
|
||||
this.groupBox1.Controls.Add(this.BtnUpdateVer);
|
||||
this.groupBox1.Controls.Add(this.BtnUpdateDll);
|
||||
|
@ -254,6 +266,18 @@
|
|||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "快速代码";
|
||||
//
|
||||
// BtnRepairFolder
|
||||
//
|
||||
this.BtnRepairFolder.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
|
||||
this.BtnRepairFolder.Location = new System.Drawing.Point(531, 20);
|
||||
this.BtnRepairFolder.Name = "BtnRepairFolder";
|
||||
this.BtnRepairFolder.Size = new System.Drawing.Size(111, 34);
|
||||
this.BtnRepairFolder.TabIndex = 30;
|
||||
this.BtnRepairFolder.Text = "修复毕方文件结构";
|
||||
this.toolTip1.SetToolTip(this.BtnRepairFolder, "将当前毕方项目中缺失的一些文件和文件夹进行重新创建。");
|
||||
this.BtnRepairFolder.UseVisualStyleBackColor = true;
|
||||
this.BtnRepairFolder.Click += new System.EventHandler(this.BtnRepairFolder_Click);
|
||||
//
|
||||
// FrmProject
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
|
@ -300,5 +324,6 @@
|
|||
private ryControls.ButtonEx BtnUpdateVer;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private ryControls.ButtonEx BtnUpdateDllVer;
|
||||
private ryControls.ButtonEx BtnRepairFolder;
|
||||
}
|
||||
}
|
|
@ -149,7 +149,8 @@ namespace 开发辅助工具.Tools
|
|||
}
|
||||
private string GetDebugPath()
|
||||
{
|
||||
if (_ProjectPath == "") { return ""; }
|
||||
if (_ProjectPath.Length==0) { return ""; }
|
||||
if (!System.IO.File.Exists(_ProjectPath)) { return ""; }
|
||||
System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
|
||||
xml.Load(_ProjectPath);
|
||||
var xmlnsm = new XmlNamespaceManager(xml.NameTable);
|
||||
|
@ -359,96 +360,22 @@ namespace 开发辅助工具.Tools
|
|||
th.Start();
|
||||
void Start()
|
||||
{
|
||||
var com_mode = "Debug";
|
||||
DataProvider mydb = new DataProvider();
|
||||
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
|
||||
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
|
||||
{
|
||||
var ds = db.ReadData("select * from Settings where name='Setting'");
|
||||
if (mydb.HaveData(ds))
|
||||
{
|
||||
var row = mydb.GetData(ds);
|
||||
ryCommon.Storage mStor = new ryCommon.Storage(row["value"].ToString());
|
||||
mStor.SelectNodeBySet();
|
||||
var ReactorPath = mStor.GetAttrValue("ReactorPath");
|
||||
var WinRARPath = mStor.GetAttrValue("WinRARPath");
|
||||
if (WinRARPath == "")
|
||||
{
|
||||
if (System.IO.File.Exists(@"C:\Program Files\WinRAR\WinRAR.exe"))
|
||||
{
|
||||
WinRARPath = @"C:\Program Files\WinRAR\WinRAR.exe";
|
||||
}
|
||||
}
|
||||
var bf_folder = GetBFFolderPath();
|
||||
if (bf_folder != "")
|
||||
{
|
||||
ryCommon.Ini ini = new Ini(bf_folder+ "\\查看项目.ryp");
|
||||
var eng_name = ini.ReadIni("project", "engname");
|
||||
var proglang= ini.ReadIni("project", "proglang");
|
||||
var ouput_folder = bf_folder + "\\Bin\\" + com_mode + "\\" + eng_name;
|
||||
var file_ver = "";
|
||||
if (System.IO.File.Exists(ouput_folder + "\\" + eng_name + ".exe"))
|
||||
{
|
||||
FileVersionInfo fileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(ouput_folder + "\\" + eng_name + ".exe");
|
||||
file_ver = fileVerInfo.ProductVersion;
|
||||
}
|
||||
if (proglang == "c#")
|
||||
{
|
||||
ShowState("正在进行混淆...");
|
||||
if (System.IO.File.Exists(bf_folder + "\\Bin\\混淆_" + com_mode + ".nrproj"))
|
||||
{
|
||||
var cmd = Read_Prog(ReactorPath, "-project \"" + bf_folder + "\\Bin\\混淆_" + com_mode + ".nrproj\"");
|
||||
MessageBox.Show(cmd, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
ShowState("正在清理不重要的缓存...");
|
||||
ryCommon.RyFiles.DeleteFile(ouput_folder + "\\Secure\\*.pdb");
|
||||
ShowState("复制混淆文件到底包目录...");
|
||||
ryCommon.RyFiles.CopyFile(ouput_folder + "\\Secure\\*", bf_folder + "\\Publish\\OriginalFiles\\");
|
||||
#region 复制自定义规则文件到底包目录
|
||||
ShowState("复制自定义规则文件到底包目录...");
|
||||
var Publish = ryCommon.RyFiles.ReadAllLines(bf_folder + "\\Publish\\Publish.set");
|
||||
for (int m = 0; m < Publish.Length; m++)
|
||||
{
|
||||
var line = Publish[m].Trim();
|
||||
if (line == "" || line.IndexOf("#") == 0) { continue; }
|
||||
if (line.IndexOfEx("del:") == 0)
|
||||
{
|
||||
ryCommon.RyFiles.DeleteFile(bf_folder + "\\Publish\\OriginalFiles\\" + line.Substring(4));
|
||||
}
|
||||
else if (line.IndexOfEx("copy:") == 0)
|
||||
{
|
||||
var from_to = line.Substring(5).Replace("->", "|").Split('|');
|
||||
if (from_to.Length == 2)
|
||||
{
|
||||
var from_path = from_to[0];
|
||||
var to_path = from_to[1];
|
||||
ryCommon.RyFiles.CopyFile(ouput_folder + "\\"+ from_path, bf_folder + "\\Publish\\OriginalFiles\\" + to_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
ShowState("正在打包...");
|
||||
var cmd2 = Read_Prog(WinRARPath, "-r -ep1 a \""+ bf_folder + "\\Publish\\Green\\"+ eng_name + ".zip\" \""+ bf_folder + "\\Publish\\OriginalFiles\\\"");
|
||||
RyFiles.CopyFile(bf_folder + "\\Publish\\Green\\" + eng_name + ".zip", bf_folder + "\\Publish\\Green\\HistoryVer\\" + eng_name + "_"+file_ver+".zip");
|
||||
ShowState("打包完成...");
|
||||
}
|
||||
}
|
||||
}
|
||||
db.Free();
|
||||
void ShowState(string text)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
LblState.Text = "状态:" + text;
|
||||
}));
|
||||
}
|
||||
RyProject project = new RyProject();
|
||||
project.OnStateChanged += Project_OnStateChanged;
|
||||
project.Pack(GetBFFolderPath());
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
BtnBatchZip.Enabled = true;
|
||||
}));
|
||||
}
|
||||
}
|
||||
private void Project_OnStateChanged(object sender, string e)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
LblState.Text = "状态:" + e;
|
||||
}));
|
||||
}
|
||||
private void GetVersBySln(string path)
|
||||
{
|
||||
var _bf_path = GetBFFolderPath();
|
||||
|
@ -491,7 +418,7 @@ namespace 开发辅助工具.Tools
|
|||
private void BtnInsertUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var _path = GetBFFolderPath();
|
||||
if (_path != "")
|
||||
if (_path.Length>0)
|
||||
{
|
||||
var files = System.IO.Directory.GetFiles(_path+"\\Source");
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
|
@ -588,5 +515,25 @@ namespace 开发辅助工具.Tools
|
|||
MessageBox.Show("更新dll完成,共失败" + error + "项。\r\n\r\n"+ _error_str, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnRepairFolder_Click(object sender, EventArgs e)
|
||||
{
|
||||
var _path = GetBFFolderPath();
|
||||
if (_path.Length > 0)
|
||||
{
|
||||
if (!System.IO.File.Exists(_path + "\\CHANGELOG.md"))
|
||||
{
|
||||
BtnInsertUpdate.PerformClick();
|
||||
}
|
||||
ryCommon.Ini ini = new Ini(_path + "\\查看项目.ryp");
|
||||
FrmCreateProject frm = new FrmCreateProject();
|
||||
frm.TxtFolder.Text = _path;
|
||||
frm.ChkUnCreateProject.Checked = true;
|
||||
frm.TxtProjectEngName.Text = ini.ReadIni("project", "engname");
|
||||
frm.TxtProjectName.Text = ini.ReadIni("project", "name");
|
||||
frm.StartPosition = FormStartPosition.CenterParent;
|
||||
frm.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,4 +126,10 @@
|
|||
<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>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>285, 17</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user