Changes for Issues #46 and #47

This commit is contained in:
Michael J. Seiferling
2016-05-26 14:13:14 -06:00
parent 7f19ae6345
commit cb9bab9892
10 changed files with 207 additions and 66 deletions
+31 -25
View File
@@ -24,6 +24,8 @@ Public Class frmMain
Private bCancelledByUser As Boolean = False
Private bShutdown As Boolean = False
Private bInitFail As Boolean = False
Private bPathDetectionFailure As Boolean = False
Private sPathDetectionError As String = String.Empty
Private bMenuEnabled As Boolean = True
Private bLockdown As Boolean = True
Private bFirstRun As Boolean = False
@@ -1520,7 +1522,6 @@ Public Class frmMain
Private Sub ScanTimerEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmScanTimer.Tick
Dim bNeedsPath As Boolean = False
Dim bContinue As Boolean = True
Dim bAskForRestart As Boolean = False
Dim iErrorCode As Integer = 0
Dim sErrorMessage As String = String.Empty
@@ -1532,42 +1533,27 @@ Public Class frmMain
If iErrorCode = 5 Then
If oProcess.Duplicate Then
sErrorMessage = mgrCommon.FormatString(frmMain_ErrorMultiAdmin)
mgrCommon.ShowMessage(sErrorMessage, MsgBoxStyle.Exclamation)
bAskForRestart = True
UpdateLog(sErrorMessage, True, ToolTipIcon.Warning, True)
Else
If Not CheckForSavedPath() Then
sErrorMessage = mgrCommon.FormatString(frmMain_ErrorAdminBackup, oProcess.GameInfo.Name)
oProcess.GameInfo.ProcessPath = mgrPath.ProcessPathSearch(oProcess.GameInfo.Name, oProcess.GameInfo.ProcessName, sErrorMessage)
If oProcess.GameInfo.ProcessPath <> String.Empty Then
'Update and reload
mgrMonitorList.DoListUpdate(oProcess.GameInfo)
LoadGameSettings()
bContinue = True
bPathDetectionFailure = True
sPathDetectionError = mgrCommon.FormatString(frmMain_ErrorAdminBackup, oProcess.GameInfo.Name)
End If
Else
bContinue = True
End If
End If
ElseIf iErrorCode = 299 Then
If oProcess.Duplicate Then
sErrorMessage = mgrCommon.FormatString(frmMain_ErrorMulti64)
mgrCommon.ShowMessage(sErrorMessage, MsgBoxStyle.Exclamation)
UpdateLog(sErrorMessage, True, ToolTipIcon.Warning, True)
Else
If Not CheckForSavedPath() Then
sErrorMessage = mgrCommon.FormatString(frmMain_Error64Backup, oProcess.GameInfo.Name)
oProcess.GameInfo.ProcessPath = mgrPath.ProcessPathSearch(oProcess.GameInfo.Name, oProcess.GameInfo.ProcessName, sErrorMessage)
If oProcess.GameInfo.ProcessPath <> String.Empty Then
'Update and reload
mgrMonitorList.DoListUpdate(oProcess.GameInfo)
LoadGameSettings()
bContinue = True
bPathDetectionFailure = True
sPathDetectionError = mgrCommon.FormatString(frmMain_Error64Backup, oProcess.GameInfo.Name)
End If
Else
bContinue = True
End If
End If
End If
End If
If bContinue = True Then
CheckForSavedDuplicate()
@@ -1584,9 +1570,6 @@ Public Class frmMain
bwMonitor.RunWorkerAsync()
Else
StopScan()
If bAskForRestart Then
RestartAsAdmin()
End If
End If
End If
End Sub
@@ -1607,9 +1590,28 @@ Public Class frmMain
End Sub
Private Sub bwMain_RunWorkerCompleted(sender As System.Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwMonitor.RunWorkerCompleted
Dim bContinue As Boolean = True
oProcess.EndTime = Now
If Not bCancelledByUser Then
'Check if we failed to detect the game path
If bPathDetectionFailure Then
oProcess.GameInfo.ProcessPath = mgrPath.ProcessPathSearch(oProcess.GameInfo.Name, oProcess.GameInfo.ProcessName, sPathDetectionError)
If oProcess.GameInfo.ProcessPath <> String.Empty Then
'Update and reload
mgrMonitorList.DoListUpdate(oProcess.GameInfo)
LoadGameSettings()
Else
bContinue = False
If oSettings.TimeTracking Then HandleTimeSpent()
UpdateLog(mgrCommon.FormatString(frmMain_ErrorBackupUnknownPath, oProcess.GameInfo.Name), False)
oProcess.GameInfo = Nothing
ResetGameInfo()
ResumeScan()
End If
End If
If bContinue Then
If DoMultiGameCheck() Then
UpdateLog(mgrCommon.FormatString(frmMain_GameEnded, oProcess.GameInfo.Name), False)
If oSettings.TimeTracking Then HandleTimeSpent()
@@ -1621,7 +1623,11 @@ Public Class frmMain
ResumeScan()
End If
End If
End If
'Reset globals
bPathDetectionFailure = False
sPathDetectionError = String.Empty
bCancelledByUser = False
oProcess.StartTime = Now : oProcess.EndTime = Now
End Sub
+29 -10
View File
@@ -22,6 +22,7 @@ Partial Class frmSettings
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.chkMonitorOnStartup = New System.Windows.Forms.CheckBox()
Me.chkBackupConfirm = New System.Windows.Forms.CheckBox()
Me.grpGeneral = New System.Windows.Forms.GroupBox()
@@ -45,21 +46,24 @@ Partial Class frmSettings
Me.chkOverwriteWarning = New System.Windows.Forms.CheckBox()
Me.chkCreateFolder = New System.Windows.Forms.CheckBox()
Me.grp7z = New System.Windows.Forms.GroupBox()
Me.pbUtilityStatus = New System.Windows.Forms.PictureBox()
Me.btn7zLocation = New System.Windows.Forms.Button()
Me.txt7zLocation = New System.Windows.Forms.TextBox()
Me.lblLocation = New System.Windows.Forms.Label()
Me.txt7zArguments = New System.Windows.Forms.TextBox()
Me.lblArguments = New System.Windows.Forms.Label()
Me.lbl7zCopyright = New System.Windows.Forms.Label()
Me.cboCompression = New System.Windows.Forms.ComboBox()
Me.lblCompression = New System.Windows.Forms.Label()
Me.lbl7zCopyright = New System.Windows.Forms.Label()
Me.lbl7zProduct = New System.Windows.Forms.Label()
Me.btnDefaults = New System.Windows.Forms.Button()
Me.ttUtilityStatus = New System.Windows.Forms.ToolTip(Me.components)
Me.grpGeneral.SuspendLayout()
Me.grpPaths.SuspendLayout()
Me.grpBackup.SuspendLayout()
CType(Me.nudSupressBackupThreshold, System.ComponentModel.ISupportInitialize).BeginInit()
Me.grp7z.SuspendLayout()
CType(Me.pbUtilityStatus, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'chkMonitorOnStartup
@@ -290,6 +294,7 @@ Partial Class frmSettings
'
'grp7z
'
Me.grp7z.Controls.Add(Me.pbUtilityStatus)
Me.grp7z.Controls.Add(Me.btn7zLocation)
Me.grp7z.Controls.Add(Me.txt7zLocation)
Me.grp7z.Controls.Add(Me.lblLocation)
@@ -306,6 +311,15 @@ Partial Class frmSettings
Me.grp7z.TabStop = False
Me.grp7z.Text = "7z Options"
'
'pbUtilityStatus
'
Me.pbUtilityStatus.Location = New System.Drawing.Point(319, 93)
Me.pbUtilityStatus.Name = "pbUtilityStatus"
Me.pbUtilityStatus.Size = New System.Drawing.Size(35, 35)
Me.pbUtilityStatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.pbUtilityStatus.TabIndex = 7
Me.pbUtilityStatus.TabStop = False
'
'btn7zLocation
'
Me.btn7zLocation.Location = New System.Drawing.Point(327, 70)
@@ -347,6 +361,15 @@ Partial Class frmSettings
Me.lblArguments.TabIndex = 2
Me.lblArguments.Text = "Custom Arguments:"
'
'lbl7zCopyright
'
Me.lbl7zCopyright.AutoEllipsis = True
Me.lbl7zCopyright.Location = New System.Drawing.Point(9, 110)
Me.lbl7zCopyright.Name = "lbl7zCopyright"
Me.lbl7zCopyright.Size = New System.Drawing.Size(301, 17)
Me.lbl7zCopyright.TabIndex = 8
Me.lbl7zCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'cboCompression
'
Me.cboCompression.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
@@ -365,19 +388,12 @@ Partial Class frmSettings
Me.lblCompression.TabIndex = 0
Me.lblCompression.Text = "Compression:"
'
'lbl7zCopyright
'
Me.lbl7zCopyright.Location = New System.Drawing.Point(6, 110)
Me.lbl7zCopyright.Name = "lbl7zCopyright"
Me.lbl7zCopyright.Size = New System.Drawing.Size(348, 17)
Me.lbl7zCopyright.TabIndex = 8
Me.lbl7zCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'lbl7zProduct
'
Me.lbl7zProduct.AutoEllipsis = True
Me.lbl7zProduct.Location = New System.Drawing.Point(6, 93)
Me.lbl7zProduct.Name = "lbl7zProduct"
Me.lbl7zProduct.Size = New System.Drawing.Size(348, 17)
Me.lbl7zProduct.Size = New System.Drawing.Size(304, 17)
Me.lbl7zProduct.TabIndex = 7
Me.lbl7zProduct.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
@@ -419,6 +435,7 @@ Partial Class frmSettings
CType(Me.nudSupressBackupThreshold, System.ComponentModel.ISupportInitialize).EndInit()
Me.grp7z.ResumeLayout(False)
Me.grp7z.PerformLayout()
CType(Me.pbUtilityStatus, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
@@ -455,4 +472,6 @@ Partial Class frmSettings
Friend WithEvents txt7zArguments As TextBox
Friend WithEvents lblArguments As Label
Friend WithEvents btnDefaults As Button
Friend WithEvents pbUtilityStatus As PictureBox
Friend WithEvents ttUtilityStatus As ToolTip
End Class
+3
View File
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ttUtilityStatus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>32</value>
</metadata>
+23 -1
View File
@@ -116,19 +116,41 @@ Public Class frmSettings
End Function
Private Sub Get7zInfo(ByVal sLocation As String)
Dim bDefault As Boolean = False
Try
'Use default when no custom location is set
If sLocation = String.Empty Then
sLocation = mgrPath.Default7zLocation
bDefault = True
End If
'Get info
Dim oFileInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(sLocation)
lbl7zProduct.Text = oFileInfo.FileDescription & " " & oFileInfo.ProductVersion
lbl7zCopyright.Text = oFileInfo.LegalCopyright
'Set Status
If bDefault Then
If oSettings.Is7zUtilityValid Then
pbUtilityStatus.Image = Utility_Valid
ttUtilityStatus.ToolTipTitle = frmSettings_ttUtilityStatus_Title
ttUtilityStatus.SetToolTip(pbUtilityStatus, frmSettings_ttUtilityStatus_Valid7z)
Else
pbUtilityStatus.Image = Utility_Invalid
ttUtilityStatus.ToolTipTitle = frmSettings_ttUtilityStatus_Title
ttUtilityStatus.SetToolTip(pbUtilityStatus, frmSettings_ttUtilityStatus_Invalid7z)
End If
Else
pbUtilityStatus.Image = Utility_Custom
ttUtilityStatus.ToolTipTitle = frmSettings_ttUtilityStatus_Title
ttUtilityStatus.SetToolTip(pbUtilityStatus, frmSettings_ttUtilityStatus_Custom7z)
End If
Catch ex As Exception
lbl7zProduct.Text = mgrCommon.FormatString(frmSettings_Error7zInfo)
lbl7zProduct.Text = String.Empty
lbl7zCopyright.Text = String.Empty
pbUtilityStatus.Image = Utility_Invalid
ttUtilityStatus.ToolTipTitle = frmSettings_ttUtilityStatus_Title
ttUtilityStatus.SetToolTip(pbUtilityStatus, frmSettings_ttUtilityStatus_Failure7z)
End Try
End Sub
+4
View File
@@ -283,6 +283,7 @@
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
@@ -328,6 +329,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="References\Mono.Data.Sqlite.dll" />
<Content Include="Resources\custom_7z.png" />
<Content Include="Resources\valid_7z.png" />
<Content Include="Resources\warning_7z.png" />
<Content Include="Utilities\x64\7za.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+79 -13
View File
@@ -88,7 +88,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to 7-Zip (7za.exe) failed to be validated and has been prevented from running. The application may be corrupted or has been modified by another application. Verify your PC&apos;s security and re-install GBM to solve this problem..
''' Looks up a localized string similar to 7-Zip (7za.exe) is invalid and has been prevented from running..
'''</summary>
Friend ReadOnly Property App_Invalid7zDetected() As String
Get
@@ -2338,7 +2338,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to [PARAM] is running as Administrator and GBM is not, GBM cannot detect the required information to save your backup..
''' Looks up a localized string similar to [PARAM] was running as Administrator and GBM is not, GBM cannot detect the required information to save your backup..
'''</summary>
Friend ReadOnly Property frmMain_ErrorAdminBackup() As String
Get
@@ -2464,7 +2464,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to Multiple possible 64-bit games have been detected, GBM cannot detect the path to identify your game or save your backup.[BR][BR]Please install the 64-bit version of GBM to detect and backup this game properly..
''' Looks up a localized string similar to Install the 64-bit version of GBM to detect the last running game..
'''</summary>
Friend ReadOnly Property frmMain_ErrorMulti64() As String
Get
@@ -2473,7 +2473,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to Multiple possible games have been detected running as Administrator and GBM is not, GBM cannot detect the path to identify your game or save your backup.[BR][BR]Please run GBM as Administrator to properly detect and backup this game..
''' Looks up a localized string similar to Restart GBM as Administrator to detect the last running game..
'''</summary>
Friend ReadOnly Property frmMain_ErrorMultiAdmin() As String
Get
@@ -3309,15 +3309,6 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Unable to retrieve 7-Zip information!.
'''</summary>
Friend ReadOnly Property frmSettings_Error7zInfo() As String
Get
Return ResourceManager.GetString("frmSettings_Error7zInfo", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to The backup folder does not exist. Please choose a valid backup folder..
'''</summary>
@@ -3426,6 +3417,51 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to GBM is using a custom 7-Zip utility, it cannot be verified..
'''</summary>
Friend ReadOnly Property frmSettings_ttUtilityStatus_Custom7z() As String
Get
Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Custom7z", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to GBM could not verify the custom 7-Zip utility..
'''</summary>
Friend ReadOnly Property frmSettings_ttUtilityStatus_Failure7z() As String
Get
Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Failure7z", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to GBM&apos;s default 7-Zip utility has failed verification, it cannot be used..
'''</summary>
Friend ReadOnly Property frmSettings_ttUtilityStatus_Invalid7z() As String
Get
Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Invalid7z", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to 7-Zip Status.
'''</summary>
Friend ReadOnly Property frmSettings_ttUtilityStatus_Title() As String
Get
Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Title", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to GBM is using the default 7-Zip utility, it has been verified..
'''</summary>
Friend ReadOnly Property frmSettings_ttUtilityStatus_Valid7z() As String
Get
Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Valid7z", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Invalid or poorly formatted 7-Zip arguments can cause backup or restore operations to fail.[BR][BR]If problems occur, clear the arguments and refer to the GBM manual..
'''</summary>
@@ -4617,5 +4653,35 @@ Namespace My.Resources
Return ResourceManager.GetString("mgrXML_ErrorImportFailure", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
Friend ReadOnly Property Utility_Custom() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("Utility_Custom", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
Friend ReadOnly Property Utility_Invalid() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("Utility_Invalid", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
Friend ReadOnly Property Utility_Valid() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("Utility_Valid", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
End Module
End Namespace
+27 -6
View File
@@ -197,7 +197,7 @@
<value>7-Zip was not found. The application cannot continue.</value>
</data>
<data name="frmMain_ErrorAdminBackup" xml:space="preserve">
<value>[PARAM] is running as Administrator and GBM is not, GBM cannot detect the required information to save your backup.</value>
<value>[PARAM] was running as Administrator and GBM is not, GBM cannot detect the required information to save your backup.</value>
</data>
<data name="frmMain_ErrorAdminDetect" xml:space="preserve">
<value>[PARAM] is running as Administrator and GBM is not.[BR]You cannot cancel monitoring at this time.[BR][BR]Run GBM as Administrator to prevent this issue.</value>
@@ -227,10 +227,10 @@
<value>The GBM data (Version [PARAM]) in your backup folder is too new for your version of GBM (Version [PARAM])[BR][BR]All computers sharing a backup folder must use the same version of GBM. The application cannot proceed.</value>
</data>
<data name="frmMain_ErrorMulti64" xml:space="preserve">
<value>Multiple possible 64-bit games have been detected, GBM cannot detect the path to identify your game or save your backup.[BR][BR]Please install the 64-bit version of GBM to detect and backup this game properly.</value>
<value>Install the 64-bit version of GBM to detect the last running game.</value>
</data>
<data name="frmMain_ErrorMultiAdmin" xml:space="preserve">
<value>Multiple possible games have been detected running as Administrator and GBM is not, GBM cannot detect the path to identify your game or save your backup.[BR][BR]Please run GBM as Administrator to properly detect and backup this game.</value>
<value>Restart GBM as Administrator to detect the last running game.</value>
</data>
<data name="frmMain_ErrorRelativePath" xml:space="preserve">
<value>[PARAM] uses a relative path and has never been detected on this computer.</value>
@@ -1600,9 +1600,6 @@
<data name="frmSettings_btnDefaults" xml:space="preserve">
<value>Set &amp;Defaults</value>
</data>
<data name="frmSettings_Error7zInfo" xml:space="preserve">
<value>Unable to retrieve 7-Zip information!</value>
</data>
<data name="frmSettings_lblArguments" xml:space="preserve">
<value>Custom Arguments:</value>
</data>
@@ -1633,4 +1630,28 @@
<data name="App_Invalid7zDetected" xml:space="preserve">
<value>7-Zip (7za.exe) is invalid and has been prevented from running.</value>
</data>
<data name="Utility_Custom" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\custom_7z.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Utility_Valid" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\valid_7z.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Utility_Invalid" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\warning_7z.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="frmSettings_ttUtilityStatus_Custom7z" xml:space="preserve">
<value>GBM is using a custom 7-Zip utility, it cannot be verified.</value>
</data>
<data name="frmSettings_ttUtilityStatus_Failure7z" xml:space="preserve">
<value>GBM could not verify the custom 7-Zip utility.</value>
</data>
<data name="frmSettings_ttUtilityStatus_Invalid7z" xml:space="preserve">
<value>GBM's default 7-Zip utility has failed verification, it cannot be used.</value>
</data>
<data name="frmSettings_ttUtilityStatus_Title" xml:space="preserve">
<value>7-Zip Status</value>
</data>
<data name="frmSettings_ttUtilityStatus_Valid7z" xml:space="preserve">
<value>GBM is using the default 7-Zip utility, it has been verified.</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB