예제 #1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string[] dirs        = Directory.GetDirectories(sourceRootPath);
            string   destDirPath = "";

            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();
            //foreach (string dir in dirs)
            //{
            //    destDirPath = destRootPath + "\\" + Path.GetFileName(dir);
            //    if (!Directory.Exists(destDirPath))
            //    {
            //        Directory.CreateDirectory(destDirPath);

            //    }
            //}
            FileOpHelper.CopyDirectory(sourceRootPath, destRootPath);
            stopwatch.Stop();
            this.richTextBox1.Text = "Total time:" + stopwatch.ElapsedMilliseconds + "ms";
        }
예제 #2
0
        private void Watcher_Renamed(object sender, RenamedEventArgs e)
        {
            ThreadInteropUtils.OpeMainFormControl(() =>
            {
                this.richTextBox1.Text += "Rename folder or file was happened..." + Environment.NewLine;
            }, this);

            //SyncProcess();

            string oldname = destRootPath + "\\" + e.OldName;

            FileOpHelper.DeleteDirOrFile(oldname);

            FileOpHelper.CopyDirectory(sourceRootPath, destRootPath, true);

            //string destPath = destRootPath + "\\" + e.Name;
            //if (!Directory.Exists(destPath) && FileOpHelper.isFile(destPath) == false)
            //    Directory.CreateDirectory(destPath);

            //if (!File.Exists(destPath) && FileOpHelper.isFile(destPath))
            //{
            //    FileInfo flinfo = new FileInfo(e.FullPath);
            //    flinfo.CopyTo(destPath, true);
            //}

            ThreadInteropUtils.OpeMainFormControl(() =>
            {
                this.richTextBox1.Text += "Synchronizing file completed..." + Environment.NewLine + Environment.NewLine;
            }, this);

            ThreadInteropUtils.OpeMainFormControl(() =>
            {
                getSpecifiedPathDirsList(sourceRootPath, this.treeView1);
                getSpecifiedPathDirsList(destRootPath, this.treeView2);
            }, this);
        }