This commit is contained in:
2025-11-12 14:29:31 +01:00
parent 8ab1689309
commit d798eea1d8
25 changed files with 394 additions and 2778 deletions

View File

@@ -63,7 +63,7 @@
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
<PackageReference Include="Pilz.IO" Version="2.1.0" />
<PackageReference Include="Pilz.UI" Version="3.1.1" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.0" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.8" />
<PackageReference Include="Avalonia" Version="11.3.8" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.8" />
<PackageReference Include="Avalonia.Svg" Version="11.3.0" />

View File

@@ -0,0 +1,7 @@
namespace ModpackUpdater.Apps.Manager.Api.Model;
public class WorkspaceContext(IMainApi mainApi, IWorkspace workspace)
{
public IMainApi MainApi => mainApi;
public IWorkspace Workspace { get; set; } = workspace;
}

View File

@@ -10,16 +10,12 @@ public abstract class WorkspaceFeature(string identifier, string name) : PluginF
return workspace?.Config == null || workspace.Config.ProviderId == Identifier;
}
public virtual bool Configure(ref IWorkspace? workspace)
public virtual async Task Configure(WorkspaceContext context)
{
OnConfigure(ref workspace);
await OnConfigure(context);
if (workspace?.Config is null)
return false;
workspace.Config.ProviderId = Identifier;
return true;
if (context?.Workspace?.Config is not null)
context.Workspace.Config.ProviderId = Identifier;
}
public virtual IWorkspace CreateFromConfig(WorkspaceConfig config)
@@ -30,5 +26,5 @@ public abstract class WorkspaceFeature(string identifier, string name) : PluginF
protected abstract void OnCreate(out IWorkspace workspace, WorkspaceConfig config);
protected abstract bool OnConfigure(ref IWorkspace? workspace);
protected abstract Task OnConfigure(WorkspaceContext context);
}

View File

@@ -84,14 +84,14 @@ internal static class SharedFunctions
var updates = new List<UpdatesCollectorUi.ModUpdateInfo>();
foreach (var update in ucDialog.CurrentUpdates.List)
{
if (update.Origin.SourceTag != update.AvailableVersions[update.NewVersion].Value)
if (update.Origin.SourceTag != update.AvailableVersions[update.NewVersion].Key)
updates.Add(update);
}
// Path install actions
foreach (var update in updates)
{
update.Origin.SourceTag = update.AvailableVersions[update.NewVersion].Value;
update.Origin.SourceTag = update.AvailableVersions[update.NewVersion].Key;
api.UpdateItem(update.Origin);
}
@@ -253,7 +253,7 @@ internal static class SharedFunctions
public static ExcelPackage? GenerateModlistAsExcel(InstallInfos installInfos)
{
var pkg = new ExcelPackage();
var ws = pkg.Workbook.Worksheets.Add(string.Format(GeneralLangRes.Text_ModlistForVersion, installInfos.Version));
var ws = pkg.Workbook.Worksheets.Add(string.Format(GeneralLangRes.ModlistForVersionX, installInfos.Version));
var cr = 1;
var cc = 1;

View File

@@ -2,21 +2,19 @@
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
internal class GitLabRepoWorkspaceConfig : WorkspaceConfig
public class GitLabRepoWorkspaceConfig : WorkspaceConfig, ICloneable
{
public override string DisplayText => $"{RepoName ?? "?"} | {RepoBranche} | {InstanceUrl}";
public string? RepoName { get; set; }
public string InstanceUrl { get; set; } = "https://gitlab.com";
public string? ApiToken { get; set; }
public long RepoId { get; set; } = 0L;
public string RepoBranche { get; set; } = "master";
public string FileLocationInstallJson { get; set; } = "install.json";
public string FileLocationUpdateJson { get; set; } = "updates.json";
public object Clone()
{
return MemberwiseClone();
}
}

View File

@@ -1,266 +0,0 @@
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
partial class GitLabRepoWorkspaceConfigEditor
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Komponenten-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
tableLayoutPanel1 = new TableLayoutPanel();
radTextBox_FileLocUpdateJson = new Telerik.WinControls.UI.RadTextBox();
radTextBox_FileLocInstallJson = new Telerik.WinControls.UI.RadTextBox();
radTextBox_RepoBranche = new Telerik.WinControls.UI.RadTextBox();
radSpinEditor_RepoId = new Telerik.WinControls.UI.RadSpinEditor();
radTextBox_ApiToken = new Telerik.WinControls.UI.RadTextBox();
radTextBox_InstanceUrl = new Telerik.WinControls.UI.RadTextBox();
radLabel1 = new Telerik.WinControls.UI.RadLabel();
radLabel2 = new Telerik.WinControls.UI.RadLabel();
radLabel3 = new Telerik.WinControls.UI.RadLabel();
radLabel4 = new Telerik.WinControls.UI.RadLabel();
radLabel5 = new Telerik.WinControls.UI.RadLabel();
radLabel6 = new Telerik.WinControls.UI.RadLabel();
radLabel7 = new Telerik.WinControls.UI.RadLabel();
radTextBox_ModpackConfigUrl = new Telerik.WinControls.UI.RadTextBox();
tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)radTextBox_FileLocUpdateJson).BeginInit();
((System.ComponentModel.ISupportInitialize)radTextBox_FileLocInstallJson).BeginInit();
((System.ComponentModel.ISupportInitialize)radTextBox_RepoBranche).BeginInit();
((System.ComponentModel.ISupportInitialize)radSpinEditor_RepoId).BeginInit();
((System.ComponentModel.ISupportInitialize)radTextBox_ApiToken).BeginInit();
((System.ComponentModel.ISupportInitialize)radTextBox_InstanceUrl).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel1).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel2).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel3).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel4).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel5).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel6).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel7).BeginInit();
((System.ComponentModel.ISupportInitialize)radTextBox_ModpackConfigUrl).BeginInit();
SuspendLayout();
//
// tableLayoutPanel1
//
tableLayoutPanel1.AutoSize = true;
tableLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableLayoutPanel1.ColumnCount = 1;
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableLayoutPanel1.Controls.Add(radTextBox_FileLocUpdateJson, 0, 11);
tableLayoutPanel1.Controls.Add(radTextBox_FileLocInstallJson, 0, 9);
tableLayoutPanel1.Controls.Add(radTextBox_RepoBranche, 0, 7);
tableLayoutPanel1.Controls.Add(radSpinEditor_RepoId, 0, 5);
tableLayoutPanel1.Controls.Add(radTextBox_ApiToken, 0, 3);
tableLayoutPanel1.Controls.Add(radTextBox_InstanceUrl, 0, 1);
tableLayoutPanel1.Controls.Add(radLabel1, 0, 0);
tableLayoutPanel1.Controls.Add(radLabel2, 0, 2);
tableLayoutPanel1.Controls.Add(radLabel3, 0, 4);
tableLayoutPanel1.Controls.Add(radLabel4, 0, 6);
tableLayoutPanel1.Controls.Add(radLabel5, 0, 8);
tableLayoutPanel1.Controls.Add(radLabel6, 0, 10);
tableLayoutPanel1.Controls.Add(radLabel7, 0, 12);
tableLayoutPanel1.Controls.Add(radTextBox_ModpackConfigUrl, 0, 13);
tableLayoutPanel1.Dock = DockStyle.Fill;
tableLayoutPanel1.Location = new Point(0, 30);
tableLayoutPanel1.Name = "tableLayoutPanel1";
tableLayoutPanel1.RowCount = 14;
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.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.RowStyles.Add(new RowStyle());
tableLayoutPanel1.RowStyles.Add(new RowStyle());
tableLayoutPanel1.RowStyles.Add(new RowStyle());
tableLayoutPanel1.RowStyles.Add(new RowStyle());
tableLayoutPanel1.Size = new Size(300, 406);
tableLayoutPanel1.TabIndex = 4;
//
// radTextBox_FileLocUpdateJson
//
radTextBox_FileLocUpdateJson.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
radTextBox_FileLocUpdateJson.Location = new Point(3, 321);
radTextBox_FileLocUpdateJson.Name = "radTextBox_FileLocUpdateJson";
radTextBox_FileLocUpdateJson.Size = new Size(294, 24);
radTextBox_FileLocUpdateJson.TabIndex = 4;
//
// radTextBox_FileLocInstallJson
//
radTextBox_FileLocInstallJson.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
radTextBox_FileLocInstallJson.Location = new Point(3, 263);
radTextBox_FileLocInstallJson.Name = "radTextBox_FileLocInstallJson";
radTextBox_FileLocInstallJson.Size = new Size(294, 24);
radTextBox_FileLocInstallJson.TabIndex = 3;
//
// radTextBox_RepoBranche
//
radTextBox_RepoBranche.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
radTextBox_RepoBranche.Location = new Point(3, 205);
radTextBox_RepoBranche.Name = "radTextBox_RepoBranche";
radTextBox_RepoBranche.Size = new Size(294, 24);
radTextBox_RepoBranche.TabIndex = 2;
//
// radSpinEditor_RepoId
//
radSpinEditor_RepoId.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
radSpinEditor_RepoId.Location = new Point(3, 147);
radSpinEditor_RepoId.Maximum = new decimal(new int[] { -1, int.MaxValue, 0, 0 });
radSpinEditor_RepoId.Name = "radSpinEditor_RepoId";
radSpinEditor_RepoId.Size = new Size(294, 24);
radSpinEditor_RepoId.TabIndex = 6;
//
// radTextBox_ApiToken
//
radTextBox_ApiToken.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
radTextBox_ApiToken.Location = new Point(3, 89);
radTextBox_ApiToken.Name = "radTextBox_ApiToken";
radTextBox_ApiToken.Size = new Size(294, 24);
radTextBox_ApiToken.TabIndex = 1;
//
// radTextBox_InstanceUrl
//
radTextBox_InstanceUrl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
radTextBox_InstanceUrl.Location = new Point(3, 31);
radTextBox_InstanceUrl.Name = "radTextBox_InstanceUrl";
radTextBox_InstanceUrl.Size = new Size(294, 24);
radTextBox_InstanceUrl.TabIndex = 0;
//
// radLabel1
//
radLabel1.Location = new Point(3, 3);
radLabel1.Name = "radLabel1";
radLabel1.Size = new Size(80, 22);
radLabel1.TabIndex = 7;
radLabel1.Text = "Instance url";
//
// radLabel2
//
radLabel2.Location = new Point(3, 61);
radLabel2.Name = "radLabel2";
radLabel2.Size = new Size(69, 22);
radLabel2.TabIndex = 8;
radLabel2.Text = "Api token";
//
// radLabel3
//
radLabel3.Location = new Point(3, 119);
radLabel3.Name = "radLabel3";
radLabel3.Size = new Size(91, 22);
radLabel3.TabIndex = 9;
radLabel3.Text = "Repository id";
//
// radLabel4
//
radLabel4.Location = new Point(3, 177);
radLabel4.Name = "radLabel4";
radLabel4.Size = new Size(130, 22);
radLabel4.TabIndex = 10;
radLabel4.Text = "Repository branche";
//
// radLabel5
//
radLabel5.Location = new Point(3, 235);
radLabel5.Name = "radLabel5";
radLabel5.Size = new Size(181, 22);
radLabel5.TabIndex = 11;
radLabel5.Text = "File location for install infos";
//
// radLabel6
//
radLabel6.Location = new Point(3, 293);
radLabel6.Name = "radLabel6";
radLabel6.Size = new Size(189, 22);
radLabel6.TabIndex = 12;
radLabel6.Text = "File location for updates info";
//
// radLabel7
//
radLabel7.Location = new Point(3, 351);
radLabel7.Name = "radLabel7";
radLabel7.Size = new Size(131, 22);
radLabel7.TabIndex = 13;
radLabel7.Text = "Modpack config url";
//
// radTextBox_ModpackConfigUrl
//
radTextBox_ModpackConfigUrl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
radTextBox_ModpackConfigUrl.Location = new Point(3, 379);
radTextBox_ModpackConfigUrl.Name = "radTextBox_ModpackConfigUrl";
radTextBox_ModpackConfigUrl.Size = new Size(294, 24);
radTextBox_ModpackConfigUrl.TabIndex = 14;
//
// GitLabRepoWorkspaceConfigEditor
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
BackColor = Color.Transparent;
Controls.Add(tableLayoutPanel1);
MinimumSize = new Size(300, 0);
Name = "GitLabRepoWorkspaceConfigEditor";
Size = new Size(300, 466);
Controls.SetChildIndex(tableLayoutPanel1, 0);
tableLayoutPanel1.ResumeLayout(false);
tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)radTextBox_FileLocUpdateJson).EndInit();
((System.ComponentModel.ISupportInitialize)radTextBox_FileLocInstallJson).EndInit();
((System.ComponentModel.ISupportInitialize)radTextBox_RepoBranche).EndInit();
((System.ComponentModel.ISupportInitialize)radSpinEditor_RepoId).EndInit();
((System.ComponentModel.ISupportInitialize)radTextBox_ApiToken).EndInit();
((System.ComponentModel.ISupportInitialize)radTextBox_InstanceUrl).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel1).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel2).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel3).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel4).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel5).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel6).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel7).EndInit();
((System.ComponentModel.ISupportInitialize)radTextBox_ModpackConfigUrl).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private TableLayoutPanel tableLayoutPanel1;
private Telerik.WinControls.UI.RadTextBox radTextBox_InstanceUrl;
private Telerik.WinControls.UI.RadTextBox radTextBox_ApiToken;
private Telerik.WinControls.UI.RadTextBox radTextBox_RepoBranche;
private Telerik.WinControls.UI.RadTextBox radTextBox_FileLocInstallJson;
private Telerik.WinControls.UI.RadTextBox radTextBox_FileLocUpdateJson;
private Telerik.WinControls.UI.RadSpinEditor radSpinEditor_RepoId;
private Telerik.WinControls.UI.RadLabel radLabel1;
private Telerik.WinControls.UI.RadLabel radLabel2;
private Telerik.WinControls.UI.RadLabel radLabel3;
private Telerik.WinControls.UI.RadLabel radLabel4;
private Telerik.WinControls.UI.RadLabel radLabel5;
private Telerik.WinControls.UI.RadLabel radLabel6;
private Telerik.WinControls.UI.RadLabel radLabel7;
private Telerik.WinControls.UI.RadTextBox radTextBox_ModpackConfigUrl;
}

View File

@@ -1,45 +0,0 @@
using Pilz.UI;
using Pilz.UI.WinForms.Telerik.Dialogs;
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
internal partial class GitLabRepoWorkspaceConfigEditor : RadFlyoutBase, ILoadContent
{
private readonly GitLabRepoWorkspaceConfig settings;
public GitLabRepoWorkspaceConfigEditor(GitLabRepoWorkspaceConfig settings)
{
this.settings = settings;
InitializeComponent();
var defaults = new GitLabRepoWorkspaceConfig();
radTextBox_InstanceUrl.NullText = defaults.InstanceUrl;
radTextBox_RepoBranche.NullText = defaults.RepoBranche;
radTextBox_FileLocInstallJson.NullText = defaults.InstanceUrl;
radTextBox_FileLocUpdateJson.NullText = defaults.FileLocationUpdateJson;
}
public void LoadContent()
{
radTextBox_InstanceUrl.Text = settings.InstanceUrl;
radTextBox_ApiToken.Text = settings.ApiToken;
radSpinEditor_RepoId.Value = settings.RepoId;
radTextBox_RepoBranche.Text = settings.RepoBranche;
radTextBox_FileLocInstallJson.Text = settings.FileLocationInstallJson;
radTextBox_FileLocUpdateJson.Text = settings.FileLocationUpdateJson;
radTextBox_ModpackConfigUrl.Text = settings.ModpackConfigUrl;
}
protected override bool ValidateOK()
{
settings.InstanceUrl = radTextBox_InstanceUrl.Text.Trim();
settings.ApiToken = radTextBox_ApiToken.Text.Trim();
settings.RepoId = (long)radSpinEditor_RepoId.Value;
settings.RepoBranche = radTextBox_RepoBranche.Text.Trim();
settings.FileLocationInstallJson = radTextBox_FileLocInstallJson.Text.Trim();
settings.FileLocationUpdateJson = radTextBox_FileLocUpdateJson.Text.Trim();
settings.ModpackConfigUrl = radTextBox_ModpackConfigUrl.Text.Trim();
return base.ValidateOK();
}
}

View File

@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,36 @@
<dialogs:AvaloniaFlyoutBase
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:dialogs="https://git.pilzinsel64.de/pilz-framework/pilz"
xmlns:gitLabRepo="clr-namespace:ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo"
xmlns:langRes="clr-namespace:ModpackUpdater.Apps.Manager.LangRes"
mc:Ignorable="d"
d:DesignWidth="800"
d:DesignHeight="450"
Width="300"
x:Class="ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo.GitLabRepoWorkspaceConfigEditorView">
<dialogs:AvaloniaFlyoutBase.MainContent>
<StackPanel Spacing="6">
<TextBlock Text="{x:Static langRes:GeneralLangRes.GitLabInstanceUrl}"/>
<TextBox Text="{Binding InstanceUrl, DataType=gitLabRepo:GitLabRepoWorkspaceConfig}"/>
<TextBlock Text="{x:Static langRes:GeneralLangRes.GitLabApiToken}"/>
<TextBox Text="{Binding ApiToken, DataType=gitLabRepo:GitLabRepoWorkspaceConfig}"/>
<TextBlock Text="{x:Static langRes:GeneralLangRes.RepositoryId}"/>
<NumericUpDown Value="{Binding RepoId, DataType=gitLabRepo:GitLabRepoWorkspaceConfig}"/>
<TextBlock Text="{x:Static langRes:GeneralLangRes.FileLocationOfInstallJson}"/>
<TextBox Text="{Binding FileLocationInstallJson, DataType=gitLabRepo:GitLabRepoWorkspaceConfig}"/>
<TextBlock Text="{x:Static langRes:GeneralLangRes.FileLocationOfUpdateJson}"/>
<TextBox Text="{Binding FileLocationUpdateJson, DataType=gitLabRepo:GitLabRepoWorkspaceConfig}"/>
<TextBlock Text="{x:Static langRes:GeneralLangRes.ModpackConfigUrl}"/>
<TextBox Text="{Binding ModpackConfigUrl, DataType=gitLabRepo:GitLabRepoWorkspaceConfig}"/>
</StackPanel>
</dialogs:AvaloniaFlyoutBase.MainContent>
</dialogs:AvaloniaFlyoutBase>

View File

@@ -0,0 +1,17 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Pilz.UI.AvaloniaUI.Dialogs;
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
public partial class GitLabRepoWorkspaceConfigEditorView : AvaloniaFlyoutBase
{
public GitLabRepoWorkspaceConfig Settings { get; }
public GitLabRepoWorkspaceConfigEditorView(GitLabRepoWorkspaceConfig settings)
{
Settings = settings;
InitializeComponent();
}
}

View File

@@ -2,9 +2,7 @@
using ModpackUpdater.Apps.Manager.Api.Plugins.Features;
using ModpackUpdater.Apps.Manager.LangRes;
using Pilz.Features;
using Pilz.UI.Symbols;
using Pilz.UI.WinForms.Extensions;
using Pilz.UI.WinForms.Telerik.Dialogs;
using Pilz.UI.AvaloniaUI.Dialogs;
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
@@ -14,26 +12,26 @@ internal class GitLabRepoWorkspaceFeature : WorkspaceFeature, IPluginFeatureProv
public GitLabRepoWorkspaceFeature() : base("origin.gitlab", FeatureNamesLangRes.GitLabWorkspace)
{
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small);
Icon = AppGlobals.Symbols.GetImageSource(AppSymbols.gitlab);
}
protected override bool OnConfigure(ref IWorkspace? workspace)
protected override async Task OnConfigure(WorkspaceContext context)
{
var settings = workspace?.Config as GitLabRepoWorkspaceConfig ?? new();
var settings = context.Workspace?.Config as GitLabRepoWorkspaceConfig ?? new();
if (RadDialogBase.ShowDialog(new GitLabRepoWorkspaceConfigEditor(settings), TitlesLangRes.GitLabRepoWorkspaceEditor, AppGlobals.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small)).Result.IsNotOk())
return false;
workspace = new GitLabRepoWorkspace(settings);
return true;
if ((await AvaloniaFlyoutBase.Show(
new GitLabRepoWorkspaceConfigEditorView((GitLabRepoWorkspaceConfig)settings.Clone()),
context.MainApi.MainWindow,
TitlesLangRes.GitLabRepoWorkspaceEditor,
AppGlobals.Symbols.GetImageSource(AppSymbols.gitlab)))
.Result is GitLabRepoWorkspaceConfig settingsNew)
context.Workspace = new GitLabRepoWorkspace(settingsNew);
}
protected override void OnCreate(out IWorkspace workspace, WorkspaceConfig config)
{
if (config is not GitLabRepoWorkspaceConfig gitlabConfig)
throw new NotImplementedException($"Only configs of type {typeof(GitLabRepoWorkspaceConfig).Name} are allowed.");
throw new NotImplementedException($"Only configs of type {nameof(GitLabRepoWorkspaceConfig)} are allowed.");
workspace = new GitLabRepoWorkspace(gitlabConfig);
}
}

View File

@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
// This code was generated by a tool.
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@@ -12,46 +11,32 @@ namespace ModpackUpdater.Apps.Manager.LangRes {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class GeneralLangRes {
private static global::System.Resources.ResourceManager resourceMan;
private static System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
private static System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal GeneralLangRes() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ModpackUpdater.Apps.Manager.LangRes.GeneralLangRes", typeof(GeneralLangRes).Assembly);
if (object.Equals(null, resourceMan)) {
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("ModpackUpdater.Apps.Manager.LangRes.GeneralLangRes", typeof(GeneralLangRes).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@@ -60,30 +45,57 @@ namespace ModpackUpdater.Apps.Manager.LangRes {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Installation: {0} ähnelt.
/// </summary>
internal static string Node_Install {
get {
return ResourceManager.GetString("Node_Install", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Update: {0} ähnelt.
/// </summary>
internal static string Node_Update {
get {
return ResourceManager.GetString("Node_Update", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Modlist for v{0} ähnelt.
/// </summary>
internal static string Text_ModlistForVersion {
internal static string ModlistForVersionX {
get {
return ResourceManager.GetString("Text_ModlistForVersion", resourceCulture);
return ResourceManager.GetString("ModlistForVersionX", resourceCulture);
}
}
internal static string GitLabInstanceUrl {
get {
return ResourceManager.GetString("GitLabInstanceUrl", resourceCulture);
}
}
internal static string GitLabApiToken {
get {
return ResourceManager.GetString("GitLabApiToken", resourceCulture);
}
}
internal static string RepositoryId {
get {
return ResourceManager.GetString("RepositoryId", resourceCulture);
}
}
internal static string FileLocationOfInstallJson {
get {
return ResourceManager.GetString("FileLocationOfInstallJson", resourceCulture);
}
}
internal static string FileLocationOfUpdateJson {
get {
return ResourceManager.GetString("FileLocationOfUpdateJson", resourceCulture);
}
}
internal static string ModpackConfigUrl {
get {
return ResourceManager.GetString("ModpackConfigUrl", resourceCulture);
}
}
}

View File

@@ -123,7 +123,25 @@
<data name="Node_Update" xml:space="preserve">
<value>Update: {0}</value>
</data>
<data name="Text_ModlistForVersion" xml:space="preserve">
<data name="ModlistForVersionX" xml:space="preserve">
<value>Modlist for v{0}</value>
</data>
<data name="GitLabInstanceUrl" xml:space="preserve">
<value>GitLab instance url</value>
</data>
<data name="GitLabApiToken" xml:space="preserve">
<value>GitLab Api token</value>
</data>
<data name="RepositoryId" xml:space="preserve">
<value>Repository Id</value>
</data>
<data name="FileLocationOfInstallJson" xml:space="preserve">
<value>File location of "install.json"</value>
</data>
<data name="FileLocationOfUpdateJson" xml:space="preserve">
<value>File location of "update.json"</value>
</data>
<data name="ModpackConfigUrl" xml:space="preserve">
<value>Modpack config url</value>
</data>
</root>

View File

@@ -30,7 +30,7 @@
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
<PackageReference Include="Pilz.Features" Version="2.12.0" />
<PackageReference Include="Pilz.UI" Version="3.1.1" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.0" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.8" />
<PackageReference Include="Pilz.UI.AvaloniaUI.Features" Version="1.0.0" />
<PackageReference Include="Avalonia" Version="11.3.8" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.8" />

View File

@@ -425,7 +425,7 @@ public partial class MainForm : RadForm, IMainApi
if (sender is RadMenuItem item && item.Tag is WorkspaceFeature feature)
{
var ws = wsInfo?.Workspace;
if (feature.Configure(ref ws))
if (feature.Configure(ws))
await LoadNewWorkspace(ws, feature);
}
}
@@ -441,7 +441,7 @@ public partial class MainForm : RadForm, IMainApi
if (wsInfo != null)
{
var ws = wsInfo.Workspace;
if (wsInfo.Feature.Configure(ref ws))
if (wsInfo.Feature.Configure(ws))
await LoadNewWorkspace(ws, wsInfo.Feature);
}
}

View File

@@ -1,9 +1,12 @@
<Window xmlns="https://github.com/avaloniaui"
<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"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="ModpackUpdater.Apps.Manager.Ui.MainWindow"
Title="MainWindow">
Welcome to Avalonia!
Title="Minecraft Modpack Manager"
Padding="3">
</Window>

View File

@@ -1,268 +0,0 @@
namespace ModpackUpdater.Apps.Manager.Ui;
partial class UpdatesCollectorUi
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
var listViewDetailColumn1 = new Telerik.WinControls.UI.ListViewDetailColumn("Column 0", "Name");
var listViewDetailColumn2 = new Telerik.WinControls.UI.ListViewDetailColumn("Column 1", "Current version");
var listViewDetailColumn3 = new Telerik.WinControls.UI.ListViewDetailColumn("Column 2", "New version");
var listViewDetailColumn4 = new Telerik.WinControls.UI.ListViewDetailColumn("Column 0", "Release");
var listViewDetailColumn5 = new Telerik.WinControls.UI.ListViewDetailColumn("Column 1", "Tag");
var resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdatesCollectorUi));
tableLayoutPanel1 = new TableLayoutPanel();
radButton_Continue = new Telerik.WinControls.UI.RadButton();
radProgressBar1 = new Telerik.WinControls.UI.RadProgressBar();
radSplitContainer1 = new Telerik.WinControls.UI.RadSplitContainer();
splitPanel1 = new Telerik.WinControls.UI.SplitPanel();
tableLayoutPanel2 = new TableLayoutPanel();
radListView_Updates = new Telerik.WinControls.UI.RadListView();
splitPanel2 = new Telerik.WinControls.UI.SplitPanel();
tableLayoutPanel3 = new TableLayoutPanel();
radListView_VersionTags = new Telerik.WinControls.UI.RadListView();
radWaitingBar1 = new Telerik.WinControls.UI.RadWaitingBar();
dotsSpinnerWaitingBarIndicatorElement1 = new Telerik.WinControls.UI.DotsSpinnerWaitingBarIndicatorElement();
tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)radButton_Continue).BeginInit();
((System.ComponentModel.ISupportInitialize)radProgressBar1).BeginInit();
((System.ComponentModel.ISupportInitialize)radSplitContainer1).BeginInit();
radSplitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)splitPanel1).BeginInit();
splitPanel1.SuspendLayout();
tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)radListView_Updates).BeginInit();
((System.ComponentModel.ISupportInitialize)splitPanel2).BeginInit();
splitPanel2.SuspendLayout();
tableLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)radListView_VersionTags).BeginInit();
((System.ComponentModel.ISupportInitialize)radWaitingBar1).BeginInit();
((System.ComponentModel.ISupportInitialize)this).BeginInit();
SuspendLayout();
//
// tableLayoutPanel1
//
tableLayoutPanel1.AutoSize = true;
tableLayoutPanel1.ColumnCount = 3;
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 200F));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle());
tableLayoutPanel1.Controls.Add(radButton_Continue, 2, 0);
tableLayoutPanel1.Controls.Add(radProgressBar1, 0, 0);
tableLayoutPanel1.Dock = DockStyle.Bottom;
tableLayoutPanel1.Location = new Point(0, 419);
tableLayoutPanel1.Name = "tableLayoutPanel1";
tableLayoutPanel1.RowCount = 1;
tableLayoutPanel1.RowStyles.Add(new RowStyle());
tableLayoutPanel1.Size = new Size(800, 30);
tableLayoutPanel1.TabIndex = 0;
//
// radButton_Continue
//
radButton_Continue.Anchor = AnchorStyles.Top | AnchorStyles.Right;
radButton_Continue.DialogResult = DialogResult.OK;
radButton_Continue.ImageAlignment = ContentAlignment.MiddleRight;
radButton_Continue.Location = new Point(647, 3);
radButton_Continue.Name = "radButton_Continue";
radButton_Continue.Size = new Size(150, 24);
radButton_Continue.TabIndex = 0;
radButton_Continue.Text = "Continue";
radButton_Continue.TextAlignment = ContentAlignment.MiddleLeft;
radButton_Continue.TextImageRelation = TextImageRelation.ImageBeforeText;
//
// radProgressBar1
//
radProgressBar1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
radProgressBar1.Location = new Point(3, 3);
radProgressBar1.Name = "radProgressBar1";
radProgressBar1.Size = new Size(194, 24);
radProgressBar1.TabIndex = 2;
radProgressBar1.Visible = false;
//
// radSplitContainer1
//
radSplitContainer1.Controls.Add(splitPanel1);
radSplitContainer1.Controls.Add(splitPanel2);
radSplitContainer1.Dock = DockStyle.Fill;
radSplitContainer1.Location = new Point(0, 0);
radSplitContainer1.Name = "radSplitContainer1";
radSplitContainer1.Size = new Size(800, 419);
radSplitContainer1.TabIndex = 1;
radSplitContainer1.TabStop = false;
//
// splitPanel1
//
splitPanel1.Controls.Add(tableLayoutPanel2);
splitPanel1.Location = new Point(0, 0);
splitPanel1.Name = "splitPanel1";
splitPanel1.Size = new Size(516, 419);
splitPanel1.SizeInfo.AutoSizeScale = new SizeF(0.148241222F, 0F);
splitPanel1.SizeInfo.SplitterCorrection = new Size(118, 0);
splitPanel1.TabIndex = 0;
splitPanel1.TabStop = false;
splitPanel1.Text = "splitPanel1";
//
// tableLayoutPanel2
//
tableLayoutPanel2.ColumnCount = 1;
tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
tableLayoutPanel2.Controls.Add(radListView_Updates, 0, 0);
tableLayoutPanel2.Dock = DockStyle.Fill;
tableLayoutPanel2.Location = new Point(0, 0);
tableLayoutPanel2.Name = "tableLayoutPanel2";
tableLayoutPanel2.RowCount = 1;
tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
tableLayoutPanel2.Size = new Size(516, 419);
tableLayoutPanel2.TabIndex = 1;
//
// radListView_Updates
//
radListView_Updates.AllowEdit = false;
radListView_Updates.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
listViewDetailColumn1.HeaderText = "Name";
listViewDetailColumn2.HeaderText = "Current version";
listViewDetailColumn2.Width = 120F;
listViewDetailColumn3.HeaderText = "New version";
listViewDetailColumn3.Width = 120F;
radListView_Updates.Columns.AddRange(new Telerik.WinControls.UI.ListViewDetailColumn[] { listViewDetailColumn1, listViewDetailColumn2, listViewDetailColumn3 });
radListView_Updates.ItemSpacing = -1;
radListView_Updates.Location = new Point(3, 3);
radListView_Updates.Name = "radListView_Updates";
radListView_Updates.Size = new Size(510, 413);
radListView_Updates.TabIndex = 0;
radListView_Updates.ViewType = Telerik.WinControls.UI.ListViewType.DetailsView;
radListView_Updates.SelectedItemChanged += RadListView_Updates_SelectedItemChanged;
radListView_Updates.ItemRemoved += RadListView_Updates_ItemRemoved;
//
// splitPanel2
//
splitPanel2.Controls.Add(tableLayoutPanel3);
splitPanel2.Location = new Point(520, 0);
splitPanel2.Name = "splitPanel2";
splitPanel2.Size = new Size(280, 419);
splitPanel2.SizeInfo.AutoSizeScale = new SizeF(-0.148241192F, 0F);
splitPanel2.SizeInfo.SplitterCorrection = new Size(-118, 0);
splitPanel2.TabIndex = 1;
splitPanel2.TabStop = false;
splitPanel2.Text = "splitPanel2";
//
// tableLayoutPanel3
//
tableLayoutPanel3.ColumnCount = 1;
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
tableLayoutPanel3.Controls.Add(radListView_VersionTags, 0, 0);
tableLayoutPanel3.Dock = DockStyle.Fill;
tableLayoutPanel3.Location = new Point(0, 0);
tableLayoutPanel3.Name = "tableLayoutPanel3";
tableLayoutPanel3.RowCount = 1;
tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
tableLayoutPanel3.Size = new Size(280, 419);
tableLayoutPanel3.TabIndex = 0;
//
// radListView_VersionTags
//
radListView_VersionTags.AllowEdit = false;
radListView_VersionTags.AllowRemove = false;
radListView_VersionTags.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
listViewDetailColumn4.HeaderText = "Release";
listViewDetailColumn5.HeaderText = "Tag";
radListView_VersionTags.Columns.AddRange(new Telerik.WinControls.UI.ListViewDetailColumn[] { listViewDetailColumn4, listViewDetailColumn5 });
radListView_VersionTags.ItemSpacing = -1;
radListView_VersionTags.Location = new Point(3, 3);
radListView_VersionTags.Name = "radListView_VersionTags";
radListView_VersionTags.Size = new Size(274, 413);
radListView_VersionTags.TabIndex = 0;
radListView_VersionTags.ViewType = Telerik.WinControls.UI.ListViewType.DetailsView;
radListView_VersionTags.SelectedIndexChanged += RadListView_VersionTags_SelectedIndexChanged;
//
// radWaitingBar1
//
radWaitingBar1.AssociatedControl = radListView_Updates;
radWaitingBar1.Location = new Point(220, 171);
radWaitingBar1.Name = "radWaitingBar1";
radWaitingBar1.Size = new Size(70, 70);
radWaitingBar1.TabIndex = 2;
radWaitingBar1.Text = "radWaitingBar1";
radWaitingBar1.WaitingIndicators.Add(dotsSpinnerWaitingBarIndicatorElement1);
radWaitingBar1.WaitingIndicatorSize = new Size(100, 14);
radWaitingBar1.WaitingSpeed = 100;
radWaitingBar1.WaitingStyle = Telerik.WinControls.Enumerations.WaitingBarStyles.DotsSpinner;
//
// dotsSpinnerWaitingBarIndicatorElement1
//
dotsSpinnerWaitingBarIndicatorElement1.Name = "dotsSpinnerWaitingBarIndicatorElement1";
//
// UpdatesCollectorUi
//
AutoScaleBaseSize = new Size(7, 15);
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 449);
Controls.Add(radSplitContainer1);
Controls.Add(tableLayoutPanel1);
Icon = (Icon)resources.GetObject("$this.Icon");
Name = "UpdatesCollectorUi";
StartPosition = FormStartPosition.CenterParent;
Text = "Find updates";
Shown += UpdatesCollectorUi_Shown;
tableLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)radButton_Continue).EndInit();
((System.ComponentModel.ISupportInitialize)radProgressBar1).EndInit();
((System.ComponentModel.ISupportInitialize)radSplitContainer1).EndInit();
radSplitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)splitPanel1).EndInit();
splitPanel1.ResumeLayout(false);
tableLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)radListView_Updates).EndInit();
((System.ComponentModel.ISupportInitialize)splitPanel2).EndInit();
splitPanel2.ResumeLayout(false);
tableLayoutPanel3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)radListView_VersionTags).EndInit();
((System.ComponentModel.ISupportInitialize)radWaitingBar1).EndInit();
((System.ComponentModel.ISupportInitialize)this).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private TableLayoutPanel tableLayoutPanel1;
private Telerik.WinControls.UI.RadButton radButton_Continue;
private Telerik.WinControls.UI.RadSplitContainer radSplitContainer1;
private Telerik.WinControls.UI.SplitPanel splitPanel1;
private TableLayoutPanel tableLayoutPanel2;
private Telerik.WinControls.UI.SplitPanel splitPanel2;
private TableLayoutPanel tableLayoutPanel3;
private Telerik.WinControls.UI.RadListView radListView_Updates;
private Telerik.WinControls.UI.RadWaitingBar radWaitingBar1;
private Telerik.WinControls.UI.RadListView radListView_VersionTags;
private Telerik.WinControls.UI.RadProgressBar radProgressBar1;
private Telerik.WinControls.UI.DotsSpinnerWaitingBarIndicatorElement dotsSpinnerWaitingBarIndicatorElement1;
}

View File

@@ -1,136 +0,0 @@
using ModpackUpdater.Apps.Manager.Api.Model;
using ModpackUpdater.Manager;
namespace ModpackUpdater.Apps.Manager.Ui;
public partial class UpdatesCollectorUi : RadForm
{
public record ModUpdateInfo(KeyValuePair<string, string>[] AvailableVersions, InstallAction Origin)
{
public int NewVersion { get; set; } = 0;
}
public record ModUpdates(List<ModUpdateInfo> List);
private readonly IWorkspace workspace;
private readonly ModpackFactory factory = new();
private readonly InstallAction[] actions;
public ModUpdates? CurrentUpdates { get; private set; }
public ModUpdateInfo? SelectedUpdate => radListView_Updates.SelectedItem?.Value as ModUpdateInfo;
public int SelectedVersion => radListView_VersionTags.SelectedIndex;
public UpdatesCollectorUi(IWorkspace workspace, params InstallAction[] actions)
{
this.workspace = workspace;
this.actions = actions;
InitializeComponent();
radListView_Updates.AutoSizeColumnsMode = ListViewAutoSizeColumnsMode.Fill;
radListView_VersionTags.AutoSizeColumnsMode = ListViewAutoSizeColumnsMode.Fill;
}
private async Task<ModUpdates> FindUpdates()
{
var list = new List<ModUpdateInfo>();
foreach (var action in actions)
{
var updates = await factory.FindUpdates(action, workspace.ModpackConfig?.MinecraftVersion, workspace.ModpackConfig?.ModLoader ?? ModLoader.Any);
BeginInvoke(() =>
{
radProgressBar1.Value1 += 1;
radProgressBar1.Text = $"{radProgressBar1.Value1} / {radProgressBar1.Maximum}";
});
if (updates == null || updates.Length == 0 || updates[0].Value == action.SourceTag)
continue;
list.Add(new(updates, action));
}
return new ModUpdates(list);
}
private void LoadUpdates(ModUpdates updates)
{
radListView_Updates.BeginUpdate();
radListView_Updates.Items.Clear();
foreach (var update in updates.List)
{
var item = new ListViewDataItem(update);
UpdateUpdatesItem(item);
radListView_Updates.Items.Add(item);
}
radListView_Updates.EndUpdate();
}
private static void UpdateUpdatesItem(ListViewDataItem? item)
{
if (item?.Value is not ModUpdateInfo updates)
return;
item[0] = updates.Origin.Name;
item[1] = updates.Origin.SourceTag;
item[2] = updates.AvailableVersions[updates.NewVersion].Value;
}
private void LoadVersions(ModUpdateInfo updates)
{
radListView_VersionTags.BeginUpdate();
radListView_VersionTags.Items.Clear();
foreach (var kvp in updates.AvailableVersions)
{
var item = new ListViewDataItem();
item[0] = kvp.Key;
item[1] = kvp.Value;
radListView_VersionTags.Items.Add(item);
}
radListView_VersionTags.SelectedIndex = updates.NewVersion;
radListView_VersionTags.EndUpdate();
}
private async void UpdatesCollectorUi_Shown(object sender, EventArgs e)
{
radWaitingBar1.StartWaiting();
radProgressBar1.Value1 = 0;
radProgressBar1.Maximum = actions.Length;
radProgressBar1.Text = null;
radProgressBar1.Visible = true;
CurrentUpdates = await FindUpdates();
LoadUpdates(CurrentUpdates);
radProgressBar1.Visible = false;
radWaitingBar1.StopWaiting();
}
private void RadListView_Updates_SelectedItemChanged(object sender, EventArgs e)
{
if (SelectedUpdate is ModUpdateInfo updates)
LoadVersions(updates);
}
private void RadListView_VersionTags_SelectedIndexChanged(object sender, EventArgs e)
{
var newIndex = SelectedVersion;
if (newIndex != -1 && SelectedUpdate is ModUpdateInfo updates)
{
updates.NewVersion = newIndex;
UpdateUpdatesItem(radListView_Updates.SelectedItem);
}
}
private void RadListView_Updates_ItemRemoved(object sender, ListViewItemEventArgs e)
{
if (e.Item?.Value is ModUpdateInfo update && CurrentUpdates is not null && CurrentUpdates.List.Contains(update))
CurrentUpdates.List.Remove(update);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,101 @@
<dialogs:AvaloniaFlyoutBase
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:dialogs="https://git.pilzinsel64.de/pilz-framework/pilz"
xmlns:local="clr-namespace:ModpackUpdater.Apps.Manager.Ui"
mc:Ignorable="d"
d:DesignWidth="600"
d:DesignHeight="450"
Width="1000"
Height="800"
x:Class="ModpackUpdater.Apps.Manager.Ui.UpdatesCollectorView"
Title="UpdatesCollectorWindow"
Loaded="Me_OnLoaded">
<!-- Main -->
<dialogs:AvaloniaFlyoutBase.MainContent>
<Grid
RowDefinitions="Auto,*"
RowSpacing="6"
VerticalAlignment="Stretch">
<!-- TextBox: Search -->
<TextBox
x:Name="TextBoxSearch"
Grid.Row="0"
Watermark="Search"
TextChanged="TextBoxSearch_OnTextChanged"/>
<!-- ScrollViewer: Updates -->
<ScrollViewer
Grid.Row="1">
<ItemsControl
x:Name="ItemsControlUpdates">
<ItemsControl.ItemTemplate>
<DataTemplate
DataType="{x:Type local:UpdatesCollectorView+ModUpdateInfo}">
<Grid
ColumnDefinitions="20*,20*,20*,Auto"
ColumnSpacing="6"
RowSpacing="6"
Margin="3">
<!-- Label: Name -->
<TextBlock
Grid.Column="0"
VerticalAlignment="Center"
Text="{Binding Origin.Name}"/>
<!-- Label: Version (old) -->
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{Binding Origin.SourceTag}"/>
<!-- ComboBox: Version (new) -->
<ComboBox
HorizontalAlignment="Stretch"
Grid.Column="2"
ItemsSource="{Binding DisplayVersions}"
SelectedIndex="{Binding NewVersion}"/>
<!-- Button: RemoveUpdate -->
<dialogs:ImageButton
Grid.Column="3"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="Remove"
Click="ButtonRemoveUpdate_Click"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</dialogs:AvaloniaFlyoutBase.MainContent>
<!-- Footer -->
<dialogs:AvaloniaFlyoutBase.FooterContent>
<Panel
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<!-- ProgressBar: Status -->
<ProgressBar
x:Name="ProgressBarStatus"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
<!-- TextBox: Status -->
<TextBlock
x:Name="TextBlockStatus"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</Panel>
</dialogs:AvaloniaFlyoutBase.FooterContent>
</dialogs:AvaloniaFlyoutBase>

View File

@@ -0,0 +1,94 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using Avalonia.Controls;
using Avalonia.Interactivity;
using ModpackUpdater.Apps.Manager.Api.Model;
using ModpackUpdater.Manager;
using Pilz.UI.AvaloniaUI.Dialogs;
namespace ModpackUpdater.Apps.Manager.Ui;
public partial class UpdatesCollectorView : AvaloniaFlyoutBase
{
public record ModUpdateInfo(KeyValuePair<string, string>[] AvailableVersions, InstallAction Origin)
{
public int NewVersion { get; set; }
public IEnumerable<string> DisplayVersions { get; } = AvailableVersions.Select(n =>
{
if (string.IsNullOrWhiteSpace(n.Value) || n.Value == n.Key)
return n.Key;
return $"{n.Value} ({n.Value})";
});
}
public record ModUpdates(IList<ModUpdateInfo> List);
private readonly IWorkspace workspace;
private readonly ModpackFactory factory = new();
private readonly InstallAction[] actions;
public ModUpdates? CurrentUpdates { get; private set; }
public UpdatesCollectorView(IWorkspace workspace, params InstallAction[] actions)
{
this.workspace = workspace;
this.actions = actions;
InitializeComponent();
}
private async Task<ModUpdates> FindUpdates()
{
var list = new ObservableCollection<ModUpdateInfo>();
ProgressBarStatus.Maximum = actions.Length;
foreach (var action in actions)
{
var updates = await factory.FindUpdates(action, workspace.ModpackConfig?.MinecraftVersion, workspace.ModpackConfig?.ModLoader ?? ModLoader.Any);
ProgressBarStatus.Value += 1;
TextBlockStatus.Text = $"{Math.Round(ProgressBarStatus.Value / ProgressBarStatus.Maximum * 100)}";
if (updates == null || updates.Length == 0 || updates[0].Value == action.SourceTag)
continue;
list.Add(new(updates, action));
}
return new ModUpdates(list);
}
protected override void OnLoadData(DoWorkEventArgs e)
{
e.Result = Task.Run(FindUpdates).Result;
}
protected override void OnLoadDataCompleted(RunWorkerCompletedEventArgs e)
{
if (e.Result is ModUpdates updates)
ItemsControlUpdates.ItemsSource = (CurrentUpdates = updates).List;
}
private void Me_OnLoaded(object? sender, RoutedEventArgs e)
{
LoadData();
}
private void TextBoxSearch_OnTextChanged(object? sender, TextChangedEventArgs e)
{
var searchString = TextBoxSearch.Text?.Trim().ToLowerInvariant();
var hasNoSearch = string.IsNullOrWhiteSpace(searchString);
foreach (var item in ItemsControlUpdates.Items.OfType<Grid>())
{
item.IsVisible = hasNoSearch || (item.Name != null && item.Name.Contains(searchString!, StringComparison.InvariantCultureIgnoreCase));
}
}
private void ButtonRemoveUpdate_Click(object? sender, RoutedEventArgs e)
{
if (sender is Button button && button.DataContext is ModUpdateInfo update)
CurrentUpdates?.List.Remove(update);
}
}

View File

@@ -1,10 +0,0 @@
<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"
mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="450"
Width="600" Height="600"
x:Class="ModpackUpdater.Apps.Manager.Ui.UpdatesCollectorWindow"
Title="UpdatesCollectorWindow">
</Window>

View File

@@ -1,33 +0,0 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using ModpackUpdater.Apps.Manager.Api.Model;
using ModpackUpdater.Manager;
namespace ModpackUpdater.Apps.Manager.Ui;
public partial class UpdatesCollectorWindow : Window
{
public record ModUpdateInfo(KeyValuePair<string, string>[] AvailableVersions, InstallAction Origin)
{
public int NewVersion { get; set; } = 0;
}
public record ModUpdates(List<ModUpdateInfo> List);
private readonly IWorkspace workspace;
private readonly ModpackFactory factory = new();
private readonly InstallAction[] actions;
public ModUpdates? CurrentUpdates { get; private set; }
public ModUpdateInfo? SelectedUpdate => radListView_Updates.SelectedItem?.Value as ModUpdateInfo;
public int SelectedVersion => radListView_VersionTags.SelectedIndex;
public UpdatesCollectorWindow(IWorkspace workspace, params InstallAction[] actions)
{
this.workspace = workspace;
this.actions = actions;
InitializeComponent();
}
}

View File

@@ -17,7 +17,7 @@
<ItemGroup>
<PackageReference Include="Pilz" Version="2.6.1" />
<PackageReference Include="Pilz.UI" Version="3.1.1" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.0" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.8" />
<PackageReference Include="Avalonia" Version="11.3.8" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.8" />
<PackageReference Include="Avalonia.Svg" Version="11.3.0" />

View File

@@ -56,36 +56,37 @@ public class ModpackFactory
return action.GetSourceUrl(targetVersion, overwriteVersion: overwriteVersion);
}
public async Task<KeyValuePair<string, string>[]> FindUpdates(InstallAction action, string? gameVersion, ModLoader modLoader)
public async Task<KeyValuePair<string, string>[]?> FindUpdates(InstallAction action, string? gameVersion, ModLoader modLoader)
{
if (action.SourceType == SourceType.GitHub)
switch (action.SourceType)
{
case SourceType.GitHub:
try
{
var repo = await github.Repository.Get(action.SourceOwner, action.SourceName);
var releases = await github.Repository.Release.GetAll(repo.Id);
return releases.Select(r => new KeyValuePair<string, string>(r.Name ?? r.TagName, r.TagName)).ToArray();
return releases.Select(r => new KeyValuePair<string, string>(r.TagName, r.Name ?? r.TagName)).ToArray();
}
catch (Exception)
catch
{
// Ignore
}
}
else if (action.SourceType == SourceType.GitLab)
{
break;
case SourceType.GitLab:
throw new NotImplementedException("To be implemented soon.");
}
else if (action.SourceType == SourceType.CurseForge)
case SourceType.CurseForge:
{
var res = await curseForge.GetModFilesAsync(Convert.ToInt32(action.SourceName), gameVersion: gameVersion, modLoaderType: GetModLoaderForCurseForge(modLoader));
if (res.Data != null)
return res.Data.Select(n => new KeyValuePair<string, string>(n.DisplayName, n.Id.ToString())).ToArray();
break;
}
else if (action.SourceType == SourceType.Modrinth)
case SourceType.Modrinth:
{
var res = await modrinth.Version.GetProjectVersionListAsync(action.SourceName, gameVersions: GetGameVersionForModrinth(gameVersion), loaders: GetModLoaderForModrinth(modLoader));
return res.Select(v => new KeyValuePair<string, string>($"{v.VersionNumber} {v.ProjectVersionType} {v.Name}", v.Id)).ToArray();
}
}
return null;
}