Fixes and changes for issue #142
This commit is contained in:
+27
-12
@@ -577,12 +577,34 @@ Public Class frmMain
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub SetGameIcon()
|
||||||
|
Dim ic As Icon
|
||||||
|
Dim sIconFile As String
|
||||||
|
Dim oBitmap As Bitmap
|
||||||
|
|
||||||
|
Try
|
||||||
|
'Grab icon from the executable
|
||||||
|
ic = System.Drawing.Icon.ExtractAssociatedIcon(oProcess.FoundProcess.MainModule.FileName)
|
||||||
|
|
||||||
|
'Save a copy
|
||||||
|
sIconFile = mgrPath.SettingsRoot & Path.DirectorySeparatorChar & oProcess.GameInfo.ID & ".ico"
|
||||||
|
ic.ToBitmap.Save(sIconFile, System.Drawing.Imaging.ImageFormat.Icon)
|
||||||
|
ic.Dispose()
|
||||||
|
|
||||||
|
'Set the icon, we need to use an intermediary object to prevent file locking
|
||||||
|
oBitmap = New Bitmap(sIconFile)
|
||||||
|
pbIcon.Image = New Bitmap(oBitmap)
|
||||||
|
oBitmap.Dispose()
|
||||||
|
Catch ex As Exception
|
||||||
|
UpdateLog(mgrCommon.FormatString(frmMain_ErrorGameIcon), False, ToolTipIcon.Error)
|
||||||
|
UpdateLog(mgrCommon.FormatString(App_GenericError, ex.Message), False,, False)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub SetGameInfo(Optional ByVal bMulti As Boolean = False)
|
Private Sub SetGameInfo(Optional ByVal bMulti As Boolean = False)
|
||||||
Dim sFileName As String = String.Empty
|
Dim sFileName As String = String.Empty
|
||||||
Dim sFileVersion As String = String.Empty
|
Dim sFileVersion As String = String.Empty
|
||||||
Dim sCompanyName As String = String.Empty
|
Dim sCompanyName As String = String.Empty
|
||||||
Dim ic As Icon
|
|
||||||
Dim sIconFile As String
|
|
||||||
|
|
||||||
'Wipe Game Info
|
'Wipe Game Info
|
||||||
lblStatus1.Text = String.Empty
|
lblStatus1.Text = String.Empty
|
||||||
@@ -590,17 +612,10 @@ Public Class frmMain
|
|||||||
lblStatus3.Text = String.Empty
|
lblStatus3.Text = String.Empty
|
||||||
pbIcon.Image = Icon_Unknown
|
pbIcon.Image = Icon_Unknown
|
||||||
|
|
||||||
'Get Process Information
|
'Set Game Icon
|
||||||
Try
|
If Not mgrCommon.IsUnix Then SetGameIcon()
|
||||||
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
|
|
||||||
|
|
||||||
|
Try
|
||||||
'Set Game Details
|
'Set Game Details
|
||||||
sFileName = oProcess.FoundProcess.MainModule.FileName
|
sFileName = oProcess.FoundProcess.MainModule.FileName
|
||||||
sFileVersion = oProcess.FoundProcess.MainModule.FileVersionInfo.FileVersion
|
sFileVersion = oProcess.FoundProcess.MainModule.FileVersionInfo.FileVersion
|
||||||
|
|||||||
Generated
+9
@@ -3084,6 +3084,15 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to An error occured while extracting the executable icon..
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmMain_ErrorGameIcon() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmMain_ErrorGameIcon", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' 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).
|
''' 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).
|
||||||
'''</summary>
|
'''</summary>
|
||||||
|
|||||||
@@ -2194,4 +2194,7 @@
|
|||||||
<data name="frmMain_ErrorGameDetails" xml:space="preserve">
|
<data name="frmMain_ErrorGameDetails" xml:space="preserve">
|
||||||
<value>An error occured while obtaining the details of the detected game.</value>
|
<value>An error occured while obtaining the details of the detected game.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="frmMain_ErrorGameIcon" xml:space="preserve">
|
||||||
|
<value>An error occured while extracting the executable icon.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user