public static IEnumerable <PKM> GetCompatible(this SaveFile sav, IEnumerable <PKM> pks) { var savtype = sav.PKMType; foreach (var temp in pks) { var pk = PKMConverter.ConvertToType(temp, savtype, out string c); if (pk == null) { Debug.WriteLine(c); continue; } if (sav is ILangDeviantSave il && PKMConverter.IsIncompatibleGB(temp, il.Japanese, pk.Japanese)) { c = PKMConverter.GetIncompatibleGBMessage(pk, il.Japanese); Debug.WriteLine(c); continue; } var compat = sav.IsPKMCompatible(pk); if (compat.Count > 0) { continue; } yield return(pk); } }
public static IEnumerable <PKM> GetCompatible(this SaveFile SAV, IEnumerable <PKM> pks) { var savtype = SAV.PKMType; foreach (var temp in pks) { var pk = PKMConverter.ConvertToType(temp, savtype, out string c); if (pk == null) { Debug.WriteLine(c); continue; } if (PKMConverter.IsIncompatibleGB(pk.Format, SAV.Japanese, pk.Japanese)) { c = PKMConverter.GetIncompatibleGBMessage(pk, SAV.Japanese); Debug.WriteLine(c); continue; } var compat = SAV.IsPKMCompatible(pk); if (compat.Count > 0) { continue; } yield return(pk); } }
/// <summary> /// Checks a <see cref="PKM"/> file for compatibility to the <see cref="SaveFile"/>. /// </summary> /// <param name="sav"><see cref="SaveFile"/> that is being checked.</param> /// <param name="pk"><see cref="PKM"/> that is being tested for compatibility.</param> public static bool IsCompatiblePKM(this SaveFile sav, PKM pk) { if (sav.PKMType != pk.GetType()) { return(false); } if (sav is ILangDeviantSave il && PKMConverter.IsIncompatibleGB(pk, il.Japanese, pk.Japanese)) { return(false); } return(true); }