From e04e5f0b1328181ddfe5aa2bfd01e4d3d3472138 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Mon, 17 Nov 2025 16:35:02 +0100 Subject: [PATCH] local folder workspace --- .../GitLabRepo/GitLabRepoWorkspace.cs | 25 ++-- .../GitLabRepoWorkspaceConfigEditorView.axaml | 27 +++-- .../GitLabRepo/GitLabRepoWorkspaceFeature.cs | 2 +- .../LocalFolder/LocalFolderWorkspace.cs | 84 +++++++++++++ .../LocalFolder/LocalFolderWorkspaceConfig.cs | 17 +++ ...LocalFolderWorkspaceConfigEditorView.axaml | 43 +++++++ ...alFolderWorkspaceConfigEditorView.axaml.cs | 35 ++++++ .../LocalFolderWorkspaceFeature.cs | 37 ++++++ .../LangRes/FeatureNamesLangRes.Designer.cs | 113 ++++++------------ .../LangRes/FeatureNamesLangRes.resx | 3 + .../LangRes/GeneralLangRes.Designer.cs | 18 +++ .../LangRes/GeneralLangRes.resx | 9 ++ .../LangRes/TitlesLangRes.Designer.cs | 68 ++++------- .../LangRes/TitlesLangRes.resx | 3 + .../ModpackUpdater.Apps.Manager.csproj | 4 + ModpackUpdater/InstallInfos.cs | 6 +- ModpackUpdater/UpdateInfos.cs | 4 +- 17 files changed, 347 insertions(+), 151 deletions(-) create mode 100644 ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspace.cs create mode 100644 ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfig.cs create mode 100644 ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfigEditorView.axaml create mode 100644 ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfigEditorView.axaml.cs create mode 100644 ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceFeature.cs diff --git a/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspace.cs b/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspace.cs index 8d9ce64..5a486d7 100644 --- a/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspace.cs +++ b/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspace.cs @@ -6,19 +6,14 @@ namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo; internal class GitLabRepoWorkspace(GitLabRepoWorkspaceConfig config) : IWorkspace { - private string? rawInstallInfos = null; - private string? rawUpdateInfos = null; + private string? rawInstallInfos; + private string? rawUpdateInfos; public WorkspaceConfig Config => ConfigX; - public GitLabRepoWorkspaceConfig ConfigX { get; } = config; - public IGitLabClient Gitlab { get; } = new GitLabClient(config.InstanceUrl, config.ApiToken); - public ModpackConfig? ModpackConfig { get; private set; } - public InstallInfos? InstallInfos { get; private set; } - public UpdateInfos? UpdateInfos { get; private set; } public async Task Load() @@ -39,13 +34,17 @@ internal class GitLabRepoWorkspace(GitLabRepoWorkspaceConfig config) : IWorkspac public async Task Save() { + var failed = true; + if (InstallInfos != null) { var newInstallInfos = InstallInfos.ToString(); if (newInstallInfos != rawInstallInfos) { - await SaveContent(ConfigX.FileLocationInstallJson, newInstallInfos); - rawInstallInfos = newInstallInfos; + if (await SaveContent(ConfigX.FileLocationInstallJson, newInstallInfos)) + rawInstallInfos = newInstallInfos; + else + failed = true; } } @@ -54,12 +53,14 @@ internal class GitLabRepoWorkspace(GitLabRepoWorkspaceConfig config) : IWorkspac var newUpdateInfos = UpdateInfos.ToString(); if (newUpdateInfos != rawUpdateInfos) { - await SaveContent(ConfigX.FileLocationUpdateJson, newUpdateInfos); - rawUpdateInfos = newUpdateInfos; + if (await SaveContent(ConfigX.FileLocationUpdateJson, newUpdateInfos)) + rawUpdateInfos = newUpdateInfos; + else + failed = true; } } - return true; + return failed; } private async Task GetContent(string path) diff --git a/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspaceConfigEditorView.axaml b/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspaceConfigEditorView.axaml index 2861f7a..27db4d7 100644 --- a/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspaceConfigEditorView.axaml +++ b/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspaceConfigEditorView.axaml @@ -10,27 +10,28 @@ d:DesignWidth="800" d:DesignHeight="450" Width="300" - x:Class="ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo.GitLabRepoWorkspaceConfigEditorView"> + x:Class="ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo.GitLabRepoWorkspaceConfigEditorView" + x:DataType="gitLabRepo:GitLabRepoWorkspaceConfig"> - - + diff --git a/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspaceFeature.cs b/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspaceFeature.cs index 4c3bc3c..ef551b9 100644 --- a/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspaceFeature.cs +++ b/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspaceFeature.cs @@ -31,7 +31,7 @@ internal class GitLabRepoWorkspaceFeature() : WorkspaceFeature("origin.gitlab", protected override void OnCreate(out IWorkspace workspace, WorkspaceConfig config) { if (config is not GitLabRepoWorkspaceConfig gitlabConfig) - throw new NotImplementedException($"Only configs of type {nameof(GitLabRepoWorkspaceConfig)} are allowed."); + throw new NotSupportedException($"Only configs of type {nameof(GitLabRepoWorkspaceConfig)} are allowed."); workspace = new GitLabRepoWorkspace(gitlabConfig); } } diff --git a/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspace.cs b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspace.cs new file mode 100644 index 0000000..a1d705f --- /dev/null +++ b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspace.cs @@ -0,0 +1,84 @@ +using ModpackUpdater.Apps.Manager.Api.Model; + +namespace ModpackUpdater.Apps.Manager.Features.Workspaces.LocalFolder; + +internal class LocalFolderWorkspace(LocalFolderWorkspaceConfig config) : IWorkspace +{ + private string? rawInstallInfos; + private string? rawUpdateInfos; + + public WorkspaceConfig Config => ConfigX; + public LocalFolderWorkspaceConfig ConfigX { get; } = config; + public ModpackConfig? ModpackConfig { get; private set; } + public InstallInfos? InstallInfos { get; private set; } + public UpdateInfos? UpdateInfos { get; private set; } + + public async Task Load() + { + if (!string.IsNullOrWhiteSpace(Config.ModpackConfigUrl)) + ModpackConfig = ModpackConfig.LoadFromUrl(Config.ModpackConfigUrl); + + rawInstallInfos = await GetContent(ConfigX.FileLocationInstallJson); + InstallInfos = InstallInfos.Parse(rawInstallInfos); + + rawUpdateInfos = await GetContent(ConfigX.FileLocationUpdateJson); + UpdateInfos = UpdateInfos.Parse(rawUpdateInfos); + + ConfigX.FolderName = Path.GetFileName(ConfigX.RootFolderPath); + + return InstallInfos != null && UpdateInfos != null; + } + + public async Task Save() + { + var failed = false; + + if (InstallInfos != null) + { + var newInstallInfos = InstallInfos.ToString(); + if (newInstallInfos != rawInstallInfos) + { + if (await SaveContent(ConfigX.FileLocationInstallJson, newInstallInfos)) + rawInstallInfos = newInstallInfos; + else + failed = true; + } + } + + if (UpdateInfos != null) + { + var newUpdateInfos = UpdateInfos.ToString(); + if (newUpdateInfos != rawUpdateInfos) + { + if (await SaveContent(ConfigX.FileLocationUpdateJson, newUpdateInfos)) + rawUpdateInfos = newUpdateInfos; + else + failed = true; + } + } + + return !failed; + } + + private async Task GetContent(string path) + { + if (ConfigX.RootFolderPath == null) + return null; + + var filePath = Path.Combine(ConfigX.RootFolderPath!, path); + return File.Exists(filePath) ? await File.ReadAllTextAsync(filePath) : null; + } + + private async Task SaveContent(string path, string content) + { + if (ConfigX.RootFolderPath == null) + return false; + + var filePath = Path.Combine(ConfigX.RootFolderPath!, path); + if (!File.Exists(filePath)) + return false; + + await File.WriteAllTextAsync(filePath, content); + return true; + } +} diff --git a/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfig.cs b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfig.cs new file mode 100644 index 0000000..ab0f431 --- /dev/null +++ b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfig.cs @@ -0,0 +1,17 @@ +using ModpackUpdater.Apps.Manager.Api.Model; + +namespace ModpackUpdater.Apps.Manager.Features.Workspaces.LocalFolder; + +public class LocalFolderWorkspaceConfig : WorkspaceConfig, ICloneable +{ + public override string DisplayText => FolderName ?? string.Empty; + public string? FolderName { get; set; } + public string? RootFolderPath { get; set; } + public string FileLocationInstallJson { get; set; } = "install.json"; + public string FileLocationUpdateJson { get; set; } = "updates.json"; + + public object Clone() + { + return MemberwiseClone(); + } +} diff --git a/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfigEditorView.axaml b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfigEditorView.axaml new file mode 100644 index 0000000..2b1078a --- /dev/null +++ b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfigEditorView.axaml @@ -0,0 +1,43 @@ + + + + + + + diff --git a/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfigEditorView.axaml.cs b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfigEditorView.axaml.cs new file mode 100644 index 0000000..b421136 --- /dev/null +++ b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceConfigEditorView.axaml.cs @@ -0,0 +1,35 @@ +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.Platform.Storage; +using ModpackUpdater.Apps.Manager.LangRes; +using Pilz.UI.AvaloniaUI.Dialogs; + +namespace ModpackUpdater.Apps.Manager.Features.Workspaces.LocalFolder; + +public partial class LocalFolderWorkspaceConfigEditorView : AvaloniaFlyoutBase +{ + public LocalFolderWorkspaceConfig Settings { get; } + + public LocalFolderWorkspaceConfigEditorView(LocalFolderWorkspaceConfig settings) + { + Settings = settings; + DataContext = settings; + InitializeComponent(); + ButtonSearch.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.opened_folder); + } + + private async void ButtonSearch_OnClick(object? sender, RoutedEventArgs e) + { + if (TopLevel.GetTopLevel(this) is not { } topLevel) + return; + + var filePaths = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions + { + Title = GeneralLangRes.SelectRootFolder, + AllowMultiple = false, + }); + + if (filePaths.Count >= 1) + TextBoxRootFolderPath.Text = filePaths[0].Path.AbsolutePath; + } +} \ No newline at end of file diff --git a/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceFeature.cs b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceFeature.cs new file mode 100644 index 0000000..246c6b2 --- /dev/null +++ b/ModpackUpdater.Apps.Manager/Features/Workspaces/LocalFolder/LocalFolderWorkspaceFeature.cs @@ -0,0 +1,37 @@ +using ModpackUpdater.Apps.Manager.Api.Model; +using ModpackUpdater.Apps.Manager.Api.Plugins.Features; +using ModpackUpdater.Apps.Manager.LangRes; +using Pilz.Features; +using Pilz.UI.AvaloniaUI.Dialogs; +using Pilz.UI.Symbols; + +namespace ModpackUpdater.Apps.Manager.Features.Workspaces.LocalFolder; + +internal class LocalFolderWorkspaceFeature() : WorkspaceFeature("origin.localfolder", FeatureNamesLangRes.LocalFolderWorkspace), IPluginFeatureProvider +{ + public static LocalFolderWorkspaceFeature Instance { get; } = new(); + + public override object? Icon => AppGlobals.Symbols.GetImage(AppSymbols.opened_folder, SymbolSize.Small); + + protected override async Task OnConfigure(WorkspaceContext context) + { + var settings = context.Workspace?.Config as LocalFolderWorkspaceConfig ?? new(); + + if ((await AvaloniaFlyoutBase.Show( + new LocalFolderWorkspaceConfigEditorView((LocalFolderWorkspaceConfig)settings.Clone()), + context.MainApi.MainWindow, + TitlesLangRes.LocalFolderWorkspaceEditor, + AppGlobals.Symbols.GetImageSource(AppSymbols.gitlab))) + .Result is LocalFolderWorkspaceConfig settingsNew) + context.Workspace = new LocalFolderWorkspace(settingsNew); + else + context.Canceled = true; + } + + protected override void OnCreate(out IWorkspace workspace, WorkspaceConfig config) + { + if (config is not LocalFolderWorkspaceConfig gitlabConfig) + throw new NotSupportedException($"Only configs of type {nameof(LocalFolderWorkspaceConfig)} are allowed."); + workspace = new LocalFolderWorkspace(gitlabConfig); + } +} diff --git a/ModpackUpdater.Apps.Manager/LangRes/FeatureNamesLangRes.Designer.cs b/ModpackUpdater.Apps.Manager/LangRes/FeatureNamesLangRes.Designer.cs index a549a92..f50a798 100644 --- a/ModpackUpdater.Apps.Manager/LangRes/FeatureNamesLangRes.Designer.cs +++ b/ModpackUpdater.Apps.Manager/LangRes/FeatureNamesLangRes.Designer.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // -// 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. // //------------------------------------------------------------------------------ @@ -12,46 +11,32 @@ namespace ModpackUpdater.Apps.Manager.LangRes { using System; - /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - /// - // 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 FeatureNamesLangRes { + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class FeatureNamesLangRes { - 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 FeatureNamesLangRes() { } - /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public 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.FeatureNamesLangRes", typeof(FeatureNamesLangRes).Assembly); + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("ModpackUpdater.Apps.Manager.LangRes.FeatureNamesLangRes", typeof(FeatureNamesLangRes).Assembly); resourceMan = temp; } return resourceMan; } } - /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -60,109 +45,79 @@ namespace ModpackUpdater.Apps.Manager.LangRes { } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Check healthy ähnelt. - /// - internal static string CheckAllActionsHealthy { + public static string CheckAllActionsHealthy { get { return ResourceManager.GetString("CheckAllActionsHealthy", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Check healthy ähnelt. - /// - internal static string CheckSingleActionHealthy { + public static string CheckSingleActionHealthy { get { return ResourceManager.GetString("CheckSingleActionHealthy", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Clear direct link ähnelt. - /// - internal static string ClearDirectLinkFeature { + public static string ClearDirectLinkFeature { get { return ResourceManager.GetString("ClearDirectLinkFeature", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Clear direct links ähnelt. - /// - internal static string ClearDirectLinksFeature { + public static string ClearDirectLinksFeature { get { return ResourceManager.GetString("ClearDirectLinksFeature", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Generate changelog ähnelt. - /// - internal static string GenerateChangelogFeature { + public static string GenerateChangelogFeature { get { return ResourceManager.GetString("GenerateChangelogFeature", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Generate modlist excel file ähnelt. - /// - internal static string GenerateModlistAsExcelFeature { + public static string GenerateModlistAsExcelFeature { get { return ResourceManager.GetString("GenerateModlistAsExcelFeature", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Generate modlist markdown table ähnelt. - /// - internal static string GenerateModlistAsMarkdownFeature { + public static string GenerateModlistAsMarkdownFeature { get { return ResourceManager.GetString("GenerateModlistAsMarkdownFeature", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die GitLab workspace ähnelt. - /// - internal static string GitLabWorkspace { + public static string GitLabWorkspace { get { return ResourceManager.GetString("GitLabWorkspace", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Find update ähnelt. - /// - internal static string UpdateCollectorFeature { + public static string LocalFolderWorkspace { + get { + return ResourceManager.GetString("LocalFolderWorkspace", resourceCulture); + } + } + + public static string UpdateCollectorFeature { get { return ResourceManager.GetString("UpdateCollectorFeature", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Update direct link ähnelt. - /// - internal static string UpdateDirectLinkFeature { + public static string UpdateDirectLinkFeature { get { return ResourceManager.GetString("UpdateDirectLinkFeature", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Update direct links ähnelt. - /// - internal static string UpdateDirectLinksFeature { + public static string UpdateDirectLinksFeature { get { return ResourceManager.GetString("UpdateDirectLinksFeature", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Find updates ähnelt. - /// - internal static string UpdatesCollectorFeature { + public static string UpdatesCollectorFeature { get { return ResourceManager.GetString("UpdatesCollectorFeature", resourceCulture); } diff --git a/ModpackUpdater.Apps.Manager/LangRes/FeatureNamesLangRes.resx b/ModpackUpdater.Apps.Manager/LangRes/FeatureNamesLangRes.resx index ce1cf1c..584ba6f 100644 --- a/ModpackUpdater.Apps.Manager/LangRes/FeatureNamesLangRes.resx +++ b/ModpackUpdater.Apps.Manager/LangRes/FeatureNamesLangRes.resx @@ -141,6 +141,9 @@ GitLab workspace + + Local folder workspace + Find update diff --git a/ModpackUpdater.Apps.Manager/LangRes/GeneralLangRes.Designer.cs b/ModpackUpdater.Apps.Manager/LangRes/GeneralLangRes.Designer.cs index bf54e62..91409d6 100644 --- a/ModpackUpdater.Apps.Manager/LangRes/GeneralLangRes.Designer.cs +++ b/ModpackUpdater.Apps.Manager/LangRes/GeneralLangRes.Designer.cs @@ -69,6 +69,12 @@ namespace ModpackUpdater.Apps.Manager.LangRes { } } + public static string RootFolderPath { + get { + return ResourceManager.GetString("RootFolderPath", resourceCulture); + } + } + public static string FileLocationOfInstallJson { get { return ResourceManager.GetString("FileLocationOfInstallJson", resourceCulture); @@ -296,5 +302,17 @@ namespace ModpackUpdater.Apps.Manager.LangRes { return ResourceManager.GetString("Website", resourceCulture); } } + + public static string Select { + get { + return ResourceManager.GetString("Select", resourceCulture); + } + } + + public static string SelectRootFolder { + get { + return ResourceManager.GetString("SelectRootFolder", resourceCulture); + } + } } } diff --git a/ModpackUpdater.Apps.Manager/LangRes/GeneralLangRes.resx b/ModpackUpdater.Apps.Manager/LangRes/GeneralLangRes.resx index 7d76ebc..bad5c43 100644 --- a/ModpackUpdater.Apps.Manager/LangRes/GeneralLangRes.resx +++ b/ModpackUpdater.Apps.Manager/LangRes/GeneralLangRes.resx @@ -129,6 +129,9 @@ Repository Id + + Root folder path + File location of "install.json" @@ -243,4 +246,10 @@ Website + + Select + + + Select root folder + \ No newline at end of file diff --git a/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs b/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs index 69e2210..2846c27 100644 --- a/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs +++ b/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // -// 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. // //------------------------------------------------------------------------------ @@ -12,46 +11,32 @@ namespace ModpackUpdater.Apps.Manager.LangRes { using System; - /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - /// - // 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 { + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class TitlesLangRes { - 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 TitlesLangRes() { } - /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public 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.TitlesLangRes", typeof(TitlesLangRes).Assembly); + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("ModpackUpdater.Apps.Manager.LangRes.TitlesLangRes", typeof(TitlesLangRes).Assembly); resourceMan = temp; } return resourceMan; } } - /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -60,31 +45,28 @@ namespace ModpackUpdater.Apps.Manager.LangRes { } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Create update ähnelt. - /// - internal static string CreateUpdate { + public static string CreateUpdate { get { return ResourceManager.GetString("CreateUpdate", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Edit update ähnelt. - /// - internal static string EditUpdate { + public static string EditUpdate { get { return ResourceManager.GetString("EditUpdate", resourceCulture); } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Setup GitLab workspace ähnelt. - /// - internal static string GitLabRepoWorkspaceEditor { + public static string GitLabRepoWorkspaceEditor { get { return ResourceManager.GetString("GitLabRepoWorkspaceEditor", resourceCulture); } } + + public static string LocalFolderWorkspaceEditor { + get { + return ResourceManager.GetString("LocalFolderWorkspaceEditor", resourceCulture); + } + } } } diff --git a/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx b/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx index 8db607a..0bf11ef 100644 --- a/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx +++ b/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx @@ -126,4 +126,7 @@ Setup GitLab workspace + + Setup local folder workspace + \ No newline at end of file diff --git a/ModpackUpdater.Apps.Manager/ModpackUpdater.Apps.Manager.csproj b/ModpackUpdater.Apps.Manager/ModpackUpdater.Apps.Manager.csproj index 387a384..3b72e0b 100644 --- a/ModpackUpdater.Apps.Manager/ModpackUpdater.Apps.Manager.csproj +++ b/ModpackUpdater.Apps.Manager/ModpackUpdater.Apps.Manager.csproj @@ -26,6 +26,10 @@ True SourceTypeLangRes.resx + + GitLabRepoWorkspaceConfigEditorView.axaml + Code + diff --git a/ModpackUpdater/InstallInfos.cs b/ModpackUpdater/InstallInfos.cs index 207ba4f..a1ba84f 100644 --- a/ModpackUpdater/InstallInfos.cs +++ b/ModpackUpdater/InstallInfos.cs @@ -6,7 +6,7 @@ namespace ModpackUpdater; public class InstallInfos : IActionSetInfos { [JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))] - public Version Version { get; set; } + public Version Version { get; set; } = new(); [DefaultValue(true)] public bool IsPublic { get; set; } = true; @@ -17,8 +17,10 @@ public class InstallInfos : IActionSetInfos IEnumerable IActionSet.Actions => Actions; - public static InstallInfos Parse(string content) + public static InstallInfos? Parse(string? content) { + if (string.IsNullOrWhiteSpace(content)) + return null; return JsonConvert.DeserializeObject(content); } diff --git a/ModpackUpdater/UpdateInfos.cs b/ModpackUpdater/UpdateInfos.cs index bf9642b..f8572f2 100644 --- a/ModpackUpdater/UpdateInfos.cs +++ b/ModpackUpdater/UpdateInfos.cs @@ -6,8 +6,10 @@ public class UpdateInfos { public List Updates { get; private set; } = []; - public static UpdateInfos Parse(string content) + public static UpdateInfos? Parse(string? content) { + if (string.IsNullOrWhiteSpace(content)) + return null; return JsonConvert.DeserializeObject(content); }