repair manager project
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
using Pilz.UI.Gtk.Symbols;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ModpackUpdater.Apps;
|
||||
namespace ModpackUpdater.Apps.Client;
|
||||
|
||||
internal class AppSymbolFactory : GtkSymbolFactory<AppSymbols>
|
||||
{
|
||||
public override Assembly GetImageResourceAssembly()
|
||||
{
|
||||
return Assembly.GetExecutingAssembly();
|
||||
return typeof(AppSymbols).Assembly;
|
||||
}
|
||||
|
||||
public override string GetImageRessourcePath(AppSymbols svgImage)
|
||||
{
|
||||
return $"{GetType().Namespace}.Symbols.{svgImage}.svg";
|
||||
return $"{typeof(AppSymbols).Namespace}.Symbols.{svgImage}.svg";
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using Pilz.UI.Gtk.Dialogs;
|
||||
using Pilz.UI.Symbols;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using UI = Gtk.Builder.ObjectAttribute;
|
||||
|
||||
namespace ModpackUpdater.Apps.Client;
|
||||
@@ -45,10 +44,10 @@ internal class MainWindow : Window
|
||||
|
||||
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion()})";
|
||||
|
||||
button_CheckForUpdates.Image = AppGlobals.Symbols.GetImage(AppSymbols.update_done, SymbolSize.Small);
|
||||
button_SearchMinecraftFolder.Image = AppGlobals.Symbols.GetImage(AppSymbols.opened_folder, SymbolSize.Small);
|
||||
button_Install.Image = AppGlobals.Symbols.GetImage(AppSymbols.software_installer, SymbolSize.Small);
|
||||
image_Repair.Pixbuf = AppGlobals.Symbols.GetPixbuf(AppSymbols.wrench, SymbolSize.Small);
|
||||
button_CheckForUpdates.Image = Program.Symbols.GetImage(AppSymbols.update_done, SymbolSize.Small);
|
||||
button_SearchMinecraftFolder.Image = Program.Symbols.GetImage(AppSymbols.opened_folder, SymbolSize.Small);
|
||||
button_Install.Image = Program.Symbols.GetImage(AppSymbols.software_installer, SymbolSize.Small);
|
||||
image_Repair.Pixbuf = Program.Symbols.GetPixbuf(AppSymbols.wrench, SymbolSize.Small);
|
||||
|
||||
LoadProfileToUi();
|
||||
|
||||
@@ -77,7 +76,7 @@ internal class MainWindow : Window
|
||||
var updater = new AppUpdater();
|
||||
if (!updateOptions.NoUpdate && await updater.Check() && MessageBox.Show(this, ButtonsType.YesNo, MessageType.Info, LangRes.MsgBox_UpdateAvailable) == ResponseType.Yes)
|
||||
{
|
||||
SetStatus(LangRes.StatusText_InstallingAppUpdate, AppGlobals.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_InstallingAppUpdate, Program.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small));
|
||||
Sensitive = false;
|
||||
await updater.Install();
|
||||
Program.Restart();
|
||||
@@ -203,21 +202,21 @@ internal class MainWindow : Window
|
||||
|
||||
if (modpackInfo == null || string.IsNullOrWhiteSpace(textBox_MinecraftFolder.Text) /*|| modpackInfo.Valid*/)
|
||||
{
|
||||
SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppGlobals.Symbols.GetPixbuf(AppSymbols.general_warning_sign, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_MinecraftProfileWarning, Program.Symbols.GetPixbuf(AppSymbols.general_warning_sign, SymbolSize.Small));
|
||||
button_CheckForUpdates.Sensitive = false;
|
||||
button_Install.Sensitive = false;
|
||||
return false;
|
||||
}
|
||||
else if (updateConfig == null || string.IsNullOrWhiteSpace(textBox_ModpackUrl.Text))
|
||||
{
|
||||
SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, AppGlobals.Symbols.GetPixbuf(AppSymbols.general_warning_sign, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, Program.Symbols.GetPixbuf(AppSymbols.general_warning_sign, SymbolSize.Small));
|
||||
button_CheckForUpdates.Sensitive = false;
|
||||
button_Install.Sensitive = false;
|
||||
return false;
|
||||
}
|
||||
else if (updateConfig.Maintenance && !updateOptions.IgnoreMaintenance)
|
||||
{
|
||||
SetStatus(LangRes.StatusText_Maintenance, AppGlobals.Symbols.GetPixbuf(AppSymbols.services, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_Maintenance, Program.Symbols.GetPixbuf(AppSymbols.services, SymbolSize.Small));
|
||||
button_CheckForUpdates.Sensitive = false;
|
||||
button_Install.Sensitive = false;
|
||||
return false;
|
||||
@@ -243,28 +242,28 @@ internal class MainWindow : Window
|
||||
|
||||
void error()
|
||||
{
|
||||
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, AppGlobals.Symbols.GetPixbuf(AppSymbols.close, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, Program.Symbols.GetPixbuf(AppSymbols.close, SymbolSize.Small));
|
||||
currentUpdating = false;
|
||||
}
|
||||
void installing()
|
||||
{
|
||||
SetStatus(LangRes.StatusText_Installing, AppGlobals.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_Installing, Program.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small));
|
||||
currentUpdating = true;
|
||||
}
|
||||
void updatesAvailable()
|
||||
{
|
||||
SetStatus(LangRes.StatusText_UpdateAvailable, AppGlobals.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_UpdateAvailable, Program.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small));
|
||||
}
|
||||
void everythingOk()
|
||||
{
|
||||
SetStatus(LangRes.StatusTest_EverythingOk, AppGlobals.Symbols.GetPixbuf(AppSymbols.done, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusTest_EverythingOk, Program.Symbols.GetPixbuf(AppSymbols.done, SymbolSize.Small));
|
||||
currentUpdating = false;
|
||||
}
|
||||
|
||||
// Check only if not pressed "install", not really needed otherwise.
|
||||
if (lastUpdateCheckResult is null || !doInstall || repair)
|
||||
{
|
||||
SetStatus(LangRes.StatusText_CheckingForUpdates, AppGlobals.Symbols.GetPixbuf(AppSymbols.update_done, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_CheckingForUpdates, Program.Symbols.GetPixbuf(AppSymbols.update_done, SymbolSize.Small));
|
||||
|
||||
// Check for extras once again
|
||||
updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
|
||||
@@ -335,13 +334,13 @@ internal class MainWindow : Window
|
||||
|
||||
private void Updated_CheckingProgresssUpdated(int toCheck, int processed)
|
||||
{
|
||||
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", AppGlobals.Symbols.GetPixbuf(AppSymbols.update_done, SymbolSize.Small));
|
||||
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", Program.Symbols.GetPixbuf(AppSymbols.update_done, SymbolSize.Small));
|
||||
}
|
||||
|
||||
private void Update_InstallProgessUpdated(UpdateCheckResult result, int processedSyncs)
|
||||
{
|
||||
int actionCount = result.Actions.Count;
|
||||
SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", AppGlobals.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small));
|
||||
SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", Program.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<PackageReference Include="Pilz.Configuration" Version="3.2.2" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
|
||||
<PackageReference Include="Pilz.IO" Version="2.1.0" />
|
||||
<PackageReference Include="Pilz.UI.Gtk" Version="1.0.1" />
|
||||
<PackageReference Include="Pilz.UI.Gtk" Version="1.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Castle.Core.Logging;
|
||||
using Gtk;
|
||||
using Microsoft.Win32;
|
||||
using ModpackUpdater.Manager;
|
||||
using Newtonsoft.Json;
|
||||
using Pilz;
|
||||
using Pilz.Configuration;
|
||||
using Pilz.UI.Gtk.Symbols;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
@@ -18,10 +20,9 @@ public static class Program
|
||||
private static readonly ILogger log = new ConsoleLogger();
|
||||
private static Application uiApp;
|
||||
|
||||
public static IGtkSymbolFactory<AppSymbols> Symbols { get; } = new AppSymbolFactory();
|
||||
public static ISettings Settings => settingsManager.Instance;
|
||||
|
||||
public static ILogger Log => log;
|
||||
|
||||
internal static Options Options { get; private set; }
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
@@ -54,6 +55,9 @@ public static class Program
|
||||
|
||||
private static void RunApp(UpdateCheckOptionsAdv updateOptions)
|
||||
{
|
||||
if (UsesWindowsDarkTheme())
|
||||
Environment.SetEnvironmentVariable("GTK_THEME", "Adwaita:dark");
|
||||
|
||||
Application.Init();
|
||||
|
||||
uiApp = new Application("ModpackUpdater.Apps.Client", GLib.ApplicationFlags.None);
|
||||
@@ -170,4 +174,19 @@ public static class Program
|
||||
return info.ConfigUrl;
|
||||
return configUrl;
|
||||
}
|
||||
|
||||
private static bool UsesWindowsDarkTheme()
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
try
|
||||
{
|
||||
return Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")?.GetValue("AppsUseLightTheme") as bool? ?? default;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
17
ModpackUpdater.Apps.Manager/AppSymbolFactory.cs
Normal file
17
ModpackUpdater.Apps.Manager/AppSymbolFactory.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Pilz.UI.WinForms.Telerik.Symbols;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager;
|
||||
|
||||
internal class AppSymbolFactory : RadSymbolFactory<AppSymbols>
|
||||
{
|
||||
public override Assembly GetImageResourceAssembly()
|
||||
{
|
||||
return typeof(AppSymbols).Assembly;
|
||||
}
|
||||
|
||||
public override string GetImageRessourcePath(AppSymbols svgImage)
|
||||
{
|
||||
return $"{typeof(AppSymbols).Namespace}.Symbols.{svgImage}.svg";
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ internal class CheckSingleActionHealthyFeature : PluginFunction, IPluginFeatureP
|
||||
|
||||
public CheckSingleActionHealthyFeature() : base(FeatureTypes.ActionsContextMenu, "origin.checksingleactionhearlthy", FeatureNamesLangRes.CheckSingleActionHealthy)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.heart_with_pulse, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.heart_with_pulse, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -12,7 +12,7 @@ internal class ClearDirectLinkFeature : PluginFunction, IPluginFeatureProvider<C
|
||||
|
||||
public ClearDirectLinkFeature() : base(FeatureTypes.ActionsContextMenu, "origin.cleardirectlink", FeatureNamesLangRes.ClearDirectLinkFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.broom, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.broom, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -12,7 +12,7 @@ internal class UpdateCollectorFeature : PluginFunction, IPluginFeatureProvider<U
|
||||
|
||||
public UpdateCollectorFeature() : base(FeatureTypes.ActionsContextMenu, "origin.updatecollector", FeatureNamesLangRes.UpdateCollectorFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.search, SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.search, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -12,7 +12,7 @@ internal class UpdateDirectLinkFeature : PluginFunction, IPluginFeatureProvider<
|
||||
|
||||
public UpdateDirectLinkFeature() : base(FeatureTypes.ActionsContextMenu, "origin.updatedirectlink", FeatureNamesLangRes.UpdateDirectLinkFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.renew, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.renew, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using ModpackUpdater.Apps.Manager.Ui;
|
||||
using ModpackUpdater.Manager;
|
||||
using OfficeOpenXml;
|
||||
using Pilz.UI.Extensions;
|
||||
using Pilz.UI.WinForms.Extensions;
|
||||
using System.Text;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features;
|
||||
@@ -281,7 +279,7 @@ internal static class SharedFunctions
|
||||
cellName.SetHyperlink(new Uri(action.Website));
|
||||
|
||||
var cellTag = ws.Cells[cr, cc++];
|
||||
cellTag.Value = string.IsNullOrWhiteSpace(action.SourceTag)? "direct link" : action.SourceTag;
|
||||
cellTag.Value = string.IsNullOrWhiteSpace(action.SourceTag) ? "direct link" : action.SourceTag;
|
||||
if (!string.IsNullOrWhiteSpace(action.SourceUrl))
|
||||
cellTag.SetHyperlink(new Uri(action.GetSourceUrl(installInfos.Version)));
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ internal class CheckAllActionsHealthyFeature : PluginFunction, IPluginFeaturePro
|
||||
|
||||
public CheckAllActionsHealthyFeature() : base(FeatureTypes.Tools, "origin.checkallactionshearlthy", FeatureNamesLangRes.CheckAllActionsHealthy)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.heart_with_pulse, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.heart_with_pulse, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -10,7 +10,7 @@ internal class ClearDirectLinksFeature : PluginFunction, IPluginFeatureProvider<
|
||||
|
||||
public ClearDirectLinksFeature() : base(FeatureTypes.Tools, "origin.cleardirectlinks", FeatureNamesLangRes.ClearDirectLinksFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.broom, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.broom, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -11,7 +11,7 @@ internal class GenerateChangelogFeature : PluginFunction, IPluginFeatureProvider
|
||||
|
||||
public GenerateChangelogFeature() : base(FeatureTypes.Tools, "origin.genchangelog", FeatureNamesLangRes.GenerateChangelogFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.time_machine, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.time_machine, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -11,7 +11,7 @@ internal class GenerateModlistAsExcelFeature : PluginFunction, IPluginFeaturePro
|
||||
|
||||
public GenerateModlistAsExcelFeature() : base(FeatureTypes.Tools, "origin.genmodlist.xlsx", FeatureNamesLangRes.GenerateModlistAsExcelFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.list_view, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.list_view, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -10,7 +10,7 @@ internal class GenerateModlistAsMarkdownFeature : PluginFunction, IPluginFeature
|
||||
|
||||
public GenerateModlistAsMarkdownFeature() : base(FeatureTypes.Tools, "origin.genmodlist.md", FeatureNamesLangRes.GenerateModlistAsMarkdownFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.list_view, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.list_view, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -10,7 +10,7 @@ internal class UpdateDirectLinksFeature : PluginFunction, IPluginFeatureProvider
|
||||
|
||||
public UpdateDirectLinksFeature() : base(FeatureTypes.Tools, "origin.updatedirectlinks", FeatureNamesLangRes.UpdateDirectLinksFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.renew, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.renew, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -11,7 +11,7 @@ internal class UpdatesCollectorFeature : PluginFunction, IPluginFeatureProvider<
|
||||
|
||||
public UpdatesCollectorFeature() : base(FeatureTypes.Tools, "origin.updatescollector", FeatureNamesLangRes.UpdatesCollectorFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.search, SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.search, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||
using NGitLab;
|
||||
using NGitLab.Models;
|
||||
using System.Text.Encodings.Web;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Pilz.UI;
|
||||
using Pilz.UI.Telerik.Dialogs;
|
||||
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
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;
|
||||
using Pilz.UI.WinForms.Extensions;
|
||||
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
|
||||
|
||||
@@ -14,14 +14,14 @@ internal class GitLabRepoWorkspaceFeature : WorkspaceFeature, IPluginFeatureProv
|
||||
|
||||
public GitLabRepoWorkspaceFeature() : base("origin.gitlab", FeatureNamesLangRes.GitLabWorkspace)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small);
|
||||
Icon = Program.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override bool OnConfigure(ref IWorkspace? workspace)
|
||||
{
|
||||
var settings = workspace?.Config as GitLabRepoWorkspaceConfig ?? new();
|
||||
|
||||
if (RadDialogBase.ShowDialog(new GitLabRepoWorkspaceConfigEditor(settings), TitlesLangRes.GitLabRepoWorkspaceEditor, AppGlobals.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small)).Result.IsNotOk())
|
||||
if (RadDialogBase.ShowDialog(new GitLabRepoWorkspaceConfigEditor(settings), TitlesLangRes.GitLabRepoWorkspaceEditor, Program.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small)).Result.IsNotOk())
|
||||
return false;
|
||||
|
||||
workspace = new GitLabRepoWorkspace(settings);
|
||||
|
||||
@@ -11,16 +11,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EPPlus" Version="7.5.3" />
|
||||
<PackageReference Include="NGitLab" Version="7.3.0" />
|
||||
<PackageReference Include="Pilz.Configuration" Version="3.2.0" />
|
||||
<PackageReference Include="Pilz.Plugins.Advanced" Version="2.10.2" />
|
||||
<PackageReference Include="Pilz.Plugins.Advanced.UI" Version="1.8.3" />
|
||||
<PackageReference Include="Pilz.Plugins.Advanced.UI.Telerik" Version="1.7.2" />
|
||||
<PackageReference Include="Pilz.UI" Version="2.4.5" />
|
||||
<PackageReference Include="Pilz.UI.Telerik" Version="2.9.5" />
|
||||
<PackageReference Include="UI.for.WinForms.Common" Version="2024.4.1113" />
|
||||
<PackageReference Include="UI.for.WinForms.GridView" Version="2024.4.1113" />
|
||||
<PackageReference Include="EPPlus" Version="8.0.6" />
|
||||
<PackageReference Include="NGitLab" Version="9.0.1" />
|
||||
<PackageReference Include="Pilz.Configuration" Version="3.2.2" />
|
||||
<PackageReference Include="Pilz.Plugins.Advanced" Version="2.10.6" />
|
||||
<PackageReference Include="Pilz.Plugins.Advanced.UI.WinForms" Version="1.9.1" />
|
||||
<PackageReference Include="Pilz.Plugins.Advanced.UI.WinForms.Telerik" Version="1.8.2" />
|
||||
<PackageReference Include="Pilz.UI" Version="3.0.0" />
|
||||
<PackageReference Include="Pilz.UI.WinForms.Telerik" Version="2.12.2" />
|
||||
<PackageReference Include="Pilz.UI.WinForms.Telerik.Symbols" Version="1.2.1" />
|
||||
<PackageReference Include="UI.for.WinForms.Common" Version="2025.1.211" />
|
||||
<PackageReference Include="UI.for.WinForms.GridView" Version="2025.1.211" />
|
||||
<PackageReference Include="UI.for.WinForms.Themes" Version="2025.1.211" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,6 +2,10 @@ using OfficeOpenXml;
|
||||
using Pilz;
|
||||
using Pilz.Configuration;
|
||||
using Pilz.Plugins.Advanced;
|
||||
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||
using Pilz.UI.WinForms.Telerik.Symbols;
|
||||
using Pilz.UI.WinForms.Telerik.Theming;
|
||||
using Telerik.WinControls.Themes;
|
||||
|
||||
[assembly: AssemblyAppVersion("1.0.0.0")]
|
||||
|
||||
@@ -9,13 +13,15 @@ namespace ModpackUpdater.Apps.Manager;
|
||||
|
||||
public static class Program
|
||||
{
|
||||
public static IRadSymbolFactory<AppSymbols> Symbols { get; } = new AppSymbolFactory();
|
||||
|
||||
private static readonly SettingsManager settingsManager;
|
||||
|
||||
public static ISettings Settings => settingsManager.Instance;
|
||||
|
||||
static Program()
|
||||
{
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
ExcelPackage.License.SetNonCommercialPersonal("Pilzinsel64");
|
||||
settingsManager = new(GetSettingsPath(), true);
|
||||
}
|
||||
|
||||
@@ -28,7 +34,14 @@ public static class Program
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
AppGlobals.Initialize();
|
||||
ThemeHelper.ApplyApplicationTheme(new ThemeDefinition(ApplicationTheme.Auto, HighContrastMode.Auto), n => n.Theme switch
|
||||
{
|
||||
ApplicationTheme.Light => new Windows11CompactTheme(),
|
||||
ApplicationTheme.Gray or ApplicationTheme.Dark => new Windows11CompactDarkTheme(),
|
||||
_ => throw new NotImplementedException(),
|
||||
});
|
||||
RadFlyoutBase.ConfirmSvg = Symbols.GetSvgImage(AppSymbols.checkmark, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
RadFlyoutBase.CancelSvg = Symbols.GetSvgImage(AppSymbols.cancel, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
PluginFeatureController.Instance.RegisterAllOwn();
|
||||
Application.Run(new Ui.MainForm());
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using ModpackUpdater.Apps.Manager.Settings;
|
||||
using Pilz.Plugins.Advanced;
|
||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
||||
using Pilz.UI.Extensions;
|
||||
using Pilz.Plugins.Advanced.UI.WinForms.Telerik;
|
||||
using Pilz.UI.Symbols;
|
||||
using Pilz.UI.Telerik.Dialogs;
|
||||
using Pilz.UI.Telerik.Extensions.Extensions;
|
||||
using Pilz.UI.WinForms.Extensions;
|
||||
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||
using Pilz.UI.WinForms.Telerik.Extensions;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
@@ -32,16 +32,16 @@ public partial class MainForm : RadForm, IMainApi
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
radMenuItem_Workspace.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.workspace, SymbolSize.Small);
|
||||
radMenuItem_WorkspacePreferences.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.settings, SymbolSize.Small);
|
||||
radMenuItem_SaveWorkspace.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.save, SymbolSize.Small);
|
||||
radMenuItem_OpenNewWorkspace.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.new_window, SymbolSize.Small);
|
||||
radMenuItem_RecentWorkspaces.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.time_machine, SymbolSize.Small);
|
||||
radMenuItem_Updates.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small);
|
||||
radMenuItem_EditUpdate.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small);
|
||||
radMenuItem_CreateUpdate.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.add, SymbolSize.Small);
|
||||
radMenuItem_RemoveUpdate.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.remove, SymbolSize.Small);
|
||||
radMenuItem_Tools.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.tools, SymbolSize.Small);
|
||||
radMenuItem_Workspace.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.workspace, SymbolSize.Small);
|
||||
radMenuItem_WorkspacePreferences.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.settings, SymbolSize.Small);
|
||||
radMenuItem_SaveWorkspace.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.save, SymbolSize.Small);
|
||||
radMenuItem_OpenNewWorkspace.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.new_window, SymbolSize.Small);
|
||||
radMenuItem_RecentWorkspaces.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.time_machine, SymbolSize.Small);
|
||||
radMenuItem_Updates.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small);
|
||||
radMenuItem_EditUpdate.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small);
|
||||
radMenuItem_CreateUpdate.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.add, SymbolSize.Small);
|
||||
radMenuItem_RemoveUpdate.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.remove, SymbolSize.Small);
|
||||
radMenuItem_Tools.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.tools, SymbolSize.Small);
|
||||
|
||||
radMenuItem_SaveWorkspace.Shortcuts.Add(new(Keys.Control, Keys.S));
|
||||
|
||||
@@ -170,7 +170,7 @@ public partial class MainForm : RadForm, IMainApi
|
||||
else
|
||||
item.Text = infos.Version.ToString();
|
||||
|
||||
item.SvgImage = AppGlobals.Symbols.GetSvgImage(infos.IsPublic ? AppSymbols.eye : AppSymbols.invisible, SymbolSize.Small);
|
||||
item.SvgImage = Program.Symbols.GetSvgImage(infos.IsPublic ? AppSymbols.eye : AppSymbols.invisible, SymbolSize.Small);
|
||||
}
|
||||
|
||||
public void UpdateItem(IActionSetInfos actionSetInfos)
|
||||
@@ -426,8 +426,8 @@ public partial class MainForm : RadForm, IMainApi
|
||||
//{
|
||||
// cellElement.SvgImage = sourceType switch
|
||||
// {
|
||||
// SourceType.DirectLink => AppGlobals.Symbols.GetSvgImage(AppSymbols.link, SymbolSize.Small),
|
||||
// SourceType.GitHub => AppGlobals.Symbols.GetSvgImage(AppSymbols.github, SymbolSize.Small),
|
||||
// SourceType.DirectLink => Program.Symbols.GetSvgImage(AppSymbols.link, SymbolSize.Small),
|
||||
// SourceType.GitHub => Program.Symbols.GetSvgImage(AppSymbols.github, SymbolSize.Small),
|
||||
// _ => null,
|
||||
// };
|
||||
// cellElement.DrawImage = cellElement.SvgImage != null;
|
||||
@@ -536,7 +536,7 @@ public partial class MainForm : RadForm, IMainApi
|
||||
private void RadMenuItem_EditUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (radListControl_Updates.SelectedItem?.Value is IActionSetInfos infos
|
||||
&& RadDialogBase.ShowDialog(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid())
|
||||
&& RadDialogBase.ShowDialog(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, Program.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid())
|
||||
UpdateUpdateItem(radListControl_Updates.SelectedItem);
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ public partial class MainForm : RadForm, IMainApi
|
||||
var infos = new UpdateInfo();
|
||||
|
||||
if (wsInfo?.Workspace.UpdateInfos is not null
|
||||
&& RadDialogBase.ShowDialog(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid())
|
||||
&& RadDialogBase.ShowDialog(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, Program.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid())
|
||||
{
|
||||
wsInfo.Workspace.UpdateInfos.Updates.Insert(0, infos);
|
||||
InsertUpdateItem(infos);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Pilz.UI;
|
||||
using Pilz.UI.Telerik.Dialogs;
|
||||
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Ui;
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
using Microsoft.Win32;
|
||||
using Pilz.UI.Gtk.Symbols;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ModpackUpdater.Apps;
|
||||
|
||||
public static class AppGlobals
|
||||
{
|
||||
public static IGtkSymbolFactory<AppSymbols> Symbols { get; } = new AppSymbolFactory();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (UsesWindowsDarkTheme())
|
||||
Environment.SetEnvironmentVariable("GTK_THEME", "Adwaita:dark");
|
||||
|
||||
//RadFlyoutBase.ConfirmSvg = Symbols.GetSvgImage(AppSymbols.checkmark, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
//RadFlyoutBase.CancelSvg = Symbols.GetSvgImage(AppSymbols.cancel, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
private static bool UsesWindowsDarkTheme()
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
try
|
||||
{
|
||||
return Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")?.GetValue("AppsUseLightTheme") as bool? ?? default;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pilz.UI.Gtk" Version="1.0.1" />
|
||||
<PackageReference Include="Pilz.UI" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -55,7 +55,7 @@ public static class Extensions
|
||||
if (!string.IsNullOrWhiteSpace(overwriteRefTag))
|
||||
return @this.InstallUrl?.Replace("{ref}", overwriteRefTag);
|
||||
if (!string.IsNullOrWhiteSpace(@this.RefTag))
|
||||
return @this.InstallUrl?.Replace("{ref}", @this.RefTag);
|
||||
return @this.InstallUrl?.Replace("{ref}", @this.RefTag);
|
||||
return @this.InstallUrl;
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
switch (uaction.Type)
|
||||
{
|
||||
case UpdateActionType.Update:
|
||||
if (!await InstallFile(destFilePath, sourceUrl, uaction.IsZip, uaction.ZipPath, localZipCache))
|
||||
if (!await InstallFile(destFilePath, sourceUrl, uaction.IsZip, uaction.ZipPath, localZipCache))
|
||||
return false;
|
||||
break;
|
||||
case UpdateActionType.Delete:
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ModpackUpdater;
|
||||
namespace ModpackUpdater;
|
||||
|
||||
public class InstallOption
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user