基本信息
源码名称:C#文件夹监控并生成更改日志
源码大小:0.26M
文件格式:.rar
开发语言:C#
更新时间:2020-04-01
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
{
Application.Run(new Form1());
}
private void button1_Click_1(object sender, System.EventArgs e)
{//浏览文件夹
if(this.folderBrowserDialog1.ShowDialog()==DialogResult.OK)
{
if(this.folderBrowserDialog1.SelectedPath.Trim()!="")
{
this.textBox1.Text=this.folderBrowserDialog1.SelectedPath.Trim();
}
}
}
private void button2_Click(object sender, System.EventArgs e)
{//开始监视文件系统变化情况
if(!System.IO.Directory.Exists(this.textBox1.Text))
{
MessageBox.Show("选择的不是一个文件夹","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
this.fileSystemWatcher1.Path=this.textBox1.Text;
MessageBox.Show(this.textBox1.Text "已经处于被监视状态!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
{//发生改变
this.richTextBox1.Text =e.FullPath.ToString() DateTime.Now " 发生改变!\n";
write_log.write_log_txt(this.richTextBox1.Text);
}
private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
{//新增
this.richTextBox1.Text ="\n刚刚新增:" DateTime.Now e.FullPath.ToString();
write_log.write_log_txt(this.richTextBox1.Text);
}
private void fileSystemWatcher1_Deleted(object sender, System.IO.FileSystemEventArgs e)
{//删除
this.richTextBox1.Text ="\n刚刚删除:" DateTime.Now e.FullPath.ToString();
write_log.write_log_txt(this.richTextBox1.Text);
}
private void fileSystemWatcher1_Renamed(object sender, System.IO.RenamedEventArgs e)
{//更名
this.richTextBox1.Text ="\n刚刚更名:" DateTime.Now e.FullPath.ToString();
write_log.write_log_txt(this.richTextBox1.Text);
}
}
[STAThread]
static void Main(){
Application.Run(new Form1());
}
private void button1_Click_1(object sender, System.EventArgs e)
{//浏览文件夹
if(this.folderBrowserDialog1.ShowDialog()==DialogResult.OK)
{
if(this.folderBrowserDialog1.SelectedPath.Trim()!="")
{
this.textBox1.Text=this.folderBrowserDialog1.SelectedPath.Trim();
}
}
}
private void button2_Click(object sender, System.EventArgs e)
{//开始监视文件系统变化情况
if(!System.IO.Directory.Exists(this.textBox1.Text))
{
MessageBox.Show("选择的不是一个文件夹","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
this.fileSystemWatcher1.Path=this.textBox1.Text;
MessageBox.Show(this.textBox1.Text "已经处于被监视状态!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
{//发生改变
this.richTextBox1.Text =e.FullPath.ToString() DateTime.Now " 发生改变!\n";
write_log.write_log_txt(this.richTextBox1.Text);
}
private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
{//新增
this.richTextBox1.Text ="\n刚刚新增:" DateTime.Now e.FullPath.ToString();
write_log.write_log_txt(this.richTextBox1.Text);
}
private void fileSystemWatcher1_Deleted(object sender, System.IO.FileSystemEventArgs e)
{//删除
this.richTextBox1.Text ="\n刚刚删除:" DateTime.Now e.FullPath.ToString();
write_log.write_log_txt(this.richTextBox1.Text);
}
private void fileSystemWatcher1_Renamed(object sender, System.IO.RenamedEventArgs e)
{//更名
this.richTextBox1.Text ="\n刚刚更名:" DateTime.Now e.FullPath.ToString();
write_log.write_log_txt(this.richTextBox1.Text);
}
}