use primary constructor

This commit is contained in:
2024-06-26 14:54:45 +02:00
parent 35f8f1544a
commit 890a2787a3

View File

@@ -5,7 +5,7 @@ using System.IO.Compression;
namespace Pilz.Updating; namespace Pilz.Updating;
public class UpdateClient public class UpdateClient(string updateUrl, ApplicationVersion currentVersion, Channels minimumChannel)
{ {
// E b v e n t s // E b v e n t s
@@ -38,9 +38,9 @@ public class UpdateClient
// P r o p e r t i e s // P r o p e r t i e s
public HttpClient WebClient { get; private set; } = new(); public HttpClient WebClient { get; private set; } = new();
public string UpdateUrl { get; private set; } public string UpdateUrl { get; private set; } = updateUrl;
public ApplicationVersion CurrentVersion { get; private set; } public ApplicationVersion CurrentVersion { get; private set; } = currentVersion;
public Channels MinimumChannel { get; private set; } public Channels MinimumChannel { get; private set; } = (Channels)Math.Max((int)minimumChannel, (int)currentVersion.Channel);
public UpdateInfo UpdateInfo { get; private set; } = null; public UpdateInfo UpdateInfo { get; private set; } = null;
public UpdatePackageInfo UpdatePackageInfo { get; private set; } = null; public UpdatePackageInfo UpdatePackageInfo { get; private set; } = null;
public bool AutoCloseHostApplication { get; set; } = false; public bool AutoCloseHostApplication { get; set; } = false;
@@ -53,15 +53,6 @@ public class UpdateClient
public bool ForceClosingHostApplication { get; set; } = true; public bool ForceClosingHostApplication { get; set; } = true;
public bool UIDarkMode { get; set; } = false; public bool UIDarkMode { get; set; } = false;
// C o n s t r u c t o r s
public UpdateClient(string updateUrl, ApplicationVersion currentVersion, Channels minimumChannel)
{
UpdateUrl = updateUrl;
CurrentVersion = currentVersion;
MinimumChannel = (Channels)Math.Max((int)minimumChannel, (int)currentVersion.Channel);
}
// E v e n t M e t h o d s // E v e n t M e t h o d s
private bool RaiseDownloadingUpdate(UpdatePackageInfo pkg) private bool RaiseDownloadingUpdate(UpdatePackageInfo pkg)