【发布时间】:2010-09-29 13:44:47
【问题描述】:
var fsw = new FileSystemWatcher(sPath, "*.PPF");
fsw.NotifyFilter = NotifyFilters.FileName;
fsw.IncludeSubdirectories = true;
fsw.Created += FswCreated;
fsw.EnableRaisingEvents = true;
static void FswCreated(object sender, FileSystemEventArgs e)
{
string sFile = e.FullPath;
string[] arrLines = File.ReadAllLines(sFile);
}
这对于大文件会失败,因为该过程没有完成写入文件。该文件是通过网络复制的,所以我不知道文件的大小。需要什么样的同步才能使其稳健?
【问题讨论】:
标签: c# io filesystemwatcher