Exemple #1
0
 public DirectoryTest()
 {
     testPath = @"C:\Dev\test";
     if (!Directory.Exists(testPath)) Directory.CreateDirectory(testPath);
     folderNames = new string[] {".svn", "CVS"};
     dirInfo = new DirectoryInfo(testPath);
     cleaner = new Cleaner();
 }
Exemple #2
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            string path = txtPath.Text.Trim();

            //check if txtPath has a path
            if (path.Length == 0)
            {
                MessageBox.Show("Please select a path");
                return;
            }

            //check if path exists
            if (!Directory.Exists(path))
            {
                MessageBox.Show("Please select a valid folder");
                return;
            }

            //confirm that deleting the source control files
            DialogResult confirmResult = MessageBox.Show(this, "Are you sure you wish to remove source control for this folder and its subfolders?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2 );

            if (confirmResult == DialogResult.Yes)
            {
                //remove source control files...
                this.Cursor = System.Windows.Forms.Cursors.WaitCursor;

                //recursively delete
                DirectoryInfo dirinfo = new DirectoryInfo(path);
                Cleaner cleaner = new Cleaner();
                cleaner.CleanDirectory(dirinfo, folderNames);
                this.Cursor = System.Windows.Forms.Cursors.Default;

                //inform the user
                txtPath.Text = String.Empty;
                MessageBox.Show("Done");
            }
        }