Added game id sync to import
This commit is contained in:
@@ -1497,7 +1497,9 @@ Public Class frmGameManager
|
||||
|
||||
If sLocation <> String.Empty Then
|
||||
If mgrMonitorList.DoImport(sLocation) Then
|
||||
mgrMonitorList.SyncMonitorLists(Settings.SyncFields)
|
||||
LoadData()
|
||||
LoadBackupData()
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -1525,7 +1527,9 @@ Public Class frmGameManager
|
||||
|
||||
If mgrCommon.ShowMessage(frmGameManager_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
|
||||
If mgrMonitorList.DoImport(sImportURL) Then
|
||||
mgrMonitorList.SyncMonitorLists(Settings.SyncFields)
|
||||
LoadData()
|
||||
LoadBackupData()
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -163,7 +163,6 @@ Public Class mgrMonitorList
|
||||
End If
|
||||
|
||||
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)
|
||||
@@ -787,6 +786,9 @@ Public Class mgrMonitorList
|
||||
If (sPath.IndexOf("http://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Or
|
||||
(sPath.IndexOf("https://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Then
|
||||
If mgrCommon.CheckAddress(sPath) Then
|
||||
If mgrCommon.ShowMessage(mgrMonitorList_ConfirmGameIDSync, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
|
||||
ImportSyncGameID(sPath, True)
|
||||
End If
|
||||
ImportMonitorList(sPath, True)
|
||||
Return True
|
||||
Else
|
||||
@@ -795,6 +797,9 @@ Public Class mgrMonitorList
|
||||
End If
|
||||
Else
|
||||
If File.Exists(sPath) Then
|
||||
If mgrCommon.ShowMessage(mgrMonitorList_ConfirmGameIDSync, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
|
||||
ImportSyncGameID(sPath)
|
||||
End If
|
||||
ImportMonitorList(sPath)
|
||||
Return True
|
||||
Else
|
||||
@@ -815,8 +820,14 @@ Public Class mgrMonitorList
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor
|
||||
|
||||
'Add / Update Sync
|
||||
hshCompareFrom = mgrXML.ReadMonitorList(sLocation, oExportInfo, bWebRead)
|
||||
|
||||
If oExportInfo.AppVer < 110 Then
|
||||
If mgrCommon.ShowMessage(mgrMonitorList_ImportVersionWarning, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
hshCompareTo = ReadList(eListTypes.FullList, mgrSQLite.Database.Local)
|
||||
|
||||
hshSyncItems = hshCompareFrom.Clone
|
||||
@@ -829,7 +840,11 @@ Public Class mgrMonitorList
|
||||
hshSyncItems.Remove(oFromItem.ID)
|
||||
Else
|
||||
DirectCast(hshSyncItems(oFromItem.ID), clsGame).ImportUpdate = True
|
||||
'These fields need to be set via the object or they will be lost when the configuration is updated
|
||||
DirectCast(hshSyncItems(oFromItem.ID), clsGame).Hours = oToItem.Hours
|
||||
DirectCast(hshSyncItems(oFromItem.ID), clsGame).CleanFolder = oToItem.CleanFolder
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
@@ -856,6 +871,65 @@ Public Class mgrMonitorList
|
||||
Application.DoEvents()
|
||||
End Sub
|
||||
|
||||
Private Shared Sub ImportSyncGameID(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False)
|
||||
Dim oLocalDatabase As New mgrSQLite(mgrSQLite.Database.Local)
|
||||
Dim oRemoteDatabase As New mgrSQLite(mgrSQLite.Database.Remote)
|
||||
Dim sSQL As String
|
||||
Dim hshParams As Hashtable
|
||||
Dim oParamList As New List(Of Hashtable)
|
||||
Dim hshCompareFrom As Hashtable
|
||||
Dim hshCompareTo As Hashtable
|
||||
Dim hshSyncIDs As New Hashtable
|
||||
Dim oFromItem As clsGame
|
||||
Dim oToItem As clsGame
|
||||
Dim oExportInfo As New ExportData
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor
|
||||
|
||||
hshCompareFrom = mgrXML.ReadMonitorList(sLocation, oExportInfo, bWebRead)
|
||||
|
||||
If oExportInfo.AppVer < 110 Then
|
||||
mgrCommon.ShowMessage(mgrMonitorList_ErrorGameIDVerFailure, MsgBoxStyle.Exclamation)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
hshCompareTo = ReadList(eListTypes.FullList, mgrSQLite.Database.Local)
|
||||
|
||||
For Each oFromItem In hshCompareFrom.Values
|
||||
If Not hshCompareTo.Contains(oFromItem.ID) Then
|
||||
For Each oToItem In hshCompareTo.Values
|
||||
'Strip all special characters and compare names
|
||||
If Regex.Replace(oToItem.Name, "[^\w]+", "") = Regex.Replace(oFromItem.Name, "[^\w]+", "") Then
|
||||
'Ignore games with duplicate names
|
||||
If Not hshSyncIDs.Contains(oFromItem.ID) Then
|
||||
hshSyncIDs.Add(oToItem.ID, oFromItem.ID)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each de As DictionaryEntry In hshSyncIDs
|
||||
hshParams = New Hashtable
|
||||
hshParams.Add("MonitorID", CStr(de.Value))
|
||||
hshParams.Add("QueryID", CStr(de.Key))
|
||||
oParamList.Add(hshParams)
|
||||
Next
|
||||
|
||||
sSQL = "UPDATE monitorlist SET MonitorID=@MonitorID WHERE MonitorID=@QueryID;"
|
||||
sSQL &= "UPDATE gametags SET MonitorID=@MonitorID WHERE MonitorID=@QueryID;"
|
||||
sSQL &= "UPDATE manifest SET MonitorID=@MonitorID WHERE MonitorID=@QueryID;"
|
||||
|
||||
oRemoteDatabase.RunMassParamQuery(sSQL, oParamList)
|
||||
|
||||
sSQL &= "UPDATE sessions SET MonitorID=@MonitorID WHERE MonitorID=@QueryID;"
|
||||
|
||||
oLocalDatabase.RunMassParamQuery(sSQL, oParamList)
|
||||
|
||||
Cursor.Current = Cursors.Default
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Sub ExportMonitorList(ByVal sLocation As String)
|
||||
Dim oList As List(Of Game)
|
||||
Dim bSuccess As Boolean = False
|
||||
|
||||
Generated
+27
@@ -5437,6 +5437,24 @@ Namespace My.Resources
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers? (Recommened).
|
||||
'''</summary>
|
||||
Friend ReadOnly Property mgrMonitorList_ConfirmGameIDSync() As String
|
||||
Get
|
||||
Return ResourceManager.GetString("mgrMonitorList_ConfirmGameIDSync", resourceCulture)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to This file cannot be used to sync game indentifiers. It was created with an older version of GBM..
|
||||
'''</summary>
|
||||
Friend ReadOnly Property mgrMonitorList_ErrorGameIDVerFailure() As String
|
||||
Get
|
||||
Return ResourceManager.GetString("mgrMonitorList_ErrorGameIDVerFailure", resourceCulture)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to Export Complete. [PARAM] item(s) have been exported..
|
||||
'''</summary>
|
||||
@@ -5473,6 +5491,15 @@ Namespace My.Resources
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to This export file was created with a version of GBM prior to 1.1.0 and does not contain unique game identifiers.[BR][BR]Do you still want to import configurations from this file? (Not Recommended).
|
||||
'''</summary>
|
||||
Friend ReadOnly Property mgrMonitorList_ImportVersionWarning() As String
|
||||
Get
|
||||
Return ResourceManager.GetString("mgrMonitorList_ImportVersionWarning", resourceCulture)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to [PARAM] change(s) synced..
|
||||
'''</summary>
|
||||
|
||||
@@ -2026,4 +2026,13 @@
|
||||
<data name="frmFilter_FieldGameID" xml:space="preserve">
|
||||
<value>Game ID</value>
|
||||
</data>
|
||||
<data name="mgrMonitorList_ConfirmGameIDSync" xml:space="preserve">
|
||||
<value>GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers? (Recommened)</value>
|
||||
</data>
|
||||
<data name="mgrMonitorList_ErrorGameIDVerFailure" xml:space="preserve">
|
||||
<value>This file cannot be used to sync game indentifiers. It was created with an older version of GBM.</value>
|
||||
</data>
|
||||
<data name="mgrMonitorList_ImportVersionWarning" xml:space="preserve">
|
||||
<value>This export file was created with a version of GBM prior to 1.1.0 and does not contain unique game identifiers.[BR][BR]Do you still want to import configurations from this file? (Not Recommended)</value>
|
||||
</data>
|
||||
</root>
|
||||
+3
-3
@@ -8,9 +8,9 @@ New in 1.1.0
|
||||
|
||||
Disclaimer:
|
||||
|
||||
1. This is pre-release software intended for testing.
|
||||
2. Database files from this version (gbm.s3db) may not be compatible with the full release. GBM makes automatic backups of your database files if you need to revert to a prior version.
|
||||
3. Do not make external links to this release, it will be available for a limited time.
|
||||
Version 1.1.0 makes fundamental changes to how GBM works with game configurations and backup data. Please read the changes below carefully.
|
||||
|
||||
I've done my best to make sure the upgrade process is seamless and allows everyone to continue using their existing data and configurations.
|
||||
|
||||
All Platforms:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user