[WIP] Fixing application runshortcut

Dies in ToBitmapOverlay because originalBitmap
isn't set.
This commit is contained in:
Terry MacDonald 2020-10-13 22:32:41 +13:00
parent 3992157793
commit ba54c9b99b
3 changed files with 26 additions and 14 deletions

View File

@ -9,6 +9,7 @@ using Microsoft.Win32;
using System.IO; using System.IO;
using System.Drawing.IconLib; using System.Drawing.IconLib;
using System.Security; using System.Security;
using System.Diagnostics;
namespace HeliosPlus.GameLibraries namespace HeliosPlus.GameLibraries
{ {
@ -357,7 +358,7 @@ namespace HeliosPlus.GameLibraries
var newAppInfo = new AppInfo(); var newAppInfo = new AppInfo();
newAppInfo.Read(appInfoVdfFile); newAppInfo.Read(appInfoVdfFile);
Console.WriteLine($"{newAppInfo.Apps.Count} apps"); Debug.WriteLine($"{newAppInfo.Apps.Count} apps");
// Chec through all the apps we've extracted // Chec through all the apps we've extracted
foreach (var app in newAppInfo.Apps) foreach (var app in newAppInfo.Apps)
@ -376,28 +377,28 @@ namespace HeliosPlus.GameLibraries
foreach (KVObject data in app.Data) foreach (KVObject data in app.Data)
{ {
//Console.WriteLine($"App: {app.AppID} - Data.Name: {data.Name}"); //Debug.WriteLine($"App: {app.AppID} - Data.Name: {data.Name}");
if (data.Name == "common") if (data.Name == "common")
{ {
foreach (KVObject common in data.Children) foreach (KVObject common in data.Children)
{ {
//Console.WriteLine($"App: {app.AppID} - Common {common.Name}: {common.Value}"); //Debug.WriteLine($"App: {app.AppID} - Common {common.Name}: {common.Value}");
if (common.Name == "name") if (common.Name == "name")
{ {
Console.WriteLine($"App: {app.AppID} - Common {common.Name}: {common.Value}"); Debug.WriteLine($"App: {app.AppID} - Common {common.Name}: {common.Value}");
steamGameAppInfo.GameName = common.Value.ToString(); steamGameAppInfo.GameName = common.Value.ToString();
} }
else if (common.Name == "clienticon") else if (common.Name == "clienticon")
{ {
Console.WriteLine($"App: {app.AppID} - Common {common.Name}: {common.Value}"); Debug.WriteLine($"App: {app.AppID} - Common {common.Name}: {common.Value}");
steamGameAppInfo.GameSteamIconPath = Path.Combine(_steamPath, @"steam", @"games", String.Concat(common.Value, @".ico")); steamGameAppInfo.GameSteamIconPath = Path.Combine(_steamPath, @"steam", @"games", String.Concat(common.Value, @".ico"));
} }
else if (common.Name == "type") else if (common.Name == "type")
{ {
Console.WriteLine($"App: {app.AppID} - Common {common.Name}: {common.Value}"); Debug.WriteLine($"App: {app.AppID} - Common {common.Name}: {common.Value}");
} }
} }
} }
@ -409,7 +410,7 @@ namespace HeliosPlus.GameLibraries
if (config.Name == "installdir") if (config.Name == "installdir")
{ {
Console.WriteLine($"App: {app.AppID} - Config {config.Name}: {config.Value}"); Debug.WriteLine($"App: {app.AppID} - Config {config.Name}: {config.Value}");
steamGameAppInfo.GameInstallDir = config.Value.ToString(); steamGameAppInfo.GameInstallDir = config.Value.ToString();
} }
else if (config.Name == "launch") else if (config.Name == "launch")
@ -420,7 +421,7 @@ namespace HeliosPlus.GameLibraries
{ {
if (launch_num.Name == "executable") if (launch_num.Name == "executable")
{ {
Console.WriteLine($"App: {app.AppID} - Config - Launch {launch.Name} - {launch_num.Name}: {launch_num.Value}"); Debug.WriteLine($"App: {app.AppID} - Config - Launch {launch.Name} - {launch_num.Name}: {launch_num.Value}");
steamGameAppInfo.GameExes.Add(launch_num.Value.ToString()); steamGameAppInfo.GameExes.Add(launch_num.Value.ToString());
} }
@ -439,7 +440,7 @@ namespace HeliosPlus.GameLibraries
//we just want to ignore it if we try to add it twice.... //we just want to ignore it if we try to add it twice....
} }
Console.WriteLine($"App: {app.AppID} - Token: {app.Token}"); Debug.WriteLine($"App: {app.AppID} - Token: {app.Token}");
} }
} }
@ -463,7 +464,7 @@ namespace HeliosPlus.GameLibraries
if (steamLibraryMatch.Success) if (steamLibraryMatch.Success)
{ {
string steamLibraryPath = Regex.Unescape(steamLibraryMatch.Groups[1].Value); string steamLibraryPath = Regex.Unescape(steamLibraryMatch.Groups[1].Value);
Console.WriteLine($"Found steam library: {steamLibraryPath}"); Debug.WriteLine($"Found steam library: {steamLibraryPath}");
steamLibrariesPaths.Add(steamLibraryPath); steamLibrariesPaths.Add(steamLibraryPath);
} }
} }

View File

@ -213,11 +213,15 @@ namespace HeliosPlus
// We now force creation of the bitmap // We now force creation of the bitmap
// straight away, so we know it has already been done. // straight away, so we know it has already been done.
_originalBitmap = ToBitmapFromIcon(_originalIconPath);
/*if (Category == ShortcutCategory.Application)
_originalBitmap = ToBitmapFromExe(_originalIconPath);
else
_originalBitmap = ToBitmapFromIcon(_originalIconPath);*/
// And we do the same for the Bitmap overlay, but only if the ProfileToUse is set // And we do the same for the Bitmap overlay, but only if the ProfileToUse is set
if (ProfileToUse is ProfileItem) //if (ProfileToUse is ProfileItem)
_shortcutBitmap = ToBitmapOverlay(_originalBitmap, ProfileToUse.ProfileTightestBitmap, 256, 256); // _shortcutBitmap = ToBitmapOverlay(_originalBitmap, ProfileToUse.ProfileTightestBitmap, 256, 256);
} }
} }
@ -233,7 +237,12 @@ namespace HeliosPlus
if (String.IsNullOrEmpty(OriginalIconPath)) if (String.IsNullOrEmpty(OriginalIconPath))
return null; return null;
return ToBitmapFromIcon(OriginalIconPath); if (Category == ShortcutCategory.Application)
_originalBitmap = ToBitmapFromExe(OriginalIconPath);
else
_originalBitmap = ToBitmapFromIcon(OriginalIconPath);
return _originalBitmap;
} }
} }

View File

@ -486,7 +486,9 @@ namespace HeliosPlus.UIForms
_shortcutToEdit.GameLibrary = SupportedGameLibrary.Uplay; _shortcutToEdit.GameLibrary = SupportedGameLibrary.Uplay;
}*/ }*/
else if (rb_standalone.Checked) else if (rb_standalone.Checked)
{
_shortcutToEdit.Category = ShortcutCategory.Application; _shortcutToEdit.Category = ShortcutCategory.Application;
}
// Add the Shortcut to the list of saved Shortcuts so it gets saved for later // Add the Shortcut to the list of saved Shortcuts so it gets saved for later
// but only if it's new... if it is an edit then it will already be in the list. // but only if it's new... if it is an edit then it will already be in the list.