diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index bf45b3f..386c7fb 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -172,7 +172,7 @@ Public Class frmGameManager Dim sFileName As String Dim sNewFileName As String - 'If there is a name change, check and update the manifest + 'If there is an ID change, check and update the manifest If oNewApp.ID <> oOriginalApp.ID Then 'Local If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Local) Then @@ -625,6 +625,9 @@ Public Class frmGameManager CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.ID), clsBackup) + 'Override Path + CurrentBackupItem.RestorePath = oApp.Path + sFileName = BackupFolder & CurrentBackupItem.FileName btnOpenBackupFile.Enabled = True @@ -638,6 +641,7 @@ Public Class frmGameManager lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists End If + mgrRestore.DoPathOverride(CurrentBackupItem, oApp) lblRestorePathData.Text = CurrentBackupItem.RestorePath Else oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_None)) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 303cb91..0271255 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -365,9 +365,9 @@ Public Class frmMain Private Sub AutoRestoreCheck() Dim slRestoreData As SortedList = mgrRestore.CompareManifests() - Dim sNotReady As New List(Of String) - Dim sNotInstalled As New List(Of String) - Dim sNoCheckSum As New List(Of String) + Dim oNotReady As New List(Of clsBackup) + Dim oNotInstalled As New List(Of clsBackup) + Dim oNoCheckSum As New List(Of clsBackup) Dim oBackup As clsBackup Dim sFileName As String Dim sExtractPath As String @@ -395,15 +395,15 @@ Public Class frmMain If oBackup.CheckSum <> String.Empty Then sFileName = oSettings.BackupFolder & Path.DirectorySeparatorChar & oBackup.FileName If mgrHash.Generate_SHA256_Hash(sFileName) <> oBackup.CheckSum Then - sNotReady.Add(de.Key) + oNotReady.Add(oBackup) bFinished = False End If Else - sNoCheckSum.Add(de.Key) + oNoCheckSum.Add(oBackup) End If 'Check if the restore location exists, if not we assume the game is not installed and should be auto-marked. - hshGames = mgrMonitorList.DoListGetbyName(de.Key) + hshGames = mgrMonitorList.DoListGetbyMonitorID(de.Key) If hshGames.Count = 1 Then oGame = DirectCast(hshGames(0), clsGame) If oGame.ProcessPath <> String.Empty Then @@ -425,28 +425,28 @@ Public Class frmMain mgrManifest.DoManifestAdd(de.Value, mgrSQLite.Database.Local) End If End If - sNotInstalled.Add(de.Key) + oNotInstalled.Add(oBackup) End If Next 'Remove any backup files that are not ready - For Each s As String In sNotReady - slRestoreData.Remove(s) - UpdateLog(mgrCommon.FormatString(frmMain_RestoreNotReady, s), False, ToolTipIcon.Info, True) + For Each o As clsBackup In oNotReady + slRestoreData.Remove(o.MonitorID) + UpdateLog(mgrCommon.FormatString(frmMain_RestoreNotReady, o.Name), False, ToolTipIcon.Info, True) Next 'Remove any backup files that should not be automatically restored - For Each s As String In sNotInstalled - slRestoreData.Remove(s) + For Each o As clsBackup In oNotInstalled + slRestoreData.Remove(o.MonitorID) If oSettings.AutoMark Then - UpdateLog(mgrCommon.FormatString(frmMain_AutoMark, s), False, ToolTipIcon.Info, True) + UpdateLog(mgrCommon.FormatString(frmMain_AutoMark, o.Name), False, ToolTipIcon.Info, True) Else - UpdateLog(mgrCommon.FormatString(frmMain_NoAutoMark, s), False, ToolTipIcon.Info, True) + UpdateLog(mgrCommon.FormatString(frmMain_NoAutoMark, o.Name), False, ToolTipIcon.Info, True) End If Next - For Each s As String In sNoCheckSum - slRestoreData.Remove(s) - UpdateLog(mgrCommon.FormatString(frmMain_NoCheckSum, s), False, ToolTipIcon.Info, True) + For Each o As clsBackup In oNoCheckSum + slRestoreData.Remove(o.MonitorID) + UpdateLog(mgrCommon.FormatString(frmMain_NoCheckSum, o.Name), False, ToolTipIcon.Info, True) Next 'Automatically restore backup files @@ -455,13 +455,14 @@ Public Class frmMain hshRestore = New Hashtable sGame = String.Empty For Each de As DictionaryEntry In slRestoreData - hshGames = mgrMonitorList.DoListGetbyName(de.Key) + oBackup = DirectCast(de.Value, clsBackup) + hshGames = mgrMonitorList.DoListGetbyMonitorID(de.Key) If hshGames.Count = 1 Then oGame = DirectCast(hshGames(0), clsGame) sGame = oGame.CroppedName hshRestore.Add(oGame, de.Value) Else - UpdateLog(mgrCommon.FormatString(frmMain_AutoRestoreFailure, de.Key), False, ToolTipIcon.Info, True) + UpdateLog(mgrCommon.FormatString(frmMain_AutoRestoreFailure, oBackup.Name), False, ToolTipIcon.Info, True) End If Next diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index fcb8bc3..da957a2 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -287,7 +287,7 @@ Public Class mgrMonitorList Return oGame End Function - Public Shared Function DoListGetbyName(ByVal sName As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable + Public Shared Function DoListGetbyMonitorID(ByVal sMonitorID As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable Dim oDatabase As New mgrSQLite(iSelectDB) Dim sSQL As String Dim oData As DataSet @@ -297,9 +297,9 @@ Public Class mgrMonitorList Dim iCounter As Integer = 0 sSQL = "SELECT * from monitorlist " - sSQL &= "WHERE Name = @Name" + sSQL &= "WHERE MonitorID = @MonitorID" - hshParams.Add("Name", sName) + hshParams.Add("MonitorID", sMonitorID) oData = oDatabase.ReadParamData(sSQL, hshParams) diff --git a/GBM/Managers/mgrRestore.vb b/GBM/Managers/mgrRestore.vb index 1484ef5..a863415 100644 --- a/GBM/Managers/mgrRestore.vb +++ b/GBM/Managers/mgrRestore.vb @@ -28,6 +28,17 @@ Public Class mgrRestore Public Event UpdateRestoreInfo(oRestoreInfo As clsBackup) Public Event SetLastAction(sMessage As String) + 'This should only be needed by the Game Manager after v1.1.0 + Public Shared Sub DoPathOverride(ByRef oCheckBackup As clsBackup, ByVal oCheckGame As clsGame) + If Path.IsPathRooted(oCheckGame.Path) Then + oCheckBackup.AbsolutePath = True + Else + oCheckBackup.AbsolutePath = False + End If + + oCheckBackup.RestorePath = oCheckGame.Path + End Sub + Public Shared Function CheckPath(ByRef oRestoreInfo As clsBackup, ByVal oGame As clsGame, ByRef bTriggerReload As Boolean) As Boolean Dim sProcess As String Dim sRestorePath As String