public DirectoryObject PickChildDirectory() { if (n_dirs_below == 0) { return(null); } int i; i = random.Next(n_dirs_below); foreach (FileSystemObject fso in Children) { DirectoryObject dir = fso as DirectoryObject; if (dir == null) { continue; } if (i == 0) { return(dir); } --i; if (i < dir.n_dirs_below) { return(dir.PickChildDirectory()); } i -= dir.n_dirs_below; } throw new Exception("This also shouldn't happen!"); }
public bool HammerOnce(DirectoryObject dir, EventTracker tracker) { DirectoryObject target; target = dir.PickChildDirectory(); if (target == null) { return(false); } Log.Info("Deleted directory '{0}'", target.ShortName); target.Parent.RemoveChild(target, tracker); return(true); }
override protected FileSystemObject PickTarget(DirectoryObject dir) { return(dir.PickChildDirectory()); }
public bool HammerOnce (DirectoryObject dir, EventTracker tracker) { DirectoryObject target; target = dir.PickChildDirectory (); if (target == null) return false; Log.Info ("Deleted directory '{0}'", target.ShortName); target.Parent.RemoveChild (target, tracker); return true; }
override protected FileSystemObject PickTarget (DirectoryObject dir) { return dir.PickChildDirectory (); }