/// <summary> /// Gets the corresponding name from <see cref="ManipCategoryNames"/> for the requested <see cref="type"/>. /// </summary> /// <param name="type">Manipulation type.</param> /// <returns>Category Name</returns> public static string GetManipCategoryName(this BoxManipType type) { for (int i = 0; i < ManipCategories.Length; i++) { if (ManipCategories[i].Any(z => z.Type == type)) { return(ManipCategoryNames[i]); } } return(null); }
public BoxManipClearDuplicate(BoxManipType type, Func <PKM, T> criteria, Func <SaveFile, bool> usable) : base(type, usable) { Criteria = pk => { var result = criteria(pk); if (HashSet.Contains(result)) { return(true); } HashSet.Add(result); return(false); }; }
public BoxManipClearDuplicate(BoxManipType type, Func <PKM, T> criteria, Func <SaveFile, bool> usable = null) { Type = type; Usable = usable; CriteriaSimple = pk => { var result = criteria(pk); if (HashSet.Contains(result)) { return(true); } HashSet.Add(result); return(false); }; }
public BoxManipClear(BoxManipType type, Func <PKM, bool> criteria, Func <SaveFile, bool> usable) : base(type, usable) => Criteria = criteria;
/// <summary> /// Gets a <see cref="IBoxManip"/> reference that carries out the action of the requested <see cref="type"/>. /// </summary> /// <param name="type">Manipulation type.</param> /// <returns>Reference to <see cref="IBoxManip"/>.</returns> public static IBoxManip GetManip(this BoxManipType type) => ManipCategories.SelectMany(c => c).FirstOrDefault(m => m.Type == type);
public BoxManipSortComplex(BoxManipType type, Func <IEnumerable <PKM>, SaveFile, IEnumerable <PKM> > sorter) : this(type, sorter, _ => true) { }
public BoxManipSortComplex(BoxManipType type, Func <IEnumerable <PKM>, SaveFile, IEnumerable <PKM> > sorter, Func <SaveFile, bool> usable) : base(type, usable) => Sorter = sorter;
private BoxManipClear(BoxManipType type, Func <PKM, SaveFile, bool> criteria, Func <SaveFile, bool> usable = null) { Type = type; CriteriaSAV = criteria; Usable = usable; }
public BoxManipModify(BoxManipType type, Action <PKM> action, Func <SaveFile, bool> usable) : base(type, usable) => Action = action;
/// <summary> /// Executes the provided <see cref="type"/> with the provided parameters. /// </summary> /// <param name="type">Manipulation to perform on the <see cref="SAV"/> box data.</param> /// <param name="box">Single box to modify; if <see cref="allBoxes"/> is set, this param is ignored.</param> /// <param name="allBoxes">Indicates if all boxes are to be manipulated, or just one box.</param> /// <param name="reverse">Manipulation action should be inverted (criteria) or reversed (sort).</param> /// <returns>True if operation succeeded, false if no changes made.</returns> public bool Execute(BoxManipType type, int box, bool allBoxes, bool reverse = false) { var manip = type.GetManip(); return(Execute(manip, box, allBoxes, reverse)); }
public BoxManipSort(BoxManipType type, Func <IEnumerable <PKM>, IEnumerable <PKM> > sorter) : this(type, sorter, _ => true) { }
private BoxManipSort(BoxManipType type, Func <IEnumerable <PKM>, SaveFile, IEnumerable <PKM> > sorter, Func <SaveFile, bool> usable = null) { Type = type; SorterComplex = sorter; Usable = usable; }
public BoxManipClearComplex(BoxManipType type, Func <PKM, SaveFile, bool> criteria) : this(type, criteria, _ => true) { }
public BoxManipClearDuplicate(BoxManipType type, Func <PKM, T> criteria) : this(type, criteria, _ => true) { }
public BoxManipClear(BoxManipType type, Func <PKM, bool> criteria) : this(type, criteria, _ => true) { }
protected BoxManipBase(BoxManipType type, Func <SaveFile, bool> usable) { Type = type; Usable = usable; }
private BoxManipModify(BoxManipType type, Action <PKM, SaveFile> action, Func <SaveFile, bool> usable = null) { Type = type; ActionComplex = action; Usable = usable; }
public BoxManipModify(BoxManipType type, Action <PKM> action) : this(type, action, _ => true) { }
public BoxManipModifyComplex(BoxManipType type, Action <PKM, SaveFile> action) : this(type, action, _ => true) { }