support urls
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
Imports System.IO
|
||||
|
||||
Imports ModpackUpdater.GitLab
|
||||
|
||||
Imports ModpackUpdater.Manager
|
||||
|
||||
Imports ModpackUpdater.Model
|
||||
@@ -70,10 +72,17 @@ Public Class Form1
|
||||
|
||||
Private Sub LoadUpdateConfigFile(filePath As String)
|
||||
RadTextBoxControl_ModpackConfig.Text = filePath
|
||||
|
||||
If IsUpdateConfigLoaded() Then
|
||||
updateConfig = UpdateConfig.LoadFromFile(filePath)
|
||||
End If
|
||||
Try
|
||||
If IsUpdateConfigLoaded() Then
|
||||
If filePath.StartsWith("http") Then
|
||||
updateConfig = UpdateConfigExt.LoadFromSnippet(filePath)
|
||||
Else
|
||||
updateConfig = UpdateConfig.LoadFromFile(filePath)
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
RadTextBoxControl_ModpackConfig.Text = String.Empty
|
||||
End Try
|
||||
|
||||
If IsMinecaftProfileLoaded() Then
|
||||
RadButton_CheckForUpdates.PerformClick()
|
||||
@@ -93,7 +102,7 @@ Public Class Form1
|
||||
|
||||
Try
|
||||
lastUpdateCheckResult = Await updater.CheckForUpdates(Not AppConfig.Instance.AllowRemoveLocalFiles)
|
||||
Catch
|
||||
Catch ex As Exception
|
||||
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px)
|
||||
Finally
|
||||
End Try
|
||||
@@ -144,14 +153,22 @@ Public Class Form1
|
||||
End Sub
|
||||
|
||||
Private Sub ButtonX_SearchUpdateConfig_Click(sender As Object, e As EventArgs) Handles RadButton_SearchModpackConfig.Click
|
||||
Dim ofd As New RadOpenFileDialog
|
||||
ofd.Filter = FiledialogFilters.JSON_Display & "|" & FiledialogFilters.JSON_Filter
|
||||
Dim ofd As New RadOpenFileDialog With {
|
||||
.Filter = FiledialogFilters.JSON_Display & "|" & FiledialogFilters.JSON_Filter
|
||||
}
|
||||
|
||||
If ofd.ShowDialog(Me) = DialogResult.OK Then
|
||||
LoadUpdateConfigFile(ofd.FileName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub RadButton_PasteModpackConfig_Click(sender As Object, e As EventArgs) Handles RadButton_PasteModpackConfig.Click
|
||||
Dim text = Clipboard.GetText
|
||||
If text.StartsWith("http") Then
|
||||
LoadUpdateConfigFile(text)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ButtonX_EditUpdateConfig_Click(sender As Object, e As EventArgs) Handles RadButton_EditModpackConfig.Click
|
||||
Dim frm As New FormSettings(updateConfig)
|
||||
frm.ShowDialog(Me)
|
||||
@@ -183,9 +200,7 @@ Public Class Form1
|
||||
If Directory.Exists(AppConfig.Instance.LastMinecraftProfilePath) Then
|
||||
LoadMinecraftProfile(AppConfig.Instance.LastMinecraftProfilePath)
|
||||
End If
|
||||
If File.Exists(AppConfig.Instance.LastConfigFilePath) Then
|
||||
LoadUpdateConfigFile(AppConfig.Instance.LastConfigFilePath)
|
||||
End If
|
||||
LoadUpdateConfigFile(AppConfig.Instance.LastConfigFilePath)
|
||||
End Sub
|
||||
|
||||
Private Async Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
@@ -196,4 +211,5 @@ Public Class Form1
|
||||
Application.Restart()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user