mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed ShortcutAdaptor errors and Saved prompt
Did a fix for the SHortcutAdaptor doing exceptions for showing the form before loading all the graphics but can't really do much about it without adding background loading to the main form. This is a lot of work considering we'll be moving from WinForms to WPF UI in the future. Also fixed the 'Do you want to save' prompt detection logic so that it correctly waits until all the loading has finished before monitoring for users making changes. Should stop the form incorrectly suggesting you should save unless they've really made a change.
This commit is contained in:
parent
0e985238f9
commit
85963b3417
@ -100,8 +100,9 @@ namespace HeliosPlus.Shared
|
|||||||
{
|
{
|
||||||
NvAPIWrapper.NVIDIA.Initialize();
|
NvAPIWrapper.NVIDIA.Initialize();
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutItem/Instansiation exception: {ex.Message}: {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,8 +365,9 @@ namespace HeliosPlus.Shared
|
|||||||
GridTopology.SetGridTopologies(surroundTopologies, SetDisplayTopologyFlag.MaximizePerformance);
|
GridTopology.SetGridTopologies(surroundTopologies, SetDisplayTopologyFlag.MaximizePerformance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileItem/ApplyTopos exception: {ex.Message}: {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,8 +165,9 @@ namespace HeliosPlus.Shared
|
|||||||
{
|
{
|
||||||
File.Delete(ProfileToRemove.SavedProfileIconCacheFilename);
|
File.Delete(ProfileToRemove.SavedProfileIconCacheFilename);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileRepository/RemoveProfile exception: {ex.Message}: {ex.InnerException}");
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,8 +200,9 @@ namespace HeliosPlus.Shared
|
|||||||
{
|
{
|
||||||
File.Delete(ProfileToRemove.SavedProfileIconCacheFilename);
|
File.Delete(ProfileToRemove.SavedProfileIconCacheFilename);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileRepository/RemoveProfile exception 2: {ex.Message}: {ex.InnerException}");
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,8 +235,9 @@ namespace HeliosPlus.Shared
|
|||||||
{
|
{
|
||||||
File.Delete(ProfileToRemove.SavedProfileIconCacheFilename);
|
File.Delete(ProfileToRemove.SavedProfileIconCacheFilename);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileRepository/RemoveProfile exception 3: {ex.Message}: {ex.InnerException}");
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -419,6 +422,7 @@ namespace HeliosPlus.Shared
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// ignored
|
// ignored
|
||||||
|
Console.WriteLine($"ProfileRepository/LoadProfiles exception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine($"Unable to load Profiles from JSON file {_profileStorageJsonFileName}: " + ex.Message);
|
Console.WriteLine($"Unable to load Profiles from JSON file {_profileStorageJsonFileName}: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,6 +477,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileRepository/SaveProfiles exception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine($"Unable to create Profile folder {_profileStorageJsonPath}: " + ex.Message);
|
Console.WriteLine($"Unable to create Profile folder {_profileStorageJsonPath}: " + ex.Message);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -497,6 +502,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileRepository/SaveProfiles exception 2: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine($"Unable to save Profile JSON file {_profileStorageJsonFileName}: " + ex.Message);
|
Console.WriteLine($"Unable to save Profile JSON file {_profileStorageJsonFileName}: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,6 +523,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileRepository/SaveProfileIconToCache exception: {ex.Message}: {ex.InnerException}");
|
||||||
// If we fail to create an icon based on the Profile, then we use the standard HeliosPlus profile one.
|
// If we fail to create an icon based on the Profile, then we use the standard HeliosPlus profile one.
|
||||||
// Which is created on program startup.
|
// Which is created on program startup.
|
||||||
File.Copy(AppHeliosPlusIconFilename, profile.SavedProfileIconCacheFilename);
|
File.Copy(AppHeliosPlusIconFilename, profile.SavedProfileIconCacheFilename);
|
||||||
@ -560,6 +567,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileRepository/ApplyProfile exception: {ex.Message}: {ex.InnerException}");
|
||||||
UpdateCurrentProfile();
|
UpdateCurrentProfile();
|
||||||
Console.WriteLine($"Profile: Problem applying the '{profile.Name}' Display Profile: {ex.Message}");
|
Console.WriteLine($"Profile: Problem applying the '{profile.Name}' Display Profile: {ex.Message}");
|
||||||
MessageBox.Show($"Problem applying the '{profile.Name}' Display Profile! \n(ex.Message)", $"Problem applying '{profile.Name}' Profile", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show($"Problem applying the '{profile.Name}' Display Profile! \n(ex.Message)", $"Problem applying '{profile.Name}' Profile", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
@ -102,18 +102,20 @@ namespace HeliosPlus.GameLibraries
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SecurityException e)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/IsRunning securityexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// Extract some information from this exception, and then
|
// Extract some information from this exception, and then
|
||||||
// throw it to the parent method.
|
// throw it to the parent method.
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/IsRunning ioexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("IOException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,18 +137,20 @@ namespace HeliosPlus.GameLibraries
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SecurityException e)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/IsUpdating securityexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// Extract some information from this exception, and then
|
// Extract some information from this exception, and then
|
||||||
// throw it to the parent method.
|
// throw it to the parent method.
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/IsUpdating ioexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("IOException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,8 +322,9 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
steamAppInfo.Add(app.AppID, steamGameAppInfo);
|
steamAppInfo.Add(app.AppID, steamGameAppInfo);
|
||||||
}
|
}
|
||||||
catch (ArgumentException e)
|
catch (ArgumentException ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"SteamGame/GetAllInstalledGames exception: {ex.Message}: {ex.InnerException}");
|
||||||
//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....
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,30 +444,34 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SecurityException e)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/GetAllInstalledGames securityexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (UnauthorizedAccessException e)
|
catch (UnauthorizedAccessException ex)
|
||||||
{
|
{
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/GetAllInstalledGames unauthorizedaccessexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("UnauthorizedAccessException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("UnauthorizedAccessException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException e)
|
catch (ObjectDisposedException ex)
|
||||||
{
|
{
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/GetAllInstalledGames objectdisposedexceptions: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("ObjectDisposedException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("ObjectDisposedException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"SteamGame/GetAllInstalledGames ioexception: {ex.Message}: {ex.InnerException}");
|
||||||
// Extract some information from this exception, and then
|
// Extract some information from this exception, and then
|
||||||
// throw it to the parent method.
|
// throw it to the parent method.
|
||||||
if (e.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("IOException source: {0} - Message: {1}", e.Source, e.Message);
|
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,18 +102,20 @@ namespace HeliosPlus.GameLibraries
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SecurityException e)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/IsUpdating securityexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// Extract some information from this exception, and then
|
// Extract some information from this exception, and then
|
||||||
// throw it to the parent method.
|
// throw it to the parent method.
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/IsUpdating ioexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("IOException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,18 +137,20 @@ namespace HeliosPlus.GameLibraries
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SecurityException e)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/IsUpdating securityexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// Extract some information from this exception, and then
|
// Extract some information from this exception, and then
|
||||||
// throw it to the parent method.
|
// throw it to the parent method.
|
||||||
if (e.Source != null)
|
Console.WriteLine($"SteamGame/IsUpdating ioexception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("IOException source: {0} - Message: {1}", e.Source, e.Message);
|
if (ex.Source != null)
|
||||||
|
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,8 +323,9 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
uplayAppInfo.Add(app.AppID, uplayGameAppInfo);
|
uplayAppInfo.Add(app.AppID, uplayGameAppInfo);
|
||||||
}
|
}
|
||||||
catch (ArgumentException e)
|
catch (ArgumentException ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"UplayGame/GetAllInstalledGames argumentexception: {ex.Message}: {ex.InnerException}");
|
||||||
//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....
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.ServiceModel;
|
using System.ServiceModel;
|
||||||
using System.ServiceModel.Description;
|
using System.ServiceModel.Description;
|
||||||
@ -49,8 +50,9 @@ namespace HeliosPlus.InterProcess
|
|||||||
{
|
{
|
||||||
processChannel = new IPCClient(process);
|
processChannel = new IPCClient(process);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"IPCClient/QueryAll exception: {ex.Message}: {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,8 +80,9 @@ namespace HeliosPlus.InterProcess
|
|||||||
return processChannel;
|
return processChannel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"IPCClient/QueryByStatus exception: {ex.Message}: {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,14 +51,16 @@ namespace HeliosPlus.InterProcess
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"IPCService/StartService exception: {ex.Message}: {ex.InnerException}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_serviceHost?.Close();
|
_serviceHost?.Close();
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"IPCService/StartService exception 2: {ex2.Message}: {ex2.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,6 +202,7 @@ namespace HeliosPlus {
|
|||||||
}
|
}
|
||||||
catch (CommandParsingException ex)
|
catch (CommandParsingException ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Program/Main commandParsingException: {ex.Message}: {ex.InnerException}");
|
||||||
// You'll always want to catch this exception, otherwise it will generate a messy and confusing error for the end user.
|
// You'll always want to catch this exception, otherwise it will generate a messy and confusing error for the end user.
|
||||||
// the message will usually be something like:
|
// the message will usually be something like:
|
||||||
// "Unrecognized command or argument '<invalid-command>'"
|
// "Unrecognized command or argument '<invalid-command>'"
|
||||||
@ -209,6 +210,7 @@ namespace HeliosPlus {
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Program/Main exception: {ex.Message}: {ex.InnerException}");
|
||||||
Console.WriteLine("Unable to execute application: {0}", ex.Message);
|
Console.WriteLine("Unable to execute application: {0}", ex.Message);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -239,8 +241,9 @@ namespace HeliosPlus {
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(AppIconPath);
|
Directory.CreateDirectory(AppIconPath);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Program/StartUpNormally exception: {ex.Message}: {ex.InnerException}");
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,8 +290,9 @@ namespace HeliosPlus {
|
|||||||
heliosIcon.Save(fs);
|
heliosIcon.Save(fs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Program/StartUpNormally exception 2: {ex.Message}: {ex.InnerException}");
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,6 +302,7 @@ namespace HeliosPlus {
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Program/StartUpNormally exception 3: {ex.Message}: {ex.InnerException}");
|
||||||
MessageBox.Show(
|
MessageBox.Show(
|
||||||
ex.Message,
|
ex.Message,
|
||||||
Language.Fatal_Error,
|
Language.Fatal_Error,
|
||||||
@ -374,8 +379,9 @@ namespace HeliosPlus {
|
|||||||
};
|
};
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Program/SwitchToExecutable exception: {ex.Message}: {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,8 +391,9 @@ namespace HeliosPlus {
|
|||||||
{
|
{
|
||||||
p.WaitForExit();
|
p.WaitForExit();
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Program/SwitchToExecutable exception 2: {ex.Message}: {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -514,8 +521,9 @@ namespace HeliosPlus {
|
|||||||
};
|
};
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Program/SwitchToSteamGame exception: {ex.Message}: {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,11 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { return null; }
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"ShortcutItem/ExtractVisataIcon exception: {ex.Message}: {ex.InnerException}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return bmpPngExtracted;
|
return bmpPngExtracted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,16 +586,20 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutItem/CreateShortcut exception (saving)");
|
||||||
Marshal.FinalReleaseComObject(shortcut);
|
Marshal.FinalReleaseComObject(shortcut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutItem/CreateShortcut exception (Creating shortcut)");
|
||||||
Marshal.FinalReleaseComObject(wshShell);
|
Marshal.FinalReleaseComObject(wshShell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutItem/CreateShortcut exception (deleting old shortcut)");
|
||||||
|
|
||||||
// Clean up a failed attempt
|
// Clean up a failed attempt
|
||||||
if (File.Exists(shortcutFileName))
|
if (File.Exists(shortcutFileName))
|
||||||
{
|
{
|
||||||
|
@ -134,8 +134,10 @@ namespace HeliosPlus
|
|||||||
{
|
{
|
||||||
File.Delete(shortcutToRemove.SavedShortcutIconCacheFilename);
|
File.Delete(shortcutToRemove.SavedShortcutIconCacheFilename);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutRepository/RemoveShortcut exception: {ex.Message}: {ex.InnerException}");
|
||||||
|
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,8 +184,10 @@ namespace HeliosPlus
|
|||||||
{
|
{
|
||||||
File.Delete(shortcutToRemove.SavedShortcutIconCacheFilename);
|
File.Delete(shortcutToRemove.SavedShortcutIconCacheFilename);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutRepository/RemoveShortcut exception 2: {ex.Message}: {ex.InnerException}");
|
||||||
|
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,6 +358,8 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutRepository/SaveShortcuts exception: {ex.Message}: {ex.InnerException}");
|
||||||
|
|
||||||
Console.WriteLine($"Unable to create Shortcut folder {_shortcutStorageJsonPath}: " + ex.Message);
|
Console.WriteLine($"Unable to create Shortcut folder {_shortcutStorageJsonPath}: " + ex.Message);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -378,6 +384,8 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutRepository/SaveShortcuts exception 2: {ex.Message}: {ex.InnerException}");
|
||||||
|
|
||||||
Console.WriteLine($"Unable to save Shortcut JSON file {_shortcutStorageJsonFileName}: " + ex.Message);
|
Console.WriteLine($"Unable to save Shortcut JSON file {_shortcutStorageJsonFileName}: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,6 +442,8 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutRepository/SaveShortcutIconToCache exception: {ex.Message}: {ex.InnerException}");
|
||||||
|
|
||||||
// If we fail to create an icon based on the original executable or game
|
// If we fail to create an icon based on the original executable or game
|
||||||
// Then we use the standard HeliosPlus profile one.
|
// Then we use the standard HeliosPlus profile one.
|
||||||
shortcutIcon = shortcut.ProfileToUse.ProfileIcon.ToIcon();
|
shortcutIcon = shortcut.ProfileToUse.ProfileIcon.ToIcon();
|
||||||
|
@ -188,8 +188,9 @@ namespace HeliosPlus.UIForms
|
|||||||
{
|
{
|
||||||
Opacity = f;
|
Opacity = f;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ApplyingChangesForm/SplashForm_FormClosing exception: {ex.Message}: {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}, this), new SafeInvoker(() =>
|
}, this), new SafeInvoker(() =>
|
||||||
@ -213,8 +214,9 @@ namespace HeliosPlus.UIForms
|
|||||||
{
|
{
|
||||||
Opacity = f;
|
Opacity = f;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ApplyingChangesForm/SplashForm_Shown exception: {ex.Message}: {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}, this), new SafeInvoker(DoTimeout, this));
|
}, this), new SafeInvoker(DoTimeout, this));
|
||||||
|
@ -18,15 +18,14 @@ namespace HeliosPlus.UIForms
|
|||||||
private string _saveOrRenameMode = "save";
|
private string _saveOrRenameMode = "save";
|
||||||
//private static bool _inDialog = false;
|
//private static bool _inDialog = false;
|
||||||
private static ProfileItem _profileToLoad = null;
|
private static ProfileItem _profileToLoad = null;
|
||||||
private ProfileAdaptor _profileAdaptor;
|
private ProfileAdaptor _profileAdaptor = new ProfileAdaptor();
|
||||||
private ProfileRepository _profileRepository;
|
private ProfileRepository _profileRepository = new ProfileRepository();
|
||||||
|
|
||||||
public DisplayProfileForm()
|
public DisplayProfileForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.AcceptButton = this.btn_save_or_rename;
|
this.AcceptButton = this.btn_save_or_rename;
|
||||||
_profileAdaptor = new ProfileAdaptor();
|
//_profileRepository = new ProfileRepository();
|
||||||
_profileRepository = new ProfileRepository();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisplayProfileForm(ProfileItem profileToLoad) : this()
|
public DisplayProfileForm(ProfileItem profileToLoad) : this()
|
||||||
|
@ -64,7 +64,9 @@ namespace HeliosPlus.UIForms
|
|||||||
Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(() => { return false; });
|
Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(() => { return false; });
|
||||||
return profileToUse.ProfileBitmap.GetThumbnailImage(size.Width, size.Height, myCallback, IntPtr.Zero);
|
return profileToUse.ProfileBitmap.GetThumbnailImage(size.Width, size.Height, myCallback, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
catch {
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"ProfileAdaptor/GetThumbnail exception: {ex.Message}: {ex.InnerException}");
|
||||||
// If we have a problem with converting the submitted key to a profile
|
// If we have a problem with converting the submitted key to a profile
|
||||||
// Then we return null
|
// Then we return null
|
||||||
return null;
|
return null;
|
||||||
@ -90,11 +92,18 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string profileName = (string)key;
|
ProfileItem profileToUse = (ProfileItem)key;
|
||||||
return profileName;
|
|
||||||
|
if (profileToUse == null)
|
||||||
|
{
|
||||||
|
profileToUse = ProfileRepository.CurrentProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
return profileToUse.Name;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileAdaptor/GertUniqueIdentifier exception: {ex.Message}: {ex.InnerException}");
|
||||||
// If we have a problem with converting the submitted key to a profile
|
// If we have a problem with converting the submitted key to a profile
|
||||||
// Then we return null
|
// Then we return null
|
||||||
return null;
|
return null;
|
||||||
@ -116,8 +125,9 @@ namespace HeliosPlus.UIForms
|
|||||||
string profileName = (string)key;
|
string profileName = (string)key;
|
||||||
return profileName;
|
return profileName;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileAdaptor/GetSourceImage exception: {ex.Message}: {ex.InnerException}");
|
||||||
// If we have a problem with converting the submitted key to a profile
|
// If we have a problem with converting the submitted key to a profile
|
||||||
// Then we return null
|
// Then we return null
|
||||||
return null;
|
return null;
|
||||||
@ -138,17 +148,7 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string profileName = (string)key;
|
ProfileItem profileToUse = (ProfileItem)key;
|
||||||
ProfileItem profileToUse = null;
|
|
||||||
|
|
||||||
foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles)
|
|
||||||
{
|
|
||||||
if (profileToTest.Name == profileName)
|
|
||||||
{
|
|
||||||
profileToUse = profileToTest;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (profileToUse == null)
|
if (profileToUse == null)
|
||||||
{
|
{
|
||||||
@ -183,8 +183,9 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
return details.ToArray();
|
return details.ToArray();
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ProfileAdaptor/Utility.Tuple exception: {ex.Message}: {ex.InnerException}");
|
||||||
// If we have a problem with converting the submitted key to a profile
|
// If we have a problem with converting the submitted key to a profile
|
||||||
// Then we return null
|
// Then we return null
|
||||||
return null;
|
return null;
|
||||||
|
@ -53,7 +53,10 @@ namespace HeliosPlus.UIForms
|
|||||||
//return shortcut.ShortcutBitmap.GetThumbnailImage(size.Width, size.Height, myCallback, IntPtr.Zero);
|
//return shortcut.ShortcutBitmap.GetThumbnailImage(size.Width, size.Height, myCallback, IntPtr.Zero);
|
||||||
return shortcut.ShortcutBitmap;
|
return shortcut.ShortcutBitmap;
|
||||||
}
|
}
|
||||||
catch {
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"ShortcutAdapter/GetThumbnail exception: {ex.Message}: {ex.InnerException}");
|
||||||
|
|
||||||
// If we have a problem with converting the submitted key to a profile
|
// If we have a problem with converting the submitted key to a profile
|
||||||
// Then we return null
|
// Then we return null
|
||||||
return null;
|
return null;
|
||||||
@ -79,11 +82,12 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ShortcutItem shortcutName = (ShortcutItem) key;
|
ShortcutItem shortcut = (ShortcutItem) key;
|
||||||
return shortcutName.Name;
|
return shortcut.Name;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutAdapter/GetUniqueIdentifier exception: {ex.Message}: {ex.InnerException}");
|
||||||
// If we have a problem with converting the submitted key to a Shortcut
|
// If we have a problem with converting the submitted key to a Shortcut
|
||||||
// Then we return null
|
// Then we return null
|
||||||
return null;
|
return null;
|
||||||
@ -102,18 +106,13 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Shortcut shortcut = (Shortcut)key;
|
|
||||||
//return shortcut.SavedShortcutIconCacheFilename;
|
|
||||||
string shortcutName = (string)key;
|
string shortcutName = (string)key;
|
||||||
/* Shortcut shortcut = (from item in Shortcut.AllSavedShortcuts where item.Name == shortcutName select item).First();
|
|
||||||
if (shortcut is Shortcut)
|
|
||||||
return shortcut.SavedShortcutIconCacheFilename;
|
|
||||||
else
|
|
||||||
return null;*/
|
|
||||||
return shortcutName;
|
return shortcutName;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutAdaptor/GetSourceImage exception: {ex.Message}: {ex.InnerException}");
|
||||||
|
|
||||||
// If we have a problem with converting the submitted key to a profile
|
// If we have a problem with converting the submitted key to a profile
|
||||||
// Then we return null
|
// Then we return null
|
||||||
return null;
|
return null;
|
||||||
@ -134,7 +133,6 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
ShortcutItem shortcut = (ShortcutItem) key;
|
ShortcutItem shortcut = (ShortcutItem) key;
|
||||||
|
|
||||||
// Get file info
|
// Get file info
|
||||||
@ -165,8 +163,9 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
return details.ToArray();
|
return details.ToArray();
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutAdapter/Utility.Tuple exception: {ex.Message}: {ex.InnerException}");
|
||||||
// If we have a problem with converting the submitted key to a profile
|
// If we have a problem with converting the submitted key to a profile
|
||||||
// Then we return null
|
// Then we return null
|
||||||
return null;
|
return null;
|
||||||
|
1
HeliosPlus/UIForms/ShortcutForm.Designer.cs
generated
1
HeliosPlus/UIForms/ShortcutForm.Designer.cs
generated
@ -587,7 +587,6 @@ namespace HeliosPlus.UIForms
|
|||||||
this.lv_games.SmallImageList = this.il_games;
|
this.lv_games.SmallImageList = this.il_games;
|
||||||
this.lv_games.TabIndex = 22;
|
this.lv_games.TabIndex = 22;
|
||||||
this.lv_games.UseCompatibleStateImageBehavior = false;
|
this.lv_games.UseCompatibleStateImageBehavior = false;
|
||||||
this.lv_games.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lv_games_ItemSelectionChanged);
|
|
||||||
this.lv_games.DoubleClick += new System.EventHandler(this.btn_choose_game_Click);
|
this.lv_games.DoubleClick += new System.EventHandler(this.btn_choose_game_Click);
|
||||||
//
|
//
|
||||||
// rb_launcher
|
// rb_launcher
|
||||||
|
@ -676,8 +676,9 @@ namespace HeliosPlus.UIForms
|
|||||||
il_games.Images.Add(extractedBitmap);
|
il_games.Images.Add(extractedBitmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"ShortcutForm exception: {ex.Message}: {ex.InnerException}");
|
||||||
il_games.Images.Add(Image.FromFile("Resources/Steam.ico"));
|
il_games.Images.Add(Image.FromFile("Resources/Steam.ico"));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -686,6 +687,7 @@ namespace HeliosPlus.UIForms
|
|||||||
il_games.Images.Add(Image.FromFile("Resources/Steam.ico"));
|
il_games.Images.Add(Image.FromFile("Resources/Steam.ico"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!Visible)
|
if (!Visible)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -700,7 +702,6 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now start populating the other fields
|
// Now start populating the other fields
|
||||||
|
|
||||||
_uuid = _shortcutToEdit.UUID;
|
_uuid = _shortcutToEdit.UUID;
|
||||||
// Set if we launch App/Game/NoGame
|
// Set if we launch App/Game/NoGame
|
||||||
switch (_shortcutToEdit.Category)
|
switch (_shortcutToEdit.Category)
|
||||||
@ -738,7 +739,6 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the executable items if we have them
|
// Set the executable items if we have them
|
||||||
txt_executable.Text = _shortcutToEdit.ExecutableNameAndPath;
|
txt_executable.Text = _shortcutToEdit.ExecutableNameAndPath;
|
||||||
nud_timeout_executable.Value = _shortcutToEdit.ExecutableTimeout;
|
nud_timeout_executable.Value = _shortcutToEdit.ExecutableTimeout;
|
||||||
@ -759,7 +759,6 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
txt_alternative_executable.Text = _shortcutToEdit.DifferentExecutableToMonitor;
|
txt_alternative_executable.Text = _shortcutToEdit.DifferentExecutableToMonitor;
|
||||||
|
|
||||||
|
|
||||||
// Set the shortcut name
|
// Set the shortcut name
|
||||||
txt_shortcut_save_name.Text = _shortcutToEdit.Name;
|
txt_shortcut_save_name.Text = _shortcutToEdit.Name;
|
||||||
|
|
||||||
@ -857,6 +856,8 @@ namespace HeliosPlus.UIForms
|
|||||||
if (loadedProfile.Name == e.Item.Text)
|
if (loadedProfile.Name == e.Item.Text)
|
||||||
{
|
{
|
||||||
ChangeSelectedProfile(loadedProfile);
|
ChangeSelectedProfile(loadedProfile);
|
||||||
|
if (_loadedShortcut)
|
||||||
|
_isUnsaved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1039,16 +1040,10 @@ namespace HeliosPlus.UIForms
|
|||||||
enableSaveButtonIfValid();
|
enableSaveButtonIfValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lv_games_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (_loadedShortcut)
|
|
||||||
_isUnsaved = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShortcutForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void ShortcutForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_isUnsaved)
|
if (_isUnsaved && _loadedShortcut)
|
||||||
{
|
{
|
||||||
// If the user doesn't want to close this window without saving, then don't close the window.
|
// If the user doesn't want to close this window without saving, then don't close the window.
|
||||||
DialogResult result = MessageBox.Show(
|
DialogResult result = MessageBox.Show(
|
||||||
@ -1085,12 +1080,16 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
private void txt_shortcut_save_name_Click(object sender, EventArgs e)
|
private void txt_shortcut_save_name_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_loadedShortcut)
|
||||||
|
_isUnsaved = true;
|
||||||
_saveNameAutomatic = false;
|
_saveNameAutomatic = false;
|
||||||
cb_autosuggest.Checked = false;
|
cb_autosuggest.Checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cb_autosuggest_CheckedChanged(object sender, EventArgs e)
|
private void cb_autosuggest_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_loadedShortcut)
|
||||||
|
_isUnsaved = true;
|
||||||
if (cb_autosuggest.Checked)
|
if (cb_autosuggest.Checked)
|
||||||
_saveNameAutomatic = true;
|
_saveNameAutomatic = true;
|
||||||
else
|
else
|
||||||
|
@ -20,18 +20,18 @@ namespace HeliosPlus.UIForms
|
|||||||
public partial class ShortcutLibraryForm : Form
|
public partial class ShortcutLibraryForm : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
private ShortcutAdaptor _shortcutAdaptor;
|
private ShortcutAdaptor _shortcutAdaptor = new ShortcutAdaptor();
|
||||||
private ImageListViewItem _selectedShortcutILVItem = null;
|
private ImageListViewItem _selectedShortcutILVItem = null;
|
||||||
private ShortcutItem _selectedShortcut = null;
|
private ShortcutItem _selectedShortcut = null;
|
||||||
private ShortcutRepository _shortcutRepository;
|
private ShortcutRepository _shortcutRepository = new ShortcutRepository();
|
||||||
private ProfileRepository _profileRepository;
|
private ProfileRepository _profileRepository = new ProfileRepository();
|
||||||
|
|
||||||
public ShortcutLibraryForm()
|
public ShortcutLibraryForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_shortcutAdaptor = new ShortcutAdaptor();
|
//_shortcutAdaptor = new ShortcutAdaptor();
|
||||||
_shortcutRepository = new ShortcutRepository();
|
//_shortcutRepository = new ShortcutRepository();
|
||||||
_profileRepository = new ProfileRepository();
|
//_profileRepository = new ProfileRepository();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btn_new_Click(object sender, EventArgs e)
|
private void btn_new_Click(object sender, EventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user