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