From bbac69b79e6e9414b7ee569ff375bbca2ff5148f Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Mon, 17 Jun 2024 16:55:31 +0200 Subject: [PATCH] support urls --- .../ModpackUpdater.GitLab.vbproj | 12 + ModpackUpdater.GitLab/UpdateConfigExt.vb | 33 ++ ModpackUpdater.sln | 10 +- ModpackUpdater/AppConfig.vb | 1 - ModpackUpdater/Form1.Designer.vb | 413 +++++++++--------- ModpackUpdater/Form1.resx | 72 ++- ModpackUpdater/Form1.vb | 36 +- ModpackUpdater/ModpackUpdater.vbproj | 1 + 8 files changed, 363 insertions(+), 215 deletions(-) create mode 100644 ModpackUpdater.GitLab/ModpackUpdater.GitLab.vbproj create mode 100644 ModpackUpdater.GitLab/UpdateConfigExt.vb diff --git a/ModpackUpdater.GitLab/ModpackUpdater.GitLab.vbproj b/ModpackUpdater.GitLab/ModpackUpdater.GitLab.vbproj new file mode 100644 index 0000000..36ae3a6 --- /dev/null +++ b/ModpackUpdater.GitLab/ModpackUpdater.GitLab.vbproj @@ -0,0 +1,12 @@ + + + + ModpackUpdater.GitLab + net8.0 + + + + + + + diff --git a/ModpackUpdater.GitLab/UpdateConfigExt.vb b/ModpackUpdater.GitLab/UpdateConfigExt.vb new file mode 100644 index 0000000..4e2cda3 --- /dev/null +++ b/ModpackUpdater.GitLab/UpdateConfigExt.vb @@ -0,0 +1,33 @@ +Imports System.Net.Http + +Imports ModpackUpdater.Model + +Imports Newtonsoft.Json + +Public Class UpdateConfigExt + + ' + '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 UpdateConfig + Dim client As New HttpClient + Dim result = client.GetStringAsync(url).Result + Return JsonConvert.DeserializeObject(Of UpdateConfig)(result) + End Function + +End Class diff --git a/ModpackUpdater.sln b/ModpackUpdater.sln index 7290800..6c770eb 100644 --- a/ModpackUpdater.sln +++ b/ModpackUpdater.sln @@ -5,9 +5,11 @@ VisualStudioVersion = 17.2.32526.322 MinimumVisualStudioVersion = 10.0.40219.1 Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ModpackUpdater", "ModpackUpdater\ModpackUpdater.vbproj", "{33DD239C-1F33-40F9-908F-54BC02FBA420}" EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ModpackUpdater.Model", "ModpackUpdater.Model\ModpackUpdater.Model.vbproj", "{BC4FE51B-4045-432C-B4D9-8C6CF5372DC0}" +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ModpackUpdater.Model", "ModpackUpdater.Model\ModpackUpdater.Model.vbproj", "{BC4FE51B-4045-432C-B4D9-8C6CF5372DC0}" EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ModpackUpdater.Manager", "ModpackUpdater.Manager\ModpackUpdater.Manager.vbproj", "{618DAFD6-3336-4621-82F9-EA5C783D2D2E}" +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ModpackUpdater.Manager", "ModpackUpdater.Manager\ModpackUpdater.Manager.vbproj", "{618DAFD6-3336-4621-82F9-EA5C783D2D2E}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ModpackUpdater.GitLab", "ModpackUpdater.GitLab\ModpackUpdater.GitLab.vbproj", "{65D44991-EB3B-4AC4-9166-3E8D0BADD402}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,6 +29,10 @@ Global {618DAFD6-3336-4621-82F9-EA5C783D2D2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {618DAFD6-3336-4621-82F9-EA5C783D2D2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {618DAFD6-3336-4621-82F9-EA5C783D2D2E}.Release|Any CPU.Build.0 = Release|Any CPU + {65D44991-EB3B-4AC4-9166-3E8D0BADD402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65D44991-EB3B-4AC4-9166-3E8D0BADD402}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65D44991-EB3B-4AC4-9166-3E8D0BADD402}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65D44991-EB3B-4AC4-9166-3E8D0BADD402}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ModpackUpdater/AppConfig.vb b/ModpackUpdater/AppConfig.vb index c153e44..5752e1f 100644 --- a/ModpackUpdater/AppConfig.vb +++ b/ModpackUpdater/AppConfig.vb @@ -1,6 +1,5 @@ Imports System.IO -Imports Newtonsoft.Json Imports Newtonsoft.Json.Linq Public Class AppConfig diff --git a/ModpackUpdater/Form1.Designer.vb b/ModpackUpdater/Form1.Designer.vb index 2970d8d..1636458 100644 --- a/ModpackUpdater/Form1.Designer.vb +++ b/ModpackUpdater/Form1.Designer.vb @@ -24,207 +24,217 @@ Partial Class Form1 _ Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1)) - Me.RadLabel1 = New Telerik.WinControls.UI.RadLabel() - Me.RadLabel2 = New Telerik.WinControls.UI.RadLabel() - Me.RadLabel3 = New Telerik.WinControls.UI.RadLabel() - Me.RadLabel_Status = New Telerik.WinControls.UI.RadLabel() - Me.RadTextBoxControl_MinecraftProfileFolder = New Telerik.WinControls.UI.RadTextBoxControl() - Me.RadTextBoxControl_ModpackConfig = New Telerik.WinControls.UI.RadTextBoxControl() - Me.Panel1 = New System.Windows.Forms.Panel() - Me.RadButton_Install = New Telerik.WinControls.UI.RadButton() - Me.RadButton_CheckForUpdates = New Telerik.WinControls.UI.RadButton() - Me.RadButton_EditModpackConfig = New Telerik.WinControls.UI.RadButton() - Me.RadButton_SearchModpackConfig = New Telerik.WinControls.UI.RadButton() - Me.RadButton_SearchMinecraftProfileFolder = New Telerik.WinControls.UI.RadButton() - CType(Me.RadLabel1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadLabel2, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadLabel3, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadLabel_Status, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadTextBoxControl_MinecraftProfileFolder, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadTextBoxControl_ModpackConfig, System.ComponentModel.ISupportInitialize).BeginInit() - Me.Panel1.SuspendLayout() - CType(Me.RadButton_Install, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadButton_CheckForUpdates, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadButton_EditModpackConfig, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadButton_SearchModpackConfig, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadButton_SearchMinecraftProfileFolder, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me, System.ComponentModel.ISupportInitialize).BeginInit() - Me.SuspendLayout() - ' - 'RadLabel1 - ' - Me.RadLabel1.Location = New System.Drawing.Point(3, 5) - Me.RadLabel1.Name = "RadLabel1" - Me.RadLabel1.Size = New System.Drawing.Size(135, 19) - Me.RadLabel1.TabIndex = 0 - Me.RadLabel1.Text = "Minecraft profile folder:" - ' - 'RadLabel2 - ' - Me.RadLabel2.Location = New System.Drawing.Point(3, 63) - Me.RadLabel2.Name = "RadLabel2" - Me.RadLabel2.Size = New System.Drawing.Size(98, 19) - Me.RadLabel2.TabIndex = 1 - Me.RadLabel2.Text = "Modpack config:" - ' - 'RadLabel3 - ' - Me.RadLabel3.Location = New System.Drawing.Point(3, 121) - Me.RadLabel3.Name = "RadLabel3" - Me.RadLabel3.Size = New System.Drawing.Size(43, 19) - Me.RadLabel3.TabIndex = 2 - Me.RadLabel3.Text = "Status:" - ' - 'RadLabel_Status - ' - Me.RadLabel_Status.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.RadLabel_Status.AutoSize = False - Me.RadLabel_Status.Location = New System.Drawing.Point(144, 119) - Me.RadLabel_Status.Name = "RadLabel_Status" - Me.RadLabel_Status.Size = New System.Drawing.Size(273, 22) - Me.RadLabel_Status.TabIndex = 3 - Me.RadLabel_Status.Text = "-" - Me.RadLabel_Status.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText - ' - 'RadTextBoxControl_MinecraftProfileFolder - ' - Me.RadTextBoxControl_MinecraftProfileFolder.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.RadTextBoxControl_MinecraftProfileFolder.IsReadOnly = True - Me.RadTextBoxControl_MinecraftProfileFolder.Location = New System.Drawing.Point(144, 3) - Me.RadTextBoxControl_MinecraftProfileFolder.Name = "RadTextBoxControl_MinecraftProfileFolder" - Me.RadTextBoxControl_MinecraftProfileFolder.NullText = "No file loaded!" - Me.RadTextBoxControl_MinecraftProfileFolder.Size = New System.Drawing.Size(273, 22) - Me.RadTextBoxControl_MinecraftProfileFolder.TabIndex = 4 - ' - 'RadTextBoxControl_ModpackConfig - ' - Me.RadTextBoxControl_ModpackConfig.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.RadTextBoxControl_ModpackConfig.IsReadOnly = True - Me.RadTextBoxControl_ModpackConfig.Location = New System.Drawing.Point(144, 61) - Me.RadTextBoxControl_ModpackConfig.Name = "RadTextBoxControl_ModpackConfig" - Me.RadTextBoxControl_ModpackConfig.NullText = "No file loaded!" - Me.RadTextBoxControl_ModpackConfig.Size = New System.Drawing.Size(273, 22) - Me.RadTextBoxControl_ModpackConfig.TabIndex = 5 - ' - 'Panel1 - ' - Me.Panel1.BackColor = System.Drawing.Color.Transparent - Me.Panel1.Controls.Add(Me.RadButton_Install) - Me.Panel1.Controls.Add(Me.RadButton_CheckForUpdates) - Me.Panel1.Controls.Add(Me.RadButton_EditModpackConfig) - Me.Panel1.Controls.Add(Me.RadButton_SearchModpackConfig) - Me.Panel1.Controls.Add(Me.RadButton_SearchMinecraftProfileFolder) - Me.Panel1.Controls.Add(Me.RadLabel1) - Me.Panel1.Controls.Add(Me.RadTextBoxControl_ModpackConfig) - Me.Panel1.Controls.Add(Me.RadLabel2) - Me.Panel1.Controls.Add(Me.RadTextBoxControl_MinecraftProfileFolder) - Me.Panel1.Controls.Add(Me.RadLabel3) - Me.Panel1.Controls.Add(Me.RadLabel_Status) - Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill - Me.Panel1.Location = New System.Drawing.Point(0, 0) - Me.Panel1.Name = "Panel1" - Me.Panel1.Size = New System.Drawing.Size(420, 176) - Me.Panel1.TabIndex = 6 - ' - 'RadButton_Install - ' - Me.RadButton_Install.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.RadButton_Install.Image = Global.ModpackUpdater.My.Resources.MySymbols.icons8_software_installer_16px - Me.RadButton_Install.ImageAlignment = System.Drawing.ContentAlignment.MiddleRight - Me.RadButton_Install.Location = New System.Drawing.Point(337, 149) - Me.RadButton_Install.Name = "RadButton_Install" - Me.RadButton_Install.Size = New System.Drawing.Size(80, 24) - Me.RadButton_Install.TabIndex = 10 - Me.RadButton_Install.Text = "Install" - Me.RadButton_Install.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft - Me.RadButton_Install.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText - ' - 'RadButton_CheckForUpdates - ' - Me.RadButton_CheckForUpdates.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.RadButton_CheckForUpdates.Image = Global.ModpackUpdater.My.Resources.MySymbols.icons8_update_16px - Me.RadButton_CheckForUpdates.ImageAlignment = System.Drawing.ContentAlignment.MiddleRight - Me.RadButton_CheckForUpdates.Location = New System.Drawing.Point(191, 149) - Me.RadButton_CheckForUpdates.Name = "RadButton_CheckForUpdates" - Me.RadButton_CheckForUpdates.Size = New System.Drawing.Size(140, 24) - Me.RadButton_CheckForUpdates.TabIndex = 0 - Me.RadButton_CheckForUpdates.Text = "Check for Updates" - Me.RadButton_CheckForUpdates.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft - Me.RadButton_CheckForUpdates.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText - ' - 'RadButton_EditModpackConfig - ' - Me.RadButton_EditModpackConfig.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) - Me.RadButton_EditModpackConfig.Image = Global.ModpackUpdater.My.Resources.MySymbols.icons8_wrench_16px - Me.RadButton_EditModpackConfig.ImageAlignment = System.Drawing.ContentAlignment.MiddleRight - Me.RadButton_EditModpackConfig.Location = New System.Drawing.Point(3, 149) - Me.RadButton_EditModpackConfig.Name = "RadButton_EditModpackConfig" - Me.RadButton_EditModpackConfig.Size = New System.Drawing.Size(150, 24) - Me.RadButton_EditModpackConfig.TabIndex = 8 - Me.RadButton_EditModpackConfig.Text = "Edit modpack config" - Me.RadButton_EditModpackConfig.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft - Me.RadButton_EditModpackConfig.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText - ' - 'RadButton_SearchModpackConfig - ' - Me.RadButton_SearchModpackConfig.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.RadButton_SearchModpackConfig.Image = CType(resources.GetObject("RadButton_SearchModpackConfig.Image"), System.Drawing.Image) - Me.RadButton_SearchModpackConfig.ImageAlignment = System.Drawing.ContentAlignment.MiddleRight - Me.RadButton_SearchModpackConfig.Location = New System.Drawing.Point(327, 89) - Me.RadButton_SearchModpackConfig.Name = "RadButton_SearchModpackConfig" - Me.RadButton_SearchModpackConfig.Size = New System.Drawing.Size(90, 24) - Me.RadButton_SearchModpackConfig.TabIndex = 7 - Me.RadButton_SearchModpackConfig.Text = "Search" - Me.RadButton_SearchModpackConfig.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft - Me.RadButton_SearchModpackConfig.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText - ' - 'RadButton_SearchMinecraftProfileFolder - ' - Me.RadButton_SearchMinecraftProfileFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.RadButton_SearchMinecraftProfileFolder.Image = CType(resources.GetObject("RadButton_SearchMinecraftProfileFolder.Image"), System.Drawing.Image) - Me.RadButton_SearchMinecraftProfileFolder.ImageAlignment = System.Drawing.ContentAlignment.MiddleRight - Me.RadButton_SearchMinecraftProfileFolder.Location = New System.Drawing.Point(327, 31) - Me.RadButton_SearchMinecraftProfileFolder.Name = "RadButton_SearchMinecraftProfileFolder" - Me.RadButton_SearchMinecraftProfileFolder.Size = New System.Drawing.Size(90, 24) - Me.RadButton_SearchMinecraftProfileFolder.TabIndex = 6 - Me.RadButton_SearchMinecraftProfileFolder.Text = "Search" - Me.RadButton_SearchMinecraftProfileFolder.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft - Me.RadButton_SearchMinecraftProfileFolder.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText - ' - 'Form1 - ' - Me.AutoScaleBaseSize = New System.Drawing.Size(7, 15) - Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(420, 176) - Me.Controls.Add(Me.Panel1) - Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) - Me.MaximizeBox = False - Me.Name = "Form1" - ' - ' - ' - Me.RootElement.ApplyShapeToControl = True - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Minecraft Modpack Updater" - CType(Me.RadLabel1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadLabel2, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadLabel3, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadLabel_Status, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadTextBoxControl_MinecraftProfileFolder, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadTextBoxControl_ModpackConfig, System.ComponentModel.ISupportInitialize).EndInit() - Me.Panel1.ResumeLayout(False) - Me.Panel1.PerformLayout() - CType(Me.RadButton_Install, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadButton_CheckForUpdates, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadButton_EditModpackConfig, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadButton_SearchModpackConfig, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadButton_SearchMinecraftProfileFolder, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me, System.ComponentModel.ISupportInitialize).EndInit() - Me.ResumeLayout(False) + RadLabel1 = New Telerik.WinControls.UI.RadLabel() + RadLabel2 = New Telerik.WinControls.UI.RadLabel() + RadLabel3 = New Telerik.WinControls.UI.RadLabel() + RadLabel_Status = New Telerik.WinControls.UI.RadLabel() + RadTextBoxControl_MinecraftProfileFolder = New Telerik.WinControls.UI.RadTextBoxControl() + RadTextBoxControl_ModpackConfig = New Telerik.WinControls.UI.RadTextBoxControl() + Panel1 = New Panel() + RadButton_Install = New Telerik.WinControls.UI.RadButton() + RadButton_CheckForUpdates = New Telerik.WinControls.UI.RadButton() + RadButton_EditModpackConfig = New Telerik.WinControls.UI.RadButton() + RadButton_SearchModpackConfig = New Telerik.WinControls.UI.RadButton() + RadButton_SearchMinecraftProfileFolder = New Telerik.WinControls.UI.RadButton() + RadButton_PasteModpackConfig = New Telerik.WinControls.UI.RadButton() + CType(RadLabel1, ComponentModel.ISupportInitialize).BeginInit() + CType(RadLabel2, ComponentModel.ISupportInitialize).BeginInit() + CType(RadLabel3, ComponentModel.ISupportInitialize).BeginInit() + CType(RadLabel_Status, ComponentModel.ISupportInitialize).BeginInit() + CType(RadTextBoxControl_MinecraftProfileFolder, ComponentModel.ISupportInitialize).BeginInit() + CType(RadTextBoxControl_ModpackConfig, ComponentModel.ISupportInitialize).BeginInit() + Panel1.SuspendLayout() + CType(RadButton_Install, ComponentModel.ISupportInitialize).BeginInit() + CType(RadButton_CheckForUpdates, ComponentModel.ISupportInitialize).BeginInit() + CType(RadButton_EditModpackConfig, ComponentModel.ISupportInitialize).BeginInit() + CType(RadButton_SearchModpackConfig, ComponentModel.ISupportInitialize).BeginInit() + CType(RadButton_SearchMinecraftProfileFolder, ComponentModel.ISupportInitialize).BeginInit() + CType(RadButton_PasteModpackConfig, ComponentModel.ISupportInitialize).BeginInit() + CType(Me, ComponentModel.ISupportInitialize).BeginInit() + SuspendLayout() + ' + ' RadLabel1 + ' + RadLabel1.Location = New Point(3, 5) + RadLabel1.Name = "RadLabel1" + RadLabel1.Size = New Size(124, 18) + RadLabel1.TabIndex = 0 + RadLabel1.Text = "Minecraft profile folder:" + ' + ' RadLabel2 + ' + RadLabel2.Location = New Point(3, 63) + RadLabel2.Name = "RadLabel2" + RadLabel2.Size = New Size(90, 18) + RadLabel2.TabIndex = 1 + RadLabel2.Text = "Modpack config:" + ' + ' RadLabel3 + ' + RadLabel3.Location = New Point(3, 121) + RadLabel3.Name = "RadLabel3" + RadLabel3.Size = New Size(39, 18) + RadLabel3.TabIndex = 2 + RadLabel3.Text = "Status:" + ' + ' RadLabel_Status + ' + RadLabel_Status.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right + RadLabel_Status.AutoSize = False + RadLabel_Status.Location = New Point(144, 119) + RadLabel_Status.Name = "RadLabel_Status" + RadLabel_Status.Size = New Size(273, 22) + RadLabel_Status.TabIndex = 3 + RadLabel_Status.Text = "-" + RadLabel_Status.TextImageRelation = TextImageRelation.ImageBeforeText + ' + ' RadTextBoxControl_MinecraftProfileFolder + ' + RadTextBoxControl_MinecraftProfileFolder.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right + RadTextBoxControl_MinecraftProfileFolder.IsReadOnly = True + RadTextBoxControl_MinecraftProfileFolder.Location = New Point(144, 3) + RadTextBoxControl_MinecraftProfileFolder.Name = "RadTextBoxControl_MinecraftProfileFolder" + RadTextBoxControl_MinecraftProfileFolder.NullText = "No file loaded!" + RadTextBoxControl_MinecraftProfileFolder.Size = New Size(273, 22) + RadTextBoxControl_MinecraftProfileFolder.TabIndex = 4 + ' + ' RadTextBoxControl_ModpackConfig + ' + RadTextBoxControl_ModpackConfig.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right + RadTextBoxControl_ModpackConfig.IsReadOnly = True + RadTextBoxControl_ModpackConfig.Location = New Point(144, 61) + RadTextBoxControl_ModpackConfig.Name = "RadTextBoxControl_ModpackConfig" + RadTextBoxControl_ModpackConfig.NullText = "No file loaded!" + RadTextBoxControl_ModpackConfig.Size = New Size(273, 22) + RadTextBoxControl_ModpackConfig.TabIndex = 5 + ' + ' Panel1 + ' + Panel1.BackColor = Color.Transparent + Panel1.Controls.Add(RadButton_Install) + Panel1.Controls.Add(RadButton_CheckForUpdates) + Panel1.Controls.Add(RadButton_EditModpackConfig) + Panel1.Controls.Add(RadButton_PasteModpackConfig) + Panel1.Controls.Add(RadButton_SearchModpackConfig) + Panel1.Controls.Add(RadButton_SearchMinecraftProfileFolder) + Panel1.Controls.Add(RadLabel1) + Panel1.Controls.Add(RadTextBoxControl_ModpackConfig) + Panel1.Controls.Add(RadLabel2) + Panel1.Controls.Add(RadTextBoxControl_MinecraftProfileFolder) + Panel1.Controls.Add(RadLabel3) + Panel1.Controls.Add(RadLabel_Status) + Panel1.Dock = DockStyle.Fill + Panel1.Location = New Point(0, 0) + Panel1.Name = "Panel1" + Panel1.Size = New Size(420, 176) + Panel1.TabIndex = 6 + ' + ' RadButton_Install + ' + RadButton_Install.Anchor = AnchorStyles.Bottom Or AnchorStyles.Right + RadButton_Install.Image = My.Resources.MySymbols.icons8_software_installer_16px + RadButton_Install.ImageAlignment = ContentAlignment.MiddleRight + RadButton_Install.Location = New Point(337, 149) + RadButton_Install.Name = "RadButton_Install" + RadButton_Install.Size = New Size(80, 24) + RadButton_Install.TabIndex = 10 + RadButton_Install.Text = "Install" + RadButton_Install.TextAlignment = ContentAlignment.MiddleLeft + RadButton_Install.TextImageRelation = TextImageRelation.ImageBeforeText + ' + ' RadButton_CheckForUpdates + ' + RadButton_CheckForUpdates.Anchor = AnchorStyles.Bottom Or AnchorStyles.Right + RadButton_CheckForUpdates.Image = My.Resources.MySymbols.icons8_update_16px + RadButton_CheckForUpdates.ImageAlignment = ContentAlignment.MiddleRight + RadButton_CheckForUpdates.Location = New Point(191, 149) + RadButton_CheckForUpdates.Name = "RadButton_CheckForUpdates" + RadButton_CheckForUpdates.Size = New Size(140, 24) + RadButton_CheckForUpdates.TabIndex = 0 + RadButton_CheckForUpdates.Text = "Check for Updates" + RadButton_CheckForUpdates.TextAlignment = ContentAlignment.MiddleLeft + RadButton_CheckForUpdates.TextImageRelation = TextImageRelation.ImageBeforeText + ' + ' RadButton_EditModpackConfig + ' + RadButton_EditModpackConfig.Anchor = AnchorStyles.Bottom Or AnchorStyles.Left + RadButton_EditModpackConfig.Image = My.Resources.MySymbols.icons8_wrench_16px + RadButton_EditModpackConfig.ImageAlignment = ContentAlignment.MiddleRight + RadButton_EditModpackConfig.Location = New Point(3, 149) + RadButton_EditModpackConfig.Name = "RadButton_EditModpackConfig" + RadButton_EditModpackConfig.Size = New Size(150, 24) + RadButton_EditModpackConfig.TabIndex = 8 + RadButton_EditModpackConfig.Text = "Edit modpack config" + RadButton_EditModpackConfig.TextAlignment = ContentAlignment.MiddleLeft + RadButton_EditModpackConfig.TextImageRelation = TextImageRelation.ImageBeforeText + ' + ' RadButton_SearchModpackConfig + ' + RadButton_SearchModpackConfig.Anchor = AnchorStyles.Top Or AnchorStyles.Right + RadButton_SearchModpackConfig.Image = CType(resources.GetObject("RadButton_SearchModpackConfig.Image"), Image) + RadButton_SearchModpackConfig.ImageAlignment = ContentAlignment.MiddleRight + RadButton_SearchModpackConfig.Location = New Point(327, 89) + RadButton_SearchModpackConfig.Name = "RadButton_SearchModpackConfig" + RadButton_SearchModpackConfig.Size = New Size(90, 24) + RadButton_SearchModpackConfig.TabIndex = 7 + RadButton_SearchModpackConfig.Text = "Search" + RadButton_SearchModpackConfig.TextAlignment = ContentAlignment.MiddleLeft + RadButton_SearchModpackConfig.TextImageRelation = TextImageRelation.ImageBeforeText + ' + ' RadButton_SearchMinecraftProfileFolder + ' + RadButton_SearchMinecraftProfileFolder.Anchor = AnchorStyles.Top Or AnchorStyles.Right + RadButton_SearchMinecraftProfileFolder.Image = CType(resources.GetObject("RadButton_SearchMinecraftProfileFolder.Image"), Image) + RadButton_SearchMinecraftProfileFolder.ImageAlignment = ContentAlignment.MiddleRight + RadButton_SearchMinecraftProfileFolder.Location = New Point(327, 31) + RadButton_SearchMinecraftProfileFolder.Name = "RadButton_SearchMinecraftProfileFolder" + RadButton_SearchMinecraftProfileFolder.Size = New Size(90, 24) + RadButton_SearchMinecraftProfileFolder.TabIndex = 6 + RadButton_SearchMinecraftProfileFolder.Text = "Search" + RadButton_SearchMinecraftProfileFolder.TextAlignment = ContentAlignment.MiddleLeft + RadButton_SearchMinecraftProfileFolder.TextImageRelation = TextImageRelation.ImageBeforeText + ' + ' RadButton_PasteModpackConfig + ' + RadButton_PasteModpackConfig.Anchor = AnchorStyles.Top Or AnchorStyles.Right + RadButton_PasteModpackConfig.Image = CType(resources.GetObject("RadButton_PasteModpackConfig.Image"), Image) + RadButton_PasteModpackConfig.ImageAlignment = ContentAlignment.MiddleRight + RadButton_PasteModpackConfig.Location = New Point(231, 89) + RadButton_PasteModpackConfig.Name = "RadButton_PasteModpackConfig" + RadButton_PasteModpackConfig.Size = New Size(90, 24) + RadButton_PasteModpackConfig.TabIndex = 7 + RadButton_PasteModpackConfig.Text = "Paste" + RadButton_PasteModpackConfig.TextAlignment = ContentAlignment.MiddleLeft + RadButton_PasteModpackConfig.TextImageRelation = TextImageRelation.ImageBeforeText + ' + ' Form1 + ' + AutoScaleBaseSize = New Size(7, 15) + AutoScaleDimensions = New SizeF(7F, 15F) + AutoScaleMode = AutoScaleMode.Font + ClientSize = New Size(420, 176) + Controls.Add(Panel1) + Icon = CType(resources.GetObject("$this.Icon"), Icon) + MaximizeBox = False + Name = "Form1" + StartPosition = FormStartPosition.CenterScreen + Text = "Minecraft Modpack Updater" + CType(RadLabel1, ComponentModel.ISupportInitialize).EndInit() + CType(RadLabel2, ComponentModel.ISupportInitialize).EndInit() + CType(RadLabel3, ComponentModel.ISupportInitialize).EndInit() + CType(RadLabel_Status, ComponentModel.ISupportInitialize).EndInit() + CType(RadTextBoxControl_MinecraftProfileFolder, ComponentModel.ISupportInitialize).EndInit() + CType(RadTextBoxControl_ModpackConfig, ComponentModel.ISupportInitialize).EndInit() + Panel1.ResumeLayout(False) + Panel1.PerformLayout() + CType(RadButton_Install, ComponentModel.ISupportInitialize).EndInit() + CType(RadButton_CheckForUpdates, ComponentModel.ISupportInitialize).EndInit() + CType(RadButton_EditModpackConfig, ComponentModel.ISupportInitialize).EndInit() + CType(RadButton_SearchModpackConfig, ComponentModel.ISupportInitialize).EndInit() + CType(RadButton_SearchMinecraftProfileFolder, ComponentModel.ISupportInitialize).EndInit() + CType(RadButton_PasteModpackConfig, ComponentModel.ISupportInitialize).EndInit() + CType(Me, ComponentModel.ISupportInitialize).EndInit() + ResumeLayout(False) End Sub Friend WithEvents RadLabel1 As Telerik.WinControls.UI.RadLabel @@ -239,4 +249,5 @@ Partial Class Form1 Friend WithEvents RadButton_EditModpackConfig As Telerik.WinControls.UI.RadButton Friend WithEvents RadButton_SearchModpackConfig As Telerik.WinControls.UI.RadButton Friend WithEvents RadButton_SearchMinecraftProfileFolder As Telerik.WinControls.UI.RadButton + Friend WithEvents RadButton_PasteModpackConfig As Telerik.WinControls.UI.RadButton End Class diff --git a/ModpackUpdater/Form1.resx b/ModpackUpdater/Form1.resx index ab6248a..c628285 100644 --- a/ModpackUpdater/Form1.resx +++ b/ModpackUpdater/Form1.resx @@ -1,4 +1,64 @@ - + + + @@ -58,6 +118,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAADvSURBVDhPY8AFJixbowfCUC5pYNLidfoTlqxbBcJ9SzboQoXxA9eolHlA/BOo6T8I9y5a87Jv + 4ZpXMD5IDojnQJVjAqDk3x8/f/2fu247WAMynrt+x3+QHFDNH6hyTACU/E8IgNRAlWMCZAM+//z3/9bb + vxg4rn7a/wknf4aCMFQbAiAbAFI84dRPvBiqDQFoYoDDpPsYOHrpC+INyFj3BgXDbKefARR7AV0zzHas + BrhEpXzaffjY/4MnTv/feOIWimJsGKoNAVwiU4Ndo1NWukalrkrrWnoMmyZkDNWGHUw68cti4smfq/Fh + iEoGBgDk9v/D66ccygAAAABJRU5ErkJggg== + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAMhJREFUOE9j diff --git a/ModpackUpdater/Form1.vb b/ModpackUpdater/Form1.vb index bcb2d5f..e2bbd71 100644 --- a/ModpackUpdater/Form1.vb +++ b/ModpackUpdater/Form1.vb @@ -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 diff --git a/ModpackUpdater/ModpackUpdater.vbproj b/ModpackUpdater/ModpackUpdater.vbproj index fe8382e..83091f1 100644 --- a/ModpackUpdater/ModpackUpdater.vbproj +++ b/ModpackUpdater/ModpackUpdater.vbproj @@ -78,6 +78,7 @@ +