update deps & enable console logging

This commit is contained in:
2024-12-05 07:06:06 +01:00
parent a83d109f24
commit 3e1ab72162
6 changed files with 39 additions and 22 deletions

View File

@@ -39,11 +39,11 @@
<ItemGroup>
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Pilz.Configuration" Version="3.1.3" />
<PackageReference Include="Pilz.Configuration" Version="3.2.0" />
<PackageReference Include="Pilz.Cryptography" Version="2.1.1" />
<PackageReference Include="Pilz.IO" Version="2.1.0" />
<PackageReference Include="Pilz.UI" Version="2.3.10" />
<PackageReference Include="Pilz.UI.Telerik" Version="2.7.4" />
<PackageReference Include="Pilz.UI" Version="2.3.14" />
<PackageReference Include="Pilz.UI.Telerik" Version="2.8.1" />
<PackageReference Include="Pilz.Win32" Version="2.1.0" />
<PackageReference Include="UI.for.WinForms.Common" Version="2024.3.806" />
</ItemGroup>

View File

@@ -1,10 +1,11 @@
using ModpackUpdater.Manager;
using Castle.Core.Logging;
using ModpackUpdater.Manager;
using Newtonsoft.Json;
using Pilz;
using Pilz.Configuration;
using System.Runtime.InteropServices;
[assembly: AssemblyAppVersion("1.6.2.0")]
[assembly: AssemblyAppVersion("1.6.3.0")]
namespace ModpackUpdater.Apps.Client;
@@ -97,7 +98,10 @@ public static class Program
updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(info));
// Check for update
var installer = new ModpackInstaller(config, info);
var installer = new ModpackInstaller(config, info)
{
Log = new ConsoleLogger(),
};
var result = installer.Check(updateOptions).Result;
if (!silent && !updateOptions.NoUpdate && new AppUpdater().Check().Result)

View File

@@ -11,13 +11,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NGitLab" Version="6.55.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" />
<PackageReference Include="Pilz.UI" Version="2.3.10" />
<PackageReference Include="Pilz.UI.Telerik" Version="2.7.4" />
<PackageReference Include="NGitLab" Version="6.59.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.3.14" />
<PackageReference Include="Pilz.UI.Telerik" Version="2.8.1" />
<PackageReference Include="UI.for.WinForms.Common" Version="2024.3.806" />
<PackageReference Include="UI.for.WinForms.GridView" Version="2024.3.806" />
</ItemGroup>

View File

@@ -12,8 +12,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Pilz.UI" Version="2.3.10" />
<PackageReference Include="Pilz.UI.Telerik" Version="2.7.4" />
<PackageReference Include="Pilz.UI" Version="2.3.14" />
<PackageReference Include="Pilz.UI.Telerik" Version="2.8.1" />
<PackageReference Include="UI.for.WinForms.Common" Version="2024.3.806" />
<PackageReference Include="UI.for.WinForms.Themes" Version="2024.3.806" />
</ItemGroup>

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Castle.Core.Logging;
using Newtonsoft.Json;
using System.IO.Compression;
using FileMode = System.IO.FileMode;
@@ -19,6 +20,8 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
public delegate void CheckingProgressUpdatedEventHandler(int toCheck, int processed);
public ILogger Log { get; set; } = NullLogger.Instance;
private readonly HttpClient http = new();
private readonly ModpackFactory factory = new();
@@ -153,7 +156,8 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
switch (uaction.Type)
{
case UpdateActionType.Update:
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:
{
@@ -198,8 +202,8 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
break;
}
}
else
await InstallFile(destFilePath, sourceUrl, iaction.IsZip, iaction.ZipPath, localZipCache);
else if (!await InstallFile(destFilePath, sourceUrl, iaction.IsZip, iaction.ZipPath, localZipCache))
return false;
processed += 1;
InstallProgessUpdated?.Invoke(checkResult, processed);
@@ -217,7 +221,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
return true;
}
private async Task InstallFile(string destFilePath, string sourceUrl, bool isZip, string zipPath, List<LocalZipCacheEntry> localZipCache)
private async Task<bool> InstallFile(string destFilePath, string sourceUrl, bool isZip, string zipPath, List<LocalZipCacheEntry> localZipCache)
{
Directory.CreateDirectory(Path.GetDirectoryName(destFilePath));
@@ -257,7 +261,13 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
}
catch (HttpRequestException ex)
{
throw;
Log.Error("Could not download file: " + sourceUrl, ex);
return false;
}
catch (Exception ex)
{
Log.Error("Could not install file: " + sourceUrl, ex);
return false;
}
}
@@ -268,5 +278,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
var zipSrc = Path.Combine(cachedZipInfo.ExtractedZipPath, zipPath);
Extensions.CopyDirectory(zipSrc, destFilePath, true);
}
return true;
}
}

View File

@@ -7,11 +7,12 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="CurseForge.APIClient" Version="3.0.0" />
<PackageReference Include="Modrinth.Net" Version="3.4.5" />
<PackageReference Include="Octokit" Version="13.0.1" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
<PackageReference Include="Unleash.Client" Version="4.1.12" />
<PackageReference Include="Unleash.Client" Version="5.0.2" />
</ItemGroup>
<ItemGroup>