Fixed serialize crash when using "Backups Only" and "New Backups Pending" filters in Linux

This commit is contained in:
Michael J. Seiferling
2019-02-27 18:17:06 -06:00
parent 2682274e57
commit dec4c3d0b8
2 changed files with 2 additions and 24 deletions
+2 -2
View File
@@ -342,7 +342,7 @@ Public Class frmGameManager
oRestoreData = mgrRestore.CompareManifests oRestoreData = mgrRestore.CompareManifests
'Only show games with data to restore 'Only show games with data to restore
Dim oTemporaryList As OrderedDictionary = mgrCommon.GenericClone(GameData) Dim oTemporaryList As OrderedDictionary = mgrMonitorList.ReadFilteredList(oCurrentIncludeTagFilters, oCurrentExcludeTagFilters, oCurrentFilters, eCurrentFilter, bCurrentAndOperator, bCurrentSortAsc, sCurrentSortField)
For Each de As DictionaryEntry In oTemporaryList For Each de As DictionaryEntry In oTemporaryList
oGame = DirectCast(de.Value, clsGame) oGame = DirectCast(de.Value, clsGame)
If Not oRestoreData.ContainsKey(oGame.ID) Then If Not oRestoreData.ContainsKey(oGame.ID) Then
@@ -353,7 +353,7 @@ Public Class frmGameManager
Next Next
ElseIf optBackupData.Checked Then ElseIf optBackupData.Checked Then
'Only show games with backup data 'Only show games with backup data
Dim oTemporaryList As OrderedDictionary = mgrCommon.GenericClone(GameData) Dim oTemporaryList As OrderedDictionary = mgrMonitorList.ReadFilteredList(oCurrentIncludeTagFilters, oCurrentExcludeTagFilters, oCurrentFilters, eCurrentFilter, bCurrentAndOperator, bCurrentSortAsc, sCurrentSortField)
oRestoreData = oRemoteBackupData.Clone oRestoreData = oRemoteBackupData.Clone
For Each de As DictionaryEntry In oTemporaryList For Each de As DictionaryEntry In oTemporaryList
-22
View File
@@ -43,28 +43,6 @@ Public Class mgrCommon
End Get End Get
End Property End Property
'Source - https://stackoverflow.com/questions/18873152/deep-copy-of-ordereddictionary
Public Shared Function GenericClone(ByVal oOriginal As Object) As Object
'Construct a temporary memory stream
Dim oStream As MemoryStream = New MemoryStream()
'Construct a serialization formatter that does all the hard work
Dim oFormatter As BinaryFormatter = New BinaryFormatter()
'This line Is explained in the "Streaming Contexts" section
oFormatter.Context = New StreamingContext(StreamingContextStates.Clone)
'Serialize the object graph into the memory stream
oFormatter.Serialize(oStream, oOriginal)
'Seek back to the start of the memory stream before deserializing
oStream.Position = 0
'Deserialize the graph into a New set of objects
'Return the root of the graph (deep copy) to the caller
Return oFormatter.Deserialize(oStream)
End Function
Public Shared Function SafeIconFromFile(ByVal sPath As String) As Image Public Shared Function SafeIconFromFile(ByVal sPath As String) As Image
Dim oImage As Image Dim oImage As Image
Dim oReturnImage As Image Dim oReturnImage As Image