33 lines
986 B
C#
33 lines
986 B
C#
using System.Drawing;
|
|
|
|
namespace EonaCat.XSBOX.Launcher;
|
|
|
|
internal static class LauncherBrand
|
|
{
|
|
public static string? ResolveLogoPath()
|
|
{
|
|
var candidates = new List<string>
|
|
{
|
|
Path.Combine(AppContext.BaseDirectory, "assets", "eonacat-logo.ico"),
|
|
Path.Combine(AppContext.BaseDirectory, "eonacat-logo.ico")
|
|
};
|
|
|
|
var directory = new DirectoryInfo(AppContext.BaseDirectory);
|
|
for (var depth = 0; depth < 8 && directory != null; depth++, directory = directory.Parent)
|
|
{
|
|
candidates.Add(Path.Combine(directory.FullName, "assets", "eonacat-logo.ico"));
|
|
candidates.Add(Path.Combine(directory.FullName, "eonacat-logo.ico"));
|
|
}
|
|
|
|
return candidates.FirstOrDefault(File.Exists);
|
|
}
|
|
|
|
public static Icon? CreateIcon()
|
|
{
|
|
var path = ResolveLogoPath();
|
|
if (path == null) return null;
|
|
try { return new Icon(path); }
|
|
catch { return null; }
|
|
}
|
|
}
|