Commit 4ad24f61 authored by 罗显健's avatar 罗显健
parents cbe07d8d 05b572a2
......@@ -9,8 +9,6 @@
<add key="PatchTimeFrame_Sql" value="720"/>
<add key="PatchTimeFrame_Xml" value="720"/>
<add key="PatchTimeFrame_Xml" value="720"/>
<!--是否排除.pdb文件。1:排除,其他包含。-->
<add key="Exclude_PDB" value="1"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
......
......@@ -3,7 +3,7 @@
<appSettings>
<add key="LoginInfo" value="wwF/xpBzWek=" />
<add key="LoginVerify" value="v86f5Q3Xa7U=" />
<add key="UpdateTime" value="2021-11-26 14:21:49.650" />
<add key="UpdateTime" value="2021-12-09 09:48:49.755" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
......
......@@ -96,4 +96,28 @@
<UserId>sa</UserId>
<Pwd>a*1</Pwd>
</links>
<links>
<Link>192.168.1.31</Link>
<DbName>FTT_PDM</DbName>
<UserId>sa</UserId>
<Pwd>a*1</Pwd>
</links>
<links>
<Link>122.226.244.210,1800</Link>
<DbName>FTT_U6</DbName>
<UserId>sa</UserId>
<Pwd>a*1</Pwd>
</links>
<links>
<Link>120.192.78.70,5088</Link>
<DbName>JHD_HY_210911</DbName>
<UserId>sa</UserId>
<Pwd>a*1</Pwd>
</links>
<links>
<Link>192.168.1.204</Link>
<DbName>FTT_GuBang</DbName>
<UserId>sa</UserId>
<Pwd>sa</Pwd>
</links>
</DocumentElement>
\ No newline at end of file
......@@ -71,8 +71,25 @@ namespace Ftt.PatchPack
static Project()
{
var strExceptFiles = ConfigurationManager.AppSettings["ExceptFiles"];
//检查配置文件
var val = ConfigurationManager.AppSettings["PatchTimeFrame_Dll"];
if (val == null)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
//添加默认配置
config.AppSettings.Settings.Add("ExceptFiles", "");
config.AppSettings.Settings.Add("ContainFiles", "");
config.AppSettings.Settings.Add("PatchTimeFrame_Dll", "48");
config.AppSettings.Settings.Add("PatchTimeFrame_Sql", "720");
config.AppSettings.Settings.Add("PatchTimeFrame_Xml", "720");
config.AppSettings.Settings.Add("Exclude_PDB", "1");
//保存配置文件
config.Save(ConfigurationSaveMode.Modified);
//更新缓存
ConfigurationManager.RefreshSection("appSettings");
}
var strExceptFiles = ConfigurationManager.AppSettings["ExceptFiles"];
if (!string.IsNullOrEmpty(strExceptFiles))
{
var files = strExceptFiles.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
......@@ -86,12 +103,10 @@ namespace Ftt.PatchPack
foreach (var file in files) if (!ContainFiles.Contains(file)) ContainFiles.Add(file);
}
Int32.TryParse(ConfigurationManager.AppSettings["PatchTimeFrame_Dll"], out PatchTimeFrame_Dll);
Int32.TryParse(ConfigurationManager.AppSettings["PatchTimeFrame_Sql"], out PatchTimeFrame_Sql);
Int32.TryParse(ConfigurationManager.AppSettings["PatchTimeFrame_Xml"], out PatchTimeFrame_Xml);
Int32.TryParse(ConfigurationManager.AppSettings["Exclude_PDB"], out int _exclude_PDB);
Int32.TryParse(ConfigurationManager.AppSettings["Exclude_PDB"], out int _exclude_PDB); //是否包含pdb文件
if (_exclude_PDB == 1) Exclude_PDB = true;
}
......@@ -323,7 +338,6 @@ namespace Ftt.PatchPack
return date;
}
#endregion
}
......
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace FTT.Core
{
/// <summary>
/// 日志
/// </summary>
public sealed class Log
{
/// <summary>
/// 调试
/// </summary>
/// <param name="msg"></param>
public static void Debug(object obj)
{
Write(obj, nameof(Debug));
}
/// <summary>
/// 错误
/// </summary>
/// <param name="msg"></param>
public static void Error(object obj)
{
Write(obj, nameof(Error));
}
/// <summary>
/// 信息
/// </summary>
/// <param name="obj">消息对象</param>
/// <param name="title">自定义标题</param>
public static void Info(object obj, string title = "Info")
{
Write(obj, title);
}
/// <summary>
/// 警告
/// </summary>
/// <param name="msg"></param>
public static void Warn(object obj)
{
Write(obj, nameof(Warn));
}
/// <summary>
/// [并发]锁对象
/// </summary>
private static object _locker = new object();
/// <summary>
/// [异步]写入日志
/// </summary>
/// <param name="obj">消息对象</param>
/// <param name="category">消息类别</param>
private static void Write(object obj, string category)
{
lock (_locker)
{
try
{
Task.Run(() => Loger.Instance.Write(obj, category));
}
finally
{
Monitor.Pulse(_locker);
}
}
}
}
/// <summary>
/// 日志(单例)
/// </summary>
public class Loger
{
private static Loger _instance = null;
/// <summary>
/// 单例
/// </summary>
public static Loger Instance
{
get
{
if (_instance == null)
_instance = new Loger();
return _instance;
}
}
/// <summary>
/// 私有:构造方法
/// </summary>
private Loger()
{
//清除监听器
Trace.Listeners.Clear();
//通过自定义监听器,监听消息并记录日志
Trace.Listeners.Add(new LogerTraceListener());
}
/// <summary>
/// 写入日志
/// </summary>
/// <param name="msg"></param>
/// <param name="category"></param>
public void Write(object obj, string category)
{
Trace.WriteLine(obj, category);
}
}
/// <summary>
/// 日志记录监听器
/// </summary>
public class LogerTraceListener : TraceListener
{
private string _fileName;
public LogerTraceListener()
{
//日志路径初始化
string logPath = $@"{AppDomain.CurrentDomain.BaseDirectory}\Logs";
if (!Directory.Exists(logPath))
Directory.CreateDirectory(logPath);
this._fileName = $@"{logPath}\Log-{DateTime.Now.ToString("yyyyMMdd")}.txt";
}
public override void Write(string message)
{
this.WriteLogFile(message);
}
public override void Write(object obj)
{
this.WriteLogFile(obj);
}
public override void Write(string message, string category)
{
this.WriteLogFile(message, category);
}
public override void Write(object obj, string category)
{
this.WriteLogFile(obj, category);
}
public override void WriteLine(string message)
{
this.WriteLogFile(message);
}
public override void WriteLine(object obj)
{
this.WriteLogFile(obj);
}
public override void WriteLine(string message, string category)
{
this.WriteLogFile(message, category);
}
public override void WriteLine(object obj, string category)
{
this.WriteLogFile(obj, category);
}
/// <summary>
/// 写入日志文件
/// </summary>
/// <param name="obj"></param>
/// <param name="category"></param>
private void WriteLogFile(object obj, string category = "")
{
var message = this.Format(obj, category);
File.AppendAllText(_fileName, message);
}
/// <summary>
/// 格式化消息对象
/// </summary>
/// <param name="obj"></param>
/// <param name="category"></param>
/// <returns></returns>
private string Format(object obj, string category)
{
StringBuilder builder = new StringBuilder();
//添加类别,格式:[类别名称] 日期 消息体
if (!string.IsNullOrEmpty(category))
builder.AppendFormat("[{0}] ", category);
//添加日期
builder.AppendFormat("{0} ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
//构建消息体
if (obj is Exception)
{
var ex = (Exception)obj;
builder.Append(ex.Message + "\r\n");
builder.Append(ex.StackTrace + "\r\n");
}
else
{
builder.Append(obj.ToString() + "\r\n");
}
return builder.ToString();
}
}
}
......@@ -9,12 +9,12 @@ using Tools.MyCommon;
using Tools.MyData;
using Tools.MyUtils;
namespace Tools
namespace Tools.MyCommon
{
/// <summary>
/// 日志
/// 用户日志
/// </summary>
public class Log
public class UserLog
{
/// <summary>
/// 数据库访问对象
......
namespace Tools.MyCommon
{
partial class wProgressText
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.BackColor = System.Drawing.Color.LightGreen;
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.ForeColor = System.Drawing.Color.Black;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(200, 22);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// wProgressText
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Window;
this.ClientSize = new System.Drawing.Size(200, 22);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "wProgressText";
this.Text = "wProgressBar";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
//
using Tools.MyUtils;
namespace Tools.MyCommon
{
public partial class wProgressText : wBasic
{
int _max = 0;
public wProgressText()
{
InitializeComponent();
//隐藏窗体边框
this.ShowInTaskbar = false; //不显示在任务栏
this.FormBorderStyle = FormBorderStyle.None;
this.MaximumSize = new Size(200, 22);
this.MinimumSize = new Size(200, 22);
this.FormClosing += WProgressText_FormClosing;
}
/// <summary>
/// 事件-窗口关闭
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void WProgressText_FormClosing(object sender, FormClosingEventArgs e)
{
Task.Run(() => Thread.Sleep(200)).Wait(); //窗口结束时停顿0.2秒
}
/// <summary>
/// 设置进度条最大值
/// </summary>
/// <param name="total"></param>
public void SetMaximum(int max)
{
this.AsyncUI(() => {
this._max = max;
this.label1.Text = $"共{max}条数据 已处理0条";
this.Text = $"0/{max}";
});
}
/// <summary>
/// 设置进度条当前位置
/// </summary>
/// <param name="pos"></param>
public void SetPosition(int pos)
{
this.AsyncUI(() => {
this.label1.Text = $"共{_max}条数据 已处理{pos}条";
this.Text = $"{pos}/{_max}";
});
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using System;
using ICSharpCode.SharpZipLib.Zip;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
......@@ -10,6 +11,7 @@ using System.Text;
using System.Threading.Tasks;
//
using System.Windows.Forms;
using Tools.MyCommon;
namespace Tools.MyUtils
{
......@@ -263,6 +265,59 @@ namespace Tools.MyUtils
#endregion
#region ZIP压缩
/// <summary>
/// Zip:打包专用压缩方法(进度提示)
/// </summary>
/// <param name="bar">进度提示</param>
/// <param name="zipFileName">压缩文件保存路径</param>
/// <param name="fileNames">待压缩的文件列表</param>
/// <param name="rootPath">待压缩文件的根路径:用于定位压缩相对路径</param>
public static void ZipCompress4Package(wProgressText bar, string zipFileName, List<string> fileNames, string rootPath)
{
try
{
using (ZipOutputStream zip = new ZipOutputStream(File.Create(zipFileName)))
{
zip.SetLevel(9); // 压缩级别 0-9
byte[] buffer = new byte[1024]; //缓冲区大小
int iCount = 0;
bar?.SetMaximum(fileNames.Count);
foreach (string path in fileNames)
{
//进度条显示
bar?.SetPosition(++iCount);
//EntryName用以指定压缩层级
string EntryName = path.Substring($@"{rootPath}\".Length); //这里取根目录的相对路径
//创建新入口
ZipEntry entry = new ZipEntry(EntryName) {
DateTime = DateTime.Now
};
zip.PutNextEntry(entry);
//写入源数据
using (FileStream fs = File.OpenRead(path))
{
int size;
while ((size = fs.Read(buffer, 0, buffer.Length)) > 0)
{
zip.Write(buffer, 0, size);
}
}
}
zip.Finish();
zip.Close();
}
}
catch (Exception ex)
{
TipException(ex);
}
}
#endregion
#region winform:提示;帮助窗口;异步UI支持
/// <summary>
......@@ -304,10 +359,7 @@ namespace Tools.MyUtils
var helpFileName = $@"{Utils.ConfigPath}\help\{txtFileName}.txt";
if (File.Exists(helpFileName))
{
using (var sr = new StreamReader(helpFileName))
{
Utils.Tip(sr.ReadToEnd(), 700, 400);
}
Utils.Tip(File.ReadAllText(helpFileName), 700, 400);
}
}
/// <summary>
......@@ -315,7 +367,7 @@ namespace Tools.MyUtils
/// </summary>
/// <param name="frm"></param>
/// <param name="action"></param>
public static void AsyncUI(this Form frm, Action action)
public static void AsyncUI(this Control frm, Action action)
{
if (frm.Disposing || frm.IsDisposed)
return;
......
......@@ -74,7 +74,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Log.cs" />
<Compile Include="MyCommon\Log.cs" />
<Compile Include="MyCommon\UserLog.cs" />
<Compile Include="MyCommon\controls\MyTreeView.cs">
<SubType>Component</SubType>
</Compile>
......@@ -106,6 +107,12 @@
<Compile Include="MyCommon\controls\TabControlEx.Designer.cs">
<DependentUpon>TabControlEx.cs</DependentUpon>
</Compile>
<Compile Include="MyCommon\wProgressText.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MyCommon\wProgressText.Designer.cs">
<DependentUpon>wProgressText.cs</DependentUpon>
</Compile>
<Compile Include="MyData\AnlysisHelper.cs" />
<Compile Include="MyData\DBHelper.cs" />
<Compile Include="MyData\SqlHelper.cs" />
......@@ -341,6 +348,9 @@
<EmbeddedResource Include="MyCommon\controls\TabControlEx.resx">
<DependentUpon>TabControlEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MyCommon\wProgressText.resx">
<DependentUpon>wProgressText.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MyUtils\wDbSetting.resx">
<DependentUpon>wDbSetting.cs</DependentUpon>
</EmbeddedResource>
......
......@@ -37,6 +37,9 @@
this.Column3 = new System.Windows.Forms.DataGridViewButtonColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dgvDetail)).BeginInit();
this.panel2.SuspendLayout();
......@@ -51,6 +54,9 @@
this.Column3,
this.Column1,
this.Column2,
this.Column5,
this.Column6,
this.Column7,
this.Column4});
this.dgvDetail.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvDetail.Location = new System.Drawing.Point(0, 25);
......@@ -132,6 +138,24 @@
this.Column2.Name = "Column2";
this.Column2.Width = 120;
//
// Column5
//
this.Column5.DataPropertyName = "CreateUser";
this.Column5.HeaderText = "创建人";
this.Column5.Name = "Column5";
//
// Column6
//
this.Column6.DataPropertyName = "CreateDate";
this.Column6.HeaderText = "创建日期";
this.Column6.Name = "Column6";
//
// Column7
//
this.Column7.DataPropertyName = "UpdateUser";
this.Column7.HeaderText = "更新人";
this.Column7.Name = "Column7";
//
// Column4
//
this.Column4.DataPropertyName = "CreateDate";
......@@ -174,6 +198,9 @@
private System.Windows.Forms.DataGridViewButtonColumn Column3;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
}
}
\ No newline at end of file
......@@ -126,6 +126,15 @@
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
......
......@@ -28,7 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.btnUpload = new System.Windows.Forms.Button();
this.btnGenZip = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
......@@ -43,17 +43,17 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// btnUpload
// btnGenZip
//
this.btnUpload.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUpload.Location = new System.Drawing.Point(74, 303);
this.btnUpload.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnUpload.Name = "btnUpload";
this.btnUpload.Size = new System.Drawing.Size(117, 33);
this.btnUpload.TabIndex = 2;
this.btnUpload.Text = "选择压缩包";
this.btnUpload.UseVisualStyleBackColor = true;
this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click);
this.btnGenZip.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnGenZip.Location = new System.Drawing.Point(74, 303);
this.btnGenZip.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnGenZip.Name = "btnGenZip";
this.btnGenZip.Size = new System.Drawing.Size(117, 33);
this.btnGenZip.TabIndex = 2;
this.btnGenZip.Text = "生成压缩包";
this.btnGenZip.UseVisualStyleBackColor = true;
this.btnGenZip.Click += new System.EventHandler(this.btnGenZip_Click);
//
// label1
//
......@@ -181,7 +181,7 @@
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnUpload);
this.Controls.Add(this.btnGenZip);
this.Controls.Add(this.pictureBox1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
......@@ -198,7 +198,7 @@
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btnUpload;
private System.Windows.Forms.Button btnGenZip;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
......
......@@ -17,10 +17,36 @@ namespace Tools.UI.sys
{
public partial class wUploadUpdate : wEditBasic
{
/// <summary>
/// 进度文本提示
/// </summary>
wProgressText _bar = null;
/// <summary>
/// 生成的压缩文件列表
/// </summary>
List<string> GenZipFileList = new List<string>();
/// <summary>
/// 构造函数
/// </summary>
public wUploadUpdate()
{
InitializeComponent();
}
/// <summary>
/// 析构函数
/// </summary>
~wUploadUpdate()
{
//删除所有的压缩包
this.GenZipFileList.ForEach(file =>
{
if (File.Exists(file))
{
File.Delete(file);
}
});
}
private void wUploadUpdate_Load(object sender, EventArgs e)
{
......@@ -57,36 +83,63 @@ namespace Tools.UI.sys
return base.SaveCheck();
}
private void btnUpload_Click(object sender, EventArgs e)
{
//对话框
OpenFileDialog dlg = new OpenFileDialog()
{
Multiselect = false,
Filter = "压缩包|*.zip",
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
};
//结果处理
if (dlg.ShowDialog() == DialogResult.OK)
private void btnGenZip_Click(object sender, EventArgs e)
{
//显示进度条窗口
this._bar = new wProgressText();
this._bar.TopMost = true; //顶层显示;
this._bar.Show();
//异步调用
Task.Run(() => {
string Name = "工具平台";
string RootPath = Directory.GetParent(Utils.StartupPath).FullName;
string ZipFileName = $@"{RootPath}\{Name}-{DateTime.Now.ToString("yyyyMMdd-hhmmss")}.zip";
this.GenZipFileList.Add(ZipFileName); //记录压缩文件名称,可能点多次
//路径检查
string path = $@"{RootPath}\AppHome";
if (!Directory.Exists(path))
return;
//打包所有文件
DirectoryInfo dirInfo = new DirectoryInfo(path);
var fileInfos = dirInfo.GetFiles("*.*", SearchOption.AllDirectories).ToList();
fileInfos = fileInfos.Where(
f => !f.FullName.Contains("\\AutoUpdate\\") //剔除自动更新文件
&& !f.FullName.Contains("\\Config\\") //剔除配置文件
&& !f.FullName.Contains("\\Logs\\") //剔除日志文件
&& !f.FullName.Contains("Tools.exe.") //剔除应用配置文件(包含更新时间和登录信息)
).ToList(); //剔除自动更新相关目录
//构造压缩文件路径集合
List<string> FileNames = new List<string>();
FileNames.AddRange(fileInfos.Select(f => f.FullName));
//调用压缩方法
Utils.ZipCompress4Package(this._bar, ZipFileName, FileNames, RootPath);
//赋值基本信息
var bytes = File.ReadAllBytes(dlg.FileName);
var drv = this._ds.Tables[0].DefaultView[0];
var name = Path.GetFileName(dlg.FileName);
var bytes = File.ReadAllBytes(ZipFileName);
var size = (bytes.Length / 1000M / 1000M).ToString("0.##");
this.tbUName.Text = name;
this.tbUSize.Text = size;
var name = Path.GetFileName(ZipFileName);
//数据源赋值
var drv = this._ds.Tables[0].DefaultView[0];
drv["UName"] = name;
drv["USize"] = size;
drv["UData"] = bytes;
drv.EndEdit();
//上传成功,更新图片
//更新UI
this.AsyncUI(() => {
this.tbUName.Text = name;
this.tbUSize.Text = size;
this.pictureBox1.Image = Properties.Resources.压缩包;
}
});
}).ContinueWith((x) => {
if (x.IsCompleted)
this.AsyncUI(() => this._bar.Close());
});
}
private void btnSave_Click(object sender, EventArgs e)
{
this.Save();
//刷新更新日期,即默认本机为最新版本
Utils.AppSettings(APP.UPDATE_TIME, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
}
}
}
......@@ -333,6 +333,7 @@
this.Name = "wAppModel";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "APP模块编辑";
this.Load += new System.EventHandler(this.wAppModel_Load);
((System.ComponentModel.ISupportInitialize)(this.dgvAppModel)).EndInit();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
......
......@@ -21,12 +21,19 @@ namespace Tools.UI
/// <summary>
/// 刷新数据时的筛选语句
/// </summary>
private string strWhere;
private string strWhere = "1=1";
public wAppModel()
{
InitializeComponent();
}
private void wAppModel_Load(object sender, EventArgs e)
{
var link = Utils.GetDbLinkString204("FTT");
this.tstbLinkString.Text = Utils.GetDbItemModel(link).ToString();
this.InitDBHelper(link);
this.InitData();
}
public override void InitData()
{
......@@ -107,5 +114,6 @@ namespace Tools.UI
tabControl1.SelectedTab = tabSql;
}
}
}
......@@ -212,6 +212,7 @@ namespace Tools.UI
AuditUsers += $";{drv["AuditUser"]}";
}
//模拟不同人员登录
this.cmbLoginUser.Items.Clear();
this.cmbLoginUser.Items.AddRange(AuditUsers.Split(';').Distinct().ToArray());
this.cmbLoginUser.SelectedIndex = 0;
//绑定审批数据源
......
......@@ -35,7 +35,9 @@
this.Column6 = new System.Windows.Forms.DataGridViewButtonColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvDetail)).BeginInit();
......@@ -78,7 +80,9 @@
this.Column6,
this.Column2,
this.Column3,
this.Column1,
this.Column4,
this.Column7,
this.Column5});
this.dgvDetail.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvDetail.Location = new System.Drawing.Point(0, 25);
......@@ -110,6 +114,12 @@
this.Column3.HeaderText = "文件大小(K)";
this.Column3.Name = "Column3";
//
// Column1
//
this.Column1.DataPropertyName = "CreateUser";
this.Column1.HeaderText = "创建人";
this.Column1.Name = "Column1";
//
// Column4
//
this.Column4.DataPropertyName = "CreateDate";
......@@ -117,6 +127,12 @@
this.Column4.Name = "Column4";
this.Column4.Width = 120;
//
// Column7
//
this.Column7.DataPropertyName = "UpdateUser";
this.Column7.HeaderText = "更新人";
this.Column7.Name = "Column7";
//
// Column5
//
this.Column5.DataPropertyName = "UpdateDate";
......@@ -152,7 +168,9 @@
private System.Windows.Forms.DataGridViewButtonColumn Column6;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
}
}
\ No newline at end of file
......@@ -129,9 +129,15 @@
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
......
......@@ -51,6 +51,10 @@
this.tsmiDel = new System.Windows.Forms.ToolStripMenuItem();
this.tsFuncInfo = new System.Windows.Forms.ToolStrip();
this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.tslbStatus = new System.Windows.Forms.ToolStripLabel();
this.tstbFocusedCellContent = new System.Windows.Forms.ToolStripTextBox();
this.tsBaseInfo = new System.Windows.Forms.ToolStrip();
this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel();
this.label1 = new System.Windows.Forms.Label();
......@@ -78,10 +82,6 @@
this.tbSysCode = new System.Windows.Forms.TextBox();
this.tbPrevID = new System.Windows.Forms.TextBox();
this.imgList5 = new System.Windows.Forms.ImageList(this.components);
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.tstbFocusedCellContent = new System.Windows.Forms.ToolStripTextBox();
this.tslbStatus = new System.Windows.Forms.ToolStripLabel();
this.toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
......@@ -348,6 +348,30 @@
this.toolStripLabel2.Size = new System.Drawing.Size(56, 24);
this.toolStripLabel2.Text = "功能信息";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 27);
//
// toolStripLabel1
//
this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new System.Drawing.Size(0, 24);
//
// tslbStatus
//
this.tslbStatus.ForeColor = System.Drawing.Color.Gray;
this.tslbStatus.Name = "tslbStatus";
this.tslbStatus.Size = new System.Drawing.Size(44, 24);
this.tslbStatus.Text = "已复制";
//
// tstbFocusedCellContent
//
this.tstbFocusedCellContent.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tstbFocusedCellContent.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.tstbFocusedCellContent.Name = "tstbFocusedCellContent";
this.tstbFocusedCellContent.Size = new System.Drawing.Size(300, 27);
//
// tsBaseInfo
//
this.tableLayoutPanel1.SetColumnSpan(this.tsBaseInfo, 8);
......@@ -607,31 +631,6 @@
this.imgList5.Images.SetKeyName(0, "tv5-gray.png");
this.imgList5.Images.SetKeyName(1, "tv5-red.png");
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 27);
//
// toolStripLabel1
//
this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new System.Drawing.Size(0, 24);
//
// tstbFocusedCellContent
//
this.tstbFocusedCellContent.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tstbFocusedCellContent.Enabled = false;
this.tstbFocusedCellContent.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.tstbFocusedCellContent.Name = "tstbFocusedCellContent";
this.tstbFocusedCellContent.Size = new System.Drawing.Size(300, 27);
//
// tslbStatus
//
this.tslbStatus.ForeColor = System.Drawing.Color.Gray;
this.tslbStatus.Name = "tslbStatus";
this.tslbStatus.Size = new System.Drawing.Size(44, 24);
this.tslbStatus.Text = "已复制";
//
// wModuleManager
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......
......@@ -137,7 +137,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADo
CAAAAk1TRnQBSQFMAgEBAgEAAYgBAAGIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAZABAAGQAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
......
......@@ -50,8 +50,8 @@ namespace Tools
this.CreateModule(Tools_imp, typeof(UI.wExcelExportSetting), "Excel导出设置", "tr:Excel导出配置图形化版本"),
this.CreateModule(Tools_imp, typeof(UI.wLogViewer), "日志查看器", "tr:可以方便的查看系统日志"),
//-------------------------------
this.CreateModule(Tools_dev, typeof(Ftt.PatchPack.FrmMain), "自动打包工具", "xj:用于CS后端程序自动打包成压缩包"),
this.CreateModule(Tools_dev, typeof(UI.wSysModule), "功能模块管理", "xj:管理功能模块和代码窗体的映射"),
this.CreateModule(Tools_dev, typeof(Ftt.PatchPack.FrmMain), "自动打包工具", "lxj:用于CS后端程序自动打包成压缩包"),
this.CreateModule(Tools_dev, typeof(UI.wSysModule), "功能模块管理", "lxj:管理功能模块和代码窗体的映射"),
this.CreateModule(Tools_dev, typeof(UI.wAppModel), "APP模块管理", "tb:APP添加模块的图形化界面"),
this.CreateModule(Tools_dev, typeof(UI.wMonitorVisit), "APP访问监控", "tb:APP模块的访问统计查看界面"),
this.CreateModule(Tools_dev, typeof(UI.wAutoClass), "类生成工具", "tb:将任意数据库表,生成为模型类"),
......
......@@ -98,7 +98,7 @@ namespace Tools
this.lbSysVersion.Text = dt.DefaultView.Count == 0 ? $"2021.0.1" : $"{dt.DefaultView[0][0]}";
}));
//日志记录
Log.Write("打开系统");
UserLog.Write("打开系统");
}
private void WMain_FormClosing(object sender, FormClosingEventArgs e)
{
......@@ -324,7 +324,7 @@ namespace Tools
return;
}
//日志记录
Log.Write("退出系统");
UserLog.Write("退出系统");
//关闭窗体
this.Close();
}
......@@ -399,7 +399,7 @@ namespace Tools
frm.Show();
}
//日志记录
Log.Write($"打开模块:{page.Text}");
UserLog.Write($"打开模块:{page.Text}");
//选中标签页
this.tabControl1.SelectedTab = page;
page.Refresh();
......@@ -412,7 +412,7 @@ namespace Tools
{
if (page.Name != nameof(HomePage))
{
Log.Write($"关闭模块:{page.Text}"); //日志记录
UserLog.Write($"关闭模块:{page.Text}"); //日志记录
this.OpenedList.Remove(page.Text); //移除列表
this.tabControl1.TabPages.Remove(page); //移除页面
page.Dispose(); //释放页面
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment