diff --git a/SteamShared/SteamShared/SteamShared/CsgoHelper.cs b/SteamShared/SteamShared/SteamShared/CsgoHelper.cs
index 6d9eb2d..0b1ba3f 100644
--- a/SteamShared/SteamShared/SteamShared/CsgoHelper.cs
+++ b/SteamShared/SteamShared/SteamShared/CsgoHelper.cs
@@ -11,6 +11,8 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Management;
+using Pfim;
+using System.Drawing;
namespace SteamShared
{
@@ -228,36 +230,31 @@ namespace SteamShared
// Save map name without prefix
map.MapFileName = System.IO.Path.GetFileNameWithoutExtension(file).Split('_').Last();
-
- DDSImage image;
+
+ Bitmap image;
try
{
- // Read actual radar
- image = new DDSImage(System.IO.File.ReadAllBytes(map.MapImagePath!));
+ using (var pfimImage = Pfimage.FromFile(map.MapImagePath))
+ {
+ // TODO: Do we need to support more pixel formats?
+ System.Drawing.Imaging.PixelFormat format = System.Drawing.Imaging.PixelFormat.Format24bppRgb;
- // If this is still commented out after ages, I'm sorry @FutureMe
- //using (var pfimImage = Pfim.Pfim.FromFile(map.MapImagePath))
- //{
- // // TODO: Do we need to support more pixel formats?
- // System.Drawing.Imaging.PixelFormat format = System.Drawing.Imaging.PixelFormat.Format24bppRgb;
-
- // if (pfimImage.Format == Pfim.ImageFormat.Rgba32)
- // {
- // format = System.Drawing.Imaging.PixelFormat.Format32bppArgb;
- // }
-
- // // Maybe pin it so GC doesn't collect it, for now just ignore it
- // var data = System.Runtime.InteropServices.Marshal.UnsafeAddrOfPinnedArrayElement(pfimImage.Data, 0);
- // image = new System.Drawing.Bitmap(pfimImage.Width, pfimImage.Height, pfimImage.Stride, format, data);
- //}
+ if (pfimImage.Format == Pfim.ImageFormat.Rgba32)
+ {
+ format = System.Drawing.Imaging.PixelFormat.Format32bppArgb;
+ }
+ // Maybe pin it so GC doesn't collect it, for now just ignore it
+ var data = System.Runtime.InteropServices.Marshal.UnsafeAddrOfPinnedArrayElement(pfimImage.Data, 0);
+ image = new System.Drawing.Bitmap(pfimImage.Width, pfimImage.Height, pfimImage.Stride, format, data);
+ }
}
catch
{
continue;
}
- if (image.BitmapImage.Width != image.BitmapImage.Height)
+ if (image.Width != image.Height)
// We only want square map images, which should normally always be given
continue;
@@ -265,7 +262,7 @@ namespace SteamShared
// Future self: We probably want to execute it on the thread that owns the image
System.Windows.Application.Current.Dispatcher.Invoke((Action)delegate
{
- map.MapImage = Globals.BitmapToImageSource(image.BitmapImage);
+ map.MapImage = Globals.BitmapToImageSource(image);
});
maps.Add(map);
diff --git a/SteamShared/SteamShared/SteamShared/SteamShared.csproj b/SteamShared/SteamShared/SteamShared/SteamShared.csproj
index 443b512..517afc0 100644
--- a/SteamShared/SteamShared/SteamShared/SteamShared.csproj
+++ b/SteamShared/SteamShared/SteamShared/SteamShared.csproj
@@ -27,6 +27,7 @@
+