install: begin rework

This commit is contained in:
2024-06-17 17:20:02 +02:00
parent 96c178b310
commit 99b1db952b
15 changed files with 64 additions and 4358 deletions

View File

@@ -0,0 +1,9 @@
Imports Newtonsoft.Json.Converters
Public Class InstallAction
Public Property DestPath As String
Public Property DownloadUrl As String
Public Property IsZip As Boolean
End Class

View File

@@ -0,0 +1,11 @@
Imports Newtonsoft.Json
Public Class InstallInfos
Public ReadOnly Property Actions As New List(Of InstallAction)
Public Shared Function Parse(content As String) As InstallInfos
Return JsonConvert.DeserializeObject(Of InstallInfos)(content)
End Function
End Class

View File

@@ -0,0 +1,15 @@
Imports System.Net.Http
Imports Newtonsoft.Json
Public Class ModpackConfig
Public Property UpdateUrl As String
Public Property InstallUrl As String
Public Shared Function LoadFromUrl(url As String)
Dim result As String = New HttpClient().GetStringAsync(url).Result
Return JsonConvert.DeserializeObject(Of ModpackConfig)(result)
End Function
End Class

View File

@@ -1,22 +0,0 @@
Imports System.IO
Imports Newtonsoft.Json
Imports Pilz.Cryptography
Public Class UpdateConfig
Public Property UpdateUrl As String
Public Property WebdavURL As SecureString
Public Property WebdavUsername As SecureString
Public Property WebdavPassword As SecureString
Public Sub SaveToFile(filePath As String)
File.WriteAllText(filePath, JsonConvert.SerializeObject(Me))
End Sub
Public Shared Function LoadFromFile(filePath As String) As UpdateConfig
Return JsonConvert.DeserializeObject(Of UpdateConfig)(File.ReadAllText(filePath))
End Function
End Class