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