2014年1月16日 星期四

FileSystemWatcher event twice

private Hashtable getTime = new Hashtable(); private void on_Changed(object source, FileSystemEventArgs e) { string path = e.FullPath.ToString(); string currentLastWriteTime = File.GetLastWriteTime( e.FullPath ).ToString(); if ( !getTime.ContainsKey(path) || getTime[path].ToString() != currentLastWriteTime ) { // get one getTime[path] = currentLastWriteTime; } }

沒有留言:

張貼留言