From 9e7a4b5efc4c2a4bcd93144a1226aef61523bb33 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Sun, 29 Jul 2018 09:06:33 -0600 Subject: [PATCH] Tweaks to icon extraction and error handling --- GBM/Forms/frmMain.vb | 20 ++++++++++++-------- GBM/My Project/Resources.Designer.vb | 18 +++++++++--------- GBM/My Project/Resources.resx | 6 +++--- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index db0678b..698ab25 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -588,22 +588,26 @@ Public Class frmMain lblStatus1.Text = String.Empty lblStatus2.Text = String.Empty lblStatus3.Text = String.Empty + pbIcon.Image = Icon_Unknown - 'Get Process Information + 'Get Process Information Try - 'Grab icon from the executable and save a copy - ic = System.Drawing.Icon.ExtractAssociatedIcon(oProcess.FoundProcess.MainModule.FileName) - sIconFile = mgrPath.SettingsRoot & Path.DirectorySeparatorChar & oProcess.GameInfo.ID & ".bmp" - ic.ToBitmap.Save(sIconFile) - ic.Dispose() + If Not mgrCommon.IsUnix Then + 'Grab icon from the executable and save a copy + ic = System.Drawing.Icon.ExtractAssociatedIcon(oProcess.FoundProcess.MainModule.FileName) + sIconFile = mgrPath.SettingsRoot & Path.DirectorySeparatorChar & oProcess.GameInfo.ID & ".bmp" + ic.ToBitmap.Save(sIconFile) + ic.Dispose() + pbIcon.Image = Image.FromFile(sIconFile) + End If 'Set Game Details - pbIcon.Image = Image.FromFile(sIconFile) sFileName = oProcess.FoundProcess.MainModule.FileName sFileVersion = oProcess.FoundProcess.MainModule.FileVersionInfo.FileVersion sCompanyName = oProcess.FoundProcess.MainModule.FileVersionInfo.CompanyName Catch ex As Exception - pbIcon.Image = Icon_Unknown + UpdateLog(mgrCommon.FormatString(frmMain_ErrorGameDetails), False, ToolTipIcon.Error) + UpdateLog(mgrCommon.FormatString(App_GenericError, ex.Message), False,, False) End Try 'Get Game Details diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 842f959..ee75408 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -2877,15 +2877,6 @@ Namespace My.Resources End Get End Property - ''' - ''' Looks up a localized string similar to This tool removes orphaned backup information from the local manifest based on the current backup folder. Data can become orphaned when backups are deleted by various computers that share the same backup folder on a cloud or network.[BR][BR]When alternating between different backup folders you should NOT use this tool.[BR][BR]Do you wish to proceed?. - ''' - Friend ReadOnly Property frmMain_ConfirmManifestClean() As String - Get - Return ResourceManager.GetString("frmMain_ConfirmManifestClean", resourceCulture) - End Get - End Property - ''' ''' Looks up a localized string similar to Do you wish to cancel the monitoring of [PARAM]?[BR][BR]Warning: When monitoring is cancelled, session time is NOT saved.. ''' @@ -3084,6 +3075,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to An error occured while obtaining the details of the detected game.. + ''' + Friend ReadOnly Property frmMain_ErrorGameDetails() As String + Get + Return ResourceManager.GetString("frmMain_ErrorGameDetails", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to An unexpected error occured while initializing GBM.[BR][BR][PARAM][BR][BR]Do you wish to continue anyway? (Not Recommended). ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 02af0c3..1fc6ea9 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -133,9 +133,6 @@ [PARAM] entries were removed from the local manifest. - - This tool removes orphaned backup information from the local manifest based on the current backup folder. Data can become orphaned when backups are deleted by various computers that share the same backup folder on a cloud or network.[BR][BR]When alternating between different backup folders you should NOT use this tool.[BR][BR]Do you wish to proceed? - This will rebuild all databases and shrink them to an optimal size.[BR]This should only be used if your gbm.s3db files are becoming very large.[BR][BR]Do you wish to continue? @@ -2194,4 +2191,7 @@ An error occured while determining a required system path. [BR][BR]The environment value for [PARAM] is empty.[BR][BR]The application will now exit. + + An error occured while obtaining the details of the detected game. + \ No newline at end of file