用C#监视多个文件夹,然后调用flvmdi对这个flv文件进行信息注入.
来源:互联网 发布:pola局部淡斑精华知乎 编辑:程序博客网 时间:2024/05/16 11:43
写一个应用程序,监视一个文件夹,如果文件里面有新的FLV文件,则调用flvmdi对这
个flv文件进行信息注入.
flvmdi文件我等会儿会放到你的共享文件里
关于flvmdi的用法可以查看:http://www.buraks.com/flvmdi/
private const string FILE_PATH = @"C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005ProjectsWatchFolderWatchFolderinReleaseConfig.txt";
private void btnStartWatching_Click(object sender, EventArgs e)
...{
this.Text = "Watching ... ...";
string[] FileList = readFile();
this.FSWFileWatch.Path= FileList[1];
/**//*string[] cont = readFile();
for (int i = 1; i < cont.Length; i++)
{
if (cont.GetValue(i) != null)
{
FileSystemWatcher FW = new FileSystemWatcher(cont.GetValue(i).ToString());
FW.Created += new FileSystemEventHandler(FSWFileWatch_Created);
FW.BeginInit();
FW.EnableRaisingEvents=true ;
}
} */
}
private void FSWFileWatch_Created(object sender, System.IO.FileSystemEventArgs e)
...{
string name = e.Name;
string path = e.FullPath;
try
...{
if (System.IO.Path.GetExtension(name) == ".flv")
...{
Process P;
P = Process.Start("flvmdi.exe",path);
if (P.HasExited)
...{
//进程已经退出
}
//MessageBox.Show("File " + name + "Created! Directory:" + path);
}
}
catch (Exception ex)
...{
MessageBox.Show("Exception Message:"+ex.ToString());
}
}
private static string[] readFile()
...{
StreamReader sr = new StreamReader(FILE_PATH, System.Text.Encoding.UTF8);
string[] content =new string[5];
int i = 0;
try
...{
while (sr.Peek() != -1)
...{
i++;
content[i] = sr.ReadLine();
}
}
catch (Exception fileex)
...{
MessageBox.Show("File Exception:"+fileex.ToString());
}
return content;
}
private void btnStartWatching_Click(object sender, EventArgs e)
...{
this.Text = "Watching ... ...";
string[] FileList = readFile();
this.FSWFileWatch.Path= FileList[1];
/**//*string[] cont = readFile();
for (int i = 1; i < cont.Length; i++)
{
if (cont.GetValue(i) != null)
{
FileSystemWatcher FW = new FileSystemWatcher(cont.GetValue(i).ToString());
FW.Created += new FileSystemEventHandler(FSWFileWatch_Created);
FW.BeginInit();
FW.EnableRaisingEvents=true ;
}
} */
}
private void FSWFileWatch_Created(object sender, System.IO.FileSystemEventArgs e)
...{
string name = e.Name;
string path = e.FullPath;
try
...{
if (System.IO.Path.GetExtension(name) == ".flv")
...{
Process P;
P = Process.Start("flvmdi.exe",path);
if (P.HasExited)
...{
//进程已经退出
}
//MessageBox.Show("File " + name + "Created! Directory:" + path);
}
}
catch (Exception ex)
...{
MessageBox.Show("Exception Message:"+ex.ToString());
}
}
private static string[] readFile()
...{
StreamReader sr = new StreamReader(FILE_PATH, System.Text.Encoding.UTF8);
string[] content =new string[5];
int i = 0;
try
...{
while (sr.Peek() != -1)
...{
i++;
content[i] = sr.ReadLine();
}
}
catch (Exception fileex)
...{
MessageBox.Show("File Exception:"+fileex.ToString());
}
return content;
}
- 用C#监视多个文件夹,然后调用flvmdi对这个flv文件进行信息注入.
- flv文件修复工具——FLVMDI的使用方法
- C#中对文件夹及文件信息的操作
- c#对文件夹中的文件进行删除操作
- C# 用linq对某个文件夹内的文件进行排序
- 遍历文件夹下各个文件,然后读出每个文件的内容,并对内容进行过滤输出
- 【转】c#如何监视文件或者文件夹的变化
- c#如何监视文件或者文件夹的变化
- C#对指定的文件调用RAR进行压缩保存
- 对C#调用C++ dll文件进行总结
- 对文件信息进行合并
- JAVA监视某文件夹并对文件夹里的文件做操作
- c#解析FLV文件
- 监视文件夹的文件变更
- 用C#实现的文件监视
- 从文件读取数据,然后对二维数组进行标记。
- C#文件监视程序
- C#文件监视程序
- 双鱼座三:舞者与梦想家的一周
- 句号
- intercept 1.0
- 新的地盘,新的开始
- 改变窗体大小
- 用C#监视多个文件夹,然后调用flvmdi对这个flv文件进行信息注入.
- C#优化字符串操作
- java. gif动画验证码的实现
- 获得兼容的xmlDocument
- WinCE 5.0 内核启动过程
- 在MFC环境下使用ITK/VTK
- IC封装大全
- 思考+行为
- 关于java向下转型