ui(client): migrate to AvaloniaUI
This commit is contained in:
10
ModpackUpdater.Apps.Client.Gui/App.axaml
Normal file
10
ModpackUpdater.Apps.Client.Gui/App.axaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<Application xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
x:Class="ModpackUpdater.Apps.Client.Gui.App"
|
||||||
|
RequestedThemeVariant="Default">
|
||||||
|
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||||
|
|
||||||
|
<Application.Styles>
|
||||||
|
<FluentTheme />
|
||||||
|
</Application.Styles>
|
||||||
|
</Application>
|
||||||
20
ModpackUpdater.Apps.Client.Gui/App.axaml.cs
Normal file
20
ModpackUpdater.Apps.Client.Gui/App.axaml.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace ModpackUpdater.Apps.Client.Gui;
|
||||||
|
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnFrameworkInitializationCompleted()
|
||||||
|
{
|
||||||
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
|
desktop.MainWindow = new MainForm();
|
||||||
|
base.OnFrameworkInitializationCompleted();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<appSettings>
|
|
||||||
<add key="TelerikWinFormsThemeName" value="Windows11CompactDark" />
|
|
||||||
</appSettings>
|
|
||||||
</configuration>
|
|
||||||
@@ -7,10 +7,10 @@ public class AppConfig : ISettingsNode, ISettingsIdentifier
|
|||||||
{
|
{
|
||||||
public static string Identifier => "pilz.appconfig";
|
public static string Identifier => "pilz.appconfig";
|
||||||
|
|
||||||
public string LastMinecraftProfilePath { get; set; }
|
public string? LastMinecraftProfilePath { get; set; }
|
||||||
|
|
||||||
[JsonIgnore, Obsolete]
|
[JsonIgnore, Obsolete]
|
||||||
public string ConfigFilePath { get; private set; }
|
public string? ConfigFilePath { get; private set; }
|
||||||
[JsonProperty("ConfigFilePath"), Obsolete]
|
[JsonProperty("ConfigFilePath"), Obsolete]
|
||||||
private string ConfigFilePathLegacy
|
private string ConfigFilePathLegacy
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ public class AppUpdater(string updateUrl)
|
|||||||
private class UpdateInfo
|
private class UpdateInfo
|
||||||
{
|
{
|
||||||
[JsonConverter(typeof(VersionConverter))]
|
[JsonConverter(typeof(VersionConverter))]
|
||||||
public Version Version { get; set; }
|
public Version? Version { get; set; }
|
||||||
public string DownloadUrl { get; set; }
|
public string? DownloadUrl { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly HttpClient httpClient = new();
|
private readonly HttpClient httpClient = new();
|
||||||
private UpdateInfo info;
|
private UpdateInfo? info;
|
||||||
|
|
||||||
public async Task<bool> Check()
|
public async Task<bool> Check()
|
||||||
{
|
{
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
@@ -60,6 +60,15 @@ namespace ModpackUpdater.My.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sucht eine lokalisierte Zeichenfolge, die Select the minecraft profile folder (usually named .minecraft) ähnelt.
|
||||||
|
/// </summary>
|
||||||
|
internal static string FileDialog_SelectMinecraftProfileFolder {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("FileDialog_SelectMinecraftProfileFolder", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die A new version of this program is available. If you confirm, the update will be installed automatically. It takes just a few seconds. Continue? ähnelt.
|
/// Sucht eine lokalisierte Zeichenfolge, die A new version of this program is available. If you confirm, the update will be installed automatically. It takes just a few seconds. Continue? ähnelt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -117,6 +117,9 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<data name="FileDialog_SelectMinecraftProfileFolder" xml:space="preserve">
|
||||||
|
<value>Select the minecraft profile folder (usually named .minecraft)</value>
|
||||||
|
</data>
|
||||||
<data name="MsgBox_UpdateAvailable" xml:space="preserve">
|
<data name="MsgBox_UpdateAvailable" xml:space="preserve">
|
||||||
<value>A new version of this program is available. If you confirm, the update will be installed automatically. It takes just a few seconds. Continue?</value>
|
<value>A new version of this program is available. If you confirm, the update will be installed automatically. It takes just a few seconds. Continue?</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
288
ModpackUpdater.Apps.Client.Gui/MainForm.Designer.cs
generated
288
ModpackUpdater.Apps.Client.Gui/MainForm.Designer.cs
generated
@@ -1,288 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace ModpackUpdater.Apps.Client.Gui
|
|
||||||
{
|
|
||||||
[Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
|
|
||||||
|
|
||||||
public partial class MainForm : Telerik.WinControls.UI.RadForm
|
|
||||||
{
|
|
||||||
|
|
||||||
// Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (disposing && components is not null)
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wird vom Windows Form-Designer benötigt.
|
|
||||||
private System.ComponentModel.IContainer components = new System.ComponentModel.Container();
|
|
||||||
|
|
||||||
// Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
|
|
||||||
// Das Bearbeiten ist mit dem Windows Form-Designer möglich.
|
|
||||||
// Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
|
||||||
[DebuggerStepThrough()]
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
var resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
|
||||||
RadLabel_MinecraftProfile = new Telerik.WinControls.UI.RadLabel();
|
|
||||||
RadLabel_ModpackUrl = new Telerik.WinControls.UI.RadLabel();
|
|
||||||
RadTextBox_MinecraftProfileFolder = new Telerik.WinControls.UI.RadTextBoxControl();
|
|
||||||
RadTextBox_ModpackConfig = new Telerik.WinControls.UI.RadTextBoxControl();
|
|
||||||
RadButton_Install = new Telerik.WinControls.UI.RadSplitButton();
|
|
||||||
radMenuItem_Install = new Telerik.WinControls.UI.RadMenuItem();
|
|
||||||
radMenuItem_Repair = new Telerik.WinControls.UI.RadMenuItem();
|
|
||||||
RadButton_CheckForUpdates = new Telerik.WinControls.UI.RadButton();
|
|
||||||
RadButton_SearchMinecraftProfileFolder = new Telerik.WinControls.UI.RadButton();
|
|
||||||
tableLayoutPanel1 = new TableLayoutPanel();
|
|
||||||
RadLabel_Status = new Telerik.WinControls.UI.RadLabel();
|
|
||||||
RadLabel_StatusDesc = new Telerik.WinControls.UI.RadLabel();
|
|
||||||
radLabel_InstallationKey = new Telerik.WinControls.UI.RadLabel();
|
|
||||||
radTextBox_InstallKey = new Telerik.WinControls.UI.RadTextBoxControl();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadLabel_MinecraftProfile).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadLabel_ModpackUrl).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadTextBox_MinecraftProfileFolder).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadTextBox_ModpackConfig).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadButton_Install).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadButton_CheckForUpdates).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).BeginInit();
|
|
||||||
tableLayoutPanel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadLabel_Status).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadLabel_StatusDesc).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)radLabel_InstallationKey).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)radTextBox_InstallKey).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)this).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// RadLabel_MinecraftProfile
|
|
||||||
//
|
|
||||||
RadLabel_MinecraftProfile.Anchor = AnchorStyles.Left;
|
|
||||||
RadLabel_MinecraftProfile.Location = new Point(3, 6);
|
|
||||||
RadLabel_MinecraftProfile.Name = "RadLabel_MinecraftProfile";
|
|
||||||
RadLabel_MinecraftProfile.Size = new Size(89, 18);
|
|
||||||
RadLabel_MinecraftProfile.TabIndex = 0;
|
|
||||||
RadLabel_MinecraftProfile.Text = "Minecraft profile";
|
|
||||||
//
|
|
||||||
// RadLabel_ModpackUrl
|
|
||||||
//
|
|
||||||
RadLabel_ModpackUrl.Anchor = AnchorStyles.Left;
|
|
||||||
RadLabel_ModpackUrl.Location = new Point(3, 36);
|
|
||||||
RadLabel_ModpackUrl.Name = "RadLabel_ModpackUrl";
|
|
||||||
RadLabel_ModpackUrl.Size = new Size(76, 18);
|
|
||||||
RadLabel_ModpackUrl.TabIndex = 1;
|
|
||||||
RadLabel_ModpackUrl.Text = "Modpack URL";
|
|
||||||
//
|
|
||||||
// RadTextBox_MinecraftProfileFolder
|
|
||||||
//
|
|
||||||
RadTextBox_MinecraftProfileFolder.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
tableLayoutPanel1.SetColumnSpan(RadTextBox_MinecraftProfileFolder, 3);
|
|
||||||
RadTextBox_MinecraftProfileFolder.Location = new Point(98, 3);
|
|
||||||
RadTextBox_MinecraftProfileFolder.Name = "RadTextBox_MinecraftProfileFolder";
|
|
||||||
RadTextBox_MinecraftProfileFolder.NullText = "C:\\Users\\...\\AppData\\...";
|
|
||||||
RadTextBox_MinecraftProfileFolder.Size = new Size(221, 24);
|
|
||||||
RadTextBox_MinecraftProfileFolder.TabIndex = 1;
|
|
||||||
RadTextBox_MinecraftProfileFolder.TextChanged += RadTextBox_MinecraftFolder_TextInserted;
|
|
||||||
//
|
|
||||||
// RadTextBox_ModpackConfig
|
|
||||||
//
|
|
||||||
RadTextBox_ModpackConfig.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
tableLayoutPanel1.SetColumnSpan(RadTextBox_ModpackConfig, 5);
|
|
||||||
RadTextBox_ModpackConfig.Location = new Point(98, 33);
|
|
||||||
RadTextBox_ModpackConfig.Name = "RadTextBox_ModpackConfig";
|
|
||||||
RadTextBox_ModpackConfig.NullText = "https://...";
|
|
||||||
RadTextBox_ModpackConfig.Size = new Size(321, 24);
|
|
||||||
RadTextBox_ModpackConfig.TabIndex = 3;
|
|
||||||
RadTextBox_ModpackConfig.TextChanged += RadTextBox_ModpackUrl_TextInserted;
|
|
||||||
//
|
|
||||||
// RadButton_Install
|
|
||||||
//
|
|
||||||
RadButton_Install.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
tableLayoutPanel1.SetColumnSpan(RadButton_Install, 2);
|
|
||||||
RadButton_Install.ImageAlignment = ContentAlignment.MiddleRight;
|
|
||||||
RadButton_Install.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem_Install, radMenuItem_Repair });
|
|
||||||
RadButton_Install.Location = new Point(325, 121);
|
|
||||||
RadButton_Install.Name = "RadButton_Install";
|
|
||||||
RadButton_Install.Size = new Size(94, 24);
|
|
||||||
RadButton_Install.TabIndex = 0;
|
|
||||||
RadButton_Install.Text = "Install";
|
|
||||||
RadButton_Install.TextAlignment = ContentAlignment.MiddleLeft;
|
|
||||||
RadButton_Install.TextImageRelation = TextImageRelation.ImageBeforeText;
|
|
||||||
//
|
|
||||||
// radMenuItem_Install
|
|
||||||
//
|
|
||||||
radMenuItem_Install.Name = "radMenuItem_Install";
|
|
||||||
radMenuItem_Install.Text = "Install";
|
|
||||||
radMenuItem_Install.Click += RadMenuItem_Install_Click;
|
|
||||||
//
|
|
||||||
// radMenuItem_Repair
|
|
||||||
//
|
|
||||||
radMenuItem_Repair.Name = "radMenuItem_Repair";
|
|
||||||
radMenuItem_Repair.Text = "Repair";
|
|
||||||
radMenuItem_Repair.Click += RadMenuItem_Repair_Click;
|
|
||||||
//
|
|
||||||
// RadButton_CheckForUpdates
|
|
||||||
//
|
|
||||||
RadButton_CheckForUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
tableLayoutPanel1.SetColumnSpan(RadButton_CheckForUpdates, 3);
|
|
||||||
RadButton_CheckForUpdates.ImageAlignment = ContentAlignment.MiddleRight;
|
|
||||||
RadButton_CheckForUpdates.Location = new Point(98, 121);
|
|
||||||
RadButton_CheckForUpdates.Name = "RadButton_CheckForUpdates";
|
|
||||||
RadButton_CheckForUpdates.Size = new Size(221, 24);
|
|
||||||
RadButton_CheckForUpdates.TabIndex = 100;
|
|
||||||
RadButton_CheckForUpdates.Text = "Check for Updates";
|
|
||||||
RadButton_CheckForUpdates.TextAlignment = ContentAlignment.MiddleLeft;
|
|
||||||
RadButton_CheckForUpdates.TextImageRelation = TextImageRelation.ImageBeforeText;
|
|
||||||
RadButton_CheckForUpdates.Click += ButtonX_CheckForUpdates_Click;
|
|
||||||
//
|
|
||||||
// RadButton_SearchMinecraftProfileFolder
|
|
||||||
//
|
|
||||||
RadButton_SearchMinecraftProfileFolder.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
tableLayoutPanel1.SetColumnSpan(RadButton_SearchMinecraftProfileFolder, 2);
|
|
||||||
RadButton_SearchMinecraftProfileFolder.ImageAlignment = ContentAlignment.MiddleRight;
|
|
||||||
RadButton_SearchMinecraftProfileFolder.Location = new Point(325, 3);
|
|
||||||
RadButton_SearchMinecraftProfileFolder.Name = "RadButton_SearchMinecraftProfileFolder";
|
|
||||||
RadButton_SearchMinecraftProfileFolder.Size = new Size(94, 24);
|
|
||||||
RadButton_SearchMinecraftProfileFolder.TabIndex = 2;
|
|
||||||
RadButton_SearchMinecraftProfileFolder.Text = "Search";
|
|
||||||
RadButton_SearchMinecraftProfileFolder.TextAlignment = ContentAlignment.MiddleLeft;
|
|
||||||
RadButton_SearchMinecraftProfileFolder.TextImageRelation = TextImageRelation.ImageBeforeText;
|
|
||||||
RadButton_SearchMinecraftProfileFolder.Click += ButtonX_SearchMinecraftProfile_Click;
|
|
||||||
//
|
|
||||||
// tableLayoutPanel1
|
|
||||||
//
|
|
||||||
tableLayoutPanel1.AutoSize = true;
|
|
||||||
tableLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
tableLayoutPanel1.ColumnCount = 6;
|
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle());
|
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
|
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
|
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
|
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
|
|
||||||
tableLayoutPanel1.Controls.Add(RadLabel_MinecraftProfile, 0, 0);
|
|
||||||
tableLayoutPanel1.Controls.Add(RadLabel_ModpackUrl, 0, 1);
|
|
||||||
tableLayoutPanel1.Controls.Add(RadTextBox_MinecraftProfileFolder, 1, 0);
|
|
||||||
tableLayoutPanel1.Controls.Add(RadTextBox_ModpackConfig, 1, 1);
|
|
||||||
tableLayoutPanel1.Controls.Add(RadLabel_Status, 1, 3);
|
|
||||||
tableLayoutPanel1.Controls.Add(RadLabel_StatusDesc, 0, 3);
|
|
||||||
tableLayoutPanel1.Controls.Add(RadButton_Install, 4, 4);
|
|
||||||
tableLayoutPanel1.Controls.Add(radLabel_InstallationKey, 0, 2);
|
|
||||||
tableLayoutPanel1.Controls.Add(radTextBox_InstallKey, 1, 2);
|
|
||||||
tableLayoutPanel1.Controls.Add(RadButton_CheckForUpdates, 1, 4);
|
|
||||||
tableLayoutPanel1.Controls.Add(RadButton_SearchMinecraftProfileFolder, 4, 0);
|
|
||||||
tableLayoutPanel1.Dock = DockStyle.Fill;
|
|
||||||
tableLayoutPanel1.Location = new Point(0, 0);
|
|
||||||
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
|
||||||
tableLayoutPanel1.RowCount = 5;
|
|
||||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
|
||||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
|
||||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
|
||||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
|
||||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
|
||||||
tableLayoutPanel1.Size = new Size(422, 151);
|
|
||||||
tableLayoutPanel1.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// RadLabel_Status
|
|
||||||
//
|
|
||||||
RadLabel_Status.Anchor = AnchorStyles.Left;
|
|
||||||
tableLayoutPanel1.SetColumnSpan(RadLabel_Status, 5);
|
|
||||||
RadLabel_Status.Location = new Point(98, 95);
|
|
||||||
RadLabel_Status.Name = "RadLabel_Status";
|
|
||||||
RadLabel_Status.Size = new Size(11, 18);
|
|
||||||
RadLabel_Status.TabIndex = 3;
|
|
||||||
RadLabel_Status.Text = "-";
|
|
||||||
RadLabel_Status.TextImageRelation = TextImageRelation.ImageBeforeText;
|
|
||||||
//
|
|
||||||
// RadLabel_StatusDesc
|
|
||||||
//
|
|
||||||
RadLabel_StatusDesc.Anchor = AnchorStyles.Left;
|
|
||||||
RadLabel_StatusDesc.Location = new Point(3, 93);
|
|
||||||
RadLabel_StatusDesc.Name = "RadLabel_StatusDesc";
|
|
||||||
RadLabel_StatusDesc.Size = new Size(46, 22);
|
|
||||||
RadLabel_StatusDesc.TabIndex = 2;
|
|
||||||
RadLabel_StatusDesc.Text = "Status";
|
|
||||||
//
|
|
||||||
// radLabel_InstallationKey
|
|
||||||
//
|
|
||||||
radLabel_InstallationKey.Anchor = AnchorStyles.Left;
|
|
||||||
radLabel_InstallationKey.Location = new Point(3, 66);
|
|
||||||
radLabel_InstallationKey.Name = "radLabel_InstallationKey";
|
|
||||||
radLabel_InstallationKey.Size = new Size(81, 18);
|
|
||||||
radLabel_InstallationKey.TabIndex = 12;
|
|
||||||
radLabel_InstallationKey.Text = "Installation key";
|
|
||||||
radLabel_InstallationKey.Visible = false;
|
|
||||||
//
|
|
||||||
// radTextBox_InstallKey
|
|
||||||
//
|
|
||||||
radTextBox_InstallKey.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
tableLayoutPanel1.SetColumnSpan(radTextBox_InstallKey, 5);
|
|
||||||
radTextBox_InstallKey.Location = new Point(98, 63);
|
|
||||||
radTextBox_InstallKey.Name = "radTextBox_InstallKey";
|
|
||||||
radTextBox_InstallKey.NullText = "AAAAA-BBBBB-CCCCC-DDDDD-EEEEE";
|
|
||||||
radTextBox_InstallKey.Size = new Size(321, 24);
|
|
||||||
radTextBox_InstallKey.TabIndex = 4;
|
|
||||||
radTextBox_InstallKey.Visible = false;
|
|
||||||
radTextBox_InstallKey.TextChanged += RadTextBox_InstallationKey_TextInserted;
|
|
||||||
//
|
|
||||||
// MainForm
|
|
||||||
//
|
|
||||||
AutoScaleBaseSize = new Size(7, 15);
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
AutoSize = true;
|
|
||||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
ClientSize = new Size(422, 151);
|
|
||||||
Controls.Add(tableLayoutPanel1);
|
|
||||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
|
||||||
MaximizeBox = false;
|
|
||||||
MinimumSize = new Size(430, 0);
|
|
||||||
Name = "MainForm";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Minecraft Modpack Updater";
|
|
||||||
FormClosing += Form1_FormClosing;
|
|
||||||
Load += Form1_Load;
|
|
||||||
Shown += Form1_Shown;
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadLabel_MinecraftProfile).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadLabel_ModpackUrl).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadTextBox_MinecraftProfileFolder).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadTextBox_ModpackConfig).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadButton_Install).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadButton_CheckForUpdates).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).EndInit();
|
|
||||||
tableLayoutPanel1.ResumeLayout(false);
|
|
||||||
tableLayoutPanel1.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadLabel_Status).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)RadLabel_StatusDesc).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)radLabel_InstallationKey).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)radTextBox_InstallKey).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)this).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Telerik.WinControls.UI.RadLabel RadLabel_MinecraftProfile;
|
|
||||||
internal Telerik.WinControls.UI.RadLabel RadLabel_ModpackUrl;
|
|
||||||
internal Telerik.WinControls.UI.RadTextBoxControl RadTextBox_MinecraftProfileFolder;
|
|
||||||
internal Telerik.WinControls.UI.RadTextBoxControl RadTextBox_ModpackConfig;
|
|
||||||
internal Telerik.WinControls.UI.RadSplitButton RadButton_Install;
|
|
||||||
internal Telerik.WinControls.UI.RadButton RadButton_CheckForUpdates;
|
|
||||||
internal Telerik.WinControls.UI.RadButton RadButton_SearchMinecraftProfileFolder;
|
|
||||||
private TableLayoutPanel tableLayoutPanel1;
|
|
||||||
internal Telerik.WinControls.UI.RadLabel radLabel_InstallationKey;
|
|
||||||
internal Telerik.WinControls.UI.RadTextBoxControl radTextBox_InstallKey;
|
|
||||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem_Repair;
|
|
||||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem_Install;
|
|
||||||
internal Telerik.WinControls.UI.RadLabel RadLabel_Status;
|
|
||||||
internal Telerik.WinControls.UI.RadLabel RadLabel_StatusDesc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
126
ModpackUpdater.Apps.Client.Gui/MainForm.axaml
Normal file
126
ModpackUpdater.Apps.Client.Gui/MainForm.axaml
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:svg="clr-namespace:Avalonia.Svg;assembly=Avalonia.Svg"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
x:Class="ModpackUpdater.Apps.Client.Gui.MainForm"
|
||||||
|
SizeToContent="WidthAndHeight"
|
||||||
|
Title="Minecraft Modpack Updater"
|
||||||
|
Icon="/Assets/app.ico"
|
||||||
|
>
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
RowDefinitions="Auto,Auto,Auto,Auto,Auto"
|
||||||
|
Margin="3, 3, 3, 3"
|
||||||
|
RowSpacing="6"
|
||||||
|
ColumnSpacing="6"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
>
|
||||||
|
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*" MinWidth="300"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- Labels -->
|
||||||
|
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="Minecraft profile:" />
|
||||||
|
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Content="Modpack config url:" />
|
||||||
|
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" IsVisible="false" x:Name="LabelInstallKey" Content="Installation key:" />
|
||||||
|
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Content="Status:" />
|
||||||
|
<Label Grid.Row="3" Grid.Column="1" VerticalAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Width="16" Height="16" x:Name="ImageStatus" />
|
||||||
|
<TextBlock Margin="3, 0, 0, 0" x:Name="TextStatus" />
|
||||||
|
</StackPanel>
|
||||||
|
</Label>
|
||||||
|
|
||||||
|
<!-- TextBoxes: Profile -->
|
||||||
|
<TextBox
|
||||||
|
x:Name="TextBoxMinecraftProfileFolder"
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Watermark="C:\..."
|
||||||
|
TextInput="TextBoxMinecraftProfileFolder_TextInserted"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- TextBoxes: ModpackConfig -->
|
||||||
|
<TextBox
|
||||||
|
x:Name="TextBoxModpackConfig"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Watermark="https://..."
|
||||||
|
TextInput="TextBoxModpackConfig_TextInserted"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- TextBoxes: InstallKey -->
|
||||||
|
<TextBox
|
||||||
|
x:Name="TextBoxInstallKey"
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Watermark="XXXXX-YYYYY-ZZZZZ-AAAAA-BBBBB"
|
||||||
|
TextInput="TextBoxInstallKey_TextInserted"
|
||||||
|
IsVisible="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Button: SearchProfileFolder -->
|
||||||
|
<Button
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="2"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
Click="ButtonSearchProfileFolder_Click"
|
||||||
|
>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image VerticalAlignment="Center" Width="16" Height="16" x:Name="ButtonImageSearchProfileFolder" />
|
||||||
|
<TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0">Search</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<!-- Button: CheckForUpdates -->
|
||||||
|
<Button
|
||||||
|
Grid.Row="4"
|
||||||
|
Grid.Column="1"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" x:Name="ButtonCheckForUpdates" Click="ButtonCheckForUpdates_Click"
|
||||||
|
>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image VerticalAlignment="Center" Width="16" Height="16" x:Name="ButtonImageCheckForUpdates" />
|
||||||
|
<TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0">Check for updates</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<!-- Button: Install -->
|
||||||
|
<SplitButton
|
||||||
|
Grid.Row="4"
|
||||||
|
Grid.Column="2"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
x:Name="ButtonInstall"
|
||||||
|
Click="ButtonInstall_Click"
|
||||||
|
>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image VerticalAlignment="Center" Width="16" Height="16" x:Name="ButtonImageInstall" />
|
||||||
|
<TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0">Install</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
<SplitButton.Flyout>
|
||||||
|
<MenuFlyout>
|
||||||
|
<MenuItem Header="Repair" Click="MenuItemRepair_Click">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Image Width="16" Height="16" x:Name="MenuItemImageRepair" />
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuFlyout>
|
||||||
|
</SplitButton.Flyout>
|
||||||
|
</SplitButton>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -1,22 +1,26 @@
|
|||||||
using ModpackUpdater.Manager;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
|
using ModpackUpdater.Manager;
|
||||||
using ModpackUpdater.My.Resources;
|
using ModpackUpdater.My.Resources;
|
||||||
|
using MsBox.Avalonia;
|
||||||
|
using MsBox.Avalonia.Enums;
|
||||||
using Pilz.Extensions;
|
using Pilz.Extensions;
|
||||||
using Pilz.UI.Symbols;
|
using Pilz.SymbolPacks.Sets;
|
||||||
using Pilz.UI.WinForms.Extensions;
|
using Pilz.UI.AvaloniaUI.Symbols;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Telerik.WinControls;
|
|
||||||
using Telerik.WinControls.UI;
|
|
||||||
|
|
||||||
namespace ModpackUpdater.Apps.Client.Gui;
|
namespace ModpackUpdater.Apps.Client.Gui;
|
||||||
|
|
||||||
public partial class MainForm
|
public partial class MainForm : Window
|
||||||
{
|
{
|
||||||
private readonly UpdateCheckOptions updateOptions = new();
|
private readonly UpdateCheckOptions updateOptions = new();
|
||||||
private ModpackInfo modpackInfo = new();
|
private ModpackInfo modpackInfo = new();
|
||||||
private ModpackConfig updateConfig = new();
|
private ModpackConfig updateConfig = new();
|
||||||
private ModpackFeatures features;
|
private ModpackFeatures? features;
|
||||||
private UpdateCheckResult lastUpdateCheckResult;
|
private UpdateCheckResult? lastUpdateCheckResult;
|
||||||
private bool currentUpdating;
|
private bool currentUpdating;
|
||||||
private bool loadingData;
|
private bool loadingData;
|
||||||
private int curOptionsRow = 3;
|
private int curOptionsRow = 3;
|
||||||
@@ -25,42 +29,42 @@ public partial class MainForm
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Text = $"{Text} (v{Assembly.GetExecutingAssembly().GetAppVersion()})";
|
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion()})";
|
||||||
RadButton_Install.DefaultItem = radMenuItem_Install;
|
|
||||||
|
|
||||||
RadButton_CheckForUpdates.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small);
|
Closing += MainForm_Closing;
|
||||||
RadButton_SearchMinecraftProfileFolder.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.opened_folder, SymbolSize.Small);
|
Loaded += MainForm_Loaded;
|
||||||
RadButton_Install.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small);
|
|
||||||
radMenuItem_Install.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small);
|
|
||||||
radMenuItem_Repair.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.wrench, SymbolSize.Small);
|
|
||||||
|
|
||||||
|
ButtonImageSearchProfileFolder.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.opened_folder);
|
||||||
|
ButtonImageCheckForUpdates.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.update);
|
||||||
|
ButtonImageInstall.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer);
|
||||||
|
MenuItemImageRepair.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.wrench);
|
||||||
|
|
||||||
|
ClearStatus();
|
||||||
LoadProfileToUi();
|
LoadProfileToUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Features
|
#region Features
|
||||||
|
|
||||||
private void SetStatus(string statusText, RadSvgImage image)
|
private void SetStatus(string statusText, IImage? image)
|
||||||
{
|
{
|
||||||
RadLabel_Status.Text = statusText;
|
TextStatus.Text = statusText;
|
||||||
RadLabel_Status.SvgImage = image;
|
ImageStatus.Source = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearStatus()
|
private void ClearStatus()
|
||||||
{
|
{
|
||||||
RadLabel_Status.Text = "-";
|
TextStatus.Text = "-";
|
||||||
RadLabel_Status.SvgImage = null;
|
ImageStatus.Source = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadProfileToUi()
|
private void LoadProfileToUi()
|
||||||
{
|
{
|
||||||
loadingData = true;
|
loadingData = true;
|
||||||
tableLayoutPanel1.SuspendLayout();
|
|
||||||
|
|
||||||
RadTextBox_MinecraftProfileFolder.Text = modpackInfo?.LocaLPath ?? AppConfig.Instance.LastMinecraftProfilePath ?? RadTextBox_MinecraftProfileFolder.Text;
|
TextBoxMinecraftProfileFolder.Text = modpackInfo?.LocaLPath ?? AppConfig.Instance.LastMinecraftProfilePath ?? TextBoxMinecraftProfileFolder.Text;
|
||||||
RadTextBox_ModpackConfig.Text = modpackInfo?.ConfigUrl ?? RadTextBox_ModpackConfig.Text;
|
TextBoxModpackConfig.Text = modpackInfo?.ConfigUrl ?? TextBoxModpackConfig.Text;
|
||||||
radTextBox_InstallKey.Text = modpackInfo?.ExtrasKey ?? radTextBox_InstallKey.Text;
|
TextBoxInstallKey.Text = modpackInfo?.ExtrasKey ?? TextBoxInstallKey.Text;
|
||||||
|
|
||||||
tableLayoutPanel1.ResumeLayout();
|
|
||||||
loadingData = false;
|
loadingData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +86,7 @@ public partial class MainForm
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
modpackInfo = ModpackInfo.TryLoad(RadTextBox_MinecraftProfileFolder.Text.Trim());
|
modpackInfo = ModpackInfo.TryLoad(TextBoxMinecraftProfileFolder.Text?.Trim());
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -93,7 +97,7 @@ public partial class MainForm
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
updateConfig = ModpackConfig.LoadFromUrl(RadTextBox_ModpackConfig.Text);
|
updateConfig = ModpackConfig.LoadFromUrl(TextBoxModpackConfig.Text);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -102,39 +106,39 @@ public partial class MainForm
|
|||||||
if (modpackInfo != null)
|
if (modpackInfo != null)
|
||||||
features = new(updateConfig);
|
features = new(updateConfig);
|
||||||
|
|
||||||
radTextBox_InstallKey.Visible = radLabel_InstallationKey.Visible = !string.IsNullOrWhiteSpace(updateConfig.UnleashApiUrl);
|
LabelInstallKey.IsVisible = TextBoxInstallKey.IsVisible = !string.IsNullOrWhiteSpace(updateConfig.UnleashApiUrl);
|
||||||
|
|
||||||
if (modpackInfo == null || string.IsNullOrWhiteSpace(RadTextBox_MinecraftProfileFolder.Text) /*|| modpackInfo.Valid*/)
|
if (modpackInfo == null || string.IsNullOrWhiteSpace(TextBoxMinecraftProfileFolder.Text) /*|| modpackInfo.Valid*/)
|
||||||
{
|
{
|
||||||
SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppGlobals.Symbols.GetSvgImage(AppSymbols.general_warning_sign, SymbolSize.Small));
|
SetStatus(LangRes.StatusText_MinecraftProfileWarning, Symbols.Fluent.GetImageSource(SymbolsFluent.warning_shield));
|
||||||
RadButton_CheckForUpdates.Enabled = false;
|
ButtonCheckForUpdates.IsEnabled = false;
|
||||||
RadButton_Install.Enabled = false;
|
ButtonInstall.IsEnabled = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (updateConfig == null || string.IsNullOrWhiteSpace(RadTextBox_ModpackConfig.Text))
|
else if (updateConfig == null || string.IsNullOrWhiteSpace(TextBoxModpackConfig.Text))
|
||||||
{
|
{
|
||||||
SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, AppGlobals.Symbols.GetSvgImage(AppSymbols.general_warning_sign, SymbolSize.Small));
|
SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, Symbols.Fluent.GetImageSource(SymbolsFluent.warning_shield));
|
||||||
RadButton_CheckForUpdates.Enabled = false;
|
ButtonCheckForUpdates.IsEnabled = false;
|
||||||
RadButton_Install.Enabled = false;
|
ButtonInstall.IsEnabled = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (updateConfig.Maintenance && !updateOptions.IgnoreMaintenance)
|
else if (updateConfig.Maintenance && !updateOptions.IgnoreMaintenance)
|
||||||
{
|
{
|
||||||
SetStatus(LangRes.StatusText_Maintenance, AppGlobals.Symbols.GetSvgImage(AppSymbols.services, SymbolSize.Small));
|
SetStatus(LangRes.StatusText_Maintenance, Symbols.Fluent.GetImageSource(SymbolsFluent.services));
|
||||||
RadButton_CheckForUpdates.Enabled = false;
|
ButtonCheckForUpdates.IsEnabled = false;
|
||||||
RadButton_Install.Enabled = false;
|
ButtonInstall.IsEnabled = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LoadOptionsToUi();
|
LoadOptionsToUi();
|
||||||
RadButton_CheckForUpdates.Enabled = true;
|
ButtonCheckForUpdates.IsEnabled = true;
|
||||||
RadButton_Install.Enabled = true;
|
ButtonInstall.IsEnabled = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ExecuteUpdate(bool doInstall, bool repair)
|
private async Task ExecuteUpdate(bool doInstall, bool repair)
|
||||||
{
|
{
|
||||||
// Ensure set extras key
|
// Ensure set extras key
|
||||||
modpackInfo.ExtrasKey = radTextBox_InstallKey.Text.Trim();
|
modpackInfo.ExtrasKey = TextBoxInstallKey.Text?.Trim();
|
||||||
|
|
||||||
var updater = new ModpackInstaller(updateConfig, modpackInfo);
|
var updater = new ModpackInstaller(updateConfig, modpackInfo);
|
||||||
updater.InstallProgessUpdated += Update_InstallProgessUpdated;
|
updater.InstallProgessUpdated += Update_InstallProgessUpdated;
|
||||||
@@ -142,31 +146,31 @@ public partial class MainForm
|
|||||||
|
|
||||||
void error()
|
void error()
|
||||||
{
|
{
|
||||||
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.close, SymbolSize.Small));
|
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, Symbols.Fluent.GetImageSource(SymbolsFluent.close));
|
||||||
currentUpdating = false;
|
currentUpdating = false;
|
||||||
}
|
}
|
||||||
void installing()
|
void installing()
|
||||||
{
|
{
|
||||||
SetStatus(LangRes.StatusText_Installing, AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small));
|
SetStatus(LangRes.StatusText_Installing, Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer));
|
||||||
currentUpdating = true;
|
currentUpdating = true;
|
||||||
}
|
}
|
||||||
void updatesAvailable()
|
void updatesAvailable()
|
||||||
{
|
{
|
||||||
SetStatus(LangRes.StatusText_UpdateAvailable, AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small));
|
SetStatus(LangRes.StatusText_UpdateAvailable, Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer));
|
||||||
}
|
}
|
||||||
void everythingOk()
|
void everythingOk()
|
||||||
{
|
{
|
||||||
SetStatus(LangRes.StatusTest_EverythingOk, AppGlobals.Symbols.GetSvgImage(AppSymbols.done, SymbolSize.Small));
|
SetStatus(LangRes.StatusTest_EverythingOk, Symbols.Fluent.GetImageSource(SymbolsFluent.done));
|
||||||
currentUpdating = false;
|
currentUpdating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check only if not pressed "install", not really needed otherwise.
|
// Check only if not pressed "install", not really needed otherwise.
|
||||||
if (lastUpdateCheckResult is null || !doInstall || repair)
|
if (lastUpdateCheckResult is null || !doInstall || repair)
|
||||||
{
|
{
|
||||||
SetStatus(LangRes.StatusText_CheckingForUpdates, AppGlobals.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small));
|
SetStatus(LangRes.StatusText_CheckingForUpdates, Symbols.Fluent.GetImageSource(SymbolsFluent.update));
|
||||||
|
|
||||||
// Check for extras once again
|
// Check for extras once again
|
||||||
updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
|
updateOptions.IncludeExtras = features != null && features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
|
||||||
|
|
||||||
// Force re-install on repair
|
// Force re-install on repair
|
||||||
updateOptions.IgnoreInstalledVersion = repair;
|
updateOptions.IgnoreInstalledVersion = repair;
|
||||||
@@ -238,75 +242,77 @@ public partial class MainForm
|
|||||||
|
|
||||||
private void Updated_CheckingProgresssUpdated(int toCheck, int processed)
|
private void Updated_CheckingProgresssUpdated(int toCheck, int processed)
|
||||||
{
|
{
|
||||||
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", AppGlobals.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small));
|
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", Symbols.Fluent.GetImageSource(SymbolsFluent.update));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update_InstallProgessUpdated(UpdateCheckResult result, int processedSyncs)
|
private void Update_InstallProgessUpdated(UpdateCheckResult result, int processedSyncs)
|
||||||
{
|
{
|
||||||
int actionCount = result.Actions.Count;
|
int actionCount = result.Actions.Count;
|
||||||
SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small));
|
SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Gui
|
#region Gui
|
||||||
|
|
||||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
private void MainForm_Closing(object? sender, WindowClosingEventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Instance.LastMinecraftProfilePath = RadTextBox_MinecraftProfileFolder.Text.Trim();
|
AppConfig.Instance.LastMinecraftProfilePath = TextBoxMinecraftProfileFolder.Text?.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Form1_Load(object sender, EventArgs e)
|
private async void MainForm_Loaded(object? sender, RoutedEventArgs e)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void Form1_Shown(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
var updater = new AppUpdater(Program.UPDATE_URL);
|
var updater = new AppUpdater(Program.UPDATE_URL);
|
||||||
if (await updater.Check() && RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info).IsYes())
|
if (await updater.Check() && await MessageBoxManager.GetMessageBoxStandard(LangRes.MsgBox_UpdateAvailable_Title, LangRes.MsgBox_UpdateAvailable, ButtonEnum.YesNo).ShowWindowDialogAsync(this) == ButtonResult.Ok)
|
||||||
{
|
{
|
||||||
SetStatus(LangRes.StatusText_InstallingAppUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small));
|
SetStatus(LangRes.StatusText_InstallingAppUpdate, Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer));
|
||||||
Enabled = false;
|
IsEnabled = false;
|
||||||
await updater.Install();
|
await updater.Install();
|
||||||
Application.Restart();
|
//Application.Restart(); // FIXME
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckStatusAndUpdate(true);
|
CheckStatusAndUpdate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RadTextBox_MinecraftFolder_TextInserted(object o, EventArgs args)
|
private void TextBoxMinecraftProfileFolder_TextInserted(object? o, Avalonia.Input.TextInputEventArgs args)
|
||||||
{
|
{
|
||||||
if (!loadingData)
|
if (!loadingData)
|
||||||
CheckStatusAndUpdate(true);
|
CheckStatusAndUpdate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RadTextBox_ModpackUrl_TextInserted(object o, EventArgs args)
|
private void TextBoxModpackConfig_TextInserted(object? o, Avalonia.Input.TextInputEventArgs args)
|
||||||
{
|
{
|
||||||
if (!loadingData)
|
if (!loadingData)
|
||||||
CheckStatusAndUpdate(false);
|
CheckStatusAndUpdate(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RadTextBox_InstallationKey_TextInserted(object o, EventArgs args)
|
private void TextBoxInstallKey_TextInserted(object? o, Avalonia.Input.TextInputEventArgs args)
|
||||||
{
|
{
|
||||||
if (!loadingData)
|
if (!loadingData)
|
||||||
CheckStatusAndUpdate(false);
|
CheckStatusAndUpdate(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonX_SearchMinecraftProfile_Click(object sender, EventArgs e)
|
private async void ButtonSearchProfileFolder_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var ofd = new RadOpenFolderDialog();
|
var filePaths = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||||
if (ofd.ShowDialog(this) == DialogResult.OK)
|
{
|
||||||
RadTextBox_MinecraftProfileFolder.Text = ofd.FileName;
|
Title = LangRes.FileDialog_SelectMinecraftProfileFolder,
|
||||||
|
SuggestedStartLocation = await StorageProvider.TryGetFolderFromPathAsync(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)),
|
||||||
|
AllowMultiple = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (filePaths.Count >= 1)
|
||||||
|
TextBoxMinecraftProfileFolder.Text = filePaths[0].Path.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ButtonX_CheckForUpdates_Click(object sender, EventArgs e)
|
private async void ButtonCheckForUpdates_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ClearStatus();
|
ClearStatus();
|
||||||
await ExecuteUpdate(false, false);
|
await ExecuteUpdate(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void RadMenuItem_Install_Click(object sender, EventArgs e)
|
private async void ButtonInstall_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!currentUpdating)
|
if (!currentUpdating)
|
||||||
{
|
{
|
||||||
@@ -315,7 +321,7 @@ public partial class MainForm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void RadMenuItem_Repair_Click(object sender, EventArgs e)
|
private async void MenuItemRepair_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!currentUpdating)
|
if (!currentUpdating)
|
||||||
{
|
{
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -2,18 +2,24 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ApplicationIcon>minecraft modpack updater.ico</ApplicationIcon>
|
<ApplicationIcon>Assets/app.ico</ApplicationIcon>
|
||||||
<AssemblyName>Minecraft Modpack Updater</AssemblyName>
|
<AssemblyName>Minecraft Modpack Updater</AssemblyName>
|
||||||
<ImplicitUsings>true</ImplicitUsings>
|
<ImplicitUsings>true</ImplicitUsings>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<Nullable>enable</Nullable>
|
||||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||||
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\Version.cs" />
|
<Compile Include="..\Version.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<AvaloniaResource Include="Assets\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="FiledialogFilters.Designer.cs">
|
<Compile Update="FiledialogFilters.Designer.cs">
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
@@ -41,24 +47,35 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MessageBox.Avalonia" Version="3.3.0" />
|
||||||
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
|
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Pilz.Configuration" Version="3.2.6" />
|
<PackageReference Include="Pilz.Configuration" Version="3.2.6" />
|
||||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
|
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
|
||||||
<PackageReference Include="Pilz.IO" Version="2.1.0" />
|
<PackageReference Include="Pilz.IO" Version="2.1.0" />
|
||||||
<PackageReference Include="Pilz.UI" Version="3.0.0" />
|
<PackageReference Include="Pilz.SymbolPacks.Fluent" Version="1.0.12" />
|
||||||
<PackageReference Include="Pilz.UI.WinForms" Version="2.6.2" />
|
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.0.0" />
|
||||||
<PackageReference Include="Pilz.UI.WinForms.Telerik" Version="2.13.3" />
|
<PackageReference Include="Pilz.UI.AvaloniaUI.Symbols" Version="1.0.0" />
|
||||||
<PackageReference Include="Pilz.UI.WinForms.Telerik.Symbols" Version="1.2.1" />
|
<PackageReference Include="Avalonia" Version="11.3.8" />
|
||||||
<PackageReference Include="UI.for.WinForms.Common" Version="2025.2.612-preview" />
|
<PackageReference Include="Avalonia.Desktop" Version="11.3.8" />
|
||||||
<PackageReference Include="UI.for.WinForms.Themes" Version="2025.2.612-preview" />
|
<PackageReference Include="Avalonia.Svg" Version="11.3.0" />
|
||||||
|
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.8" />
|
||||||
|
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.8" />
|
||||||
|
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||||
|
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.8">
|
||||||
|
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||||
|
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ModpackUpdater.Apps.AppUpdates\ModpackUpdater.Apps.AppUpdates.csproj" />
|
<ProjectReference Include="..\ModpackUpdater.Apps.AppUpdates\ModpackUpdater.Apps.AppUpdates.csproj" />
|
||||||
<ProjectReference Include="..\ModpackUpdater.Apps\ModpackUpdater.Apps.csproj" />
|
|
||||||
<ProjectReference Include="..\ModpackUpdater.Manager\ModpackUpdater.Manager.csproj" />
|
<ProjectReference Include="..\ModpackUpdater.Manager\ModpackUpdater.Manager.csproj" />
|
||||||
<ProjectReference Include="..\ModpackUpdater\ModpackUpdater.csproj" />
|
<ProjectReference Include="..\ModpackUpdater\ModpackUpdater.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Assets\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Castle.Core.Logging;
|
using Avalonia;
|
||||||
|
using Castle.Core.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Pilz.Configuration;
|
using Pilz.Configuration;
|
||||||
|
|
||||||
@@ -23,9 +24,15 @@ public static class Program
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
internal static void Main(string[] args)
|
internal static void Main(string[] args)
|
||||||
{
|
{
|
||||||
ApplicationConfiguration.Initialize();
|
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||||
AppGlobals.Initialize();
|
}
|
||||||
Application.Run(new MainForm());
|
|
||||||
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
|
{
|
||||||
|
return AppBuilder.Configure<App>()
|
||||||
|
.UsePlatformDetect()
|
||||||
|
.WithInterFont()
|
||||||
|
.LogToTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetSettingsPath(int? settingsVersion = 3)
|
private static string GetSettingsPath(int? settingsVersion = 3)
|
||||||
|
|||||||
Reference in New Issue
Block a user