Updated Import / Export / Sync with game id changes
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Public Class Game
|
Public Class Game
|
||||||
|
Private sGameID As String
|
||||||
Private sGameName As String
|
Private sGameName As String
|
||||||
Private sProcessName As String
|
Private sProcessName As String
|
||||||
Private sParameter As String
|
Private sParameter As String
|
||||||
@@ -12,6 +13,15 @@
|
|||||||
Private bIsRegEx As Boolean
|
Private bIsRegEx As Boolean
|
||||||
Private oTags As List(Of Tag)
|
Private oTags As List(Of Tag)
|
||||||
|
|
||||||
|
Property ID As String
|
||||||
|
Set(value As String)
|
||||||
|
sGameID = value
|
||||||
|
End Set
|
||||||
|
Get
|
||||||
|
Return sGameID
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
Property Name As String
|
Property Name As String
|
||||||
Set(value As String)
|
Set(value As String)
|
||||||
sGameName = value
|
sGameName = value
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Public Class clsGame
|
|||||||
Private bIsRegEx As Boolean = False
|
Private bIsRegEx As Boolean = False
|
||||||
Private bDuplicate As Boolean = False
|
Private bDuplicate As Boolean = False
|
||||||
Private oImportTags As New List(Of Tag)
|
Private oImportTags As New List(Of Tag)
|
||||||
|
Private bImportUpdate As Boolean = False
|
||||||
|
|
||||||
<Flags()> Public Enum eOptionalSyncFields
|
<Flags()> Public Enum eOptionalSyncFields
|
||||||
None = 0
|
None = 0
|
||||||
@@ -269,6 +270,15 @@ Public Class clsGame
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Property ImportUpdate As Boolean
|
||||||
|
Get
|
||||||
|
Return bImportUpdate
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
bImportUpdate = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
ReadOnly Property IncludeArray As String()
|
ReadOnly Property IncludeArray As String()
|
||||||
Get
|
Get
|
||||||
If FileType = String.Empty Then
|
If FileType = String.Empty Then
|
||||||
@@ -384,12 +394,43 @@ Public Class clsGame
|
|||||||
If oGame Is Nothing Then
|
If oGame Is Nothing Then
|
||||||
Return False
|
Return False
|
||||||
Else
|
Else
|
||||||
|
'Core Fields
|
||||||
If ID <> oGame.ID Then
|
If ID <> oGame.ID Then
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
If Name <> oGame.Name Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
If ProcessName <> oGame.ProcessName Then
|
If ProcessName <> oGame.ProcessName Then
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
If Parameter <> oGame.Parameter Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
If Path <> oGame.Path Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
If FileType <> oGame.FileType Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
If ExcludeList <> oGame.ExcludeList Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
If AbsolutePath <> oGame.AbsolutePath Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
If FolderSave <> oGame.FolderSave Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
If MonitorOnly <> oGame.MonitorOnly Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
If Comments <> oGame.Comments Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
If IsRegEx <> oGame.IsRegEx Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -82,9 +82,9 @@ Public Class frmAdvancedImport
|
|||||||
sTags = sTags.TrimEnd(New Char() {",", " "})
|
sTags = sTags.TrimEnd(New Char() {",", " "})
|
||||||
|
|
||||||
oListViewItem = New ListViewItem(New String() {oApp.Name, oApp.TrueProcess, sTags})
|
oListViewItem = New ListViewItem(New String() {oApp.Name, oApp.TrueProcess, sTags})
|
||||||
oListViewItem.Tag = oApp.CompoundKey
|
oListViewItem.Tag = oApp.ID
|
||||||
|
|
||||||
If FinalData.ContainsKey(oApp.CompoundKey) Then
|
If FinalData.ContainsKey(oApp.ID) Then
|
||||||
oListViewItem.Checked = True
|
oListViewItem.Checked = True
|
||||||
Else
|
Else
|
||||||
oListViewItem.Checked = False
|
oListViewItem.Checked = False
|
||||||
@@ -103,6 +103,11 @@ Public Class frmAdvancedImport
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If oApp.ImportUpdate Then
|
||||||
|
oListViewItem.ForeColor = Color.Red
|
||||||
|
oListViewItem.Checked = True
|
||||||
|
End If
|
||||||
|
|
||||||
If sFilter = String.Empty Then
|
If sFilter = String.Empty Then
|
||||||
bAddItem = True
|
bAddItem = True
|
||||||
Else
|
Else
|
||||||
|
|||||||
@@ -78,15 +78,14 @@ Public Class mgrMonitorList
|
|||||||
Dim oCompareGame As clsGame
|
Dim oCompareGame As clsGame
|
||||||
Dim bIsDupe As Boolean
|
Dim bIsDupe As Boolean
|
||||||
|
|
||||||
sSQL = "Select * from monitorlist ORDER BY Name Asc"
|
sSQL = "Select * FROM monitorlist ORDER BY Name Asc"
|
||||||
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
|
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
|
||||||
|
|
||||||
For Each dr As DataRow In oData.Tables(0).Rows
|
For Each dr As DataRow In oData.Tables(0).Rows
|
||||||
oGame = MapToObject(dr)
|
oGame = MapToObject(dr)
|
||||||
Select Case eListType
|
Select Case eListType
|
||||||
Case eListTypes.FullList
|
Case eListTypes.FullList
|
||||||
'Don't wrap this, if it fails there's a problem with the database
|
hshList.Add(oGame.ID, oGame)
|
||||||
hshList.Add(oGame.CompoundKey, oGame)
|
|
||||||
Case eListTypes.ScanList
|
Case eListTypes.ScanList
|
||||||
For Each de As DictionaryEntry In hshList
|
For Each de As DictionaryEntry In hshList
|
||||||
bIsDupe = False
|
bIsDupe = False
|
||||||
@@ -521,10 +520,10 @@ Public Class mgrMonitorList
|
|||||||
hshSyncItems = hshCompareFrom.Clone
|
hshSyncItems = hshCompareFrom.Clone
|
||||||
|
|
||||||
For Each oFromItem In hshCompareFrom.Values
|
For Each oFromItem In hshCompareFrom.Values
|
||||||
If hshCompareTo.Contains(oFromItem.CompoundKey) Then
|
If hshCompareTo.Contains(oFromItem.ID) Then
|
||||||
oToItem = DirectCast(hshCompareTo(oFromItem.CompoundKey), clsGame)
|
oToItem = DirectCast(hshCompareTo(oFromItem.ID), clsGame)
|
||||||
If oFromItem.SyncEquals(oToItem, eSyncFields) Then
|
If oFromItem.SyncEquals(oToItem, eSyncFields) Then
|
||||||
hshSyncItems.Remove(oFromItem.CompoundKey)
|
hshSyncItems.Remove(oFromItem.ID)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
@@ -551,10 +550,10 @@ Public Class mgrMonitorList
|
|||||||
hshDeleteItems = hshCompareTo.Clone
|
hshDeleteItems = hshCompareTo.Clone
|
||||||
|
|
||||||
For Each oToItem In hshCompareTo.Values
|
For Each oToItem In hshCompareTo.Values
|
||||||
If hshCompareFrom.Contains(oToItem.CompoundKey) Then
|
If hshCompareFrom.Contains(oToItem.ID) Then
|
||||||
oFromItem = DirectCast(hshCompareFrom(oToItem.CompoundKey), clsGame)
|
oFromItem = DirectCast(hshCompareFrom(oToItem.ID), clsGame)
|
||||||
If oToItem.MinimalEquals(oFromItem) Then
|
If oToItem.MinimalEquals(oFromItem) Then
|
||||||
hshDeleteItems.Remove(oToItem.CompoundKey)
|
hshDeleteItems.Remove(oToItem.ID)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
@@ -749,7 +748,6 @@ Public Class mgrMonitorList
|
|||||||
Dim oDatabase As New mgrSQLite(iSelectDB)
|
Dim oDatabase As New mgrSQLite(iSelectDB)
|
||||||
Dim oData As DataSet
|
Dim oData As DataSet
|
||||||
Dim sSQL As String = String.Empty
|
Dim sSQL As String = String.Empty
|
||||||
Dim sID As String
|
|
||||||
Dim oList As New List(Of Game)
|
Dim oList As New List(Of Game)
|
||||||
Dim oGame As Game
|
Dim oGame As Game
|
||||||
Dim hshParams As New Hashtable
|
Dim hshParams As New Hashtable
|
||||||
@@ -760,7 +758,7 @@ Public Class mgrMonitorList
|
|||||||
|
|
||||||
For Each dr As DataRow In oData.Tables(0).Rows
|
For Each dr As DataRow In oData.Tables(0).Rows
|
||||||
oGame = New Game
|
oGame = New Game
|
||||||
sID = CStr(dr("MonitorID"))
|
oGame.ID = CStr(dr("MonitorID"))
|
||||||
oGame.Name = CStr(dr("Name"))
|
oGame.Name = CStr(dr("Name"))
|
||||||
oGame.ProcessName = CStr(dr("Process"))
|
oGame.ProcessName = CStr(dr("Process"))
|
||||||
If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path"))
|
If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path"))
|
||||||
@@ -772,7 +770,7 @@ Public Class mgrMonitorList
|
|||||||
If Not IsDBNull(dr("Parameter")) Then oGame.Parameter = CStr(dr("Parameter"))
|
If Not IsDBNull(dr("Parameter")) Then oGame.Parameter = CStr(dr("Parameter"))
|
||||||
If Not IsDBNull(dr("Comments")) Then oGame.Comments = CStr(dr("Comments"))
|
If Not IsDBNull(dr("Comments")) Then oGame.Comments = CStr(dr("Comments"))
|
||||||
oGame.IsRegEx = CBool(dr("IsRegEx"))
|
oGame.IsRegEx = CBool(dr("IsRegEx"))
|
||||||
oGame.Tags = mgrGameTags.GetTagsByGameForExport(sID)
|
oGame.Tags = mgrGameTags.GetTagsByGameForExport(oGame.ID)
|
||||||
oList.Add(oGame)
|
oList.Add(oGame)
|
||||||
Next
|
Next
|
||||||
|
|
||||||
@@ -818,10 +816,14 @@ Public Class mgrMonitorList
|
|||||||
hshSyncItems = hshCompareFrom.Clone
|
hshSyncItems = hshCompareFrom.Clone
|
||||||
|
|
||||||
For Each oFromItem In hshCompareFrom.Values
|
For Each oFromItem In hshCompareFrom.Values
|
||||||
If hshCompareTo.Contains(oFromItem.CompoundKey) Then
|
If hshCompareTo.Contains(oFromItem.ID) Then
|
||||||
oToItem = DirectCast(hshCompareTo(oFromItem.CompoundKey), clsGame)
|
oToItem = DirectCast(hshCompareTo(oFromItem.ID), clsGame)
|
||||||
If oFromItem.CoreEquals(oToItem) Then
|
If oFromItem.MinimalEquals(oToItem) Then
|
||||||
hshSyncItems.Remove(oFromItem.CompoundKey)
|
If oFromItem.CoreEquals(oToItem) Then
|
||||||
|
hshSyncItems.Remove(oFromItem.ID)
|
||||||
|
Else
|
||||||
|
DirectCast(hshSyncItems(oFromItem.ID), clsGame).ImportUpdate = True
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|||||||
@@ -153,7 +153,7 @@
|
|||||||
Dim hshParams As Hashtable
|
Dim hshParams As Hashtable
|
||||||
Dim oParamList As New List(Of Hashtable)
|
Dim oParamList As New List(Of Hashtable)
|
||||||
|
|
||||||
sSQL = "INSERT OR REPLACE INTO tags VALUES (COALESCE((SELECT TagID FROM tags WHERE Name = @Name), @ID), @Name); INSERT INTO gametags VALUES ((SELECT TagID from tags WHERE Name=@Name), @MonitorID);"
|
sSQL = "INSERT OR REPLACE INTO tags VALUES (COALESCE((SELECT TagID FROM tags WHERE Name = @Name), @ID), @Name); INSERT OR REPLACE INTO gametags VALUES ((SELECT TagID from tags WHERE Name=@Name), @MonitorID);"
|
||||||
For Each oGame As clsGame In hshTags.Values
|
For Each oGame As clsGame In hshTags.Values
|
||||||
sMonitorID = oGame.ID
|
sMonitorID = oGame.ID
|
||||||
For Each t As Tag In oGame.ImportTags
|
For Each t As Tag In oGame.ImportTags
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Public Class mgrXML
|
|||||||
|
|
||||||
For Each g As Game In oList
|
For Each g As Game In oList
|
||||||
oGame = New clsGame
|
oGame = New clsGame
|
||||||
|
oGame.ID = g.ID
|
||||||
oGame.Name = g.Name
|
oGame.Name = g.Name
|
||||||
oGame.ProcessName = g.ProcessName
|
oGame.ProcessName = g.ProcessName
|
||||||
oGame.AbsolutePath = g.AbsolutePath
|
oGame.AbsolutePath = g.AbsolutePath
|
||||||
@@ -42,7 +43,7 @@ Public Class mgrXML
|
|||||||
|
|
||||||
'This should be wrapped just in case we get some bad data
|
'This should be wrapped just in case we get some bad data
|
||||||
Try
|
Try
|
||||||
hshList.Add(oGame.CompoundKey, oGame)
|
hshList.Add(oGame.ID, oGame)
|
||||||
Catch e As Exception
|
Catch e As Exception
|
||||||
'Do Nothing
|
'Do Nothing
|
||||||
End Try
|
End Try
|
||||||
|
|||||||
Reference in New Issue
Block a user