Fixed serialize crash when using "Backups Only" and "New Backups Pending" filters in Linux
This commit is contained in:
@@ -342,7 +342,7 @@ Public Class frmGameManager
|
||||
oRestoreData = mgrRestore.CompareManifests
|
||||
|
||||
'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
|
||||
oGame = DirectCast(de.Value, clsGame)
|
||||
If Not oRestoreData.ContainsKey(oGame.ID) Then
|
||||
@@ -353,7 +353,7 @@ Public Class frmGameManager
|
||||
Next
|
||||
ElseIf optBackupData.Checked Then
|
||||
'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
|
||||
|
||||
For Each de As DictionaryEntry In oTemporaryList
|
||||
|
||||
@@ -43,28 +43,6 @@ Public Class mgrCommon
|
||||
End Get
|
||||
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
|
||||
Dim oImage As Image
|
||||
Dim oReturnImage As Image
|
||||
|
||||
Reference in New Issue
Block a user