PKHeX/PKHeX.Drawing.Misc/Util/PlayerSpriteUtil.cs
Kurt d47bb1d297
Update .NET Runtime to .NET 8.0 (#4082)
With the new version of Visual Studio bringing C# 12, we can revise our logic for better readability as well as use new methods/APIs introduced in the .NET 8.0 BCL.
2023-12-03 20:13:20 -08:00

21 lines
545 B
C#

using System.Drawing;
using PKHeX.Core;
using PKHeX.Drawing.Misc.Properties;
namespace PKHeX.Drawing.Misc;
public static class PlayerSpriteUtil
{
public static Bitmap? Sprite(this SaveFile sav) => GetSprite(sav);
private static Bitmap? GetSprite(SaveFile sav)
{
if (sav is IMultiplayerSprite ms)
{
// Gen6 only
string file = $"tr_{ms.MultiplayerSpriteID:00}";
return Resources.ResourceManager.GetObject(file) as Bitmap ?? Resources.tr_00;
}
return null;
}
}