Skip to content

Commit

Permalink
Newtonsoft.Json removed, IconUpdated cleaned
Browse files Browse the repository at this point in the history
  • Loading branch information
gleblebedev committed May 3, 2024
1 parent f34ab26 commit ad30801
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 0 additions & 2 deletions RbfxTemplate/RbfxTemplate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

<ItemGroup>
<PackageReference Include="unofficial.Urho3DNet" Version="$(Urho3DNetVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3">
</PackageReference>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tools/IconUpdater/IconUpdater.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
20 changes: 10 additions & 10 deletions Tools/IconUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ static async Task<int> Main(string[] args)
return await rootCommand.InvokeAsync(args);
}

private static void GenerateIcons(FileInfo fore, FileInfo back, string? backCol, DirectoryInfo output)
private static void GenerateIcons(FileInfo? fore, FileInfo? back, string? backCol, DirectoryInfo? output)
{
Color backgroundColor = Color.Transparent;
if (!string.IsNullOrWhiteSpace(backCol))
backgroundColor = System.Drawing.ColorTranslator.FromHtml(backCol);

Image foreground = (fore != null && fore.Exists) ? Image.FromFile(fore.FullName): null;
Image background = (back != null && back.Exists) ? Image.FromFile(back.FullName) : null;
Image? foreground = (fore != null && fore.Exists) ? Image.FromFile(fore.FullName) : null;
Image? background = (back != null && back.Exists) ? Image.FromFile(back.FullName) : null;

var outPath = (output == null)?Directory.GetCurrentDirectory(): output.FullName;

Expand All @@ -56,7 +56,7 @@ private static void GenerateIcons(FileInfo fore, FileInfo back, string? backCol,
MakeIOSIcons(outPath, background, backgroundColor, foreground);
}

private static void MakeWindowsIcon(string outPath, Image background, Color backgroundColor, Image foreground)
private static void MakeWindowsIcon(string outPath, Image? background, Color backgroundColor, Image? foreground)
{
MakePng(Path.Combine(outPath, "RbfxTemplate.Desktop\\icon.ico"), 64, 64, (Bitmap bmp) =>
{
Expand All @@ -65,7 +65,7 @@ private static void MakeWindowsIcon(string outPath, Image background, Color back
});
}

private static void MakeUWPIcons(string outPath, Image background, Color backgroundColor, Image foreground)
private static void MakeUWPIcons(string outPath, Image? background, Color backgroundColor, Image? foreground)
{
MakePng(Path.Combine(outPath, "RbfxTemplate.UWP\\Assets\\LockScreenLogo.scale-200.png"), 48, 48, (Bitmap bmp) =>
{
Expand Down Expand Up @@ -103,7 +103,7 @@ private static void MakeUWPIcons(string outPath, Image background, Color backgro
RenderForeground(bmp, foreground);
});
}
private static void MakeAndroidIcons(string outPath, Image background, Color backgroundColor, Image foreground)
private static void MakeAndroidIcons(string outPath, Image? background, Color backgroundColor, Image? foreground)
{
// hdpi

Expand Down Expand Up @@ -190,7 +190,7 @@ private static void MakeAndroidIcons(string outPath, Image background, Color bac
RenderForeground(bmp, foreground);
});
}
private static void MakeIOSIcons(string outPath, Image background, Color backgroundColor, Image foreground)
private static void MakeIOSIcons(string outPath, Image? background, Color backgroundColor, Image? foreground)
{

MakePng(Path.Combine(outPath, "RbfxTemplate.IOS\\Assets.xcassets\\AppIcon.appiconset\\Icon1024.png"), 1024, 1024, (Bitmap bmp) =>
Expand Down Expand Up @@ -260,7 +260,7 @@ private static void MakeIOSIcons(string outPath, Image background, Color backgro
});
}

private static void RenderBackground(Bitmap bmp, Image background, Color backgroundColor)
private static void RenderBackground(Bitmap bmp, Image? background, Color backgroundColor)
{
using (var gr = Graphics.FromImage(bmp))
{
Expand Down Expand Up @@ -325,7 +325,7 @@ private static RectangleF FitRectangle(RectangleF srcRect, RectangleF dstRect)
}
}

private static void RenderForeground(Bitmap bmp, Image foreground)
private static void RenderForeground(Bitmap bmp, Image? foreground)
{
if (foreground != null)
{
Expand All @@ -349,7 +349,7 @@ private static void MakePng(string path, int width, int height, Action<Bitmap> r
{
recipe(bmp);

Directory.CreateDirectory(Path.GetDirectoryName(path));
Directory.CreateDirectory(Path.GetDirectoryName(path)!);

switch (Path.GetExtension(path).ToLower())
{
Expand Down

0 comments on commit ad30801

Please sign in to comment.