0
0
Fork 0

Remove SDC (#6275)

This commit is contained in:
Isaac Marovitz 2024-02-08 19:36:59 +00:00 committed by GitHub
parent ea07328aea
commit d29da11d5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 16 deletions

View file

@ -45,7 +45,6 @@
<PackageVersion Include="SixLabors.ImageSharp" Version="1.0.4" /> <PackageVersion Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta11" /> <PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta11" />
<PackageVersion Include="SPB" Version="0.0.4-build32" /> <PackageVersion Include="SPB" Version="0.0.4-build32" />
<PackageVersion Include="System.Drawing.Common" Version="8.0.1" />
<PackageVersion Include="System.IO.Hashing" Version="8.0.0" /> <PackageVersion Include="System.IO.Hashing" Version="8.0.0" />
<PackageVersion Include="System.Management" Version="8.0.0" /> <PackageVersion Include="System.Management" Version="8.0.0" />
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" /> <PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />

View file

@ -2,15 +2,13 @@ using Ryujinx.Common;
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
using ShellLink; using ShellLink;
using SixLabors.ImageSharp; using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Runtime.Versioning; using System.Runtime.Versioning;
using Image = System.Drawing.Image;
namespace Ryujinx.Ui.Common.Helper namespace Ryujinx.Ui.Common.Helper
{ {
@ -23,12 +21,9 @@ namespace Ryujinx.Ui.Common.Helper
iconPath += ".ico"; iconPath += ".ico";
MemoryStream iconDataStream = new(iconData); MemoryStream iconDataStream = new(iconData);
using Image image = Image.FromStream(iconDataStream); var image = Image.Load(iconDataStream);
using Bitmap bitmap = new(128, 128); image.Mutate(x => x.Resize(128, 128));
using System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(bitmap); SaveBitmapAsIcon(image, iconPath);
graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphic.DrawImage(image, 0, 0, 128, 128);
SaveBitmapAsIcon(bitmap, iconPath);
var shortcut = Shortcut.CreateShortcut(basePath, GetArgsString(applicationFilePath), iconPath, 0); var shortcut = Shortcut.CreateShortcut(basePath, GetArgsString(applicationFilePath), iconPath, 0);
shortcut.StringData.NameString = cleanedAppName; shortcut.StringData.NameString = cleanedAppName;
@ -42,7 +37,7 @@ namespace Ryujinx.Ui.Common.Helper
var desktopFile = EmbeddedResources.ReadAllText("Ryujinx.Ui.Common/shortcut-template.desktop"); var desktopFile = EmbeddedResources.ReadAllText("Ryujinx.Ui.Common/shortcut-template.desktop");
iconPath += ".png"; iconPath += ".png";
var image = SixLabors.ImageSharp.Image.Load<Rgba32>(iconData); var image = Image.Load<Rgba32>(iconData);
image.SaveAsPng(iconPath); image.SaveAsPng(iconPath);
using StreamWriter outputFile = new(Path.Combine(desktopPath, cleanedAppName + ".desktop")); using StreamWriter outputFile = new(Path.Combine(desktopPath, cleanedAppName + ".desktop"));
@ -83,7 +78,7 @@ namespace Ryujinx.Ui.Common.Helper
} }
const string IconName = "icon.png"; const string IconName = "icon.png";
var image = SixLabors.ImageSharp.Image.Load<Rgba32>(iconData); var image = Image.Load<Rgba32>(iconData);
image.SaveAsPng(Path.Combine(resourceFolderPath, IconName)); image.SaveAsPng(Path.Combine(resourceFolderPath, IconName));
// plist file // plist file
@ -147,7 +142,7 @@ namespace Ryujinx.Ui.Common.Helper
/// <param name="source">The source bitmap image that will be saved as an .ico file</param> /// <param name="source">The source bitmap image that will be saved as an .ico file</param>
/// <param name="filePath">The location that the new .ico file will be saved too (Make sure to include '.ico' in the path).</param> /// <param name="filePath">The location that the new .ico file will be saved too (Make sure to include '.ico' in the path).</param>
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
private static void SaveBitmapAsIcon(Bitmap source, string filePath) private static void SaveBitmapAsIcon(Image source, string filePath)
{ {
// Code Modified From https://stackoverflow.com/a/11448060/368354 by Benlitz // Code Modified From https://stackoverflow.com/a/11448060/368354 by Benlitz
byte[] header = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 32, 0, 0, 0, 0, 0, 22, 0, 0, 0 }; byte[] header = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 32, 0, 0, 0, 0, 0, 22, 0, 0, 0 };
@ -155,7 +150,7 @@ namespace Ryujinx.Ui.Common.Helper
fs.Write(header); fs.Write(header);
// Writing actual data // Writing actual data
source.Save(fs, ImageFormat.Png); source.Save(fs, PngFormat.Instance);
// Getting data length (file length minus header) // Getting data length (file length minus header)
long dataLength = fs.Length - header.Length; long dataLength = fs.Length - header.Length;
// Write it in the correct place // Write it in the correct place

View file

@ -57,7 +57,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DiscordRichPresence" /> <PackageReference Include="DiscordRichPresence" />
<PackageReference Include="securifybv.ShellLink" /> <PackageReference Include="securifybv.ShellLink" />
<PackageReference Include="System.Drawing.Common" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>