## 2025-03-30 星期日更新
### RySmartEditor V1.0.2503.3001 - *.[新增]在文件管理器中新增支持将所有站点对应的文件上传到FTP。 - *.[新增]新增支持自动同步选定文件到最新版。 ### SuperDesign V3.0.2503.3001 #### 项目功能->更新日志 - *.[修复]修复当更新日志为空时,插入更新分组会报错的BUG。 - *.[修复]修复存在多个分组时,添加修复日志会添加到最后一个分组末尾的BUG。 #### 网页抓取工具 - *.[改进]改进网页图标获取,支持获取更多网站的图标。 - *.[修复]修复当图标文件夹不存在时,读取图标会报错的BUG。 - *.[修复]修复当Url不是图片地址时,勾选获取图片会报错的BUG。 - *.[修复]某些情况下,当目标网站图标不存在时,点击执行按钮时会长时间等待的BUG。 - *.[修复]修复剪切板读取失败可能会导致程序异常退出的BUG。 - *.[修复]修复历史记录里的UserAgent值不正确导致无法执行操作的BUG。
This commit is contained in:
1 parent
1f8c54fe38
commit
7d0c050763
22 files changed
+1084
-293
No files matched your search
+50
-22
@@ -56,7 +56,11 @@
|
||||
this.重命名ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.在资源管理器中定位该文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.同步所有站点文件为最新版本ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.上传到FTPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.上传全部站点对应文件到FTPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MenuDir = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.刷新文件夹ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.在资源管理器中打开该文件夹ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -68,7 +72,6 @@
|
||||
this.TxtSearch = new ryControls.TextBoxEx2();
|
||||
this.MenuDirHistory = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.fileSystemWatcher1 = new System.IO.FileSystemWatcher();
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MenuForm.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.olvFiles)).BeginInit();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
@@ -264,48 +267,51 @@
|
||||
this.toolStripMenuItem1,
|
||||
this.在资源管理器中定位该文件ToolStripMenuItem,
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem,
|
||||
this.上传到FTPToolStripMenuItem});
|
||||
this.同步所有站点文件为最新版本ToolStripMenuItem,
|
||||
this.toolStripMenuItem3,
|
||||
this.上传到FTPToolStripMenuItem,
|
||||
this.上传全部站点对应文件到FTPToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(221, 280);
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(233, 330);
|
||||
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||
//
|
||||
// 复制文件名ToolStripMenuItem
|
||||
//
|
||||
this.复制文件名ToolStripMenuItem.Name = "复制文件名ToolStripMenuItem";
|
||||
this.复制文件名ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.复制文件名ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.复制文件名ToolStripMenuItem.Text = "复制文件名";
|
||||
this.复制文件名ToolStripMenuItem.Click += new System.EventHandler(this.复制文件名ToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(217, 6);
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(229, 6);
|
||||
//
|
||||
// 新建文件夹ToolStripMenuItem
|
||||
//
|
||||
this.新建文件夹ToolStripMenuItem.Name = "新建文件夹ToolStripMenuItem";
|
||||
this.新建文件夹ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.新建文件夹ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.新建文件夹ToolStripMenuItem.Text = "新建文件夹";
|
||||
this.新建文件夹ToolStripMenuItem.Click += new System.EventHandler(this.新建文件夹ToolStripMenuItem_Click);
|
||||
//
|
||||
// 复制ToolStripMenuItem
|
||||
//
|
||||
this.复制ToolStripMenuItem.Name = "复制ToolStripMenuItem";
|
||||
this.复制ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.复制ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.复制ToolStripMenuItem.Text = "复制";
|
||||
this.复制ToolStripMenuItem.Click += new System.EventHandler(this.复制ToolStripMenuItem_Click);
|
||||
//
|
||||
// 剪切ToolStripMenuItem
|
||||
//
|
||||
this.剪切ToolStripMenuItem.Name = "剪切ToolStripMenuItem";
|
||||
this.剪切ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.剪切ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.剪切ToolStripMenuItem.Text = "剪切";
|
||||
this.剪切ToolStripMenuItem.Click += new System.EventHandler(this.剪切ToolStripMenuItem_Click);
|
||||
//
|
||||
// 粘贴ToolStripMenuItem
|
||||
//
|
||||
this.粘贴ToolStripMenuItem.Name = "粘贴ToolStripMenuItem";
|
||||
this.粘贴ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.粘贴ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.粘贴ToolStripMenuItem.Text = "粘贴";
|
||||
this.粘贴ToolStripMenuItem.Visible = false;
|
||||
this.粘贴ToolStripMenuItem.Click += new System.EventHandler(this.粘贴ToolStripMenuItem_Click);
|
||||
@@ -313,43 +319,69 @@
|
||||
// 粘贴剪切板文件列表ToolStripMenuItem
|
||||
//
|
||||
this.粘贴剪切板文件列表ToolStripMenuItem.Name = "粘贴剪切板文件列表ToolStripMenuItem";
|
||||
this.粘贴剪切板文件列表ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.粘贴剪切板文件列表ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.粘贴剪切板文件列表ToolStripMenuItem.Text = "粘贴";
|
||||
this.粘贴剪切板文件列表ToolStripMenuItem.Click += new System.EventHandler(this.粘贴剪切板文件列表ToolStripMenuItem_Click);
|
||||
//
|
||||
// 删除文件ToolStripMenuItem
|
||||
//
|
||||
this.删除文件ToolStripMenuItem.Name = "删除文件ToolStripMenuItem";
|
||||
this.删除文件ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.删除文件ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.删除文件ToolStripMenuItem.Text = "删除文件";
|
||||
this.删除文件ToolStripMenuItem.Click += new System.EventHandler(this.删除文件ToolStripMenuItem_Click);
|
||||
//
|
||||
// 重命名ToolStripMenuItem
|
||||
//
|
||||
this.重命名ToolStripMenuItem.Name = "重命名ToolStripMenuItem";
|
||||
this.重命名ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.重命名ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.重命名ToolStripMenuItem.Text = "重命名";
|
||||
this.重命名ToolStripMenuItem.Click += new System.EventHandler(this.重命名ToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(217, 6);
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(229, 6);
|
||||
//
|
||||
// 在资源管理器中定位该文件ToolStripMenuItem
|
||||
//
|
||||
this.在资源管理器中定位该文件ToolStripMenuItem.Name = "在资源管理器中定位该文件ToolStripMenuItem";
|
||||
this.在资源管理器中定位该文件ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.在资源管理器中定位该文件ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.在资源管理器中定位该文件ToolStripMenuItem.Text = "在资源管理器中定位该文件";
|
||||
this.在资源管理器中定位该文件ToolStripMenuItem.Click += new System.EventHandler(this.在资源管理器中定位该文件ToolStripMenuItem_Click);
|
||||
//
|
||||
// 复制文件到其它站点同位置ToolStripMenuItem
|
||||
//
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem.Name = "复制文件到其它站点同位置ToolStripMenuItem";
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem.Text = "复制文件到其它站点同位置";
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem.Click += new System.EventHandler(this.复制文件到其它站点同位置ToolStripMenuItem_Click);
|
||||
//
|
||||
// 同步所有站点文件为最新版本ToolStripMenuItem
|
||||
//
|
||||
this.同步所有站点文件为最新版本ToolStripMenuItem.Name = "同步所有站点文件为最新版本ToolStripMenuItem";
|
||||
this.同步所有站点文件为最新版本ToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.同步所有站点文件为最新版本ToolStripMenuItem.Text = "同步所有站点文件为最新版本";
|
||||
this.同步所有站点文件为最新版本ToolStripMenuItem.Click += new System.EventHandler(this.同步所有站点文件为最新版本ToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripMenuItem3
|
||||
//
|
||||
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||
this.toolStripMenuItem3.Size = new System.Drawing.Size(229, 6);
|
||||
//
|
||||
// 上传到FTPToolStripMenuItem
|
||||
//
|
||||
this.上传到FTPToolStripMenuItem.Name = "上传到FTPToolStripMenuItem";
|
||||
this.上传到FTPToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.上传到FTPToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.上传到FTPToolStripMenuItem.Text = "上传到FTP";
|
||||
this.上传到FTPToolStripMenuItem.Click += new System.EventHandler(this.上传到FTPToolStripMenuItem_Click);
|
||||
//
|
||||
// 上传全部站点对应文件到FTPToolStripMenuItem
|
||||
//
|
||||
this.上传全部站点对应文件到FTPToolStripMenuItem.Name = "上传全部站点对应文件到FTPToolStripMenuItem";
|
||||
this.上传全部站点对应文件到FTPToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
|
||||
this.上传全部站点对应文件到FTPToolStripMenuItem.Text = "上传全部站点对应文件到FTP";
|
||||
this.上传全部站点对应文件到FTPToolStripMenuItem.Click += new System.EventHandler(this.上传全部站点对应文件到FTPToolStripMenuItem_Click);
|
||||
//
|
||||
// MenuDir
|
||||
//
|
||||
this.MenuDir.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -485,13 +517,6 @@
|
||||
this.fileSystemWatcher1.Deleted += new System.IO.FileSystemEventHandler(this.FileSystemWatcher1_Deleted);
|
||||
this.fileSystemWatcher1.Renamed += new System.IO.RenamedEventHandler(this.FileSystemWatcher1_Renamed);
|
||||
//
|
||||
// 复制文件到其它站点同位置ToolStripMenuItem
|
||||
//
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem.Name = "复制文件到其它站点同位置ToolStripMenuItem";
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem.Text = "复制文件到其它站点同位置";
|
||||
this.复制文件到其它站点同位置ToolStripMenuItem.Click += new System.EventHandler(this.复制文件到其它站点同位置ToolStripMenuItem_Click);
|
||||
//
|
||||
// FrmFileBrowser_New
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
@@ -563,5 +588,8 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem 粘贴剪切板文件列表ToolStripMenuItem;
|
||||
private System.IO.FileSystemWatcher fileSystemWatcher1;
|
||||
private System.Windows.Forms.ToolStripMenuItem 复制文件到其它站点同位置ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 上传全部站点对应文件到FTPToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 同步所有站点文件为最新版本ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
|
||||
}
|
||||
}
|
||||
@@ -473,22 +473,22 @@ namespace SuperDesign.Tools.SmartEditor
|
||||
private void 上传到FTPToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
var list = this.olvFiles.SelectedObjects;
|
||||
List<UploadInfo> UploadList = new List<UploadInfo>();
|
||||
for (int l = 0; l < list.Count; l++)
|
||||
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
|
||||
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
|
||||
{
|
||||
MyFileSystemInfo model = (MyFileSystemInfo)list[l];
|
||||
if (model != null)
|
||||
for (int l = 0; l < list.Count; l++)
|
||||
{
|
||||
//if (System.IO.Directory.Exists(model.FullName))
|
||||
//{
|
||||
// MessageBox.Show("暂不支持上传文件夹=>" + model.FullName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
// continue ;
|
||||
//}
|
||||
string FilePath = model.FullName;
|
||||
SiteInfo SiteInfo = new SiteInfo();
|
||||
UploadInfo uploadinfo = null;
|
||||
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
|
||||
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
|
||||
MyFileSystemInfo model = (MyFileSystemInfo)list[l];
|
||||
if (model != null)
|
||||
{
|
||||
//if (System.IO.Directory.Exists(model.FullName))
|
||||
//{
|
||||
// MessageBox.Show("暂不支持上传文件夹=>" + model.FullName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
// continue ;
|
||||
//}
|
||||
string FilePath = model.FullName;
|
||||
SiteInfo SiteInfo = new SiteInfo();
|
||||
UploadInfo uploadinfo = null;
|
||||
DataSet ds = db.ReadData("select * from Site");
|
||||
if (ds.HaveData())
|
||||
{
|
||||
@@ -534,20 +534,19 @@ namespace SuperDesign.Tools.SmartEditor
|
||||
};
|
||||
}
|
||||
ds.Dispose();
|
||||
}
|
||||
db.Free();
|
||||
if (SiteInfo.FtpId > 0)
|
||||
{
|
||||
if (uploadinfo == null) { MessageBox.Show("没有找到对应站点信息=>" + model.FullName, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
|
||||
if (SiteInfo.FtpId > 0)
|
||||
{
|
||||
if (uploadinfo == null) { MessageBox.Show("没有找到对应站点信息=>" + model.FullName, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
|
||||
else
|
||||
{
|
||||
UploadList.Add(uploadinfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UploadList.Add(uploadinfo);
|
||||
MessageBox.Show("没有找到对应FTP信息=>" + model.FullName, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("没有找到对应FTP信息=>" + model.FullName, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (UploadList.Count > 0)
|
||||
@@ -1281,6 +1280,246 @@ namespace SuperDesign.Tools.SmartEditor
|
||||
//olvFiles.RemoveObjects(del_list);
|
||||
}
|
||||
}
|
||||
|
||||
private void 上传全部站点对应文件到FTPToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var list = this.olvFiles.SelectedObjects;
|
||||
var files=new List<string>();
|
||||
List<UploadInfo> UploadList = new List<UploadInfo>();
|
||||
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
|
||||
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
|
||||
{
|
||||
for (int l = 0; l < list.Count; l++)
|
||||
{
|
||||
MyFileSystemInfo model = (MyFileSystemInfo)list[l];
|
||||
if (model != null)
|
||||
{
|
||||
//if (System.IO.Directory.Exists(model.FullName))
|
||||
//{
|
||||
// MessageBox.Show("暂不支持上传文件夹=>" + model.FullName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
// continue ;
|
||||
//}
|
||||
string FilePath = model.FullName;
|
||||
DataSet ds = db.ReadData("select * from Site");
|
||||
if (ds.HaveData())
|
||||
{
|
||||
for (int m = 0; m < list.Count; m++)
|
||||
{
|
||||
var row = (MyFileSystemInfo)list[m];
|
||||
var xd_path = "";
|
||||
var cur_Id = -1;
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
DataRow reader = ds.Tables[0].Rows[i];
|
||||
if (row.FullName.IndexOfEx(reader["localPath"].ToString()) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
xd_path = row.FullName.Replace(reader["localPath"].ToString(), "", true).Trim('\\');
|
||||
cur_Id = reader["id"].ToInt();
|
||||
break;
|
||||
}
|
||||
if (cur_Id == -1)
|
||||
{
|
||||
MessageBox.Show("当前选定的文件无法获取站点信息。", "无法获取站点", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
files.Add(model.FullName);
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
DataRow reader = ds.Tables[0].Rows[i];
|
||||
if (cur_Id == reader["id"].ToInt()) { continue; }
|
||||
var same_file_path = reader["localPath"].ToString() + "\\" + xd_path;
|
||||
if (RyFiles.FileOrDirExist(same_file_path))
|
||||
{ files.Add(same_file_path); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ds.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int f = 0; f < files.Count; f++)
|
||||
{
|
||||
//if (System.IO.Directory.Exists(model.FullName))
|
||||
//{
|
||||
// MessageBox.Show("暂不支持上传文件夹=>" + model.FullName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
// continue ;
|
||||
//}
|
||||
string FilePath = files[f];
|
||||
SiteInfo SiteInfo = new SiteInfo();
|
||||
UploadInfo uploadinfo = null;
|
||||
DataSet ds = db.ReadData("select * from Site");
|
||||
if (ds.HaveData())
|
||||
{
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
DataRow reader = ds.Tables[0].Rows[i];
|
||||
if (FilePath.IndexOfEx(reader["localPath"].ToString()) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#region 读取信息
|
||||
SiteInfo.Name = reader["name"].ToString();
|
||||
SiteInfo.LocalPath = reader["localPath"].ToString();
|
||||
SiteInfo.FtpDir = reader["ftpDir"].ToString();
|
||||
SiteInfo.FtpId = reader["ftpId"].ToInt();
|
||||
SiteInfo.Id = reader["Id"].ToInt();
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
ds.Dispose();
|
||||
ds = db.ReadData("select * from Ftp where Id=" + SiteInfo.FtpId);
|
||||
if (ds.HaveData())
|
||||
{
|
||||
DataRow row = ds.Tables[0].Rows[0];
|
||||
var FtpInfo = new GameBackup3H3.DbOp.FTPInfo()
|
||||
{
|
||||
Id = row["id"].ToInt(),
|
||||
Name = row["name"].ToString(),
|
||||
IP = row["ip"].ToString(),
|
||||
Port = row["port"].ToInt(),
|
||||
RemoteDir = SiteInfo.FtpDir,
|
||||
UserName = row["username"].ToString(),
|
||||
Pwd = row["pwd"].ToString(),
|
||||
Encrypt = row["encrypt"].ToInt(0, 2, 0),
|
||||
AddTime = row["AddTime"].ToDateTime()
|
||||
};
|
||||
uploadinfo = new UploadInfo()
|
||||
{
|
||||
FtpInfo = FtpInfo,
|
||||
RemotePath = SiteInfo.FtpDir.Trim('/') + "/" + FilePath.Replace(SiteInfo.LocalPath, "", true).Trim('\\').Replace("\\", "/"),
|
||||
LocalPath = FilePath
|
||||
};
|
||||
}
|
||||
ds.Dispose();
|
||||
if (SiteInfo.FtpId > 0)
|
||||
{
|
||||
if (uploadinfo == null) { MessageBox.Show("没有找到对应站点信息=>" + FilePath, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
|
||||
else
|
||||
{
|
||||
UploadList.Add(uploadinfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("没有找到对应FTP信息=>" + FilePath, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
db.Free();
|
||||
if (UploadList.Count > 0)
|
||||
{
|
||||
FrmUploadProg frm = new FrmUploadProg();
|
||||
frm.UploadList.AddRange(UploadList);
|
||||
if (frm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
//MessageBox.Show("上传成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("上传失败。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
frm.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void 同步所有站点文件为最新版本ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var list = this.olvFiles.SelectedObjects;
|
||||
if (list.Count > 0)
|
||||
{
|
||||
switch (MessageBox.Show("确定要检索所有站点,将最新版本的文件,同步到其它存有老版本文件的站点?\r\n将选定" + list.Count + "个文件进行分析?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2))
|
||||
{
|
||||
case DialogResult.No:
|
||||
return;
|
||||
}
|
||||
this.Enabled = false;
|
||||
Thread th = new Thread(Start);
|
||||
th.Start();
|
||||
void Start()
|
||||
{
|
||||
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
|
||||
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
|
||||
{
|
||||
DataSet ds = db.ReadData("select * from Site");
|
||||
if (ds.HaveData())
|
||||
{
|
||||
for (int m = 0; m < list.Count; m++)
|
||||
{
|
||||
var row = (MyFileSystemInfo)list[m];
|
||||
var xd_path = "";
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
DataRow reader = ds.Tables[0].Rows[i];
|
||||
if (row.FullName.IndexOfEx(reader["localPath"].ToString()) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
xd_path = row.FullName.Replace(reader["localPath"].ToString(), "", true).Trim('\\');
|
||||
break;
|
||||
}
|
||||
var new_id = 0;
|
||||
ryCommon.sType.FileTime new_file_dt =null;
|
||||
var new_file_path = "";
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
DataRow reader = ds.Tables[0].Rows[i];
|
||||
var same_file = reader["localPath"].ToString() + "\\" + xd_path;
|
||||
if (RyFiles.FileOrDirExist(same_file))
|
||||
{
|
||||
var dt = RyFiles.GetFileDate(same_file);
|
||||
if (new_file_dt == null) { new_id = reader["id"].ToInt(); new_file_path = same_file; new_file_dt = dt; }
|
||||
else
|
||||
{
|
||||
if (dt.LastWriteTime > new_file_dt.LastWriteTime) { new_id = reader["id"].ToInt(); new_file_path = same_file; new_file_dt = dt; }
|
||||
else if (dt.CreateTime > new_file_dt.CreateTime) { new_id = reader["id"].ToInt(); new_file_path = same_file; new_file_dt = dt; }
|
||||
}
|
||||
}
|
||||
}
|
||||
if(new_file_path.Length>0)
|
||||
{
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
DataRow reader = ds.Tables[0].Rows[i];
|
||||
if (reader["id"].ToInt() == new_id) { continue; }
|
||||
var same_file = reader["localPath"].ToString() + "\\" + xd_path;
|
||||
var is_update = false;
|
||||
if (RyFiles.FileOrDirExist(same_file))
|
||||
{
|
||||
var dt = RyFiles.GetFileDate(same_file);
|
||||
if (dt.LastWriteTime < new_file_dt.LastWriteTime) { is_update = true; }
|
||||
else if (dt.CreateTime < new_file_dt.CreateTime) { is_update = true; }
|
||||
}
|
||||
else
|
||||
{
|
||||
is_update = true;
|
||||
}
|
||||
if(is_update)
|
||||
{
|
||||
if (RyFiles.CopyFileOrFolder(new_file_path, same_file) != 0)
|
||||
{
|
||||
MessageBox.Show("复制到以下位置出错\r\n" + same_file, "复制出错", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ds?.Dispose();
|
||||
}
|
||||
db.Free();
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
this.Enabled = true;
|
||||
UpdateNode(TreeDir.SelectedNode);
|
||||
}));
|
||||
}
|
||||
//olvFiles.RemoveObjects(del_list);
|
||||
}
|
||||
}
|
||||
//private void FileSystemWatcher1_Created(object sender, FileSystemEventArgs e)
|
||||
//{
|
||||
// if(CurFolderPath.Length>0 && e.FullPath.IndexOfEx(CurFolderPath)>=0)
|
||||
|
||||
Reference in new issue
Block a user