写卡程序

Form1.Designer.cs

None.gif namespace  WriteCard
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    partial 
class Form1
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// Required designer variable.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private System.ComponentModel.IContainer components = null;
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// Clean up any resources being used.
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

InBlock.gif        protected override void Dispose(bool disposing)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (disposing && (components != null))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                components.Dispose();
ExpandedSubBlockEnd.gif            }

InBlock.gif            
base.Dispose(disposing);
ExpandedSubBlockEnd.gif        }

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
Windows Form Designer generated code#region Windows Form Designer generated code
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// Required method for Designer support - do not modify
InBlock.gif        
/// the contents of this method with the code editor.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private void InitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.components = new System.ComponentModel.Container();
InBlock.gif            System.ComponentModel.ComponentResourceManager resources 
= new System.ComponentModel.ComponentResourceManager(typeof(Form1));
InBlock.gif            
this.timer1 = new System.Windows.Forms.Timer(this.components);
InBlock.gif            
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
InBlock.gif            
this.groupBox3 = new System.Windows.Forms.GroupBox();
InBlock.gif            
this.button1 = new System.Windows.Forms.Button();
InBlock.gif            
this.label3 = new System.Windows.Forms.Label();
InBlock.gif            
this.groupBox1 = new System.Windows.Forms.GroupBox();
InBlock.gif            
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
InBlock.gif            
this.groupBox2 = new System.Windows.Forms.GroupBox();
InBlock.gif            
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
InBlock.gif            
this.button2 = new System.Windows.Forms.Button();
InBlock.gif            
this.textBox1 = new System.Windows.Forms.TextBox();
InBlock.gif            
this.textBox2 = new System.Windows.Forms.TextBox();
InBlock.gif            
this.label1 = new System.Windows.Forms.Label();
InBlock.gif            
this.label2 = new System.Windows.Forms.Label();
InBlock.gif            
this.button3 = new System.Windows.Forms.Button();
InBlock.gif            
this.button4 = new System.Windows.Forms.Button();
InBlock.gif            
this.label4 = new System.Windows.Forms.Label();
InBlock.gif            
this.groupBox3.SuspendLayout();
InBlock.gif            
this.groupBox1.SuspendLayout();
InBlock.gif            
this.groupBox2.SuspendLayout();
InBlock.gif            
this.SuspendLayout();
InBlock.gif            
// 
InBlock.gif            
// timer1
InBlock.gif            
// 
InBlock.gif
            this.timer1.Interval = 1000;
InBlock.gif            
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
InBlock.gif            
// 
InBlock.gif            
// groupBox3
InBlock.gif            
// 
InBlock.gif
            this.groupBox3.Controls.Add(this.button1);
InBlock.gif            
this.groupBox3.Controls.Add(this.label3);
InBlock.gif            
this.groupBox3.Controls.Add(this.groupBox1);
InBlock.gif            
this.groupBox3.Controls.Add(this.groupBox2);
InBlock.gif            
this.groupBox3.Controls.Add(this.button2);
InBlock.gif            
this.groupBox3.Location = new System.Drawing.Point(1398);
InBlock.gif            
this.groupBox3.Name = "groupBox3";
InBlock.gif            
this.groupBox3.Size = new System.Drawing.Size(490305);
InBlock.gif            
this.groupBox3.TabIndex = 18;
InBlock.gif            
this.groupBox3.TabStop = false;
InBlock.gif            
this.groupBox3.Text = "WriteCard";
InBlock.gif            
// 
InBlock.gif            
// button1
InBlock.gif            
// 
InBlock.gif
            this.button1.Location = new System.Drawing.Point(39720);
InBlock.gif            
this.button1.Name = "button1";
InBlock.gif            
this.button1.Size = new System.Drawing.Size(8728);
InBlock.gif            
this.button1.TabIndex = 2;
InBlock.gif            
this.button1.Text = "start";
InBlock.gif            
this.button1.UseVisualStyleBackColor = true;
InBlock.gif            
this.button1.Click += new System.EventHandler(this.button1_Click);
InBlock.gif            
// 
InBlock.gif            
// label3
InBlock.gif            
// 
InBlock.gif
            this.label3.AutoSize = true;
InBlock.gif            
this.label3.ForeColor = System.Drawing.Color.Red;
InBlock.gif            
this.label3.Location = new System.Drawing.Point(7279);
InBlock.gif            
this.label3.Name = "label3";
InBlock.gif            
this.label3.Size = new System.Drawing.Size(012);
InBlock.gif            
this.label3.TabIndex = 15;
InBlock.gif            
// 
InBlock.gif            
// groupBox1
InBlock.gif            
// 
InBlock.gif
            this.groupBox1.Controls.Add(this.richTextBox1);
InBlock.gif            
this.groupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaption;
InBlock.gif            
this.groupBox1.Location = new System.Drawing.Point(2622);
InBlock.gif            
this.groupBox1.Name = "groupBox1";
InBlock.gif            
this.groupBox1.Size = new System.Drawing.Size(166249);
InBlock.gif            
this.groupBox1.TabIndex = 16;
InBlock.gif            
this.groupBox1.TabStop = false;
InBlock.gif            
this.groupBox1.Text = "移动设备";
InBlock.gif            
// 
InBlock.gif            
// richTextBox1
InBlock.gif            
// 
InBlock.gif
            this.richTextBox1.Location = new System.Drawing.Point(1720);
InBlock.gif            
this.richTextBox1.Name = "richTextBox1";
InBlock.gif            
this.richTextBox1.Size = new System.Drawing.Size(132217);
InBlock.gif            
this.richTextBox1.TabIndex = 13;
InBlock.gif            
this.richTextBox1.Text = "";
InBlock.gif            
// 
InBlock.gif            
// groupBox2
InBlock.gif            
// 
InBlock.gif
            this.groupBox2.Controls.Add(this.richTextBox2);
InBlock.gif            
this.groupBox2.ForeColor = System.Drawing.SystemColors.ActiveCaption;
InBlock.gif            
this.groupBox2.Location = new System.Drawing.Point(20720);
InBlock.gif            
this.groupBox2.Name = "groupBox2";
InBlock.gif            
this.groupBox2.Size = new System.Drawing.Size(184251);
InBlock.gif            
this.groupBox2.TabIndex = 17;
InBlock.gif            
this.groupBox2.TabStop = false;
InBlock.gif            
this.groupBox2.Text = "线程状态";
InBlock.gif            
// 
InBlock.gif            
// richTextBox2
InBlock.gif            
// 
InBlock.gif
            this.richTextBox2.ForeColor = System.Drawing.Color.Red;
InBlock.gif            
this.richTextBox2.Location = new System.Drawing.Point(2522);
InBlock.gif            
this.richTextBox2.Name = "richTextBox2";
InBlock.gif            
this.richTextBox2.Size = new System.Drawing.Size(132217);
InBlock.gif            
this.richTextBox2.TabIndex = 14;
InBlock.gif            
this.richTextBox2.Text = "";
InBlock.gif            
// 
InBlock.gif            
// button2
InBlock.gif            
// 
InBlock.gif
            this.button2.Location = new System.Drawing.Point(39768);
InBlock.gif            
this.button2.Name = "button2";
InBlock.gif            
this.button2.Size = new System.Drawing.Size(8726);
InBlock.gif            
this.button2.TabIndex = 7;
InBlock.gif            
this.button2.Text = " stop";
InBlock.gif            
this.button2.UseVisualStyleBackColor = true;
InBlock.gif            
this.button2.Click += new System.EventHandler(this.button2_Click);
InBlock.gif            
// 
InBlock.gif            
// textBox1
InBlock.gif            
// 
InBlock.gif
            this.textBox1.Location = new System.Drawing.Point(10521);
InBlock.gif            
this.textBox1.Name = "textBox1";
InBlock.gif            
this.textBox1.Size = new System.Drawing.Size(25421);
InBlock.gif            
this.textBox1.TabIndex = 0;
InBlock.gif            
this.textBox1.Text = "E:\\test";
InBlock.gif            
// 
InBlock.gif            
// textBox2
InBlock.gif            
// 
InBlock.gif
            this.textBox2.Location = new System.Drawing.Point(17353);
InBlock.gif            
this.textBox2.Name = "textBox2";
InBlock.gif            
this.textBox2.Size = new System.Drawing.Size(18621);
InBlock.gif            
this.textBox2.TabIndex = 1;
InBlock.gif            
this.textBox2.Text = "G:\\";
InBlock.gif            
// 
InBlock.gif            
// label1
InBlock.gif            
// 
InBlock.gif
            this.label1.AutoSize = true;
InBlock.gif            
this.label1.Location = new System.Drawing.Point(1224);
InBlock.gif            
this.label1.Name = "label1";
InBlock.gif            
this.label1.Size = new System.Drawing.Size(8312);
InBlock.gif            
this.label1.TabIndex = 3;
InBlock.gif            
this.label1.Text = "选择源文件夹:";
InBlock.gif            
// 
InBlock.gif            
// label2
InBlock.gif            
// 
InBlock.gif
            this.label2.AutoSize = true;
InBlock.gif            
this.label2.Location = new System.Drawing.Point(1158);
InBlock.gif            
this.label2.Name = "label2";
InBlock.gif            
this.label2.Size = new System.Drawing.Size(16112);
InBlock.gif            
this.label2.TabIndex = 4;
InBlock.gif            
this.label2.Text = "请选择你机器的最后一个盘: ";
InBlock.gif            
// 
InBlock.gif            
// button3
InBlock.gif            
// 
InBlock.gif
            this.button3.Location = new System.Drawing.Point(40219);
InBlock.gif            
this.button3.Name = "button3";
InBlock.gif            
this.button3.Size = new System.Drawing.Size(10023);
InBlock.gif            
this.button3.TabIndex = 10;
InBlock.gif            
this.button3.Text = "浏览dot.gif";
InBlock.gif            
this.button3.UseVisualStyleBackColor = true;
InBlock.gif            
this.button3.Click += new System.EventHandler(this.button3_Click);
InBlock.gif            
// 
InBlock.gif            
// button4
InBlock.gif            
// 
InBlock.gif
            this.button4.Location = new System.Drawing.Point(40353);
InBlock.gif            
this.button4.Name = "button4";
InBlock.gif            
this.button4.Size = new System.Drawing.Size(10023);
InBlock.gif            
this.button4.TabIndex = 11;
InBlock.gif            
this.button4.Text = " 浏览dot.gif";
InBlock.gif            
this.button4.UseVisualStyleBackColor = true;
InBlock.gif            
this.button4.Click += new System.EventHandler(this.button4_Click);
InBlock.gif            
// 
InBlock.gif            
// label4
InBlock.gif            
// 
InBlock.gif
            this.label4.AutoSize = true;
InBlock.gif            
this.label4.ForeColor = System.Drawing.Color.Blue;
InBlock.gif            
this.label4.Location = new System.Drawing.Point(204411);
InBlock.gif            
this.label4.Name = "label4";
InBlock.gif            
this.label4.Size = new System.Drawing.Size(9512);
InBlock.gif            
this.label4.TabIndex = 19;
InBlock.gif            
this.label4.Text = "@小子好黑  2007";
InBlock.gif            
this.label4.Click += new System.EventHandler(this.label4_Click);
InBlock.gif            
// 
InBlock.gif            
// Form1
InBlock.gif            
// 
InBlock.gif
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
InBlock.gif            
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
InBlock.gif            
this.ClientSize = new System.Drawing.Size(521429);
InBlock.gif            
this.Controls.Add(this.label4);
InBlock.gif            
this.Controls.Add(this.groupBox3);
InBlock.gif            
this.Controls.Add(this.button4);
InBlock.gif            
this.Controls.Add(this.button3);
InBlock.gif            
this.Controls.Add(this.label2);
InBlock.gif            
this.Controls.Add(this.label1);
InBlock.gif            
this.Controls.Add(this.textBox2);
InBlock.gif            
this.Controls.Add(this.textBox1);
InBlock.gif            
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
InBlock.gif            
this.Name = "Form1";
InBlock.gif            
this.Text = "Write Cart ";
InBlock.gif            
this.Load += new System.EventHandler(this.Form1_Load);
InBlock.gif            
this.groupBox3.ResumeLayout(false);
InBlock.gif            
this.groupBox3.PerformLayout();
InBlock.gif            
this.groupBox1.ResumeLayout(false);
InBlock.gif            
this.groupBox2.ResumeLayout(false);
InBlock.gif            
this.ResumeLayout(false);
InBlock.gif            
this.PerformLayout();
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
private System.Windows.Forms.Timer timer1;
InBlock.gif        
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
InBlock.gif        
private System.Windows.Forms.GroupBox groupBox3;
InBlock.gif        
private System.Windows.Forms.TextBox textBox1;
InBlock.gif        
private System.Windows.Forms.TextBox textBox2;
InBlock.gif        
private System.Windows.Forms.Button button1;
InBlock.gif        
private System.Windows.Forms.Label label1;
InBlock.gif        
private System.Windows.Forms.Label label2;
InBlock.gif        
private System.Windows.Forms.Button button2;
InBlock.gif        
private System.Windows.Forms.Button button3;
InBlock.gif        
private System.Windows.Forms.Button button4;
InBlock.gif        
private System.Windows.Forms.Label label3;
InBlock.gif        
private System.Windows.Forms.RichTextBox richTextBox1;
InBlock.gif        
private System.Windows.Forms.GroupBox groupBox1;
InBlock.gif        
private System.Windows.Forms.RichTextBox richTextBox2;
InBlock.gif        
private System.Windows.Forms.GroupBox groupBox2;
InBlock.gif        
private System.Windows.Forms.Label label4;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
None.gif


Form1.cs
None.gif using  System;
None.gif
using  System.Collections.Generic;
None.gif
using  System.ComponentModel;
None.gif
using  System.Data;
None.gif
using  System.Drawing;
None.gif
using  System.Text;
None.gif
using  System.Windows.Forms;
None.gif
using  System.IO;
None.gif
using  System.Threading; //
ExpandedBlockStart.gifContractedBlock.gif
/**/ /*Author:zhouhai*/
ExpandedBlockStart.gifContractedBlock.gif
/**/ /*2007.11.4*/
None.gif
namespace  WriteCard
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    
public partial class Form1 : Form
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
public Form1()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            InitializeComponent();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
string oldFolder = string.Empty;
InBlock.gif
InBlock.gif        
private void Form1_Load(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif        
InBlock.gif        
private void button1_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ContractedSubBlock.gifExpandedSubBlockStart.gif            
Init and Validate#region Init and Validate
InBlock.gif            
this.button1.Enabled = false;
InBlock.gif            
this.button2.Enabled = true;
InBlock.gif            
this.button3.Enabled = false;
InBlock.gif            
this.button4.Enabled = false;
InBlock.gif            
if (!Directory.Exists(this.textBox1.Text))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                MessageBox.Show(
"源文件目录不存在");
InBlock.gif                
return;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif            
#endregion

InBlock.gif
InBlock.gif            oldFolder 
= this.textBox1.Text;
InBlock.gif
InBlock.gif            timer1.Start();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
InBlock.gif        
public string ExistPathResult = string.Empty;
InBlock.gif        
public void ThreadGetPath()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
char Char = textBox2.Text.Substring(01).ToCharArray()[0];
InBlock.gif            
int Int = (int)Char;
InBlock.gif            
for (int i = 0; i < 5; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
char thePath = (char)(Int + i);
InBlock.gif                
string path = thePath.ToString() + @":\";
InBlock.gif                
if (Directory.Exists(path))
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
//存在盘 
InBlock.gif
                    ExistPathResult += path + "准备好了\n";
InBlock.gif
InBlock.gif                    
if (copy.copyStatus.Count > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
if (copy.copyStatus.ContainsKey(path.Substring(0,1)))
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
bool flag=copy.copyStatus[path.Substring(0,1)];
InBlock.gif                            
if (flag)
InBlock.gif                                copyThreadHelper.hasFinished 
+= path + "拷贝完了\n";
InBlock.gif                            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                copyThreadHelper.hasFinished 
+= path + "正在拷贝中……\n";
ExpandedSubBlockEnd.gif                            }

ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
ContractedSubBlock.gifExpandedSubBlockStart.gif                            
开始拷贝文件#region 开始拷贝文件
InBlock.gif                            
//开始拷贝文件
InBlock.gif
                            copyThreadHelper argu = new copyThreadHelper();
InBlock.gif                            argu.Src 
= oldFolder;
InBlock.gif                            argu.Dst 
= path;
InBlock.gif
InBlock.gif                            Thread copyThread1 
= new Thread(new ParameterizedThreadStart(copy.copyDirectory));
InBlock.gif                            copyThread1.Start(argu);
ExpandedSubBlockEnd.gif                            
#endregion

ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
ContractedSubBlock.gifExpandedSubBlockStart.gif                        
拷贝文件#region 拷贝文件
InBlock.gif                        
//开始拷贝文件
InBlock.gif
                        copyThreadHelper argu = new copyThreadHelper();
InBlock.gif                        argu.Src 
= oldFolder;
InBlock.gif                        argu.Dst 
= path;
InBlock.gif
InBlock.gif                        Thread copyThread1 
= new Thread(new ParameterizedThreadStart(copy.copyDirectory));
InBlock.gif                        copyThread1.Start(argu);
ExpandedSubBlockEnd.gif                        
#endregion

ExpandedSubBlockEnd.gif                    }

InBlock.gif
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    ExistPathResult 
+= path + "无\n";
InBlock.gif                    copy.copyStatus.Remove(path.Substring(
0,1));
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void timer1_Tick(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            ExistPathResult 
= string.Empty;
InBlock.gif            copyThreadHelper.hasFinished 
= string.Empty;
InBlock.gif            label3.Text 
= string.Empty;
InBlock.gif
InBlock.gif
InBlock.gif            Thread th1 
= new Thread(ThreadGetPath);
InBlock.gif            th1.Start();
InBlock.gif            th1.Join();
InBlock.gif
InBlock.gif            richTextBox2.Text 
= copyThreadHelper.hasFinished;
InBlock.gif            richTextBox1.Text 
= ExistPathResult;
InBlock.gif
InBlock.gif            label3.Text 
= copy.ErrMessage;
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
Button_Click#region Button_Click
InBlock.gif        
private void button2_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.button2.Enabled = false;
InBlock.gif            
this.button1.Enabled = true;
InBlock.gif            
this.button3.Enabled = true;
InBlock.gif            
this.button4.Enabled = true;
InBlock.gif            timer1.Stop();
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private void button3_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                textBox1.Text 
= folderBrowserDialog1.SelectedPath;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
private void button4_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                textBox2.Text 
= folderBrowserDialog1.SelectedPath;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
private void label4_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            label4.ForeColor 
= Color.Blue;
InBlock.gif            label4.Text 
= label4.Text =="www.cnzhouhai.cn" ? "@小子好黑  2007" : "www.cnzhouhai.cn";
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif    }

InBlock.gif   
InBlock.gif    
class copy
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
public static string ErrMessage = string.Empty;
InBlock.gif        
public static Dictionary<stringbool> copyStatus = new Dictionary<stringbool>();
InBlock.gif        
public static void copyDirectory(object argu)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string Src = (argu as copyThreadHelper).Src;
InBlock.gif            
string Dst = (argu as copyThreadHelper).Dst;
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
string rootPath = Dst.Substring(01);
InBlock.gif
InBlock.gif                
if (copyStatus.ContainsKey(rootPath))
InBlock.gif                    copyStatus[rootPath] 
= false;
InBlock.gif                
else
InBlock.gif                    copyStatus.Add(rootPath, 
false);
InBlock.gif
InBlock.gif
InBlock.gif                String[] Files;
InBlock.gif
InBlock.gif                
if (Dst[Dst.Length - 1!= Path.DirectorySeparatorChar)
InBlock.gif                    Dst 
+= Path.DirectorySeparatorChar;
InBlock.gif
InBlock.gif                
if (!Directory.Exists(Dst))
InBlock.gif                    Directory.CreateDirectory(Dst);
InBlock.gif
InBlock.gif                Files 
= Directory.GetFileSystemEntries(Src);
InBlock.gif
InBlock.gif                
foreach (string Element in Files)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if (Directory.Exists(Element))
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        copyThreadHelper argu2 
= new copyThreadHelper();
InBlock.gif                        argu2.Src 
= Element;
InBlock.gif                        argu2.Dst 
= Dst + Element.Replace(Src, string.Empty).ToString();
InBlock.gif
InBlock.gif                        Thread copyThread2 
= new Thread(new ParameterizedThreadStart(copyDirectory));
InBlock.gif                        copyThread2.Start(argu2);
InBlock.gif                        copyThread2.Join();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        File.Copy(Element, Dst 
+ Path.GetFileName(Element), true);
InBlock.gif
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

InBlock.gif
InBlock.gif                copyStatus[rootPath] 
= true;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch (Exception ex)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                ErrMessage 
= "出现错误!请查看日志:[WriteCart_log.htm]   "+DateTime.Now;
InBlock.gif                StreamWriter sw 
= new StreamWriter(AppDomain.CurrentDomain.BaseDirectory+"/WriteCart_log.htm"true);
InBlock.gif                sw.WriteLine(
"<font color='green'>"+DateTime.Now.ToString(" yy年M月d日HH时m分ss秒"+"</font>"+ "             拷贝到  <font color='blue'><b>" + Dst + "</b></font> " + "           出现错误:<font color='red'>" + ex.Message + "</font><br>");
InBlock.gif                sw.Close();
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
class copyThreadHelper
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif
InBlock.gif        
//参数
InBlock.gif
        public string Src;//源盘
InBlock.gif
        public string Dst;//目标盘
InBlock.gif
        public static string hasFinished=string.Empty;//操作结果
ExpandedSubBlockEnd.gif
    }

InBlock.gif    
//
ExpandedBlockEnd.gif
}

None.gif

转载于:https://www.cnblogs.com/cnzhouhai/archive/2007/11/04/949078.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值