Prevent file locking of custom icons
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user