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 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))
+20 -19
View File
@@ -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
+3 -3
View File
@@ -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)
+11
View File
@@ -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