コード例 #1
0
        private void buttonItem1_Click(object sender, EventArgs e) // 复制差异文件
        {
            if (leftFolder == null || rightFolder == null)
            {
                MessageBox.Show("请先选择源目录与目标目录后再使用此功能。");
                return;
            }

            string targetSaveDir = string.Empty;

            FolderBrowserDialog folderDialog = new FolderBrowserDialog();

            folderDialog.RootFolder  = Environment.SpecialFolder.MyComputer;
            folderDialog.Description = "请选择一个目录以保存差异文件";
            if (folderDialog.ShowDialog() == DialogResult.OK)
            {
                targetSaveDir = folderDialog.SelectedPath;
                if (targetSaveDir.Length == 0)
                {
                    return;
                }
            }

            Thread       newThreat = new Thread(new ParameterizedThreadStart(BeginCompare));
            ThreadParams param     = new ThreadParams();

            param.CurPathL = leftFolder;
            param.CurPathR = rightFolder;
            param.clientL  = leftFolder;
            param.clientR  = rightFolder;
            param.target   = targetSaveDir;
            newThreat.Start(param);
        }
コード例 #2
0
        private void BeginCompare(object threadParam)
        {
            //CopyDiffFiles(leftFolder, rightFolder, leftFolder, rightFolder, targetSaveDir);
            ThreadParams param = (ThreadParams)threadParam;

            CopyDiffFiles(param.CurPathL, param.CurPathR, param.clientL, param.clientR, param.target);
            MessageBox.Show("完成。");
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: viticm/pap2
        private void buttonItem1_Click(object sender, EventArgs e) // 复制差异文件
        {
            if (leftFolder == null || rightFolder == null)
            {
                MessageBox.Show("请先选择源目录与目标目录后再使用此功能。");
                return;
            }

            string targetSaveDir = string.Empty;

            FolderBrowserDialog folderDialog = new FolderBrowserDialog();
            folderDialog.RootFolder = Environment.SpecialFolder.MyComputer;
            folderDialog.Description = "请选择一个目录以保存差异文件";
            if (folderDialog.ShowDialog() == DialogResult.OK)
            {
                targetSaveDir = folderDialog.SelectedPath;
                if (targetSaveDir.Length == 0)
                    return;
            }

            Thread newThreat = new Thread(new ParameterizedThreadStart(BeginCompare));
            ThreadParams param = new ThreadParams();
            param.CurPathL = leftFolder;
            param.CurPathR = rightFolder;
            param.clientL = leftFolder;
            param.clientR = rightFolder;
            param.target = targetSaveDir;
            newThreat.Start(param);
        }