diff --git a/ModpackUpdater.Apps.AppUpdates/ModpackUpdater.Apps.AppUpdates.csproj b/ModpackUpdater.Apps.AppUpdates/ModpackUpdater.Apps.AppUpdates.csproj
new file mode 100644
index 0000000..5d949bd
--- /dev/null
+++ b/ModpackUpdater.Apps.AppUpdates/ModpackUpdater.Apps.AppUpdates.csproj
@@ -0,0 +1,15 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
diff --git a/ModpackUpdater.Apps.Client/App.config b/ModpackUpdater.Apps.Client.Gui/App.config
similarity index 100%
rename from ModpackUpdater.Apps.Client/App.config
rename to ModpackUpdater.Apps.Client.Gui/App.config
diff --git a/ModpackUpdater.Apps.Client/AppConfig.cs b/ModpackUpdater.Apps.Client.Gui/AppConfig.cs
similarity index 84%
rename from ModpackUpdater.Apps.Client/AppConfig.cs
rename to ModpackUpdater.Apps.Client.Gui/AppConfig.cs
index 4f91318..5db02be 100644
--- a/ModpackUpdater.Apps.Client/AppConfig.cs
+++ b/ModpackUpdater.Apps.Client.Gui/AppConfig.cs
@@ -1,9 +1,9 @@
using Newtonsoft.Json;
using Pilz.Configuration;
-namespace ModpackUpdater.Apps.Client;
+namespace ModpackUpdater.Apps.Client.Gui;
-public class AppConfig : IChildSettings, ISettingsIdentifier
+public class AppConfig : ISettingsNode, ISettingsIdentifier
{
public static string Identifier => "pilz.appconfig";
diff --git a/ModpackUpdater.Apps.Client/AppUpdater.cs b/ModpackUpdater.Apps.Client.Gui/AppUpdater.cs
similarity index 77%
rename from ModpackUpdater.Apps.Client/AppUpdater.cs
rename to ModpackUpdater.Apps.Client.Gui/AppUpdater.cs
index 4fe2f9a..43c8bb8 100644
--- a/ModpackUpdater.Apps.Client/AppUpdater.cs
+++ b/ModpackUpdater.Apps.Client.Gui/AppUpdater.cs
@@ -2,11 +2,10 @@
using Newtonsoft.Json.Converters;
using Pilz.Extensions;
using System.Reflection;
-using System.Runtime.InteropServices;
-namespace ModpackUpdater.Apps.Client;
+namespace ModpackUpdater.Apps.Client.Gui;
-public class AppUpdater
+public class AppUpdater(string updateUrl)
{
private class UpdateInfo
{
@@ -15,7 +14,6 @@ public class AppUpdater
public string DownloadUrl { get; set; }
}
- private const string UPDATE_URL = "https://git.pilzinsel64.de/litw-refined/minecraft-modpack-updater/-/snippets/3/raw/main/updates.json";
private readonly HttpClient httpClient = new();
private UpdateInfo info;
@@ -26,7 +24,7 @@ public class AppUpdater
try
{
var appVersion = Assembly.GetExecutingAssembly().GetAppVersion().Version;
- var result = await httpClient.GetStringAsync(UPDATE_URL);
+ var result = await httpClient.GetStringAsync(updateUrl);
info = JsonConvert.DeserializeObject(result);
if (info is not null && info.Version > appVersion)
@@ -58,10 +56,10 @@ public class AppUpdater
// Download the new file
using (var tempFileStream = new FileStream(tempFileName, FileMode.Create, FileAccess.ReadWrite))
{
- Stream downloadStream = null;
+ Stream? downloadStream = null;
try
{
- var url = info.DownloadUrl;
+ var url = info?.DownloadUrl;
downloadStream = await client.GetStreamAsync(url);
await downloadStream.CopyToAsync(tempFileStream);
}
@@ -75,7 +73,10 @@ public class AppUpdater
}
// Replace current application file with new file
- File.Move(appFileName, oldFileName, true);
- File.Move(tempFileName, appFileName);
+ if (!string.IsNullOrWhiteSpace(appFileName))
+ {
+ File.Move(appFileName, oldFileName, true);
+ File.Move(tempFileName, appFileName);
+ }
}
}
\ No newline at end of file
diff --git a/ModpackUpdater.Apps.Client/FiledialogFilters.Designer.cs b/ModpackUpdater.Apps.Client.Gui/FiledialogFilters.Designer.cs
similarity index 97%
rename from ModpackUpdater.Apps.Client/FiledialogFilters.Designer.cs
rename to ModpackUpdater.Apps.Client.Gui/FiledialogFilters.Designer.cs
index eee4e64..3c97b26 100644
--- a/ModpackUpdater.Apps.Client/FiledialogFilters.Designer.cs
+++ b/ModpackUpdater.Apps.Client.Gui/FiledialogFilters.Designer.cs
@@ -39,7 +39,7 @@ namespace ModpackUpdater.My.Resources {
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.Client.FiledialogFilters", typeof(FiledialogFilters).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ModpackUpdater.Apps.Client.Gui.FiledialogFilters", typeof(FiledialogFilters).Assembly);
resourceMan = temp;
}
return resourceMan;
diff --git a/ModpackUpdater.Apps.Client/FiledialogFilters.resx b/ModpackUpdater.Apps.Client.Gui/FiledialogFilters.resx
similarity index 100%
rename from ModpackUpdater.Apps.Client/FiledialogFilters.resx
rename to ModpackUpdater.Apps.Client.Gui/FiledialogFilters.resx
diff --git a/ModpackUpdater.Apps.Client/LangRes.Designer.cs b/ModpackUpdater.Apps.Client.Gui/LangRes.Designer.cs
similarity index 99%
rename from ModpackUpdater.Apps.Client/LangRes.Designer.cs
rename to ModpackUpdater.Apps.Client.Gui/LangRes.Designer.cs
index d512234..b607805 100644
--- a/ModpackUpdater.Apps.Client/LangRes.Designer.cs
+++ b/ModpackUpdater.Apps.Client.Gui/LangRes.Designer.cs
@@ -39,7 +39,7 @@ namespace ModpackUpdater.My.Resources {
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.Client.LangRes", typeof(LangRes).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ModpackUpdater.Apps.Client.Gui.LangRes", typeof(LangRes).Assembly);
resourceMan = temp;
}
return resourceMan;
diff --git a/ModpackUpdater.Apps.Client/LangRes.resx b/ModpackUpdater.Apps.Client.Gui/LangRes.resx
similarity index 100%
rename from ModpackUpdater.Apps.Client/LangRes.resx
rename to ModpackUpdater.Apps.Client.Gui/LangRes.resx
diff --git a/ModpackUpdater.Apps.Client/MainForm.Designer.cs b/ModpackUpdater.Apps.Client.Gui/MainForm.Designer.cs
similarity index 99%
rename from ModpackUpdater.Apps.Client/MainForm.Designer.cs
rename to ModpackUpdater.Apps.Client.Gui/MainForm.Designer.cs
index 14cd913..3aec71c 100644
--- a/ModpackUpdater.Apps.Client/MainForm.Designer.cs
+++ b/ModpackUpdater.Apps.Client.Gui/MainForm.Designer.cs
@@ -3,7 +3,7 @@ using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
-namespace ModpackUpdater.Apps.Client
+namespace ModpackUpdater.Apps.Client.Gui
{
[Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
diff --git a/ModpackUpdater.Apps.Client/MainForm.cs b/ModpackUpdater.Apps.Client.Gui/MainForm.cs
similarity index 91%
rename from ModpackUpdater.Apps.Client/MainForm.cs
rename to ModpackUpdater.Apps.Client.Gui/MainForm.cs
index dfcb295..ab97d97 100644
--- a/ModpackUpdater.Apps.Client/MainForm.cs
+++ b/ModpackUpdater.Apps.Client.Gui/MainForm.cs
@@ -8,11 +8,11 @@ using System.Reflection;
using Telerik.WinControls;
using Telerik.WinControls.UI;
-namespace ModpackUpdater.Apps.Client;
+namespace ModpackUpdater.Apps.Client.Gui;
public partial class MainForm
{
- private readonly UpdateCheckOptionsAdv updateOptions;
+ private readonly UpdateCheckOptions updateOptions = new();
private ModpackInfo modpackInfo = new();
private ModpackConfig updateConfig = new();
private ModpackFeatures features;
@@ -21,14 +21,8 @@ public partial class MainForm
private bool loadingData;
private int curOptionsRow = 3;
- public MainForm() : this(new())
+ public MainForm()
{
- }
-
- public MainForm(UpdateCheckOptionsAdv updateOptions)
- {
- this.updateOptions = updateOptions;
-
InitializeComponent();
Text = $"{Text} (v{Assembly.GetExecutingAssembly().GetAppVersion()})";
@@ -60,14 +54,24 @@ public partial class MainForm
private void LoadProfileToUi()
{
loadingData = true;
+ tableLayoutPanel1.SuspendLayout();
- RadTextBox_MinecraftProfileFolder.Text = modpackInfo?.LocaLPath ?? updateOptions.ProfileFolder ?? AppConfig.Instance.LastMinecraftProfilePath ?? RadTextBox_MinecraftProfileFolder.Text;
- RadTextBox_ModpackConfig.Text = modpackInfo?.ConfigUrl ?? updateOptions.ModpackConfig ?? RadTextBox_ModpackConfig.Text;
- radTextBox_InstallKey.Text = modpackInfo?.ExtrasKey ?? updateOptions.ExtrasKey ?? radTextBox_InstallKey.Text;
+ RadTextBox_MinecraftProfileFolder.Text = modpackInfo?.LocaLPath ?? AppConfig.Instance.LastMinecraftProfilePath ?? RadTextBox_MinecraftProfileFolder.Text;
+ RadTextBox_ModpackConfig.Text = modpackInfo?.ConfigUrl ?? RadTextBox_ModpackConfig.Text;
+ radTextBox_InstallKey.Text = modpackInfo?.ExtrasKey ?? radTextBox_InstallKey.Text;
+ tableLayoutPanel1.ResumeLayout();
loadingData = false;
}
+ private void LoadOptionsToUi()
+ {
+ //foreach (var set in )
+ //{
+ // // ...
+ //}
+ }
+
private async void CheckStatusAndUpdate(bool loadProfileToUi)
{
if (CheckStatus(loadProfileToUi))
@@ -121,6 +125,7 @@ public partial class MainForm
RadButton_Install.Enabled = false;
return false;
}
+ LoadOptionsToUi();
RadButton_CheckForUpdates.Enabled = true;
RadButton_Install.Enabled = true;
return true;
@@ -131,14 +136,10 @@ public partial class MainForm
// Ensure set extras key
modpackInfo.ExtrasKey = radTextBox_InstallKey.Text.Trim();
- var updater = new ModpackInstaller(updateConfig, modpackInfo)
- {
- OverwriteRefTag = Program.Options.RefTag,
- OverwriteVersion = Program.Options.Version,
- };
+ var updater = new ModpackInstaller(updateConfig, modpackInfo);
updater.InstallProgessUpdated += Update_InstallProgessUpdated;
updater.CheckingProgressUpdated += Updated_CheckingProgresssUpdated;
-
+
void error()
{
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.close, SymbolSize.Small));
@@ -192,6 +193,10 @@ public partial class MainForm
return;
}
+ // Load options
+ // lastUpdateCheckResult.OptionsAvailable...
+ // lastUpdateCheckResult.OptionsEnabled...
+
// No updates available
if (!lastUpdateCheckResult.HasUpdates)
{
@@ -257,8 +262,8 @@ public partial class MainForm
private async void Form1_Shown(object sender, EventArgs e)
{
- var updater = new AppUpdater();
- if (!updateOptions.NoUpdate && await updater.Check() && RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info).IsYes())
+ var updater = new AppUpdater(Program.UPDATE_URL);
+ if (await updater.Check() && RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info).IsYes())
{
SetStatus(LangRes.StatusText_InstallingAppUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small));
Enabled = false;
diff --git a/ModpackUpdater.Apps.Client/MainForm.resx b/ModpackUpdater.Apps.Client.Gui/MainForm.resx
similarity index 100%
rename from ModpackUpdater.Apps.Client/MainForm.resx
rename to ModpackUpdater.Apps.Client.Gui/MainForm.resx
diff --git a/ModpackUpdater.Apps.Client.Gui/ModpackUpdater.Apps.Client.Gui.csproj b/ModpackUpdater.Apps.Client.Gui/ModpackUpdater.Apps.Client.Gui.csproj
new file mode 100644
index 0000000..234daae
--- /dev/null
+++ b/ModpackUpdater.Apps.Client.Gui/ModpackUpdater.Apps.Client.Gui.csproj
@@ -0,0 +1,64 @@
+
+
+
+ WinExe
+ net8.0-windows
+ minecraft modpack updater.ico
+ Minecraft Modpack Updater
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+ True
+ True
+ FiledialogFilters.resx
+
+
+ True
+ True
+ LangRes.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ ModpackUpdater.My.Resources
+ FiledialogFilters.Designer.cs
+
+
+ ResXFileCodeGenerator
+ ModpackUpdater.My.Resources
+ LangRes.Designer.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ModpackUpdater.Apps.Client.Gui/Program.cs b/ModpackUpdater.Apps.Client.Gui/Program.cs
new file mode 100644
index 0000000..2a062c7
--- /dev/null
+++ b/ModpackUpdater.Apps.Client.Gui/Program.cs
@@ -0,0 +1,64 @@
+using Castle.Core.Logging;
+using Newtonsoft.Json;
+using Pilz.Configuration;
+
+namespace ModpackUpdater.Apps.Client.Gui;
+
+public static class Program
+{
+ public const string UPDATE_URL = "https://git.pilzinsel64.de/litw-refined/minecraft-modpack-updater/-/snippets/3/raw/main/updates.json";
+
+ private static readonly SettingsManager settingsManager;
+ private static readonly ILogger log = new ConsoleLogger();
+
+ public static ISettings Settings => settingsManager.Instance;
+ public static ILogger Log => log;
+
+ static Program()
+ {
+ settingsManager = new(GetSettingsPath(2), true);
+ MigrateLegacySettings(GetSettingsPath(null));
+ }
+
+ [STAThread]
+ internal static void Main(string[] args)
+ {
+ ApplicationConfiguration.Initialize();
+ AppGlobals.Initialize();
+ Application.Run(new MainForm());
+ }
+
+ private static string GetSettingsPath(int? settingsVersion = 3)
+ {
+ const string AppDataDirectoryName = "MinecraftModpackUpdater";
+ var fileNamePostfix = settingsVersion == null ? string.Empty : $"V{settingsVersion}";
+ var SettingsFileName = $"Settings{fileNamePostfix}.json";
+
+ var settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppDataDirectoryName);
+ Directory.CreateDirectory(settingsPath);
+ settingsPath = Path.Combine(settingsPath, SettingsFileName);
+
+ return settingsPath;
+ }
+
+ private static void MigrateLegacySettings(string settingsPath)
+ {
+ // Try load legacy config file
+ if (!File.Exists(settingsPath) || JsonConvert.DeserializeObject(File.ReadAllText(settingsPath)) is not AppConfig legacyConfig)
+ return;
+
+ // Migrate
+ var newConfig = Settings.Get();
+ newConfig.LastMinecraftProfilePath = legacyConfig.LastMinecraftProfilePath;
+
+ if (ModpackInfo.TryLoad(legacyConfig.LastMinecraftProfilePath) is ModpackInfo info)
+#pragma warning disable CS0612 // Typ oder Element ist veraltet
+ info.ConfigUrl = legacyConfig.ConfigFilePath;
+
+ // Ensure save settings
+ settingsManager.Save();
+
+ // Delete legacy config file
+ File.Delete(settingsPath);
+ }
+}
diff --git a/ModpackUpdater.Apps.Client/Properties/PublishProfiles/Windows.pubxml b/ModpackUpdater.Apps.Client.Gui/Properties/PublishProfiles/Windows.pubxml
similarity index 85%
rename from ModpackUpdater.Apps.Client/Properties/PublishProfiles/Windows.pubxml
rename to ModpackUpdater.Apps.Client.Gui/Properties/PublishProfiles/Windows.pubxml
index 12de6cb..6b9386f 100644
--- a/ModpackUpdater.Apps.Client/Properties/PublishProfiles/Windows.pubxml
+++ b/ModpackUpdater.Apps.Client.Gui/Properties/PublishProfiles/Windows.pubxml
@@ -6,12 +6,12 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
Release
Any CPU
- bin\publish\windows\
+ ..\publish\ui\
FileSystem
<_TargetId>Folder
net8.0-windows
win-x86
- false
+ true
true
false
diff --git a/ModpackUpdater.Apps.Client/minecraft modpack updater.ico b/ModpackUpdater.Apps.Client.Gui/minecraft modpack updater.ico
similarity index 100%
rename from ModpackUpdater.Apps.Client/minecraft modpack updater.ico
rename to ModpackUpdater.Apps.Client.Gui/minecraft modpack updater.ico
diff --git a/ModpackUpdater.Apps.Client/minecraft modpack updater.svg b/ModpackUpdater.Apps.Client.Gui/minecraft modpack updater.svg
similarity index 100%
rename from ModpackUpdater.Apps.Client/minecraft modpack updater.svg
rename to ModpackUpdater.Apps.Client.Gui/minecraft modpack updater.svg
diff --git a/ModpackUpdater.Apps.Client/ModpackUpdater.Apps.Client.csproj b/ModpackUpdater.Apps.Client/ModpackUpdater.Apps.Client.csproj
index 6fc5e16..9aa631d 100644
--- a/ModpackUpdater.Apps.Client/ModpackUpdater.Apps.Client.csproj
+++ b/ModpackUpdater.Apps.Client/ModpackUpdater.Apps.Client.csproj
@@ -1,59 +1,27 @@
-
+
Exe
- net8.0-windows
- minecraft modpack updater.ico
- Minecraft Modpack Updater
- true
- true
- true
+ net8.0
+ enable
+ enable
-
+
-
- True
- True
- FiledialogFilters.resx
-
-
- True
- True
- LangRes.resx
-
+
-
-
-
- ResXFileCodeGenerator
- ModpackUpdater.My.Resources
- FiledialogFilters.Designer.cs
-
-
- ResXFileCodeGenerator
- ModpackUpdater.My.Resources
- LangRes.Designer.cs
-
-
-
+
-
-
-
-
-
-
-
-
+
-
+
-
-
\ No newline at end of file
+
+
diff --git a/ModpackUpdater.Apps.Client/Options.cs b/ModpackUpdater.Apps.Client/Options.cs
index ec4aaf1..877d56c 100644
--- a/ModpackUpdater.Apps.Client/Options.cs
+++ b/ModpackUpdater.Apps.Client/Options.cs
@@ -10,9 +10,8 @@ internal class Options
public IReadOnlyList Additionals => additionals;
public bool Help { get; private set; }
public bool Silent { get; private set; }
- public bool NoUi { get; private set; }
- public string RefTag { get; private set; }
- public string Version { get; private set; }
+ public string? RefTag { get; private set; }
+ public string? Version { get; private set; }
public UpdateCheckOptionsAdv UpdateOptions { get; } = new();
public Options(string[] args)
@@ -21,12 +20,10 @@ internal class Options
{
{ "silent", "Do not output anything.", s => Silent = true },
{ "h|help", "Writes the help text as output.", h => Help = true },
- { "n|noui", "Install without user interface.", n => NoUi = true },
{ "p|profile=", "Sets the minecraft profile folder.", p => UpdateOptions.ProfileFolder = p },
{ "c|config=", "Sets the modpack update info url.", c => UpdateOptions.ModpackConfig = c },
{ "s|side=", "Sets the installation side.\nDefault side is Client.\nAvailable: Client, Server", s => UpdateOptions.Side = Enum.Parse(s)},
{ "u|uai", "Disallow an update directly after install. This only has effect if there is no existing installation.", uai => UpdateOptions.AllowUpdaterAfterInstall = false},
- { "noupdate", "Skip the update check.", noupdate => UpdateOptions.NoUpdate = true},
{ "m|maintenance", "Ignores the maintenance mode.", m => UpdateOptions.IgnoreMaintenance = true},
{ "i|nonpublic", "Include non public (currently hidden) updates.", i => UpdateOptions.IncludeNonPublic = true},
{ "k|key=", "An key for retriving extra files on updates.", k => UpdateOptions.ExtrasKey = k},
diff --git a/ModpackUpdater.Apps.Client/Program.cs b/ModpackUpdater.Apps.Client/Program.cs
index fe1c91f..aead8be 100644
--- a/ModpackUpdater.Apps.Client/Program.cs
+++ b/ModpackUpdater.Apps.Client/Program.cs
@@ -1,34 +1,14 @@
using Castle.Core.Logging;
using ModpackUpdater.Manager;
-using Newtonsoft.Json;
-using Pilz;
-using Pilz.Configuration;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyAppVersion("1.9.2.0")]
namespace ModpackUpdater.Apps.Client;
public static class Program
{
- private static readonly SettingsManager settingsManager;
private static readonly ILogger log = new ConsoleLogger();
- public static ISettings Settings => settingsManager.Instance;
public static ILogger Log => log;
- internal static Options Options { get; private set; }
-
- [DllImport("kernel32.dll")]
- static extern nint GetConsoleWindow();
-
- [DllImport("user32.dll")]
- static extern bool ShowWindow(nint hWnd, int nCmdShow);
-
- static Program()
- {
- settingsManager = new(GetSettingsPath(2), true);
- MigrateLegacySettings(GetSettingsPath(null));
- }
+ internal static Options Options { get; private set; } = null!;
[STAThread]
internal static void Main(string[] args)
@@ -36,61 +16,14 @@ public static class Program
Options = new Options(args);
if (Options.Help)
Options.DrawHelp();
- else if (Options.NoUi)
- InstallWithoutGui(Options.UpdateOptions, Options.Silent);
else
- {
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- ShowWindow(GetConsoleWindow(), 0);
- RunApp(Options.UpdateOptions);
- }
- }
-
- private static void RunApp(UpdateCheckOptionsAdv updateOptions)
- {
- ApplicationConfiguration.Initialize();
- AppGlobals.Initialize();
- Application.Run(new MainForm(updateOptions));
- }
-
- private static string GetSettingsPath(int? settingsVersion = 3)
- {
- const string AppDataDirectoryName = "MinecraftModpackUpdater";
- var fileNamePostfix = settingsVersion == null ? string.Empty : $"V{settingsVersion}";
- var SettingsFileName = $"Settings{fileNamePostfix}.json";
-
- var settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppDataDirectoryName);
- Directory.CreateDirectory(settingsPath);
- settingsPath = Path.Combine(settingsPath, SettingsFileName);
-
- return settingsPath;
- }
-
- private static void MigrateLegacySettings(string settingsPath)
- {
- // Try load legacy config file
- if (!File.Exists(settingsPath) || JsonConvert.DeserializeObject(File.ReadAllText(settingsPath)) is not AppConfig legacyConfig)
- return;
-
- // Migrate
- var newConfig = Settings.Get();
- newConfig.LastMinecraftProfilePath = legacyConfig.LastMinecraftProfilePath;
-
- if (ModpackInfo.TryLoad(legacyConfig.LastMinecraftProfilePath) is ModpackInfo info)
-#pragma warning disable CS0612 // Typ oder Element ist veraltet
- info.ConfigUrl = legacyConfig.ConfigFilePath;
-
- // Ensure save settings
- settingsManager.Save();
-
- // Delete legacy config file
- File.Delete(settingsPath);
+ InstallWithoutGui(Options.UpdateOptions, Options.Silent);
}
private static void InstallWithoutGui(UpdateCheckOptionsAdv updateOptions, bool silent)
{
var info = ModpackInfo.TryLoad(updateOptions.ProfileFolder);
- var config = ModpackConfig.LoadFromUrl(CheckModpackConfigUrl(updateOptions.ModpackConfig, info));
+ var config = ModpackConfig.LoadFromUrl(CheckModpackConfigUrl(updateOptions.ModpackConfig!, info));
var features = new ModpackFeatures(config);
// Check features
@@ -108,9 +41,6 @@ public static class Program
};
var result = installer.Check(updateOptions).Result;
- if (!silent && !updateOptions.NoUpdate && new AppUpdater().Check().Result)
- Log.Info("A new version is available!");
-
if (result.HasUpdates)
{
var success = installer.Install(result).Result;
diff --git a/ModpackUpdater.Apps.Client/Properties/PublishProfiles/FolderProfile.pubxml b/ModpackUpdater.Apps.Client/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..6c7695d
--- /dev/null
+++ b/ModpackUpdater.Apps.Client/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,17 @@
+
+
+
+
+ Release
+ Any CPU
+ ..\publish\cli\
+ FileSystem
+ <_TargetId>Folder
+ net8.0
+ win-x86
+ true
+ true
+ false
+ true
+
+
\ No newline at end of file
diff --git a/ModpackUpdater.Apps.Client/UpdateCheckOptionsAdv.cs b/ModpackUpdater.Apps.Client/UpdateCheckOptionsAdv.cs
index 6c1066d..be5113d 100644
--- a/ModpackUpdater.Apps.Client/UpdateCheckOptionsAdv.cs
+++ b/ModpackUpdater.Apps.Client/UpdateCheckOptionsAdv.cs
@@ -4,8 +4,7 @@ namespace ModpackUpdater.Apps.Client;
public class UpdateCheckOptionsAdv : UpdateCheckOptions
{
- public string ProfileFolder { get; set; }
- public string ModpackConfig { get; set; }
- public bool NoUpdate { get; set; }
- public string ExtrasKey { get; set; }
+ public string? ProfileFolder { get; set; }
+ public string? ModpackConfig { get; set; }
+ public string? ExtrasKey { get; set; }
}
diff --git a/ModpackUpdater.Apps.Manager/Program.cs b/ModpackUpdater.Apps.Manager/Program.cs
index e3cdfe1..ca7c313 100644
--- a/ModpackUpdater.Apps.Manager/Program.cs
+++ b/ModpackUpdater.Apps.Manager/Program.cs
@@ -3,8 +3,6 @@ using Pilz;
using Pilz.Configuration;
using Pilz.Plugins.Advanced;
-[assembly: AssemblyAppVersion("1.0.0.0")]
-
namespace ModpackUpdater.Apps.Manager;
public static class Program
diff --git a/ModpackUpdater.Apps.Manager/Properties/PublishProfiles/FolderProfile.pubxml b/ModpackUpdater.Apps.Manager/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..faa1e3e
--- /dev/null
+++ b/ModpackUpdater.Apps.Manager/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,13 @@
+
+
+
+
+ Release
+ Any CPU
+ H:\Applications\Minecraft Modpack Manager
+ FileSystem
+ <_TargetId>Folder
+ net8.0-windows
+ false
+
+
\ No newline at end of file
diff --git a/ModpackUpdater.Manager/ModpackInstaller.cs b/ModpackUpdater.Manager/ModpackInstaller.cs
index f7440f2..18c857d 100644
--- a/ModpackUpdater.Manager/ModpackInstaller.cs
+++ b/ModpackUpdater.Manager/ModpackInstaller.cs
@@ -33,13 +33,13 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
http.Dispose();
}
- private async Task DownloadUpdateInfos()
+ public async Task DownloadUpdateInfos()
{
var content = await http.GetStringAsync(updateConfig.GetUpdateUrl(overwriteRefTag: OverwriteRefTag));
return UpdateInfos.Parse(content);
}
- private async Task DownloadInstallInfos()
+ public async Task DownloadInstallInfos()
{
var content = await http.GetStringAsync(updateConfig.GetInstallUrl(overwriteRefTag: OverwriteRefTag));
return InstallInfos.Parse(content);
diff --git a/ModpackUpdater.sln b/ModpackUpdater.sln
index 86b5219..54645c8 100644
--- a/ModpackUpdater.sln
+++ b/ModpackUpdater.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32526.322
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModpackUpdater.Apps.Client", "ModpackUpdater.Apps.Client\ModpackUpdater.Apps.Client.csproj", "{81F9A2F7-D36B-0F08-12D7-9EC2606C9080}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModpackUpdater.Apps.Client.Gui", "ModpackUpdater.Apps.Client.Gui\ModpackUpdater.Apps.Client.Gui.csproj", "{81F9A2F7-D36B-0F08-12D7-9EC2606C9080}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModpackUpdater", "ModpackUpdater\ModpackUpdater.csproj", "{0E6B6470-8C1D-0CDD-3681-461297A01960}"
EndProject
@@ -17,6 +17,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModpackUpdater.Apps.Manager
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModpackUpdater.Apps", "ModpackUpdater.Apps\ModpackUpdater.Apps.csproj", "{EF2EAFAF-01CD-46BD-BE45-0125B51316A4}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModpackUpdater.Apps.Client", "ModpackUpdater.Apps.Client\ModpackUpdater.Apps.Client.csproj", "{415A7854-C358-4DCD-8C9E-D8413097A06D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModpackUpdater.Apps.AppUpdates", "ModpackUpdater.Apps.AppUpdates\ModpackUpdater.Apps.AppUpdates.csproj", "{7D8F9265-7BAC-4541-A6A8-168F45D0EA56}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -43,6 +47,14 @@ Global
{EF2EAFAF-01CD-46BD-BE45-0125B51316A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF2EAFAF-01CD-46BD-BE45-0125B51316A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF2EAFAF-01CD-46BD-BE45-0125B51316A4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {415A7854-C358-4DCD-8C9E-D8413097A06D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {415A7854-C358-4DCD-8C9E-D8413097A06D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {415A7854-C358-4DCD-8C9E-D8413097A06D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {415A7854-C358-4DCD-8C9E-D8413097A06D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7D8F9265-7BAC-4541-A6A8-168F45D0EA56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7D8F9265-7BAC-4541-A6A8-168F45D0EA56}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7D8F9265-7BAC-4541-A6A8-168F45D0EA56}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7D8F9265-7BAC-4541-A6A8-168F45D0EA56}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -53,6 +65,8 @@ Global
{D3A92EBD-FF6E-09D0-00A1-20221AAA198E} = {96B711FA-1AF2-469B-BC02-6D1E540E8E9D}
{227A37AA-73F0-431D-B976-B9B3A8ADD8C2} = {743892CF-E482-4FBD-9BAB-02920C140F2B}
{EF2EAFAF-01CD-46BD-BE45-0125B51316A4} = {743892CF-E482-4FBD-9BAB-02920C140F2B}
+ {415A7854-C358-4DCD-8C9E-D8413097A06D} = {743892CF-E482-4FBD-9BAB-02920C140F2B}
+ {7D8F9265-7BAC-4541-A6A8-168F45D0EA56} = {743892CF-E482-4FBD-9BAB-02920C140F2B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {322E6A6B-9F3E-4E88-8945-C98A9EF613BF}
diff --git a/Version.cs b/Version.cs
new file mode 100644
index 0000000..a2e1d1c
--- /dev/null
+++ b/Version.cs
@@ -0,0 +1,3 @@
+using Pilz;
+
+[assembly: AssemblyAppVersion("1.9.3.0")]
\ No newline at end of file