start a big rework

This commit is contained in:
Schedel Pascal
2024-06-19 15:01:27 +02:00
parent c9216ac79b
commit 77ddd2a72a
25 changed files with 599 additions and 1697 deletions

View File

@@ -4,7 +4,7 @@ using System.IO.Compression;
namespace Pilz.Updating.UpdateInstaller.Lib;
public class UpdateInstaller
public class UpdateInstaller(UpdateInstallerConfig config)
{
// E v e n t s
@@ -12,8 +12,8 @@ public class UpdateInstaller
public delegate void UpdateInstallerStepEventHandler(object sender, UpdateInstallerStepEventArgs e);
public delegate void StatusChangesEventHandler(object sender, UpdateInstallerStatusChangedEventArgs e);
public event StatusChangesEventHandler StatusChanges;
public event UpdateInstallerStepEventHandler OnStep;
public event StatusChangesEventHandler? StatusChanges;
public event UpdateInstallerStepEventHandler? OnStep;
// F i e l d s
@@ -21,14 +21,7 @@ public class UpdateInstaller
// P r o p e r t i e s
public UpdateInstallerConfig Configuration { get; private set; }
// C o n s t r c u t o r s
public UpdateInstaller(UpdateInstallerConfig config)
{
Configuration = config;
}
public UpdateInstallerConfig Configuration { get; private set; } = config;
// F e a t u r e s
@@ -45,9 +38,7 @@ public class UpdateInstaller
public void StartHostApplication()
{
if (!string.IsNullOrEmpty(Conversions.ToString(Configuration.RestartHostApplication)) && File.Exists(Configuration.HostApplicationProcessPath))
{
Process.Start(Configuration.HostApplicationProcessPath, Configuration.RestartHostApplicationArguments);
}
}
public void InstallUpdate()
@@ -105,9 +96,7 @@ public class UpdateInstaller
}
}
else
{
enabled = false;
}
}
}
@@ -129,7 +118,7 @@ public class UpdateInstaller
private void CopyFiles()
{
var sourceDir = new DirectoryInfo(Path.Combine(dataPath, PackageFileNameDefinations.ZIP_APP_DATA_FILES_DIRECTORY));
var sourceDir = new DirectoryInfo(dataPath);
var destDir = new DirectoryInfo(Configuration.HostApplicationPath);
CopyFiles(sourceDir, destDir);
}
@@ -137,9 +126,7 @@ public class UpdateInstaller
private void CopyFiles(DirectoryInfo sourceDir, DirectoryInfo destinationDir)
{
if (!destinationDir.Exists)
{
destinationDir.Create();
}
foreach (FileInfo sFile in sourceDir.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
{