Switching from my base64 code to the code supplied by sdtools

This commit is contained in:
dlprows 2023-08-06 13:54:00 -06:00
parent 65f0c9faf6
commit ab769bf7d2

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using BarRaider.SdTools;
namespace FocusVolumeControl namespace FocusVolumeControl
{ {
@ -51,15 +52,7 @@ namespace FocusVolumeControl
try try
{ {
var icon = Icon.ExtractAssociatedIcon(session.ExecutablePath); var icon = Icon.ExtractAssociatedIcon(session.ExecutablePath);
var bitmap = new Bitmap(icon.ToBitmap(), 48, 48); iconData = Tools.ImageToBase64(icon.ToBitmap(), true);
using var ms = new MemoryStream();
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
var base64Icon = Convert.ToBase64String(ms.ToArray());
iconData = $"data:image/png;base64,{base64Icon}";
} }
catch catch
{ {