//CreateFolder Operation
private void button1_Click(object sender, EventArgs e)
{
string path = @"F:\JunRui";
if (!Directory.Exists(path))
{
// , JunRui JunRui
Directory.CreateDirectory(path);
this.richTextBox1.Text += " \r
";
}
else
{
this.richTextBox1.Text += " \r
";
}
//
// True,
//Directory.Delete(@"F:\JunRui",true);
}
//DeleteFolder Operation
private void button2_Click(object sender, EventArgs e)
{
string path = @"F:\JunRui";
if (Directory.Exists(path))
{
//
Directory.Delete(path, true);
this.richTextBox1.Text += " \r
";
}
else
{
this.richTextBox1.Text += " \r
";
}
}
//Folder
private void button3_Click(object sender, EventArgs e)
{
string path = @"F:\JunRui\";
if (Directory.Exists(path))
{
try
{
/*
* F JunRui F Debug
* JunRui TestMove
*
*/
Directory.Move(path, @"F:\Debug\TestMove");
this.richTextBox1.Text += " \r
";
}
catch (IOException io)
{
this.richTextBox1.Text += io.Message.ToString();
}
}
else
{
this.richTextBox1.Text += " \r
";
}
}
//Run File
private void button4_Click(object sender, EventArgs e)
{
string path = @"F:\JunRui";
// ( )
string[] files = Directory.GetFiles(path);
foreach (string item in files)
{
//
// , 。
// :System.Diagnostics.Process.Start(" "," ");
System.Diagnostics.Process.Start(item);
}
}
// , TreeView ListBox , 。
//Create File
private void button5_Click(object sender, EventArgs e)
{
string path = @"F:\JunRui\CSharpAddFile.txt";
if (!File.Exists(path))
{
File.Create(path);
this.richTextBox1.Text += " \r
";
}
else
{
this.richTextBox1.Text += " \r
";
}
}
// TXT
private void button6_Click(object sender, EventArgs e)
{
string path = @"F:\JunRui\sjr.txt";
listBox1.DataSource = File.ReadAllLines(path);
}