mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Silenced the System.Drawing.Image exceptions
The ProfileAdapter and ShortcutAdapters used by the ImageListView Control unfortunately have to access the sizes of the bitmaps being loaded into the respective imagelistviews. I can't find anyway of stopping the GDI+ from complaining about the Bitmap being accessed by multiple different threads (as ImageListView creates one thread per image. This will be fixed once I move to this being a WPF application as we'll use a different control.
This commit is contained in:
@ -26,6 +26,7 @@
|
|||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<UseVSHostingProcess>true</UseVSHostingProcess>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
||||||
|
<UseVSHostingProcess>true</UseVSHostingProcess>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
|
@ -102,7 +102,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutItem/Instansiation exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutItem/Instansiation exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutItem/Instansiation exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutItem/Instansiation exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileRepository/RemoveProfile exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileRepository/RemoveProfile exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileRepository/RemoveProfile exception 2: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileRepository/RemoveProfile exception 2: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileRepository/RemoveProfile exception 3: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileRepository/RemoveProfile exception 3: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -426,7 +426,7 @@ namespace HeliosPlus.Shared
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// ignored
|
// ignored
|
||||||
Console.WriteLine($"ProfileRepository/LoadProfiles exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileRepository/LoadProfiles exception: {ex.Message}: {ex.StackTrace} - {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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileRepository/SaveProfiles exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileRepository/SaveProfiles exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
Console.WriteLine($"Unable to create Profile folder {_profileStorageJsonPath}: " + ex.Message);
|
Console.WriteLine($"Unable to create Profile folder {_profileStorageJsonPath}: " + ex.Message);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -506,7 +506,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileRepository/SaveProfiles exception 2: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileRepository/SaveProfiles exception 2: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
Console.WriteLine($"Unable to save Profile JSON file {_profileStorageJsonFileName}: " + ex.Message);
|
Console.WriteLine($"Unable to save Profile JSON file {_profileStorageJsonFileName}: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ namespace HeliosPlus.Shared
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileRepository/SaveProfileIconToCache exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileRepository/SaveProfileIconToCache exception: {ex.Message}: {ex.StackTrace} - {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);
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<UseVSHostingProcess>true</UseVSHostingProcess>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
|
@ -103,7 +103,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
catch (SecurityException ex)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SteamGame/IsRunning securityexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/IsRunning securityexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
@ -112,7 +112,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
{
|
{
|
||||||
// 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.
|
||||||
Console.WriteLine($"SteamGame/IsRunning ioexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/IsRunning ioexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
@ -138,7 +138,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
catch (SecurityException ex)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SteamGame/IsUpdating securityexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/IsUpdating securityexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
@ -147,7 +147,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
{
|
{
|
||||||
// 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.
|
||||||
Console.WriteLine($"SteamGame/IsUpdating ioexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/IsUpdating ioexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
|
@ -435,7 +435,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
catch (ArgumentException ex)
|
catch (ArgumentException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SteamGame/GetAllInstalledGames exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/GetAllInstalledGames exception: {ex.Message}: {ex.StackTrace} - {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....
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,28 +558,28 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
catch (SecurityException ex)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SteamGame/GetAllInstalledGames securityexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/GetAllInstalledGames securityexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (UnauthorizedAccessException ex)
|
catch (UnauthorizedAccessException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SteamGame/GetAllInstalledGames unauthorizedaccessexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/GetAllInstalledGames unauthorizedaccessexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("UnauthorizedAccessException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("UnauthorizedAccessException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException ex)
|
catch (ObjectDisposedException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SteamGame/GetAllInstalledGames objectdisposedexceptions: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/GetAllInstalledGames objectdisposedexceptions: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("ObjectDisposedException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("ObjectDisposedException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SteamGame/GetAllInstalledGames ioexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/GetAllInstalledGames ioexception: {ex.Message}: {ex.StackTrace} - {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 (ex.Source != null)
|
if (ex.Source != null)
|
||||||
|
@ -104,7 +104,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
catch (SecurityException ex)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SteamGame/IsUpdating securityexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/IsUpdating securityexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
@ -113,7 +113,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
{
|
{
|
||||||
// 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.
|
||||||
Console.WriteLine($"SteamGame/IsUpdating ioexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/IsUpdating ioexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
@ -139,7 +139,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
catch (SecurityException ex)
|
catch (SecurityException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SteamGame/IsUpdating securityexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/IsUpdating securityexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("SecurityException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
@ -148,7 +148,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
{
|
{
|
||||||
// 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.
|
||||||
Console.WriteLine($"SteamGame/IsUpdating ioexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"SteamGame/IsUpdating ioexception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
if (ex.Source != null)
|
if (ex.Source != null)
|
||||||
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
Console.WriteLine("IOException source: {0} - Message: {1}", ex.Source, ex.Message);
|
||||||
throw;
|
throw;
|
||||||
@ -325,7 +325,7 @@ namespace HeliosPlus.GameLibraries
|
|||||||
}
|
}
|
||||||
catch (ArgumentException ex)
|
catch (ArgumentException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"UplayGame/GetAllInstalledGames argumentexception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"UplayGame/GetAllInstalledGames argumentexception: {ex.Message}: {ex.StackTrace} - {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....
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
<UseVSHostingProcess>true</UseVSHostingProcess>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
@ -52,7 +52,7 @@ namespace HeliosPlus.InterProcess
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"IPCClient/QueryAll exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"IPCClient/QueryAll exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ namespace HeliosPlus.InterProcess
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"IPCClient/QueryByStatus exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"IPCClient/QueryByStatus exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace HeliosPlus.InterProcess
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"IPCService/StartService exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"IPCService/StartService exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_serviceHost?.Close();
|
_serviceHost?.Close();
|
||||||
|
@ -138,7 +138,7 @@ namespace HeliosPlus {
|
|||||||
}
|
}
|
||||||
catch (CommandParsingException ex)
|
catch (CommandParsingException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Program/Main commandParsingException: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"Program/Main commandParsingException: {ex.Message}: {ex.StackTrace} - {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>'"
|
||||||
@ -146,7 +146,7 @@ namespace HeliosPlus {
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Program/Main exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"Program/Main exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
Console.WriteLine("Unable to execute application: {0}", ex.Message);
|
Console.WriteLine("Unable to execute application: {0}", ex.Message);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -179,7 +179,7 @@ namespace HeliosPlus {
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Program/StartUpNormally exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"Program/StartUpNormally exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ namespace HeliosPlus {
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Program/StartUpNormally exception 2: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"Program/StartUpNormally exception 2: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ namespace HeliosPlus {
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Program/StartUpNormally exception 3: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"Program/StartUpNormally exception 3: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
MessageBox.Show(
|
MessageBox.Show(
|
||||||
ex.Message,
|
ex.Message,
|
||||||
Language.Fatal_Error,
|
Language.Fatal_Error,
|
||||||
|
@ -339,7 +339,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutItem/ExtractVisataIcon exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutItem/ExtractVisataIcon exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return bmpPngExtracted;
|
return bmpPngExtracted;
|
||||||
|
@ -128,7 +128,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutRepository/RemoveShortcut exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutRepository/RemoveShortcut exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
|
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutRepository/RemoveShortcut exception 2: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutRepository/RemoveShortcut exception 2: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
|
|
||||||
// TODO check and report
|
// TODO check and report
|
||||||
}
|
}
|
||||||
@ -350,7 +350,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutRepository/SaveShortcuts exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutRepository/SaveShortcuts exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
|
|
||||||
Console.WriteLine($"Unable to create Shortcut folder {_shortcutStorageJsonPath}: " + ex.Message);
|
Console.WriteLine($"Unable to create Shortcut folder {_shortcutStorageJsonPath}: " + ex.Message);
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutRepository/SaveShortcuts exception 2: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutRepository/SaveShortcuts exception 2: {ex.Message}: {ex.StackTrace} - {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,7 +434,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutRepository/SaveShortcutIconToCache exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutRepository/SaveShortcutIconToCache exception: {ex.Message}: {ex.StackTrace} - {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.
|
||||||
@ -537,7 +537,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutItem/Run exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutItem/Run exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,7 +550,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutItem/Run exception 2: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutItem/Run exception 2: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -624,7 +624,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Program/SwitchToSteamGame exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"Program/SwitchToSteamGame exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,7 +752,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutRepository/ApplyTopology exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutRepository/ApplyTopology exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ApplyingChangesForm/SplashForm_FormClosing exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ApplyingChangesForm/SplashForm_FormClosing exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}, this), new SafeInvoker(() =>
|
}, this), new SafeInvoker(() =>
|
||||||
@ -216,7 +216,7 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ApplyingChangesForm/SplashForm_Shown exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ApplyingChangesForm/SplashForm_Shown exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}, this), new SafeInvoker(DoTimeout, this));
|
}, this), new SafeInvoker(DoTimeout, this));
|
||||||
|
@ -10768,7 +10768,7 @@
|
|||||||
<value>Microsoft Sans Serif, 21.75pt</value>
|
<value>Microsoft Sans Serif, 21.75pt</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btn_setup_game_shortcuts.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="btn_setup_game_shortcuts.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>212, 182</value>
|
<value>212, 184</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btn_setup_game_shortcuts.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="btn_setup_game_shortcuts.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>360, 50</value>
|
<value>360, 50</value>
|
||||||
@ -10798,7 +10798,7 @@
|
|||||||
<value>Flat</value>
|
<value>Flat</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btn_exit.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="btn_exit.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>697, 354</value>
|
<value>698, 347</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btn_exit.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="btn_exit.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>75, 23</value>
|
<value>75, 23</value>
|
||||||
|
@ -66,7 +66,7 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileAdaptor/GetThumbnail exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileAdaptor/GetThumbnail exception: {ex.Message}: {ex.StackTrace} - {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;
|
||||||
@ -103,7 +103,7 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileAdaptor/GertUniqueIdentifier exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileAdaptor/GertUniqueIdentifier exception: {ex.Message}: {ex.StackTrace} - {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;
|
||||||
@ -127,7 +127,7 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileAdaptor/GetSourceImage exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileAdaptor/GetSourceImage exception: {ex.Message}: {ex.StackTrace} - {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;
|
||||||
@ -158,16 +158,52 @@ namespace HeliosPlus.UIForms
|
|||||||
// Get file info
|
// Get file info
|
||||||
if (profileToUse.ProfileBitmap is Bitmap)
|
if (profileToUse.ProfileBitmap is Bitmap)
|
||||||
{
|
{
|
||||||
|
// Have to do some gymnastics to get rid of the
|
||||||
|
// System.Drawing.Image exception created while accessing the Size
|
||||||
|
bool gotSize = false;
|
||||||
|
Size mySize = new Size(256, 256);
|
||||||
|
while (!gotSize)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mySize = profileToUse.ProfileBitmap.Size;
|
||||||
|
gotSize = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// catch the System.Drawing.Image exception created while accessing the Size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Have to do some gymnastics to get rid of the
|
||||||
|
// System.Drawing.Image exception created while accessing the SizeF
|
||||||
|
bool gotSizeF = false;
|
||||||
|
SizeF mySizeF = new SizeF(256, 256);
|
||||||
|
while (!gotSizeF)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mySizeF = profileToUse.ProfileBitmap.PhysicalDimension;
|
||||||
|
gotSizeF = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// catch the System.Drawing.Image exception created while accessing the Size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string name = profileToUse.Name;
|
||||||
|
string filepath = Path.GetDirectoryName(profileToUse.SavedProfileIconCacheFilename);
|
||||||
|
string filename = Path.GetFileName(profileToUse.SavedProfileIconCacheFilename);
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateCreated, string.Empty, now));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateCreated, string.Empty, now));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateAccessed, string.Empty, now));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateAccessed, string.Empty, now));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateModified, string.Empty, now));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateModified, string.Empty, now));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FileSize, string.Empty, (long)0));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FileSize, string.Empty, (long)0));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FilePath, string.Empty, ""));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FilePath, string.Empty, filepath ?? ""));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FolderName, string.Empty, ""));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FolderName, string.Empty, filepath ?? ""));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Dimensions, string.Empty, new Size(profileToUse.ProfileBitmap.Width, profileToUse.ProfileBitmap.Height)));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Dimensions, string.Empty, mySize));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Resolution, string.Empty, new SizeF((float)profileToUse.ProfileBitmap.Width, (float)profileToUse.ProfileBitmap.Height)));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Resolution, string.Empty, mySizeF));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.ImageDescription, string.Empty, profileToUse.Name));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.ImageDescription, string.Empty, name ?? ""));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.EquipmentModel, string.Empty, ""));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.EquipmentModel, string.Empty, ""));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateTaken, string.Empty, now));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateTaken, string.Empty, now));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Artist, string.Empty, ""));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Artist, string.Empty, ""));
|
||||||
@ -185,7 +221,7 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProfileAdaptor/Utility.Tuple exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ProfileAdaptor/Utility.Tuple exception: {ex.Message}: {ex.StackTrace} - {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;
|
||||||
|
@ -3,9 +3,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace HeliosPlus.UIForms
|
namespace HeliosPlus.UIForms
|
||||||
{
|
{
|
||||||
@ -20,7 +19,7 @@ namespace HeliosPlus.UIForms
|
|||||||
private bool disposed;
|
private bool disposed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FileSystemAdaptor"/> class.
|
/// Initializes a new instance of the <see cref="ShortcutAdaptor"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ShortcutAdaptor()
|
public ShortcutAdaptor()
|
||||||
{
|
{
|
||||||
@ -49,13 +48,14 @@ namespace HeliosPlus.UIForms
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(() => { return false; });
|
Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(() => { return false; });
|
||||||
//return shortcut.ShortcutBitmap.GetThumbnailImage(size.Width, size.Height, myCallback, IntPtr.Zero);
|
//return shortcut.ShortcutBitmap.GetThumbnailImage(size.Width, size.Height, myCallback, IntPtr.Zero);
|
||||||
|
//return Manina.Windows.Forms.Instance.GetThumbnail(shortcut.ShortcutBitmap, size, useEmbeddedThumbnails, useExifOrientation);
|
||||||
return shortcut.ShortcutBitmap;
|
return shortcut.ShortcutBitmap;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutAdapter/GetThumbnail exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutAdapter/GetThumbnail exception: {ex.Message}: {ex.StackTrace} - {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
|
||||||
@ -83,11 +83,24 @@ namespace HeliosPlus.UIForms
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ShortcutItem shortcut = (ShortcutItem) key;
|
ShortcutItem shortcut = (ShortcutItem) key;
|
||||||
return shortcut.Name;
|
//return shortcut.Name;
|
||||||
|
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.Append(shortcut.ToString());// Filename
|
||||||
|
sb.Append(':');
|
||||||
|
sb.Append(size.Width); // Thumbnail size
|
||||||
|
sb.Append(',');
|
||||||
|
sb.Append(size.Height);
|
||||||
|
sb.Append(':');
|
||||||
|
sb.Append(useEmbeddedThumbnails);
|
||||||
|
sb.Append(':');
|
||||||
|
sb.Append(useExifOrientation);
|
||||||
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutAdapter/GetUniqueIdentifier exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutAdapter/GetUniqueIdentifier exception: {ex.Message}: {ex.StackTrace} - {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;
|
||||||
@ -111,7 +124,7 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutAdaptor/GetSourceImage exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutAdaptor/GetSourceImage exception: {ex.Message}: {ex.StackTrace} - {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
|
||||||
@ -138,16 +151,53 @@ namespace HeliosPlus.UIForms
|
|||||||
// Get file info
|
// Get file info
|
||||||
if (shortcut.ShortcutBitmap is Bitmap)
|
if (shortcut.ShortcutBitmap is Bitmap)
|
||||||
{
|
{
|
||||||
|
// Have to do some gymnastics to get rid of the
|
||||||
|
// System.Drawing.Image exception created while accessing the Size
|
||||||
|
bool gotSize = false;
|
||||||
|
Size mySize = new Size(256,256);
|
||||||
|
while (!gotSize)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mySize = shortcut.ShortcutBitmap.Size;
|
||||||
|
gotSize = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// catch the System.Drawing.Image exception created while accessing the Size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Have to do some gymnastics to get rid of the
|
||||||
|
// System.Drawing.Image exception created while accessing the SizeF
|
||||||
|
bool gotSizeF = false;
|
||||||
|
SizeF mySizeF = new SizeF(256, 256);
|
||||||
|
while (!gotSizeF)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mySizeF = shortcut.ShortcutBitmap.PhysicalDimension;
|
||||||
|
gotSizeF = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// catch the System.Drawing.Image exception created while accessing the Size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string name = shortcut.Name;
|
||||||
|
string filepath = Path.GetDirectoryName(shortcut.SavedShortcutIconCacheFilename);
|
||||||
|
string filename = Path.GetFileName(shortcut.SavedShortcutIconCacheFilename);
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateCreated, string.Empty, now));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateCreated, string.Empty, now));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateAccessed, string.Empty, now));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateAccessed, string.Empty, now));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateModified, string.Empty, now));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateModified, string.Empty, now));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FileSize, string.Empty, (long)0));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FileSize, string.Empty, (long)0));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FilePath, string.Empty, shortcut.SavedShortcutIconCacheFilename));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FilePath, string.Empty, filepath ?? ""));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FolderName, string.Empty, ""));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FolderName, string.Empty, filepath ?? ""));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Dimensions, string.Empty, new Size(shortcut.ShortcutBitmap.Width, shortcut.ShortcutBitmap.Height)));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Dimensions, string.Empty, mySize));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Resolution, string.Empty, new SizeF((float)shortcut.ShortcutBitmap.Width, (float)shortcut.ShortcutBitmap.Height)));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Resolution, string.Empty, mySizeF));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.ImageDescription, string.Empty, shortcut.Name));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.ImageDescription, string.Empty, name ?? ""));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.EquipmentModel, string.Empty, ""));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.EquipmentModel, string.Empty, ""));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateTaken, string.Empty, now));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateTaken, string.Empty, now));
|
||||||
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Artist, string.Empty, ""));
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Artist, string.Empty, ""));
|
||||||
@ -165,7 +215,7 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutAdapter/Utility.Tuple exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutAdapter/Utility.Tuple exception: {ex.Message}: {ex.StackTrace} - {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;
|
||||||
|
@ -672,7 +672,7 @@ namespace HeliosPlus.UIForms
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ShortcutForm exception: {ex.Message}: {ex.InnerException}");
|
Console.WriteLine($"ShortcutForm exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
il_games.Images.Add(Image.FromFile("Resources/Steam.ico"));
|
il_games.Images.Add(Image.FromFile("Resources/Steam.ico"));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -30,17 +30,10 @@ namespace HeliosPlus.UIForms
|
|||||||
//_shortcutAdaptor = new ShortcutAdaptor();
|
//_shortcutAdaptor = new ShortcutAdaptor();
|
||||||
//_shortcutRepository = new ShortcutRepository();
|
//_shortcutRepository = new ShortcutRepository();
|
||||||
//_profileRepository = new ProfileRepository();
|
//_profileRepository = new ProfileRepository();
|
||||||
}
|
ilv_saved_shortcuts.MultiSelect = false;
|
||||||
|
ilv_saved_shortcuts.ThumbnailSize = new Size(100,100);
|
||||||
private void btn_new_Click(object sender, EventArgs e)
|
ilv_saved_shortcuts.AllowDrag = false;
|
||||||
{
|
ilv_saved_shortcuts.AllowDrop = false;
|
||||||
var shortcutForm = new ShortcutForm();
|
|
||||||
shortcutForm.ShowDialog(this);
|
|
||||||
if (shortcutForm.DialogResult == DialogResult.OK)
|
|
||||||
{
|
|
||||||
ShortcutRepository.AddShortcut(shortcutForm.Shortcut);
|
|
||||||
RefreshShortcutLibraryUI();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btn_back_Click(object sender, EventArgs e)
|
private void btn_back_Click(object sender, EventArgs e)
|
||||||
@ -57,48 +50,35 @@ namespace HeliosPlus.UIForms
|
|||||||
private void RefreshShortcutLibraryUI()
|
private void RefreshShortcutLibraryUI()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ShortcutRepository.ShortcutCount > 0)
|
if (ShortcutRepository.ShortcutCount == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Temporarily stop updating the saved_profiles listview
|
||||||
|
ilv_saved_shortcuts.SuspendLayout();
|
||||||
|
|
||||||
|
ImageListViewItem newItem = null;
|
||||||
|
ilv_saved_shortcuts.Items.Clear();
|
||||||
|
foreach (ShortcutItem loadedShortcut in ShortcutRepository.AllShortcuts)
|
||||||
{
|
{
|
||||||
// Temporarily stop updating the saved_profiles listview
|
//loadedProfile.SaveProfileImageToCache();
|
||||||
ilv_saved_shortcuts.SuspendLayout();
|
//newItem = new ImageListViewItem(loadedProfile.SavedProfileCacheFilename, loadedProfile.Name);
|
||||||
|
//newItem = new ImageListViewItem(loadedProfile, loadedProfile.Name);
|
||||||
|
newItem = new ImageListViewItem(loadedShortcut, loadedShortcut.Name);
|
||||||
|
|
||||||
ImageListViewItem newItem = null;
|
// Select it if its the selectedProfile
|
||||||
ilv_saved_shortcuts.Items.Clear();
|
if (_selectedShortcut is ShortcutItem && _selectedShortcut.Equals(loadedShortcut))
|
||||||
foreach (ShortcutItem loadedShortcut in ShortcutRepository.AllShortcuts)
|
newItem.Selected = true;
|
||||||
{
|
|
||||||
//loadedProfile.SaveProfileImageToCache();
|
|
||||||
//newItem = new ImageListViewItem(loadedProfile.SavedProfileCacheFilename, loadedProfile.Name);
|
|
||||||
//newItem = new ImageListViewItem(loadedProfile, loadedProfile.Name);
|
|
||||||
newItem = new ImageListViewItem(loadedShortcut, loadedShortcut.Name);
|
|
||||||
//ilv_saved_profiles.Items.Add(newItem);
|
|
||||||
ilv_saved_shortcuts.Items.Add(newItem, _shortcutAdaptor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_selectedShortcut != null && _selectedShortcut is ShortcutItem)
|
|
||||||
RefreshImageListView(_selectedShortcut);
|
|
||||||
|
|
||||||
// Restart updating the saved_profiles listview
|
|
||||||
ilv_saved_shortcuts.ResumeLayout();
|
|
||||||
|
|
||||||
|
//ilv_saved_profiles.Items.Add(newItem);
|
||||||
|
ilv_saved_shortcuts.Items.Add(newItem, _shortcutAdaptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh the image list view
|
|
||||||
//RefreshImageListView(_selectedShortcut);
|
// Restart updating the saved_profiles listview
|
||||||
|
ilv_saved_shortcuts.ResumeLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshImageListView(ShortcutItem shortcut)
|
|
||||||
{
|
|
||||||
ilv_saved_shortcuts.ClearSelection();
|
|
||||||
IEnumerable<ImageListViewItem> matchingImageListViewItems = (from item in ilv_saved_shortcuts.Items where item.Text == shortcut.Name select item);
|
|
||||||
if (matchingImageListViewItems.Any())
|
|
||||||
{
|
|
||||||
matchingImageListViewItems.First().Selected = true;
|
|
||||||
matchingImageListViewItems.First().Focused = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ShortcutItem GetShortcutFromName(string shortcutName)
|
private ShortcutItem GetShortcutFromName(string shortcutName)
|
||||||
{
|
{
|
||||||
return (from item in ShortcutRepository.AllShortcuts where item.Name == shortcutName select item).First();
|
return (from item in ShortcutRepository.AllShortcuts where item.Name == shortcutName select item).First();
|
||||||
@ -186,6 +166,18 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btn_new_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var shortcutForm = new ShortcutForm();
|
||||||
|
shortcutForm.ShowDialog(this);
|
||||||
|
if (shortcutForm.DialogResult == DialogResult.OK)
|
||||||
|
{
|
||||||
|
ShortcutRepository.AddShortcut(shortcutForm.Shortcut);
|
||||||
|
_selectedShortcut = shortcutForm.Shortcut;
|
||||||
|
RefreshShortcutLibraryUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void btn_edit_Click(object sender, EventArgs e)
|
private void btn_edit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_selectedShortcut == null)
|
if (_selectedShortcut == null)
|
||||||
|
Reference in New Issue
Block a user