diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index ba162a5..4cb44af 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -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,39 +1533,24 @@ 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 - End If - Else - bContinue = True + bPathDetectionFailure = True + sPathDetectionError = mgrCommon.FormatString(frmMain_ErrorAdminBackup, oProcess.GameInfo.Name) End If + bContinue = True 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 - End If - Else - bContinue = True + bPathDetectionFailure = True + sPathDetectionError = mgrCommon.FormatString(frmMain_Error64Backup, oProcess.GameInfo.Name) End If + bContinue = True End If End If End If @@ -1584,9 +1570,6 @@ Public Class frmMain bwMonitor.RunWorkerAsync() Else StopScan() - If bAskForRestart Then - RestartAsAdmin() - End If End If End If End Sub @@ -1607,21 +1590,44 @@ 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 - If DoMultiGameCheck() Then - UpdateLog(mgrCommon.FormatString(frmMain_GameEnded, oProcess.GameInfo.Name), False) - If oSettings.TimeTracking Then HandleTimeSpent() - RunBackup() - Else - UpdateLog(frmMain_UnknownGameEnded, False) - oProcess.GameInfo = Nothing - ResetGameInfo() - ResumeScan() + '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() + RunBackup() + Else + UpdateLog(frmMain_UnknownGameEnded, False) + oProcess.GameInfo = Nothing + ResetGameInfo() + ResumeScan() + End If End If End If + 'Reset globals + bPathDetectionFailure = False + sPathDetectionError = String.Empty bCancelledByUser = False oProcess.StartTime = Now : oProcess.EndTime = Now End Sub diff --git a/GBM/Forms/frmSettings.Designer.vb b/GBM/Forms/frmSettings.Designer.vb index 834ad2c..ed9d235 100644 --- a/GBM/Forms/frmSettings.Designer.vb +++ b/GBM/Forms/frmSettings.Designer.vb @@ -22,6 +22,7 @@ Partial Class frmSettings 'Do not modify it using the code editor. _ 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 diff --git a/GBM/Forms/frmSettings.resx b/GBM/Forms/frmSettings.resx index c4a320a..fdbc665 100644 --- a/GBM/Forms/frmSettings.resx +++ b/GBM/Forms/frmSettings.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + 32 diff --git a/GBM/Forms/frmSettings.vb b/GBM/Forms/frmSettings.vb index 0b79812..58e5668 100644 --- a/GBM/Forms/frmSettings.vb +++ b/GBM/Forms/frmSettings.vb @@ -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 diff --git a/GBM/Game Backup Monitor.vbproj b/GBM/Game Backup Monitor.vbproj index c471e95..f437b39 100644 --- a/GBM/Game Backup Monitor.vbproj +++ b/GBM/Game Backup Monitor.vbproj @@ -283,6 +283,7 @@ VbMyResourcesResXFileCodeGenerator My.Resources Designer + Resources.Designer.vb @@ -328,6 +329,9 @@ PreserveNewest + + + PreserveNewest diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 5e7f05b..5f2b571 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -88,7 +88,7 @@ Namespace My.Resources End Property ''' - ''' 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'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.. ''' Friend ReadOnly Property App_Invalid7zDetected() As String Get @@ -2338,7 +2338,7 @@ Namespace My.Resources End Property ''' - ''' 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.. ''' Friend ReadOnly Property frmMain_ErrorAdminBackup() As String Get @@ -2464,7 +2464,7 @@ Namespace My.Resources End Property ''' - ''' 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.. ''' Friend ReadOnly Property frmMain_ErrorMulti64() As String Get @@ -2473,7 +2473,7 @@ Namespace My.Resources End Property ''' - ''' 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.. ''' Friend ReadOnly Property frmMain_ErrorMultiAdmin() As String Get @@ -3309,15 +3309,6 @@ Namespace My.Resources End Get End Property - ''' - ''' Looks up a localized string similar to Unable to retrieve 7-Zip information!. - ''' - Friend ReadOnly Property frmSettings_Error7zInfo() As String - Get - Return ResourceManager.GetString("frmSettings_Error7zInfo", resourceCulture) - End Get - End Property - ''' ''' Looks up a localized string similar to The backup folder does not exist. Please choose a valid backup folder.. ''' @@ -3426,6 +3417,51 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to GBM is using a custom 7-Zip utility, it cannot be verified.. + ''' + Friend ReadOnly Property frmSettings_ttUtilityStatus_Custom7z() As String + Get + Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Custom7z", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to GBM could not verify the custom 7-Zip utility.. + ''' + Friend ReadOnly Property frmSettings_ttUtilityStatus_Failure7z() As String + Get + Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Failure7z", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to GBM's default 7-Zip utility has failed verification, it cannot be used.. + ''' + Friend ReadOnly Property frmSettings_ttUtilityStatus_Invalid7z() As String + Get + Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Invalid7z", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to 7-Zip Status. + ''' + Friend ReadOnly Property frmSettings_ttUtilityStatus_Title() As String + Get + Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Title", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to GBM is using the default 7-Zip utility, it has been verified.. + ''' + Friend ReadOnly Property frmSettings_ttUtilityStatus_Valid7z() As String + Get + Return ResourceManager.GetString("frmSettings_ttUtilityStatus_Valid7z", resourceCulture) + End Get + End Property + ''' ''' 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.. ''' @@ -4617,5 +4653,35 @@ Namespace My.Resources Return ResourceManager.GetString("mgrXML_ErrorImportFailure", resourceCulture) End Get End Property + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + 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 + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + 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 + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + 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 diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 53ad278..4dfd2f2 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -197,7 +197,7 @@ 7-Zip was not found. The application cannot continue. - [PARAM] is running as Administrator and GBM is not, GBM cannot detect the required information to save your backup. + [PARAM] was running as Administrator and GBM is not, GBM cannot detect the required information to save your backup. [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. @@ -227,10 +227,10 @@ 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. - 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. + Install the 64-bit version of GBM to detect the last running game. - 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. + Restart GBM as Administrator to detect the last running game. [PARAM] uses a relative path and has never been detected on this computer. @@ -1600,9 +1600,6 @@ Set &Defaults - - Unable to retrieve 7-Zip information! - Custom Arguments: @@ -1633,4 +1630,28 @@ 7-Zip (7za.exe) is invalid and has been prevented from running. + + ..\Resources\custom_7z.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\valid_7z.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\warning_7z.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + GBM is using a custom 7-Zip utility, it cannot be verified. + + + GBM could not verify the custom 7-Zip utility. + + + GBM's default 7-Zip utility has failed verification, it cannot be used. + + + 7-Zip Status + + + GBM is using the default 7-Zip utility, it has been verified. + \ No newline at end of file diff --git a/GBM/Resources/custom_7z.png b/GBM/Resources/custom_7z.png new file mode 100644 index 0000000..9ab0479 Binary files /dev/null and b/GBM/Resources/custom_7z.png differ diff --git a/GBM/Resources/valid_7z.png b/GBM/Resources/valid_7z.png new file mode 100644 index 0000000..d48b3a5 Binary files /dev/null and b/GBM/Resources/valid_7z.png differ diff --git a/GBM/Resources/warning_7z.png b/GBM/Resources/warning_7z.png new file mode 100644 index 0000000..e3799c0 Binary files /dev/null and b/GBM/Resources/warning_7z.png differ