From f6100c020613de7980861b7d77f4c37e1a65a025 Mon Sep 17 00:00:00 2001 From: Sarah Bradley Date: Mon, 25 Dec 2023 16:24:47 -0800 Subject: Added image size limits --- Mouse.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Mouse.cs') diff --git a/Mouse.cs b/Mouse.cs index c0bceda..45dbebf 100644 --- a/Mouse.cs +++ b/Mouse.cs @@ -15,6 +15,8 @@ abstract class Mouse : Drawable public static Action? Clicked; + protected readonly static byte[] FallbackImg = EmbeddedResources.GetResource("misc.cursor.png"); + public Mouse() : base() { DrawOrder = 100; @@ -23,10 +25,10 @@ abstract class Mouse : Drawable string CursorPath = OnekoOnline.Config.GetValue("CursorSpritePath", "misc/cursor.png"); if (File.Exists(CursorPath) && new FileInfo(CursorPath).Length < 2500) { - Cursor = Bitmap.FromPNGMemory(File.ReadAllBytes(CursorPath)); + Cursor = Bitmap.FromPNGMemory(File.ReadAllBytes(CursorPath), 32, 32); } else { Console.WriteLine("The cursor PNG was either mising or too big. Using the default."); - Cursor = Bitmap.FromPNGMemory(EmbeddedResources.GetResource("misc.cursor.png")); + Cursor = Bitmap.FromPNGMemory(FallbackImg); } } -- cgit