/// <summary> /// Constructs the Observer with the given directory and set of /// actions to perform when activity occurs in the directory. /// </summary> /// <param name="directoryPath"></param> /// <param name="behavior"></param> public DirectoryObserver(String directoryPath, IObserverActions behavior) : this(directoryPath, initList(behavior)) { }
/// <summary> /// Adds a behavior set to the observer. /// </summary> /// <param name="ioa"></param> public void addBehavior(IObserverActions ioa) { observer.Created += ioa.OnFileCreated; observer.Changed += ioa.OnFileChanged; observer.Deleted += ioa.OnFileDeleted; observer.Renamed += ioa.OnFileRenamed; }
/// <summary> /// Allows the constructor with one behavior set to call the one taking multiple. /// </summary> /// <param name="ioa"></param> /// <returns></returns> private static List<IObserverActions> initList(IObserverActions ioa) { List<IObserverActions> l = new List<IObserverActions>(); l.Add(ioa); return l; }