mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
d47bb1d297
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.
21 lines
545 B
C#
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;
|
|
}
|
|
}
|