diff --git a/GBM/Forms/frmChooseGame.vb b/GBM/Forms/frmChooseGame.vb index d2bfa42..5b7ccc4 100644 --- a/GBM/Forms/frmChooseGame.vb +++ b/GBM/Forms/frmChooseGame.vb @@ -2,7 +2,6 @@ Private oProcess As mgrProcesses Private oGame As clsGame - Private oGamesList As New List(Of KeyValuePair(Of String, String)) Private oGamesHash As New Hashtable Private bGameSelected As Boolean = False @@ -25,14 +24,14 @@ End Property Private Sub FillComboBox() + lstGameBox.ValueMember = "Key" + lstGameBox.DisplayMember = "Value" + For Each o As clsGame In Process.DuplicateList - oGamesList.Add(New KeyValuePair(Of String, String)(o.ID, o.Name)) + lstGameBox.Items.Add(New KeyValuePair(Of String, String)(o.ID, o.Name)) oGamesHash.Add(o.ID, o) Next - lstGameBox.ValueMember = "key" - lstGameBox.DisplayMember = "value" - lstGameBox.DataSource = oGamesList lstGameBox.SelectedIndex = 0 End Sub @@ -42,9 +41,8 @@ End Sub Private Sub GetSelection() - Dim sSelectedGame As String - sSelectedGame = CStr(lstGameBox.SelectedValue) - oGame = DirectCast(oGamesHash.Item(sSelectedGame), clsGame) + Dim oSelected As KeyValuePair(Of String, String) = lstGameBox.SelectedItem + oGame = DirectCast(oGamesHash.Item(oSelected.Key), clsGame) SaveSelection() bGameSelected = True Me.DialogResult = DialogResult.OK diff --git a/GBM/Game Backup Monitor.vbproj b/GBM/Game Backup Monitor.vbproj index 5465995..166084c 100644 --- a/GBM/Game Backup Monitor.vbproj +++ b/GBM/Game Backup Monitor.vbproj @@ -314,7 +314,9 @@ - + + PreserveNewest + PreserveNewest diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb index fef41bd..a5b5175 100644 --- a/GBM/Managers/mgrBackup.vb +++ b/GBM/Managers/mgrBackup.vb @@ -152,7 +152,7 @@ Public Class mgrBackup End If If oGame.FolderSave = True Then - BuildFileList(sSavePath, "*.*", mgrPath.IncludeFileLocation) + BuildFileList(sSavePath, "*", mgrPath.IncludeFileLocation) Else BuildFileList(sSavePath, oGame.FileType, mgrPath.IncludeFileLocation) End If diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index bbb0418..5f8269e 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -119,6 +119,7 @@ Public Class mgrMonitorList Dim oFromItem As clsGame Dim oToItem As clsGame Dim iChanges As Integer + Dim sCompareKey As String Cursor.Current = Cursors.WaitCursor @@ -140,10 +141,11 @@ Public Class mgrMonitorList hshSyncItems = hshCompareFrom.Clone For Each oFromItem In hshCompareFrom.Values - If hshCompareTo.Contains(oFromItem.ProcessName) Then - oToItem = DirectCast(hshCompareTo(oFromItem.ProcessName), clsGame) + sCompareKey = oFromItem.ProcessName & ":" & oFromItem.Name + If hshCompareTo.Contains(sCompareKey) Then + oToItem = DirectCast(hshCompareTo(sCompareKey), clsGame) If oFromItem.SyncEquals(oToItem) Then - hshSyncItems.Remove(oFromItem.ProcessName) + hshSyncItems.Remove(sCompareKey) End If End If Next @@ -171,10 +173,11 @@ Public Class mgrMonitorList hshDeleteItems = hshCompareTo.Clone For Each oToItem In hshCompareTo.Values - If hshCompareFrom.Contains(oToItem.ProcessName) Then - oFromItem = DirectCast(hshCompareFrom(oToItem.ProcessName), clsGame) + sCompareKey = oToItem.ProcessName & ":" & oToItem.Name + If hshCompareFrom.Contains(sCompareKey) Then + oFromItem = DirectCast(hshCompareFrom(sCompareKey), clsGame) If oToItem.MinimalEquals(oFromItem) Then - hshDeleteItems.Remove(oToItem.ProcessName) + hshDeleteItems.Remove(sCompareKey) End If End If Next @@ -196,6 +199,7 @@ Public Class mgrMonitorList Dim hshSyncItems As Hashtable Dim oFromItem As clsGame Dim oToItem As clsGame + Dim sCompareKey As String Cursor.Current = Cursors.WaitCursor @@ -206,10 +210,11 @@ Public Class mgrMonitorList hshSyncItems = hshCompareFrom.Clone For Each oFromItem In hshCompareFrom.Values - If hshCompareTo.Contains(oFromItem.ProcessName) Then - oToItem = DirectCast(hshCompareTo(oFromItem.ProcessName), clsGame) + sCompareKey = oFromItem.ProcessName & ":" & oFromItem.Name + If hshCompareTo.Contains(sCompareKey) Then + oToItem = DirectCast(hshCompareTo(sCompareKey), clsGame) If oFromItem.CoreEquals(oToItem) Then - hshSyncItems.Remove(oFromItem.ProcessName) + hshSyncItems.Remove(sCompareKey) End If End If Next @@ -257,7 +262,6 @@ Public Class mgrMonitorList Return True End Function - Public Shared Function ReadFilteredList(ByVal oFilters As List(Of clsTag), ByVal eFilterType As frmFilter.eFilterType, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable Dim oDatabase As New mgrSQLite(iSelectDB) Dim oData As DataSet @@ -333,7 +337,6 @@ Public Class mgrMonitorList Dim hshList As New Hashtable Dim hshDupeList As New Hashtable Dim oGame As clsGame - Dim oDupeGame As clsGame sSQL = "Select * from monitorlist ORDER BY Name Asc" oData = oDatabase.ReadParamData(sSQL, New Hashtable) @@ -359,27 +362,14 @@ Public Class mgrMonitorList Select Case eListType Case eListTypes.FullList - If hshList.Contains(oGame.ProcessName) Or hshDupeList.Contains(oGame.ProcessName) Then - oDupeGame = DirectCast(hshList.Item(oGame.ProcessName), clsGame) - If Not hshDupeList.Contains(oGame.ProcessName) Then - hshDupeList.Add(oGame.ProcessName, oDupeGame) - hshList.Remove(oDupeGame.ProcessName) - oDupeGame.Duplicate = True - oDupeGame.ProcessName = oDupeGame.ProcessName & ":" & oDupeGame.Name - hshList.Add(oDupeGame.ProcessName, oDupeGame) - End If - oGame.ProcessName = oGame.ProcessName & ":" & oGame.Name - oGame.Duplicate = True - End If - - hshList.Add(oGame.ProcessName, oGame) + 'Don't wrap this, if it fails there's a problem with the database + hshList.Add(oGame.ProcessName & ":" & oGame.Name, oGame) Case eListTypes.ScanList If hshList.Contains(oGame.ProcessName) Then DirectCast(hshList.Item(oGame.ProcessName), clsGame).Duplicate = True oGame.ProcessName = oGame.ProcessName & ":" & oGame.Name oGame.Duplicate = True End If - If oGame.Enabled Then hshList.Add(oGame.ProcessName, oGame) End Select Next diff --git a/GBM/Managers/mgrXML.vb b/GBM/Managers/mgrXML.vb index 4c1795d..6cf2912 100644 --- a/GBM/Managers/mgrXML.vb +++ b/GBM/Managers/mgrXML.vb @@ -10,7 +10,6 @@ Public Class mgrXML Dim hshList As New Hashtable Dim hshDupeList As New Hashtable Dim oGame As clsGame - Dim oDupeGame As clsGame 'If the file doesn't exist return an empty list If Not File.Exists(sLocation) And Not bWebRead Then @@ -32,20 +31,12 @@ Public Class mgrXML oGame.ImportTags.Add(t) Next - If hshList.Contains(oGame.ProcessName) Or hshDupeList.Contains(oGame.ProcessName) Then - oDupeGame = DirectCast(hshList.Item(oGame.ProcessName), clsGame) - If Not hshDupeList.Contains(oGame.ProcessName) Then - hshDupeList.Add(oGame.ProcessName, oDupeGame) - hshList.Remove(oDupeGame.ProcessName) - oDupeGame.Duplicate = True - oDupeGame.ProcessName = oDupeGame.ProcessName & ":" & oDupeGame.Name - hshList.Add(oDupeGame.ProcessName, oDupeGame) - End If - oGame.ProcessName = oGame.ProcessName & ":" & oGame.Name - oGame.Duplicate = True - End If - - hshList.Add(oGame.ProcessName, oGame) + 'This should be wrapped just in case we get some bad data + Try + hshList.Add(oGame.ProcessName & ":" & oGame.Name, oGame) + Catch e As Exception + 'Do Nothing + End Try Next Return hshList