예제 #1
0
        private void button_compareFile_Click(object sender, EventArgs e)
        {
            string dirA = this.textBox_pathA.Text;
            string dirB = this.textBox_pathB.Text;

            FileComparison fileComparison = new FileComparison(dirA, dirB);

            this.textBox_result.Text = "复制文件...";
            if (checkBox_copyFile1ToFile2.Checked)
            {
                fileComparison.CopyDifferInAToB();
            }

            this.textBox_result.Text = fileComparison.ToString();
        }
예제 #2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dirA"></param>
        /// <param name="dirB"></param>
        public FileComparison(string dirA, string dirB)
        {
            this.DirA = dirA;
            this.DirB = dirB;
            ListA     = FileComparison.Parse(dirA);
            ListB     = FileComparison.Parse(dirB);

            DiffersInA = new List <FileItem>();
            foreach (FileItem item in ListA)
            {
                if (!ListB.Contains(item))
                {
                    DiffersInA.Add(item);
                }
            }
            DiffersInB = new List <FileItem>();
            foreach (FileItem item in ListB)
            {
                if (!ListA.Contains(item))
                {
                    DiffersInB.Add(item);
                }
            }
        }