Zooflow: Make it work

This commit is contained in:
Jonathan Jenne 2022-06-02 16:45:10 +02:00
parent ab7277a953
commit 923672e8df

View File

@ -17,7 +17,7 @@ Namespace Search
Private ReadOnly Images As SvgImageCollection Private ReadOnly Images As SvgImageCollection
Private ReadOnly Config As ConfigManager(Of UIConfig) Private ReadOnly Config As ConfigManager(Of UIConfig)
Private ReadOnly Serializer As New XmlSerializer(GetType(CustomSearch)) 'Private ReadOnly Serializer As New XmlSerializer(GetType(CustomSearch))
Public Property CustomSearches As List(Of CustomSearch) Public Property CustomSearches As List(Of CustomSearch)
@ -51,11 +51,11 @@ Namespace Search
} }
CustomSearches.Add(oSearch) CustomSearches.Add(oSearch)
Dim oDirectoryPath As String = GetSearchDirectoryPath() 'Dim oDirectoryPath As String = GetSearchDirectoryPath()
Dim oFilePath As String = IO.Path.Combine(oDirectoryPath, Utils.ConvertTextToSlug(pTitle)) 'Dim oFilePath As String = IO.Path.Combine(oDirectoryPath, Utils.ConvertTextToSlug(pTitle))
Dim oBuffer As Byte() = SerializeSearch(oSearch) 'Dim oBuffer As Byte() = SerializeSearch(oSearch)
IO.File.WriteAllBytes(oFilePath, oBuffer) 'IO.File.WriteAllBytes(oFilePath, oBuffer)
End Sub End Sub
Public Function LoadSearches() As List(Of SavedSearch) Public Function LoadSearches() As List(Of SavedSearch)
@ -120,28 +120,28 @@ Namespace Search
} }
End Function End Function
Private Function SerializeSearch(pSearch As CustomSearch) As Byte() 'Private Function SerializeSearch(pSearch As CustomSearch) As Byte()
Try ' Try
Using oStream As New MemoryStream ' Using oStream As New MemoryStream
Serializer.Serialize(oStream, pSearch) ' Serializer.Serialize(oStream, pSearch)
Return oStream.ToArray() ' Return oStream.ToArray()
End Using ' End Using
Catch ex As Exception ' Catch ex As Exception
Logger.Error(ex) ' Logger.Error(ex)
Return Nothing ' Return Nothing
End Try ' End Try
End Function 'End Function
Private Function DeserializeSearch(pBytes As Byte()) As CustomSearch 'Private Function DeserializeSearch(pBytes As Byte()) As CustomSearch
Try ' Try
Using oStream As New MemoryStream(pBytes) ' Using oStream As New MemoryStream(pBytes)
Return Serializer.Deserialize(oStream) ' Return Serializer.Deserialize(oStream)
End Using ' End Using
Catch ex As Exception ' Catch ex As Exception
Logger.Error(ex) ' Logger.Error(ex)
Return Nothing ' Return Nothing
End Try ' End Try
End Function 'End Function
Public Class PredefinedSQLSearch Public Class PredefinedSQLSearch
Public Property SQLCommand As String Public Property SQLCommand As String
@ -167,8 +167,7 @@ Namespace Search
Public Property Name As String Public Property Name As String
Public Property Description As String Public Property Description As String
Public Property Image As String Public Property Image As SvgImage
'Public Property Image As SvgImage
Public Property Count As Integer = 0 Public Property Count As Integer = 0
Public Overridable Property GroupText As String = "Vordefiniert" Public Overridable Property GroupText As String = "Vordefiniert"