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 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)
@ -51,11 +51,11 @@ Namespace Search
}
CustomSearches.Add(oSearch)
Dim oDirectoryPath As String = GetSearchDirectoryPath()
Dim oFilePath As String = IO.Path.Combine(oDirectoryPath, Utils.ConvertTextToSlug(pTitle))
Dim oBuffer As Byte() = SerializeSearch(oSearch)
'Dim oDirectoryPath As String = GetSearchDirectoryPath()
'Dim oFilePath As String = IO.Path.Combine(oDirectoryPath, Utils.ConvertTextToSlug(pTitle))
'Dim oBuffer As Byte() = SerializeSearch(oSearch)
IO.File.WriteAllBytes(oFilePath, oBuffer)
'IO.File.WriteAllBytes(oFilePath, oBuffer)
End Sub
Public Function LoadSearches() As List(Of SavedSearch)
@ -120,28 +120,28 @@ Namespace Search
}
End Function
Private Function SerializeSearch(pSearch As CustomSearch) As Byte()
Try
Using oStream As New MemoryStream
Serializer.Serialize(oStream, pSearch)
Return oStream.ToArray()
End Using
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
'Private Function SerializeSearch(pSearch As CustomSearch) As Byte()
' Try
' Using oStream As New MemoryStream
' Serializer.Serialize(oStream, pSearch)
' Return oStream.ToArray()
' End Using
' Catch ex As Exception
' Logger.Error(ex)
' Return Nothing
' End Try
'End Function
Private Function DeserializeSearch(pBytes As Byte()) As CustomSearch
Try
Using oStream As New MemoryStream(pBytes)
Return Serializer.Deserialize(oStream)
End Using
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
'Private Function DeserializeSearch(pBytes As Byte()) As CustomSearch
' Try
' Using oStream As New MemoryStream(pBytes)
' Return Serializer.Deserialize(oStream)
' End Using
' Catch ex As Exception
' Logger.Error(ex)
' Return Nothing
' End Try
'End Function
Public Class PredefinedSQLSearch
Public Property SQLCommand As String
@ -167,8 +167,7 @@ Namespace Search
Public Property Name 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 Overridable Property GroupText As String = "Vordefiniert"