Browse Source

为更新添加清理冗余数据功能

yuzhengyang 8 years ago
parent
commit
de8eaea79f

+ 74 - 41
Fork.Net/Version.Update/Form1.Designer.cs

@@ -28,14 +28,15 @@
         /// </summary>
         /// </summary>
         private void InitializeComponent()
         private void InitializeComponent()
         {
         {
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
             this.DgvFileList = new System.Windows.Forms.DataGridView();
             this.DgvFileList = new System.Windows.Forms.DataGridView();
             this.ColNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ColNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ColFile = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ColFile = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -47,6 +48,8 @@
             this.BtUpdate = new System.Windows.Forms.Button();
             this.BtUpdate = new System.Windows.Forms.Button();
             this.BtBackup = new System.Windows.Forms.Button();
             this.BtBackup = new System.Windows.Forms.Button();
             this.BtDownload = new System.Windows.Forms.Button();
             this.BtDownload = new System.Windows.Forms.Button();
+            this.PbStatus = new System.Windows.Forms.ProgressBar();
+            this.BtClean = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.DgvFileList)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.DgvFileList)).BeginInit();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
@@ -57,14 +60,14 @@
             this.DgvFileList.AllowUserToResizeColumns = false;
             this.DgvFileList.AllowUserToResizeColumns = false;
             this.DgvFileList.AllowUserToResizeRows = false;
             this.DgvFileList.AllowUserToResizeRows = false;
             this.DgvFileList.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
             this.DgvFileList.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
-            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
-            dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
-            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
-            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
-            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
-            this.DgvFileList.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
+            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
+            dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
+            dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+            dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+            this.DgvFileList.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
             this.DgvFileList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.DgvFileList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.DgvFileList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.DgvFileList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.ColNum,
             this.ColNum,
@@ -73,16 +76,24 @@
             this.ColBack,
             this.ColBack,
             this.ColUpdate,
             this.ColUpdate,
             this.ColRoll});
             this.ColRoll});
-            this.DgvFileList.Location = new System.Drawing.Point(12, 55);
+            dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+            dataGridViewCellStyle17.BackColor = System.Drawing.SystemColors.Window;
+            dataGridViewCellStyle17.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.ControlText;
+            dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+            dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
+            this.DgvFileList.DefaultCellStyle = dataGridViewCellStyle17;
+            this.DgvFileList.Location = new System.Drawing.Point(12, 48);
             this.DgvFileList.Name = "DgvFileList";
             this.DgvFileList.Name = "DgvFileList";
             this.DgvFileList.ReadOnly = true;
             this.DgvFileList.ReadOnly = true;
-            dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control;
-            dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText;
-            dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
-            dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
-            dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
-            this.DgvFileList.RowHeadersDefaultCellStyle = dataGridViewCellStyle8;
+            dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Control;
+            dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.WindowText;
+            dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+            dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+            this.DgvFileList.RowHeadersDefaultCellStyle = dataGridViewCellStyle18;
             this.DgvFileList.RowHeadersVisible = false;
             this.DgvFileList.RowHeadersVisible = false;
             this.DgvFileList.RowTemplate.Height = 23;
             this.DgvFileList.RowTemplate.Height = 23;
             this.DgvFileList.Size = new System.Drawing.Size(699, 424);
             this.DgvFileList.Size = new System.Drawing.Size(699, 424);
@@ -90,8 +101,8 @@
             // 
             // 
             // ColNum
             // ColNum
             // 
             // 
-            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.ColNum.DefaultCellStyle = dataGridViewCellStyle2;
+            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.ColNum.DefaultCellStyle = dataGridViewCellStyle11;
             this.ColNum.FillWeight = 10F;
             this.ColNum.FillWeight = 10F;
             this.ColNum.HeaderText = "序号";
             this.ColNum.HeaderText = "序号";
             this.ColNum.Name = "ColNum";
             this.ColNum.Name = "ColNum";
@@ -101,8 +112,8 @@
             // 
             // 
             // ColFile
             // ColFile
             // 
             // 
-            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.ColFile.DefaultCellStyle = dataGridViewCellStyle3;
+            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.ColFile.DefaultCellStyle = dataGridViewCellStyle12;
             this.ColFile.FillWeight = 40F;
             this.ColFile.FillWeight = 40F;
             this.ColFile.HeaderText = "文件";
             this.ColFile.HeaderText = "文件";
             this.ColFile.Name = "ColFile";
             this.ColFile.Name = "ColFile";
@@ -112,8 +123,8 @@
             // 
             // 
             // ColDown
             // ColDown
             // 
             // 
-            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.ColDown.DefaultCellStyle = dataGridViewCellStyle4;
+            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.ColDown.DefaultCellStyle = dataGridViewCellStyle13;
             this.ColDown.FillWeight = 10F;
             this.ColDown.FillWeight = 10F;
             this.ColDown.HeaderText = "下载";
             this.ColDown.HeaderText = "下载";
             this.ColDown.Name = "ColDown";
             this.ColDown.Name = "ColDown";
@@ -123,8 +134,8 @@
             // 
             // 
             // ColBack
             // ColBack
             // 
             // 
-            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.ColBack.DefaultCellStyle = dataGridViewCellStyle5;
+            dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.ColBack.DefaultCellStyle = dataGridViewCellStyle14;
             this.ColBack.FillWeight = 10F;
             this.ColBack.FillWeight = 10F;
             this.ColBack.HeaderText = "备份";
             this.ColBack.HeaderText = "备份";
             this.ColBack.Name = "ColBack";
             this.ColBack.Name = "ColBack";
@@ -134,8 +145,8 @@
             // 
             // 
             // ColUpdate
             // ColUpdate
             // 
             // 
-            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.ColUpdate.DefaultCellStyle = dataGridViewCellStyle6;
+            dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.ColUpdate.DefaultCellStyle = dataGridViewCellStyle15;
             this.ColUpdate.FillWeight = 10F;
             this.ColUpdate.FillWeight = 10F;
             this.ColUpdate.HeaderText = "更新";
             this.ColUpdate.HeaderText = "更新";
             this.ColUpdate.Name = "ColUpdate";
             this.ColUpdate.Name = "ColUpdate";
@@ -145,8 +156,8 @@
             // 
             // 
             // ColRoll
             // ColRoll
             // 
             // 
-            dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.ColRoll.DefaultCellStyle = dataGridViewCellStyle7;
+            dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.ColRoll.DefaultCellStyle = dataGridViewCellStyle16;
             this.ColRoll.FillWeight = 10F;
             this.ColRoll.FillWeight = 10F;
             this.ColRoll.HeaderText = "还原";
             this.ColRoll.HeaderText = "还原";
             this.ColRoll.Name = "ColRoll";
             this.ColRoll.Name = "ColRoll";
@@ -156,7 +167,7 @@
             // 
             // 
             // BtRollback
             // BtRollback
             // 
             // 
-            this.BtRollback.Location = new System.Drawing.Point(634, 22);
+            this.BtRollback.Location = new System.Drawing.Point(634, 15);
             this.BtRollback.Name = "BtRollback";
             this.BtRollback.Name = "BtRollback";
             this.BtRollback.Size = new System.Drawing.Size(75, 23);
             this.BtRollback.Size = new System.Drawing.Size(75, 23);
             this.BtRollback.TabIndex = 14;
             this.BtRollback.TabIndex = 14;
@@ -166,7 +177,7 @@
             // 
             // 
             // BtUpdate
             // BtUpdate
             // 
             // 
-            this.BtUpdate.Location = new System.Drawing.Point(556, 22);
+            this.BtUpdate.Location = new System.Drawing.Point(556, 15);
             this.BtUpdate.Name = "BtUpdate";
             this.BtUpdate.Name = "BtUpdate";
             this.BtUpdate.Size = new System.Drawing.Size(75, 23);
             this.BtUpdate.Size = new System.Drawing.Size(75, 23);
             this.BtUpdate.TabIndex = 13;
             this.BtUpdate.TabIndex = 13;
@@ -176,7 +187,7 @@
             // 
             // 
             // BtBackup
             // BtBackup
             // 
             // 
-            this.BtBackup.Location = new System.Drawing.Point(478, 22);
+            this.BtBackup.Location = new System.Drawing.Point(478, 15);
             this.BtBackup.Name = "BtBackup";
             this.BtBackup.Name = "BtBackup";
             this.BtBackup.Size = new System.Drawing.Size(75, 23);
             this.BtBackup.Size = new System.Drawing.Size(75, 23);
             this.BtBackup.TabIndex = 12;
             this.BtBackup.TabIndex = 12;
@@ -186,7 +197,7 @@
             // 
             // 
             // BtDownload
             // BtDownload
             // 
             // 
-            this.BtDownload.Location = new System.Drawing.Point(401, 22);
+            this.BtDownload.Location = new System.Drawing.Point(401, 15);
             this.BtDownload.Name = "BtDownload";
             this.BtDownload.Name = "BtDownload";
             this.BtDownload.Size = new System.Drawing.Size(75, 23);
             this.BtDownload.Size = new System.Drawing.Size(75, 23);
             this.BtDownload.TabIndex = 11;
             this.BtDownload.TabIndex = 11;
@@ -194,16 +205,36 @@
             this.BtDownload.UseVisualStyleBackColor = true;
             this.BtDownload.UseVisualStyleBackColor = true;
             this.BtDownload.Click += new System.EventHandler(this.BtDownload_Click);
             this.BtDownload.Click += new System.EventHandler(this.BtDownload_Click);
             // 
             // 
+            // PbStatus
+            // 
+            this.PbStatus.Location = new System.Drawing.Point(-6, 484);
+            this.PbStatus.Name = "PbStatus";
+            this.PbStatus.Size = new System.Drawing.Size(738, 23);
+            this.PbStatus.TabIndex = 15;
+            // 
+            // BtClean
+            // 
+            this.BtClean.Location = new System.Drawing.Point(264, 15);
+            this.BtClean.Name = "BtClean";
+            this.BtClean.Size = new System.Drawing.Size(75, 23);
+            this.BtClean.TabIndex = 16;
+            this.BtClean.Text = "清理";
+            this.BtClean.UseVisualStyleBackColor = true;
+            this.BtClean.Click += new System.EventHandler(this.BtClean_Click);
+            // 
             // Form1
             // Form1
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(727, 494);
+            this.ClientSize = new System.Drawing.Size(727, 489);
+            this.Controls.Add(this.BtClean);
+            this.Controls.Add(this.PbStatus);
             this.Controls.Add(this.DgvFileList);
             this.Controls.Add(this.DgvFileList);
             this.Controls.Add(this.BtRollback);
             this.Controls.Add(this.BtRollback);
             this.Controls.Add(this.BtUpdate);
             this.Controls.Add(this.BtUpdate);
             this.Controls.Add(this.BtBackup);
             this.Controls.Add(this.BtBackup);
             this.Controls.Add(this.BtDownload);
             this.Controls.Add(this.BtDownload);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
             this.Name = "Form1";
             this.Name = "Form1";
             this.Text = "Form1";
             this.Text = "Form1";
             this.Load += new System.EventHandler(this.Form1_Load);
             this.Load += new System.EventHandler(this.Form1_Load);
@@ -225,6 +256,8 @@
         private System.Windows.Forms.Button BtUpdate;
         private System.Windows.Forms.Button BtUpdate;
         private System.Windows.Forms.Button BtBackup;
         private System.Windows.Forms.Button BtBackup;
         private System.Windows.Forms.Button BtDownload;
         private System.Windows.Forms.Button BtDownload;
+        private System.Windows.Forms.ProgressBar PbStatus;
+        private System.Windows.Forms.Button BtClean;
     }
     }
 }
 }
 
 

+ 53 - 4
Fork.Net/Version.Update/Form1.cs

@@ -1,9 +1,12 @@
 using System;
 using System;
+using System.Collections.Generic;
 using System.IO;
 using System.IO;
+using System.Linq;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using System.Windows.Forms;
 using Version.Update.Models;
 using Version.Update.Models;
+using Y.Utils.DataUtils.Collections;
 using Y.Utils.DataUtils.JsonUtils;
 using Y.Utils.DataUtils.JsonUtils;
 using Y.Utils.IOUtils.FileUtils;
 using Y.Utils.IOUtils.FileUtils;
 using Y.Utils.IOUtils.PathUtils;
 using Y.Utils.IOUtils.PathUtils;
@@ -16,14 +19,14 @@ namespace Version.Update
         const string FILE_SUCC = "√";
         const string FILE_SUCC = "√";
         const string FILE_FAIL = "×";
         const string FILE_FAIL = "×";
         const string FILE_JUMP = "-";
         const string FILE_JUMP = "-";
-        const int WAIT_TIME = 100;
+        const int WAIT_TIME = 50;
         string AppDir = AppDomain.CurrentDomain.BaseDirectory;
         string AppDir = AppDomain.CurrentDomain.BaseDirectory;
         string folder = Guid.NewGuid().ToString();
         string folder = Guid.NewGuid().ToString();
         string downloadPath = "";
         string downloadPath = "";
         string backupPath = "";
         string backupPath = "";
         VersionModel version;
         VersionModel version;
 
 
-        string VersionFile = @"D:\FTP\Application\version1.2.txt";
+        string VersionFile = @"D:\FTP\Application\version1.0.txt";
         string FtpIp = "192.168.3.56";
         string FtpIp = "192.168.3.56";
         string FtpAccount = "Administrator";
         string FtpAccount = "Administrator";
         string FtpPassword = "yuzhengyang";
         string FtpPassword = "yuzhengyang";
@@ -34,8 +37,8 @@ namespace Version.Update
 
 
         private void Form1_Load(object sender, EventArgs e)
         private void Form1_Load(object sender, EventArgs e)
         {
         {
-            downloadPath = AppDir + @"Download\" + folder;
-            backupPath = AppDir + @"Backup\" + folder;
+            downloadPath = AppDir + @"VersionUpdate\Download\" + folder;
+            backupPath = AppDir + @"VersionUpdate\Backup\" + folder;
 
 
             Task.Factory.StartNew(() =>
             Task.Factory.StartNew(() =>
             {
             {
@@ -246,6 +249,46 @@ namespace Version.Update
             }
             }
             return false;
             return false;
         }
         }
+        /// <summary>
+        /// 清理之前版本遗留文件及空文件夹
+        /// </summary>
+        /// <returns></returns>
+        void CleanFile()
+        {
+            #region 删除非当前版本文件
+            List<string> file = FileTool.GetAllFile(AppDir);
+            if (!ListTool.IsNullOrEmpty(file))
+            {
+                foreach (var f in file)
+                {
+                    int c = version.FileList.Where(x => x.File == "\\" + f.Replace(AppDir, "")).Count();
+                    if (c == 0)
+                    {
+                        File.Delete(f);
+                    }
+                }
+                Thread.Sleep(WAIT_TIME);
+            }
+            #endregion
+            #region 删除空文件夹
+            List<string> path = DirTool.GetAllPath(AppDir);
+            if (!ListTool.IsNullOrEmpty(path))
+            {
+                path = path.OrderByDescending(x => x).ToList();
+                foreach (var p in path)
+                {
+                    if (Directory.GetFiles(p).Length == 0 && Directory.GetDirectories(p).Length == 0)
+                    {
+                        if (Directory.Exists(p))
+                        {
+                            Directory.Delete(p);
+                        }
+                    }
+                    Thread.Sleep(WAIT_TIME);
+                }
+            }
+            #endregion
+        }
         #endregion
         #endregion
         #region UI刷新
         #region UI刷新
         /// <summary>
         /// <summary>
@@ -262,6 +305,7 @@ namespace Version.Update
         void UIDgvFileListUpdate(int row, string cell, string value)
         void UIDgvFileListUpdate(int row, string cell, string value)
         {
         {
             DgvFileList.Rows[row].Cells[cell].Value = value;
             DgvFileList.Rows[row].Cells[cell].Value = value;
+            PbStatus.Value = (int)((double)(row + 1) / version.FileList.Count * 100);
         }
         }
         #endregion
         #endregion
 
 
@@ -284,5 +328,10 @@ namespace Version.Update
         {
         {
             Task.Factory.StartNew(() => { RollBackFile(backupPath); });
             Task.Factory.StartNew(() => { RollBackFile(backupPath); });
         }
         }
+
+        private void BtClean_Click(object sender, EventArgs e)
+        {
+            Task.Factory.StartNew(() => { CleanFile(); });
+        }
     }
     }
 }
 }

+ 1 - 1
Fork.Net/Y.Test/Program.cs

@@ -17,7 +17,7 @@ namespace Y.Test
         {
         {
             Application.EnableVisualStyles();
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             Application.SetCompatibleTextRenderingDefault(false);
-            Application.Run(new MainForm());
+            Application.Run(new TestWebForm());
         }
         }
     }
     }
 }
 }

+ 73 - 0
Fork.Net/Y.Test/Views/TestWebForm.Designer.cs

@@ -0,0 +1,73 @@
+namespace Y.Test.Views
+{
+    partial class TestWebForm
+    {
+        /// <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.textBox1 = new System.Windows.Forms.TextBox();
+            this.button1 = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(13, 13);
+            this.textBox1.Multiline = true;
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(259, 209);
+            this.textBox1.TabIndex = 0;
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(205, 229);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 1;
+            this.button1.Text = "button1";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // TestWebForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(284, 261);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.textBox1);
+            this.Name = "TestWebForm";
+            this.Text = "TestWebForm";
+            this.Load += new System.EventHandler(this.TestWebForm_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.Button button1;
+    }
+}

+ 28 - 0
Fork.Net/Y.Test/Views/TestWebForm.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.NetworkInformation;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Y.Test.Views
+{
+    public partial class TestWebForm : Form
+    {
+        public TestWebForm()
+        {
+            InitializeComponent();
+        }
+
+        private void TestWebForm_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+        }
+    }
+}

+ 120 - 0
Fork.Net/Y.Test/Views/TestWebForm.resx

@@ -0,0 +1,120 @@
+<?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>

+ 13 - 0
Fork.Net/Y.Test/Y.Test.csproj

@@ -60,6 +60,12 @@
     <Compile Include="Views\MainForm.Designer.cs">
     <Compile Include="Views\MainForm.Designer.cs">
       <DependentUpon>MainForm.cs</DependentUpon>
       <DependentUpon>MainForm.cs</DependentUpon>
     </Compile>
     </Compile>
+    <Compile Include="Views\TestWebForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Views\TestWebForm.Designer.cs">
+      <DependentUpon>TestWebForm.cs</DependentUpon>
+    </Compile>
     <EmbeddedResource Include="Form1.resx">
     <EmbeddedResource Include="Form1.resx">
       <DependentUpon>Form1.cs</DependentUpon>
       <DependentUpon>Form1.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>
@@ -75,6 +81,9 @@
     <EmbeddedResource Include="Views\MainForm.resx">
     <EmbeddedResource Include="Views\MainForm.resx">
       <DependentUpon>MainForm.cs</DependentUpon>
       <DependentUpon>MainForm.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>
+    <EmbeddedResource Include="Views\TestWebForm.resx">
+      <DependentUpon>TestWebForm.cs</DependentUpon>
+    </EmbeddedResource>
     <None Include="Properties\Settings.settings">
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -93,6 +102,10 @@
       <Project>{E9A97673-3E27-4A49-90BC-8806411A2F57}</Project>
       <Project>{E9A97673-3E27-4A49-90BC-8806411A2F57}</Project>
       <Name>Y.Skin</Name>
       <Name>Y.Skin</Name>
     </ProjectReference>
     </ProjectReference>
+    <ProjectReference Include="..\Y.Utils\Y.Utils.csproj">
+      <Project>{5b8eeec7-aeb5-407d-9dc1-1c59e53f78d5}</Project>
+      <Name>Y.Utils</Name>
+    </ProjectReference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup />
   <ItemGroup />
   <ItemGroup>
   <ItemGroup>