// -------------------------------------- // GetTrashBin() - Returns the UserTrashBin in this.trashBinList with TrashPath property set to passed-in path // If none exists, one is created, added to the list, and returned // Is not case sensitive public UserTrashBin GetTrashBin(string path) { // Trim the path to the correct trash dir if (path.ToLower().Contains("tools")) { path = path.ToLower().Replace("tools\\", ""); } foreach (UserTrashBin utb in this.trashBinList) { if (path.Trim().ToLower() == utb.TrashPath.Trim().ToLower()) return utb; } // if we're here, it wasn't in the list, so lets add it UserTrashBin bin = new UserTrashBin(path); if (this.LogActions) { bin.LogFilename = this.logFilename; bin.LogActions = true; } this.trashBinList.Add(bin); return bin; }
public static PurgeCommand ConstructIntervalCommand(PurgeCommandScope scope, UserTrashBin trashBin, int dayInterval, int hourInterval, int minInterval) { PurgeCommand cmd = new PurgeCommand(scope, PurgeCommandType.INTERVAL, dayInterval, hourInterval, minInterval); cmd.AddUserTrash(trashBin); return(cmd); }
public void AddUserTrash(UserTrashBin bin) { if (this.targetTrashBinList == null) { targetTrashBinList = new ArrayList(); } this.targetTrashBinList.Add(bin); }