some background code for manager workspaces
This commit is contained in:
6
ModpackUpdater.Apps.Manager/Api/Model/IMainApi.cs
Normal file
6
ModpackUpdater.Apps.Manager/Api/Model/IMainApi.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace ModpackUpdater.Apps.Manager.Api.Model;
|
||||
|
||||
public interface IMainApi
|
||||
{
|
||||
public IWorkspace? Workspace { get; }
|
||||
}
|
||||
@@ -1,5 +1,17 @@
|
||||
namespace ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Api.Model;
|
||||
|
||||
public interface IWorkspace
|
||||
{
|
||||
WorkspaceConfig Config { get; }
|
||||
|
||||
InstallInfos? InstallInfos { get; }
|
||||
|
||||
UpdateInfos? UpdateInfos { get; }
|
||||
|
||||
[MemberNotNullWhen(true, nameof(InstallInfos), nameof(UpdateInfos))]
|
||||
Task<bool> Load();
|
||||
|
||||
Task<bool> Save();
|
||||
}
|
||||
|
||||
8
ModpackUpdater.Apps.Manager/Api/Model/WorkspaceConfig.cs
Normal file
8
ModpackUpdater.Apps.Manager/Api/Model/WorkspaceConfig.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace ModpackUpdater.Apps.Manager.Api.Model;
|
||||
|
||||
public class WorkspaceConfig
|
||||
{
|
||||
public string ProviderId { get; internal set; } = "origin.unknown";
|
||||
public string FileLocationInstallJson { get; set; } = "install.json";
|
||||
public string FileLocationUpdateJson { get; set; } = "update.json";
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using Pilz.Plugins.Advanced;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Api.Plugins.Features;
|
||||
|
||||
public abstract class WorkspaceFeature(string identifier, string name) : PluginFeature(FeatureTypes.Workspace, identifier, name)
|
||||
{
|
||||
public virtual bool CanConfigure(IWorkspace workspace)
|
||||
{
|
||||
return workspace?.Config == null || workspace.Config.ProviderId == Identifier;
|
||||
}
|
||||
|
||||
public virtual bool Configure(ref IWorkspace workspace)
|
||||
{
|
||||
OnConfigure(ref workspace);
|
||||
|
||||
if (workspace?.Config == null)
|
||||
return false;
|
||||
|
||||
workspace.Config.ProviderId = Identifier;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract bool OnConfigure(ref IWorkspace workspace);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using Pilz.Plugins.Advanced;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
|
||||
public class MainApiParameters(IMainApi api) : PluginFunctionParameter
|
||||
{
|
||||
public IMainApi Api { get; } = api;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
using Pilz.Plugins.Advanced;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
|
||||
public class WorkspaceInitParameters : PluginFunctionParameter
|
||||
{
|
||||
}
|
||||
@@ -3,4 +3,5 @@
|
||||
public static class FeatureTypes
|
||||
{
|
||||
public static string Workspace => "workspace";
|
||||
public static string Tools => "tools";
|
||||
}
|
||||
|
||||
@@ -1,7 +1,67 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using NGitLab;
|
||||
using NGitLab.Models;
|
||||
using System.Text.Encodings.Web;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
|
||||
|
||||
internal class GitLabRepoWorkspace : IWorkspace
|
||||
internal class GitLabRepoWorkspace(GitLabRepoWorkspaceConfig config) : IWorkspace
|
||||
{
|
||||
public WorkspaceConfig Config => ConfigX;
|
||||
|
||||
public GitLabRepoWorkspaceConfig ConfigX { get; } = config;
|
||||
|
||||
public IGitLabClient Gitlab { get; } = new GitLabClient(config.InstanceUrl, config.ApiToken);
|
||||
|
||||
public InstallInfos? InstallInfos { get; private set; }
|
||||
|
||||
public UpdateInfos? UpdateInfos { get; private set; }
|
||||
|
||||
public async Task<bool> Load()
|
||||
{
|
||||
InstallInfos = InstallInfos.Parse(await GetContent(ConfigX.FileLocationInstallJson));
|
||||
UpdateInfos = UpdateInfos.Parse(await GetContent(ConfigX.FileLocationUpdateJson));
|
||||
return InstallInfos != null && UpdateInfos != null;
|
||||
}
|
||||
|
||||
public async Task<bool> Save()
|
||||
{
|
||||
if (InstallInfos != null)
|
||||
await SaveContent(ConfigX.FileLocationInstallJson, InstallInfos.ToString());
|
||||
|
||||
if (UpdateInfos != null)
|
||||
await SaveContent(ConfigX.FileLocationUpdateJson, UpdateInfos.ToString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task<string> GetContent(string path)
|
||||
{
|
||||
var pathUrl = UrlEncoder.Default.Encode(path);
|
||||
var repoId = new ProjectId(ConfigX.RepoId);
|
||||
var repo = Gitlab.GetRepository(repoId);
|
||||
var data = await repo.Files.GetAsync(pathUrl, ConfigX.RepoBranche);
|
||||
return data.DecodedContent;
|
||||
}
|
||||
|
||||
private Task<bool> SaveContent(string path, string content)
|
||||
{
|
||||
var pathUrl = UrlEncoder.Default.Encode(path);
|
||||
var repoId = new ProjectId(ConfigX.RepoId);
|
||||
var repo = Gitlab.GetRepository(repoId);
|
||||
var update = new FileUpsert
|
||||
{
|
||||
Branch = ConfigX.RepoBranche,
|
||||
CommitMessage = "update " + Path.GetFileName(pathUrl),
|
||||
RawContent = content,
|
||||
Path = pathUrl,
|
||||
};
|
||||
|
||||
if (repo.Files.FileExists(pathUrl, ConfigX.RepoBranche))
|
||||
repo.Files.Update(update);
|
||||
else
|
||||
repo.Files.Create(update);
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using Pilz.Configuration;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
|
||||
|
||||
internal class GitLabRepoWorkspaceConfig : WorkspaceConfig
|
||||
{
|
||||
public string InstanceUrl { get; set; } = "https://gitlab.com";
|
||||
public string? ApiToken { get; set; }
|
||||
public long RepoId { get; set; } = -1L;
|
||||
public string RepoBranche { get; set; } = "master";
|
||||
}
|
||||
@@ -1,18 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Pilz.UI.Telerik.Dialogs;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
|
||||
public partial class GitLabRepoWorkspaceConfigEditor : UserControl
|
||||
|
||||
internal partial class GitLabRepoWorkspaceConfigEditor : RadFlyoutBase
|
||||
{
|
||||
public GitLabRepoWorkspaceConfigEditor()
|
||||
private readonly GitLabRepoWorkspaceConfig settings;
|
||||
|
||||
public GitLabRepoWorkspaceConfigEditor(GitLabRepoWorkspaceConfig settings)
|
||||
{
|
||||
this.settings = settings;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Features;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using Pilz.Plugins.Advanced;
|
||||
using Pilz.UI.Extensions;
|
||||
using Pilz.UI.Symbols;
|
||||
using Pilz.UI.Telerik.Dialogs;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
|
||||
|
||||
internal class GitLabRepoWorkspaceFeature : PluginFunction, IPluginFeatureProvider<GitLabRepoWorkspaceFeature>
|
||||
internal class GitLabRepoWorkspaceFeature : WorkspaceFeature, IPluginFeatureProvider<GitLabRepoWorkspaceFeature>
|
||||
{
|
||||
public static GitLabRepoWorkspaceFeature Instance { get; } = new();
|
||||
|
||||
public GitLabRepoWorkspaceFeature() : base(FeatureTypes.Workspace, "origin.gitlab", "GitLab repository")
|
||||
public GitLabRepoWorkspaceFeature() : base("origin.gitlab", "GitLab repository")
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.github, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
protected override bool OnConfigure(ref IWorkspace workspace)
|
||||
{
|
||||
if (@params is not WorkspaceInitParameters p)
|
||||
return null;
|
||||
var settings = workspace?.Config as GitLabRepoWorkspaceConfig ?? new();
|
||||
|
||||
/// Open config UI
|
||||
/// ...
|
||||
if (RadDialogBase.ShowDialog(new GitLabRepoWorkspaceConfigEditor(settings), TitlesLangRes.GitLabRepoWorkspaceEditor, AppGlobals.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small)).Result.IsNotOk())
|
||||
return false;
|
||||
|
||||
return new GitLabRepoWorkspace();
|
||||
workspace = new GitLabRepoWorkspace(settings);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
|
||||
|
||||
internal class GitLabRepoWorkspaceSettings
|
||||
{
|
||||
}
|
||||
50
ModpackUpdater.Apps.Manager/Form1.Designer.cs
generated
50
ModpackUpdater.Apps.Manager/Form1.Designer.cs
generated
@@ -28,7 +28,7 @@ partial class Form1
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
var tableViewDefinition2 = new Telerik.WinControls.UI.TableViewDefinition();
|
||||
var tableViewDefinition1 = new Telerik.WinControls.UI.TableViewDefinition();
|
||||
radSplitContainer1 = new Telerik.WinControls.UI.RadSplitContainer();
|
||||
splitPanel1 = new Telerik.WinControls.UI.SplitPanel();
|
||||
tableLayoutPanel2 = new TableLayoutPanel();
|
||||
@@ -36,10 +36,13 @@ partial class Form1
|
||||
splitPanel2 = new Telerik.WinControls.UI.SplitPanel();
|
||||
tableLayoutPanel1 = new TableLayoutPanel();
|
||||
radGridView_Actions = new Telerik.WinControls.UI.RadGridView();
|
||||
radMenuItem1 = new Telerik.WinControls.UI.RadMenuItem();
|
||||
radMenuItem_OpenWorkspace = new Telerik.WinControls.UI.RadMenuItem();
|
||||
radMenuItem_Workspace = new Telerik.WinControls.UI.RadMenuItem();
|
||||
radMenuItem_WorkspacePreferences = new Telerik.WinControls.UI.RadMenuItem();
|
||||
radMenuItem2 = new Telerik.WinControls.UI.RadMenuItem();
|
||||
radMenu1 = new Telerik.WinControls.UI.RadMenu();
|
||||
radMenuSeparatorItem1 = new Telerik.WinControls.UI.RadMenuSeparatorItem();
|
||||
radMenuItem_OpenNewWorkspace = new Telerik.WinControls.UI.RadMenuItem();
|
||||
radMenuItem_RecentWorkspaces = new Telerik.WinControls.UI.RadMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)radSplitContainer1).BeginInit();
|
||||
radSplitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)splitPanel1).BeginInit();
|
||||
@@ -144,21 +147,21 @@ partial class Form1
|
||||
//
|
||||
//
|
||||
//
|
||||
radGridView_Actions.MasterTemplate.ViewDefinition = tableViewDefinition2;
|
||||
radGridView_Actions.MasterTemplate.ViewDefinition = tableViewDefinition1;
|
||||
radGridView_Actions.Name = "radGridView_Actions";
|
||||
radGridView_Actions.Size = new Size(544, 416);
|
||||
radGridView_Actions.TabIndex = 0;
|
||||
//
|
||||
// radMenuItem1
|
||||
// radMenuItem_Workspace
|
||||
//
|
||||
radMenuItem1.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem_OpenWorkspace });
|
||||
radMenuItem1.Name = "radMenuItem1";
|
||||
radMenuItem1.Text = "File";
|
||||
radMenuItem_Workspace.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem_WorkspacePreferences, radMenuSeparatorItem1, radMenuItem_OpenNewWorkspace, radMenuItem_RecentWorkspaces });
|
||||
radMenuItem_Workspace.Name = "radMenuItem_Workspace";
|
||||
radMenuItem_Workspace.Text = "Workspace";
|
||||
//
|
||||
// radMenuItem_OpenWorkspace
|
||||
// radMenuItem_WorkspacePreferences
|
||||
//
|
||||
radMenuItem_OpenWorkspace.Name = "radMenuItem_OpenWorkspace";
|
||||
radMenuItem_OpenWorkspace.Text = "Open workspace";
|
||||
radMenuItem_WorkspacePreferences.Name = "radMenuItem_WorkspacePreferences";
|
||||
radMenuItem_WorkspacePreferences.Text = "Preferences";
|
||||
//
|
||||
// radMenuItem2
|
||||
//
|
||||
@@ -167,12 +170,28 @@ partial class Form1
|
||||
//
|
||||
// radMenu1
|
||||
//
|
||||
radMenu1.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem1, radMenuItem2 });
|
||||
radMenu1.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem_Workspace, radMenuItem2 });
|
||||
radMenu1.Location = new Point(0, 0);
|
||||
radMenu1.Name = "radMenu1";
|
||||
radMenu1.Size = new Size(800, 28);
|
||||
radMenu1.TabIndex = 1;
|
||||
//
|
||||
// radMenuSeparatorItem1
|
||||
//
|
||||
radMenuSeparatorItem1.Name = "radMenuSeparatorItem1";
|
||||
radMenuSeparatorItem1.Text = "radMenuSeparatorItem1";
|
||||
radMenuSeparatorItem1.TextAlignment = ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// radMenuItem_OpenNewWorkspace
|
||||
//
|
||||
radMenuItem_OpenNewWorkspace.Name = "radMenuItem_OpenNewWorkspace";
|
||||
radMenuItem_OpenNewWorkspace.Text = "Open new workspace";
|
||||
//
|
||||
// radMenuItem_RecentWorkspaces
|
||||
//
|
||||
radMenuItem_RecentWorkspaces.Name = "radMenuItem_RecentWorkspaces";
|
||||
radMenuItem_RecentWorkspaces.Text = "Recent workspaces";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
AutoScaleBaseSize = new Size(7, 15);
|
||||
@@ -208,10 +227,13 @@ partial class Form1
|
||||
private Telerik.WinControls.UI.SplitPanel splitPanel2;
|
||||
private Telerik.WinControls.UI.RadTreeView radTreeView_Updates;
|
||||
private Telerik.WinControls.UI.RadMenu radMenu1;
|
||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem1;
|
||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem_OpenWorkspace;
|
||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem_Workspace;
|
||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem_WorkspacePreferences;
|
||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem2;
|
||||
private TableLayoutPanel tableLayoutPanel2;
|
||||
private TableLayoutPanel tableLayoutPanel1;
|
||||
private Telerik.WinControls.UI.RadGridView radGridView_Actions;
|
||||
private Telerik.WinControls.UI.RadMenuSeparatorItem radMenuSeparatorItem1;
|
||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem_OpenNewWorkspace;
|
||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem_RecentWorkspaces;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,41 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using Pilz.Plugins.Advanced;
|
||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager;
|
||||
|
||||
public partial class Form1 : RadForm
|
||||
public partial class Form1 : RadForm, IMainApi
|
||||
{
|
||||
public IWorkspace? Workspace { get; set; }
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
PluginFeatureController.Instance.Functions.Get(FeatureTypes.Workspace).InsertItemsTo(radMenuItem_OpenNewWorkspace.Items, customClickHandler: RadMenuItem_OpenNewWorkspace_Click);
|
||||
PluginFeatureController.Instance.Functions.Get(FeatureTypes.Tools).InsertItemsTo(radMenuItem_OpenNewWorkspace.Items, customClickHandler: RadMenuItem_ToolsItem_Click);
|
||||
}
|
||||
|
||||
private void LoadRecentWorkspaces()
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
private void RadMenuItem_OpenNewWorkspace_Click(object? sender, EventArgs e)
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
private void RadMenuItem_OpenRecentWorkspace_Click(object? sender, EventArgs e)
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
private void RadMenuItem_ToolsItem_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is RadMenuItem item && item.Tag is PluginFunction func)
|
||||
func.Execute(new MainApiParameters(this));
|
||||
}
|
||||
}
|
||||
|
||||
72
ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs
generated
Normal file
72
ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs
generated
Normal file
@@ -0,0 +1,72 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
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()]
|
||||
internal class TitlesLangRes {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal TitlesLangRes() {
|
||||
}
|
||||
|
||||
/// <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 {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ModpackUpdater.Apps.Manager.LangRes.TitlesLangRes", typeof(TitlesLangRes).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 {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Setup GitLab workspace ähnelt.
|
||||
/// </summary>
|
||||
internal static string GitLabRepoWorkspaceEditor {
|
||||
get {
|
||||
return ResourceManager.GetString("GitLabRepoWorkspaceEditor", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
123
ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx
Normal file
123
ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx
Normal file
@@ -0,0 +1,123 @@
|
||||
<?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>
|
||||
<data name="GitLabRepoWorkspaceEditor" xml:space="preserve">
|
||||
<value>Setup GitLab workspace</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -9,6 +9,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NGitLab" Version="6.53.0" />
|
||||
<PackageReference Include="Pilz.Configuration" Version="3.1.3" />
|
||||
<PackageReference Include="Pilz.Plugins.Advanced" Version="2.10.1" />
|
||||
<PackageReference Include="Pilz.Plugins.Advanced.UI" Version="1.7.0" />
|
||||
<PackageReference Include="Pilz.Plugins.Advanced.UI.Telerik" Version="1.7.0" />
|
||||
@@ -23,4 +25,19 @@
|
||||
<ProjectReference Include="..\ModpackUpdater\ModpackUpdater.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="LangRes\TitlesLangRes.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>TitlesLangRes.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="LangRes\TitlesLangRes.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>TitlesLangRes.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,14 +1,24 @@
|
||||
using Pilz.Configuration;
|
||||
using Pilz.Plugins.Advanced;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager;
|
||||
|
||||
internal static class Program
|
||||
public static class Program
|
||||
{
|
||||
private static readonly SettingsManager settingsManager;
|
||||
|
||||
public static ISettings Settings => settingsManager.Instance;
|
||||
|
||||
static Program()
|
||||
{
|
||||
settingsManager = new(GetSettingsPath(), true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
internal static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
@@ -17,4 +27,16 @@ internal static class Program
|
||||
PluginFeatureController.Instance.RegisterAllOwn();
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
|
||||
private static string GetSettingsPath()
|
||||
{
|
||||
const string AppDataDirectoryName = "MinecraftModpackUpdateManager";
|
||||
var SettingsFileName = $"Settings.json";
|
||||
|
||||
var settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppDataDirectoryName);
|
||||
Directory.CreateDirectory(settingsPath);
|
||||
settingsPath = Path.Combine(settingsPath, SettingsFileName);
|
||||
|
||||
return settingsPath;
|
||||
}
|
||||
}
|
||||
16
ModpackUpdater.Apps.Manager/Settings/WorkspaceSettings.cs
Normal file
16
ModpackUpdater.Apps.Manager/Settings/WorkspaceSettings.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using Pilz.Configuration;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Settings;
|
||||
|
||||
internal class WorkspaceSettings : IChildSettings, ISettingsIdentifier
|
||||
{
|
||||
public static string Identifier => "origin.workspaces";
|
||||
|
||||
public List<WorkspaceConfig> Workspaces { get; } = [];
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Workspaces.Clear();
|
||||
}
|
||||
}
|
||||
@@ -18,4 +18,5 @@ public enum AppSymbols
|
||||
update_done,
|
||||
wrench,
|
||||
github,
|
||||
gitlab,
|
||||
}
|
||||
|
||||
10
ModpackUpdater.Apps/Symbols/gitlab.svg
Normal file
10
ModpackUpdater.Apps/Symbols/gitlab.svg
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="32" height="32">
|
||||
<path fill="#e53935" d="M24 43L16 20 32 20z" />
|
||||
<path fill="#ff7043" d="M24 43L42 20 32 20z" />
|
||||
<path fill="#e53935" d="M37 5L42 20 32 20z" />
|
||||
<path fill="#ffa726" d="M24 43L42 20 45 28z" />
|
||||
<path fill="#ff7043" d="M24 43L6 20 16 20z" />
|
||||
<path fill="#e53935" d="M11 5L6 20 16 20z" />
|
||||
<path fill="#ffa726" d="M24 43L6 20 3 28z" />
|
||||
</svg>
|
||||
@@ -13,4 +13,9 @@ public class InstallInfos
|
||||
{
|
||||
return JsonConvert.DeserializeObject<InstallInfos>(content);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,9 @@ public class UpdateInfos
|
||||
{
|
||||
return JsonConvert.DeserializeObject<UpdateInfos>(content);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user