public void onFileSystemChangeTimeoutElapsed(FswatcherChangeTimeout timeoutwatcher, FileSystemEventArgs e, FSEventType type) { //call the callback try{ __onchangedcallbacks(e, type); } catch(Exception exception){ Console.WriteLine(exception.Message); } //remove the change timeout watcher from the list __fswatcherchangetimeouts.Remove(timeoutwatcher); }
/************************************************ * METHODS ************************************************/ private void onFileSystemEvent(object source, FileSystemEventArgs e) { //get the type FSEventType type = this.GetFSEventType(e); //call callback handlers if(e.ChangeType == WatcherChangeTypes.Created ) { try{ __oncreatedcallbacks(e, type); } catch(Exception exception){ Console.WriteLine(exception.Message); } } else if(e.ChangeType == WatcherChangeTypes.Changed ) { if(__changetimeout > 0) { //try to find a timeout watcher, reset and return if found foreach(FswatcherChangeTimeout timeout in __fswatcherchangetimeouts) { if(timeout.path == e.FullPath) { timeout.ResetTimer(); return; } } //otherwise just create a new timeout watcher FswatcherChangeTimeout newTimeout = new FswatcherChangeTimeout(this, e, type, __changetimeout); __fswatcherchangetimeouts.Add(newTimeout); } else { try{ __onchangedcallbacks(e, type); } catch(Exception exception){ Console.WriteLine(exception.Message); } } } else if(e.ChangeType == WatcherChangeTypes.Deleted ) { try{ __ondeletedcallbacks(e, type); } catch(Exception exception){ Console.WriteLine(exception.Message); } } }