Fixed manifest issues with auto-restore and game manager

This commit is contained in:
MikeMaximus
2018-03-01 13:42:26 -06:00
parent d07fc57dad
commit 848679c1b1
4 changed files with 39 additions and 23 deletions
+5 -1
View File
@@ -172,7 +172,7 @@ Public Class frmGameManager
Dim sFileName As String Dim sFileName As String
Dim sNewFileName 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 If oNewApp.ID <> oOriginalApp.ID Then
'Local 'Local
If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Local) Then If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Local) Then
@@ -625,6 +625,9 @@ Public Class frmGameManager
CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.ID), clsBackup) CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.ID), clsBackup)
'Override Path
CurrentBackupItem.RestorePath = oApp.Path
sFileName = BackupFolder & CurrentBackupItem.FileName sFileName = BackupFolder & CurrentBackupItem.FileName
btnOpenBackupFile.Enabled = True btnOpenBackupFile.Enabled = True
@@ -638,6 +641,7 @@ Public Class frmGameManager
lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists
End If End If
mgrRestore.DoPathOverride(CurrentBackupItem, oApp)
lblRestorePathData.Text = CurrentBackupItem.RestorePath lblRestorePathData.Text = CurrentBackupItem.RestorePath
Else Else
oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_None)) oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_None))
+20 -19
View File
@@ -365,9 +365,9 @@ Public Class frmMain
Private Sub AutoRestoreCheck() Private Sub AutoRestoreCheck()
Dim slRestoreData As SortedList = mgrRestore.CompareManifests() Dim slRestoreData As SortedList = mgrRestore.CompareManifests()
Dim sNotReady As New List(Of String) Dim oNotReady As New List(Of clsBackup)
Dim sNotInstalled As New List(Of String) Dim oNotInstalled As New List(Of clsBackup)
Dim sNoCheckSum As New List(Of String) Dim oNoCheckSum As New List(Of clsBackup)
Dim oBackup As clsBackup Dim oBackup As clsBackup
Dim sFileName As String Dim sFileName As String
Dim sExtractPath As String Dim sExtractPath As String
@@ -395,15 +395,15 @@ Public Class frmMain
If oBackup.CheckSum <> String.Empty Then If oBackup.CheckSum <> String.Empty Then
sFileName = oSettings.BackupFolder & Path.DirectorySeparatorChar & oBackup.FileName sFileName = oSettings.BackupFolder & Path.DirectorySeparatorChar & oBackup.FileName
If mgrHash.Generate_SHA256_Hash(sFileName) <> oBackup.CheckSum Then If mgrHash.Generate_SHA256_Hash(sFileName) <> oBackup.CheckSum Then
sNotReady.Add(de.Key) oNotReady.Add(oBackup)
bFinished = False bFinished = False
End If End If
Else Else
sNoCheckSum.Add(de.Key) oNoCheckSum.Add(oBackup)
End If End If
'Check if the restore location exists, if not we assume the game is not installed and should be auto-marked. '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 If hshGames.Count = 1 Then
oGame = DirectCast(hshGames(0), clsGame) oGame = DirectCast(hshGames(0), clsGame)
If oGame.ProcessPath <> String.Empty Then If oGame.ProcessPath <> String.Empty Then
@@ -425,28 +425,28 @@ Public Class frmMain
mgrManifest.DoManifestAdd(de.Value, mgrSQLite.Database.Local) mgrManifest.DoManifestAdd(de.Value, mgrSQLite.Database.Local)
End If End If
End If End If
sNotInstalled.Add(de.Key) oNotInstalled.Add(oBackup)
End If End If
Next Next
'Remove any backup files that are not ready 'Remove any backup files that are not ready
For Each s As String In sNotReady For Each o As clsBackup In oNotReady
slRestoreData.Remove(s) slRestoreData.Remove(o.MonitorID)
UpdateLog(mgrCommon.FormatString(frmMain_RestoreNotReady, s), False, ToolTipIcon.Info, True) UpdateLog(mgrCommon.FormatString(frmMain_RestoreNotReady, o.Name), False, ToolTipIcon.Info, True)
Next Next
'Remove any backup files that should not be automatically restored 'Remove any backup files that should not be automatically restored
For Each s As String In sNotInstalled For Each o As clsBackup In oNotInstalled
slRestoreData.Remove(s) slRestoreData.Remove(o.MonitorID)
If oSettings.AutoMark Then 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 Else
UpdateLog(mgrCommon.FormatString(frmMain_NoAutoMark, s), False, ToolTipIcon.Info, True) UpdateLog(mgrCommon.FormatString(frmMain_NoAutoMark, o.Name), False, ToolTipIcon.Info, True)
End If End If
Next Next
For Each s As String In sNoCheckSum For Each o As clsBackup In oNoCheckSum
slRestoreData.Remove(s) slRestoreData.Remove(o.MonitorID)
UpdateLog(mgrCommon.FormatString(frmMain_NoCheckSum, s), False, ToolTipIcon.Info, True) UpdateLog(mgrCommon.FormatString(frmMain_NoCheckSum, o.Name), False, ToolTipIcon.Info, True)
Next Next
'Automatically restore backup files 'Automatically restore backup files
@@ -455,13 +455,14 @@ Public Class frmMain
hshRestore = New Hashtable hshRestore = New Hashtable
sGame = String.Empty sGame = String.Empty
For Each de As DictionaryEntry In slRestoreData 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 If hshGames.Count = 1 Then
oGame = DirectCast(hshGames(0), clsGame) oGame = DirectCast(hshGames(0), clsGame)
sGame = oGame.CroppedName sGame = oGame.CroppedName
hshRestore.Add(oGame, de.Value) hshRestore.Add(oGame, de.Value)
Else 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 End If
Next Next
+3 -3
View File
@@ -287,7 +287,7 @@ Public Class mgrMonitorList
Return oGame Return oGame
End Function 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 oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String Dim sSQL As String
Dim oData As DataSet Dim oData As DataSet
@@ -297,9 +297,9 @@ Public Class mgrMonitorList
Dim iCounter As Integer = 0 Dim iCounter As Integer = 0
sSQL = "SELECT * from monitorlist " 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) oData = oDatabase.ReadParamData(sSQL, hshParams)
+11
View File
@@ -28,6 +28,17 @@ Public Class mgrRestore
Public Event UpdateRestoreInfo(oRestoreInfo As clsBackup) Public Event UpdateRestoreInfo(oRestoreInfo As clsBackup)
Public Event SetLastAction(sMessage As String) 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 Public Shared Function CheckPath(ByRef oRestoreInfo As clsBackup, ByVal oGame As clsGame, ByRef bTriggerReload As Boolean) As Boolean
Dim sProcess As String Dim sProcess As String
Dim sRestorePath As String Dim sRestorePath As String