/// <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);
 }
예제 #2
0
 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);
     };
 }
예제 #3
0
 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);
     };
 }
예제 #4
0
 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);
예제 #6
0
 public BoxManipSortComplex(BoxManipType type, Func <IEnumerable <PKM>, SaveFile, IEnumerable <PKM> > sorter) : this(type, sorter, _ => true)
 {
 }
예제 #7
0
 public BoxManipSortComplex(BoxManipType type, Func <IEnumerable <PKM>, SaveFile, IEnumerable <PKM> > sorter, Func <SaveFile, bool> usable) : base(type, usable) => Sorter = sorter;
예제 #8
0
 private BoxManipClear(BoxManipType type, Func <PKM, SaveFile, bool> criteria, Func <SaveFile, bool> usable = null)
 {
     Type        = type;
     CriteriaSAV = criteria;
     Usable      = usable;
 }
예제 #9
0
 public BoxManipModify(BoxManipType type, Action <PKM> action, Func <SaveFile, bool> usable) : base(type, usable) => Action = action;
예제 #10
0
    /// <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));
    }
예제 #11
0
 public BoxManipSort(BoxManipType type, Func <IEnumerable <PKM>, IEnumerable <PKM> > sorter) : this(type, sorter, _ => true)
 {
 }
예제 #12
0
 private BoxManipSort(BoxManipType type, Func <IEnumerable <PKM>, SaveFile, IEnumerable <PKM> > sorter, Func <SaveFile, bool> usable = null)
 {
     Type          = type;
     SorterComplex = sorter;
     Usable        = usable;
 }
예제 #13
0
 public BoxManipClearComplex(BoxManipType type, Func <PKM, SaveFile, bool> criteria) : this(type, criteria, _ => true)
 {
 }
예제 #14
0
 public BoxManipClearDuplicate(BoxManipType type, Func <PKM, T> criteria) : this(type, criteria, _ => true)
 {
 }
예제 #15
0
 public BoxManipClear(BoxManipType type, Func <PKM, bool> criteria) : this(type, criteria, _ => true)
 {
 }
예제 #16
0
 protected BoxManipBase(BoxManipType type, Func <SaveFile, bool> usable)
 {
     Type   = type;
     Usable = usable;
 }
예제 #17
0
 private BoxManipModify(BoxManipType type, Action <PKM, SaveFile> action, Func <SaveFile, bool> usable = null)
 {
     Type          = type;
     ActionComplex = action;
     Usable        = usable;
 }
예제 #18
0
 public BoxManipModify(BoxManipType type, Action <PKM> action) : this(type, action, _ => true)
 {
 }
예제 #19
0
 public BoxManipModifyComplex(BoxManipType type, Action <PKM, SaveFile> action) : this(type, action, _ => true)
 {
 }