34 lines
1.1 KiB
VB.net
34 lines
1.1 KiB
VB.net
Imports System.Net.Http
|
|
|
|
Imports ModpackUpdater.Model
|
|
|
|
Imports Newtonsoft.Json
|
|
|
|
Public Class UpdateConfigExt
|
|
|
|
'<Extension>
|
|
'Public Sub SaveToSnippet(config As UpdateConfig, gitlabUrl As String, gitlabToken As String, projectId As Integer, snippetId As Integer, snippetFilePath As String)
|
|
' Dim client As New GitLabClient(gitlabUrl, gitlabToken)
|
|
' Dim update As New SnippetProjectUpdate With {
|
|
' .Visibility = VisibilityLevel.Public,
|
|
' .ProjectId = projectId,
|
|
' .SnippetId = snippetId,
|
|
' .Files = {
|
|
' New SnippetUpdateFile With {
|
|
' .Action = SnippetUpdateFileAction.Update.Create,
|
|
' .FilePath = snippetFilePath,
|
|
' .Content = JsonConvert.SerializeObject(config)
|
|
' }
|
|
' }
|
|
' }
|
|
' client.Snippets.Update(update)
|
|
'End Sub
|
|
|
|
Public Shared Function LoadFromSnippet(url As String) As ModpackConfig
|
|
Dim client As New HttpClient
|
|
Dim result = client.GetStringAsync(url).Result
|
|
Return JsonConvert.DeserializeObject(Of ModpackConfig)(result)
|
|
End Function
|
|
|
|
End Class
|