2021-11-27 23:48:08 +00:00
|
|
|
|
using System.Drawing;
|
|
|
|
|
using PKHeX.Core;
|
|
|
|
|
using PKHeX.Drawing.Misc.Properties;
|
|
|
|
|
using static PKHeX.Core.GameVersion;
|
|
|
|
|
|
2021-12-10 08:15:04 +00:00
|
|
|
|
namespace PKHeX.Drawing.Misc;
|
|
|
|
|
|
|
|
|
|
public static class WallpaperUtil
|
2021-11-27 23:48:08 +00:00
|
|
|
|
{
|
2021-12-10 08:15:04 +00:00
|
|
|
|
public static Image WallpaperImage(this SaveFile sav, int box) => GetWallpaper(sav, box);
|
2021-11-27 23:48:08 +00:00
|
|
|
|
|
2021-12-10 08:15:04 +00:00
|
|
|
|
private static Image GetWallpaper(SaveFile sav, int box)
|
|
|
|
|
{
|
|
|
|
|
string s = GetWallpaperResourceName(sav.Version, sav.GetBoxWallpaper(box));
|
|
|
|
|
return (Bitmap?)Resources.ResourceManager.GetObject(s) ?? Resources.box_wp16xy;
|
|
|
|
|
}
|
2021-11-27 23:48:08 +00:00
|
|
|
|
|
2021-12-10 08:15:04 +00:00
|
|
|
|
public static string GetWallpaperResourceName(GameVersion version, int index)
|
|
|
|
|
{
|
|
|
|
|
index++; // start indexes at 1
|
|
|
|
|
var suffix = GetResourceSuffix(version, index);
|
|
|
|
|
return $"box_wp{index:00}{suffix}";
|
|
|
|
|
}
|
2021-11-27 23:48:08 +00:00
|
|
|
|
|
2021-12-10 08:15:04 +00:00
|
|
|
|
private static string GetResourceSuffix(GameVersion version, int index) => version.GetGeneration() switch
|
|
|
|
|
{
|
|
|
|
|
3 when version == E => "e",
|
|
|
|
|
3 when FRLG.Contains(version) && index > 12 => "frlg",
|
|
|
|
|
3 => "rs",
|
2021-11-27 23:48:08 +00:00
|
|
|
|
|
2021-12-10 08:15:04 +00:00
|
|
|
|
4 when index < 16 => "dp",
|
|
|
|
|
4 when version == Pt => "pt",
|
|
|
|
|
4 when HGSS.Contains(version) => "hgss",
|
2021-11-27 23:48:08 +00:00
|
|
|
|
|
2021-12-10 08:15:04 +00:00
|
|
|
|
5 => B2W2.Contains(version) && index > 16 ? "b2w2" : "bw",
|
|
|
|
|
6 => ORAS.Contains(version) && index > 16 ? "ao" : "xy",
|
|
|
|
|
7 when !GG.Contains(version) => "xy",
|
2022-02-05 01:35:54 +00:00
|
|
|
|
8 when !SWSH.Contains(version) => "bdsp",
|
|
|
|
|
8 => "swsh",
|
2021-12-10 08:15:04 +00:00
|
|
|
|
_ => string.Empty,
|
|
|
|
|
};
|
2021-11-27 23:48:08 +00:00
|
|
|
|
}
|