Initial version
This commit is contained in:
1 parent
2cff35f215
commit
fe8e2cb5e7
360 files changed
+253989
-74
No files matched your search
@@ -0,0 +1,32 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user