diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index a0dd88e..169a7ff 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -382,7 +382,7 @@ Public Class frmGameManager If sNewPath <> String.Empty Then txtIcon.Text = sNewPath If IO.File.Exists(sNewPath) Then - pbIcon.Image = Image.FromFile(sNewPath) + pbIcon.Image = mgrCommon.SafeIconFromFile(sNewPath) End If End If End Sub @@ -794,7 +794,7 @@ Public Class frmGameManager For Each oBackup In oBackupData 'Delete the specific remote manifest entry - mgrManifest.DoManifestDeletebyManifestID(oBackup, mgrSQLite.Database.Remote) + mgrManifest.DoManifestDeleteByManifestID(oBackup, mgrSQLite.Database.Remote) 'Delete referenced backup file from the backup folder mgrCommon.DeleteFile(BackupFolder & oBackup.FileName) 'Check for sub-directory and delete if empty (we need to do this every pass just in case the user had a mix of settings at one point) @@ -802,7 +802,7 @@ Public Class frmGameManager Next 'Delete local manifest entry - mgrManifest.DoManifestDeletebyMonitorID(CurrentBackupItem, mgrSQLite.Database.Local) + mgrManifest.DoManifestDeleteByMonitorID(CurrentBackupItem, mgrSQLite.Database.Local) LoadBackupData() FillData() @@ -868,7 +868,7 @@ Public Class frmGameManager 'Icon If IO.File.Exists(oApp.Icon) Then - pbIcon.Image = Image.FromFile(oApp.Icon) + pbIcon.Image = mgrCommon.SafeIconFromFile(oApp.Icon) Else pbIcon.Image = Icon_Unknown End If diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index c46bc82..9077ca5 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -526,7 +526,7 @@ Public Class frmMain sIcon = fbBrowser.FileName If File.Exists(sIcon) Then oProcess.GameInfo.Icon = sIcon - pbIcon.Image = Image.FromFile(sIcon) + pbIcon.Image = mgrCommon.SafeIconFromFile(sIcon) mgrMonitorList.DoListUpdate(oProcess.GameInfo) End If End If @@ -645,7 +645,7 @@ Public Class frmMain 'Check for a custom icon & details If File.Exists(oProcess.GameInfo.Icon) Then - pbIcon.Image = Image.FromFile(oProcess.GameInfo.Icon) + pbIcon.Image = mgrCommon.SafeIconFromFile(oProcess.GameInfo.Icon) End If If sFileName = String.Empty Then If oProcess.GameInfo.ProcessPath <> String.Empty Then diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index 2f3ca54..07379bc 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -65,6 +65,18 @@ Public Class mgrCommon Return oFormatter.Deserialize(oStream) End Function + Public Shared Function SafeIconFromFile(ByVal sPath As String) As Image + Dim oImage As Image + Dim oReturnImage As Image + Dim oImageSize As Size = New Size(48, 48) + + oImage = Image.FromFile(sPath) + oReturnImage = New Bitmap(oImage, oImageSize) + oImage.Dispose() + + Return oReturnImage + End Function + Public Shared Function IsAddress(ByVal sURL As String) As Boolean If (sURL.IndexOf("http://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Or (sURL.IndexOf("https://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Then Return True