/// <summary> /// Loads a folder of files to the <see cref="SaveFile"/>. /// </summary> /// <param name="SAV"><see cref="SaveFile"/> to load folder to.</param> /// <param name="pks">Unconverted <see cref="PKM"/> objects to load.</param> /// <param name="result">Result message from the method.</param> /// <param name="boxStart">First box to start loading to. All prior boxes are not modified.</param> /// <param name="boxClear">Instruction to clear boxes after the starting box.</param> /// <param name="overwrite">Overwrite existing full slots. If true, will only overwrite empty slots.</param> /// <param name="noSetb">Bypass option to not modify <see cref="PKM"/> properties when setting to Save File.</param> /// <returns>True if any files are imported.</returns> public static bool LoadBoxes(this SaveFile SAV, IEnumerable <PKM> pks, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, bool?noSetb = null) { if (!SAV.HasBox) { result = MsgSaveBoxFailNone; return(false); } var compat = SAV.GetCompatible(pks); if (boxClear) { SAV.ClearBoxes(boxStart); } int ctr = SAV.ImportPKMs(compat, overwrite, boxStart, noSetb); if (ctr <= 0) { result = MsgSaveBoxImportNoFiles; return(false); } result = string.Format(MsgSaveBoxImportSuccess, ctr); return(true); }
public override int Execute(SaveFile SAV, BoxManipParam param) { HashSet.Clear(); bool Method(PKM p) => param.Reverse ^ Criteria(p); return(SAV.ClearBoxes(param.Start, param.Stop, Method)); }
/// <summary> /// Loads a folder of files to the <see cref="SaveFile"/>. /// </summary> /// <param name="sav"><see cref="SaveFile"/> to load folder to.</param> /// <param name="pks">Unconverted <see cref="PKM"/> objects to load.</param> /// <param name="result">Result message from the method.</param> /// <param name="boxStart">First box to start loading to. All prior boxes are not modified.</param> /// <param name="boxClear">Instruction to clear boxes after the starting box.</param> /// <param name="overwrite">Overwrite existing full slots. If true, will only overwrite empty slots.</param> /// <param name="noSetb">Bypass option to not modify <see cref="PKM"/> properties when setting to Save File.</param> /// <returns>True if any files are imported.</returns> public static int LoadBoxes(this SaveFile sav, IEnumerable <PKM> pks, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, PKMImportSetting noSetb = PKMImportSetting.UseDefault) { if (!sav.HasBox) { result = MsgSaveBoxFailNone; return(-1); } var compat = sav.GetCompatible(pks); if (boxClear) { sav.ClearBoxes(boxStart); } int ctr = sav.ImportPKMs(compat, overwrite, boxStart, noSetb); if (ctr <= 0) { result = MsgSaveBoxImportNoFiles; return(-1); } result = string.Format(MsgSaveBoxImportSuccess, ctr); return(ctr); }
public bool Execute(SaveFile SAV, BoxManipParam param) { bool Method(PKM p) => param.Reverse ^ (CriteriaSAV?.Invoke(p, SAV) ?? CriteriaSimple?.Invoke(p) ?? true); SAV.ClearBoxes(param.Start, param.Stop, Method); return(true); }