Commit 73c5f1f1 authored by 罗显健's avatar 罗显健

【编号:16392】1.打包优化,合并sql提示一下 2.更新包打包上传优化 3.图片搜索

parent 93d4ea90
......@@ -113,6 +113,12 @@ namespace Ftt.PatchPack
return;
}
if (ckbMergeSql.Checked)
{
if (MessageBox.Show("是否确认进行合并Sql的打包操作?", "询问", MessageBoxButtons.YesNo) != DialogResult.Yes)
return;
}
foreach (ListViewItem item in lstProject.Items)
{
item.ForeColor = System.Drawing.Color.Black;
......@@ -160,6 +166,7 @@ namespace Ftt.PatchPack
MessageBox.Show($"打包项目{totalCount}个,成功{success}个 {strFail}。");
ckbMergeSql.Checked = false;
}
/// <summary>
......
......@@ -42,7 +42,7 @@ namespace Tools.MyUtils
/// </summary>
public static string LogPath => $@"{Application.StartupPath}\log";
/// <summary>
/// 暂存目录
/// 暂存目录、数据库开发缓存目录
/// </summary>
public static string SavePath => $@"{Application.StartupPath}\save";
/// <summary>
......@@ -50,10 +50,15 @@ namespace Tools.MyUtils
/// </summary>
public static string TempPath => $@"{Application.StartupPath}\temp";
/// <summary>
/// 测试文件目录
/// 测试文件目录。任务看板查看详情、图片搜索
/// </summary>
public static string TestPath => $@"{Application.StartupPath}\test";
/// <summary>
/// 打包工具、更新包生成目录
/// </summary>
public static string PackagePath => $@"{Application.StartupPath}\Package";
#endregion
#region 常用日期
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//
using Tools.MyCommon;
using Tools.MyData;
......@@ -60,14 +56,14 @@ namespace Tools.UI.sys
var link = Utils.GetDbLinkString204("FTT_Work");
this.InitDBHelper(link);
//初始化保存结构
this.ModuleTableList = new List<TQuery> {
this.ModuleTableList = new List<TQuery> {
new TQuery("FTT_AutoUpdate", "SELECT TOP 0 * FROM FTT_AutoUpdate"),
};
//初始化数据源
this._ds = this._db.GetData(this.ModuleTableList, true);
//无数据行,则新增
var dt = this._ds.Tables[0];
if(dt.DefaultView.Count == 0)
if (dt.DefaultView.Count == 0)
dt.Rows.Add(dt.NewRow());
//绑定基础信息
var drv = this._ds.Tables[0].DefaultView[0];
......@@ -90,7 +86,8 @@ namespace Tools.UI.sys
this._bar.TopMost = true; //顶层显示;
this._bar.Show();
//异步调用
Task.Run(() => {
Task.Run(() =>
{
string Name = "工具平台";
string RootPath = Directory.GetParent(Utils.StartupPath).FullName;
string ZipFileName = $@"{RootPath}\{Name}-{DateTime.Now.ToString("yyyyMMdd-hhmmss")}.zip";
......@@ -103,9 +100,10 @@ namespace Tools.UI.sys
DirectoryInfo dirInfo = new DirectoryInfo(path);
var fileInfos = dirInfo.GetFiles("*.*", SearchOption.AllDirectories).ToList();
fileInfos = fileInfos.Where(
f => !f.FullName.Contains("\\AutoUpdate\\") //剔除自动更新文件
&& !f.FullName.Contains("\\Logs\\") //剔除日志文件
&& !f.Name.Contains("Tools.exe.config") //剔除应用配置文件(包含更新时间和登录信息)
f => !f.FullName.Contains("\\AutoUpdate\\") //剔除自动更新文件
&& !f.FullName.Contains(Utils.LogPath) && !f.FullName.Contains(Utils.TempPath) //日志、临时文件目录
&& !f.FullName.Contains(Utils.SavePath) // 系统预设的用户本地文件目录,需要排除
&& !f.FullName.Contains(Utils.PackagePath) //程序更新打包目录
&& !f.Name.Equals("links.xml") //剔除链接记录文件(本地常用数据库链接记录)
&& !f.Name.Equals("sys_cfg.xml") //剔除(表开发工具-系统配置)文件
&& !f.Extension.Equals(".json") //剔除json配置信息
......@@ -127,13 +125,15 @@ namespace Tools.UI.sys
drv["UData"] = bytes;
drv.EndEdit();
//更新UI
this.AsyncUI(() => {
this.AsyncUI(() =>
{
this.tbUName.Text = name;
this.tbUSize.Text = size;
this.pictureBox1.Image = Properties.Resources.压缩包;
});
}).ContinueWith((x) => {
}).ContinueWith((x) =>
{
if (x.IsCompleted)
this.AsyncUI(() => this._bar.Close());
});
......
......@@ -61,7 +61,8 @@ namespace Tools.UI
private void InitPictureBox(params PictureBox[] pboxs)
{
Array.ForEach(pboxs,
box => {
box =>
{
box.SizeMode = PictureBoxSizeMode.Zoom;
});
}
......@@ -130,7 +131,7 @@ namespace Tools.UI
string original_dhash = "";
string original_phash = "";
//图片库路径
string imgPath = $@"F:\ImageSearch\images";
string imgPath = Utils.TestPath;
//预处理缓存
DataTable dtHash = null;
......@@ -146,7 +147,7 @@ namespace Tools.UI
this.lvResult.View = View.LargeIcon;
//默认值
this.tbPath.Text = imgPath;
this.SetImage($@"{imgPath}\28b80b371ef525ab5aadf6a4cc765e36");
// this.SetImage($@"{imgPath}\timg1.jpg");
//添加事件
this.btnSelectPicture.Click += BtnSelectPicture_Click;
this.btnSelectPath.Click += BtnSelectPath_Click;
......@@ -201,22 +202,38 @@ namespace Tools.UI
this.lvResult.Items.Clear();
this.imageList1.Images.Clear();
Task.Run(() => {
if (picOriginal.Image == null)
{
Utils.Tip("请选择源图片");
return;
}
if (string.IsNullOrEmpty(tbPath.Text))
{
Utils.Tip("请选择文件目录");
tbPath.Focus();
return;
}
Task.Run(() =>
{
//图片库预处理
if (dtHash == null)
this.Pretreatment();
//if (dtHash == null)
this.Pretreatment(tbPath.Text);
//去重
var existList = new List<string>();
//查找
var rate = 0.9;
var rows = dtHash.Select($"rate_aHash > {rate} OR rate_dHash > {rate} OR rate_pHash > {rate}").ToList();
rows.ForEach(dr => {
rows.ForEach(dr =>
{
var fileName = dr["fileName"].ToString();
var imgkey = new FileInfo(fileName).Name;
var picName = $"{dr["rate_aHash"]}_{dr["rate_dHash"]}_{dr["rate_pHash"]}";
if (!existList.Contains(picName))
{
this.AsyncUI(() => {
this.AsyncUI(() =>
{
this.imageList1.Images.Add(imgkey, Image.FromFile(fileName));
this.lvResult.Items.Add(picName, imgkey);
});
......@@ -230,7 +247,8 @@ namespace Tools.UI
/// <summary>
/// 图片预处理
/// </summary>
private void Pretreatment()
/// <param name="filePath">文件目录</param>
private void Pretreatment(string filePath)
{
//缓存表够造表
dtHash = new DataTable()
......@@ -249,7 +267,7 @@ namespace Tools.UI
},
};
//文件列表
var fileNames = Directory.GetFiles(imgPath).ToList();
var fileNames = Directory.GetFiles(filePath).ToList();
//生成Hash
foreach (string fname in fileNames)
{
......@@ -370,7 +388,6 @@ namespace Tools.UI
for (int y = 0; y < img.Height; y++)
{
Color color = bmp.GetPixel(x, y);
byte grayValue = (byte)color.ToGray();
grayValues[x * img.Height + y] = grayValue;
}
......@@ -428,7 +445,7 @@ namespace Tools.UI
//计算相似比例
return count / a.Length;
}
}
/// <summary>
/// 图片指纹生成
......
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