You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
687 B
25 lines
687 B
// Author: Gockner, Simon
|
|
// Created: 2021-04-26
|
|
// Copyright(c) 2021 SimonG. All Rights Reserved.
|
|
|
|
using System.Drawing;
|
|
using System.Drawing.Imaging;
|
|
using System.IO;
|
|
using Bitmap = Avalonia.Media.Imaging.Bitmap;
|
|
|
|
namespace Lib.Tools.Avalonia
|
|
{
|
|
public static class Icons
|
|
{
|
|
public static Bitmap ExtractAssociatedIcon(string executablePath)
|
|
{
|
|
Icon icon = Icon.ExtractAssociatedIcon(executablePath);
|
|
|
|
using MemoryStream memoryStream = new();
|
|
icon.ToBitmap().Save(memoryStream, ImageFormat.Png);
|
|
memoryStream.Position = 0;
|
|
|
|
return new Bitmap(memoryStream);
|
|
}
|
|
}
|
|
} |