Refined how configs are updated after detection and backup

This commit is contained in:
Michael J. Seiferling
2019-02-08 10:16:12 -06:00
parent cf2080916f
commit a7728c7bb1
3 changed files with 17 additions and 3 deletions
+2 -2
View File
@@ -735,7 +735,7 @@ Public Class frmMain
DirectCast(hshScanList.Item(oProcess.GameInfo.ID), clsGame).Hours = oProcess.GameInfo.Hours DirectCast(hshScanList.Item(oProcess.GameInfo.ID), clsGame).Hours = oProcess.GameInfo.Hours
End If End If
mgrMonitorList.DoListUpdate(oProcess.GameInfo) mgrMonitorList.DoListFieldUpdate("Hours", oProcess.GameInfo.Hours, oProcess.GameInfo.ID)
mgrMonitorList.SyncMonitorLists(oSettings) mgrMonitorList.SyncMonitorLists(oSettings)
UpdateTimeSpent(dCurrentHours, oProcess.TimeSpent.TotalHours) UpdateTimeSpent(dCurrentHours, oProcess.TimeSpent.TotalHours)
@@ -2013,7 +2013,7 @@ Public Class frmMain
oProcess.GameInfo.ProcessPath = mgrPath.ProcessPathSearch(oProcess.GameInfo.Name, oProcess.GameInfo.ProcessName, sPathDetectionError) oProcess.GameInfo.ProcessPath = mgrPath.ProcessPathSearch(oProcess.GameInfo.Name, oProcess.GameInfo.ProcessName, sPathDetectionError)
If oProcess.GameInfo.ProcessPath <> String.Empty Then If oProcess.GameInfo.ProcessPath <> String.Empty Then
'Update and reload 'Update and reload
mgrMonitorList.DoListUpdate(oProcess.GameInfo) mgrMonitorList.DoListFieldUpdate("ProcessPath", oProcess.GameInfo.ProcessPath, oProcess.GameInfo.ID)
LoadGameSettings() LoadGameSettings()
Else Else
bContinue = False bContinue = False
+1 -1
View File
@@ -403,7 +403,7 @@ Public Class mgrBackup
'Write the process path if we have it 'Write the process path if we have it
If oGame.AbsolutePath = False Then If oGame.AbsolutePath = False Then
mgrMonitorList.DoListUpdate(oGame) mgrMonitorList.DoListFieldUpdate("ProcessPath", oGame.ProcessPath, oGame.ID)
End If End If
End If End If
Catch ex As Exception Catch ex As Exception
+14
View File
@@ -144,6 +144,20 @@ Public Class mgrMonitorList
oDatabase.RunParamQuery(sSQL, hshParams) oDatabase.RunParamQuery(sSQL, hshParams)
End Sub End Sub
'Do NOT change MonitorID with this function
Public Shared Sub DoListFieldUpdate(ByVal sFieldName As String, ByVal oValue As Object, ByVal sQueryID As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "UPDATE monitorlist SET " & sFieldName & "=@" & sFieldName & " WHERE MonitorID=@QueryID;"
'Parameters
hshParams.Add(sFieldName, oValue)
hshParams.Add("QueryID", sQueryID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoListUpdateMulti(ByVal sMonitorIDs As List(Of String), ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) Public Shared Sub DoListUpdateMulti(ByVal sMonitorIDs As List(Of String), ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB) Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String Dim sSQL As String