diff --git a/BLAZAM.Tests/Updates/UpdateTests.cs b/BLAZAM.Tests/Updates/UpdateTests.cs
index f5d6838a..e3d8bd75 100644
--- a/BLAZAM.Tests/Updates/UpdateTests.cs
+++ b/BLAZAM.Tests/Updates/UpdateTests.cs
@@ -34,17 +34,17 @@ public async void Update_Returns_ValidDownload()
await latest.Download(null);
Assert.True(latest?.UpdateFile.Exists);
- Update_Stages_OK(latest);
- Update_Cleanup_OK(latest);
+ await Update_Stages_OK(latest);
+ await Update_Cleanup_OK(latest);
}
- private async void Update_Stages_OK(ApplicationUpdate latest)
+ private async Task Update_Stages_OK(ApplicationUpdate latest)
{
await latest.ExtractFiles(null);
Assert.True(latest.UpdateStagingDirectory.Files.Count > 2);
}
- private async void Update_Cleanup_OK(ApplicationUpdate latest)
+ private async Task Update_Cleanup_OK(ApplicationUpdate latest)
{
await latest.CleanStaging(null);
diff --git a/BLAZAM/BLAZAM.csproj b/BLAZAM/BLAZAM.csproj
index 32e18308..034430a0 100644
--- a/BLAZAM/BLAZAM.csproj
+++ b/BLAZAM/BLAZAM.csproj
@@ -6,7 +6,7 @@
enable
false
0.9.2
- 2024.05.01.2106
+ 2024.05.01.2331
false
BLAZAM
False
diff --git a/BLAZAM/Pages/Users/ViewUser.razor b/BLAZAM/Pages/Users/ViewUser.razor
index d3b4ae5c..073616c6 100644
--- a/BLAZAM/Pages/Users/ViewUser.razor
+++ b/BLAZAM/Pages/Users/ViewUser.razor
@@ -227,9 +227,7 @@
@bind-Value="@ConfirmPassword"
InputType="InputType.Password" />
}
-
+
InitiateFileCopy(JobStep? step)
//Update the updater first
- Loggers.UpdateLogger.Debug("Copying updater script");
- Loggers.UpdateLogger.Debug("Source: " + UpdateStagingDirectory + "\\updater\\*");
- Loggers.UpdateLogger.Debug("Dest: " + _applicationRootDirectory + "updater\\");
+ Loggers.UpdateLogger?.Debug("Copying updater script");
+ Loggers.UpdateLogger?.Debug("Source: " + UpdateStagingDirectory + "\\updater\\*");
+ Loggers.UpdateLogger?.Debug("Dest: " + _applicationRootDirectory + "updater\\");
using var context = await _dbFactory.CreateDbContextAsync();
@@ -205,14 +205,14 @@ private async Task InitiateFileCopy(JobStep? step)
if (_applicationRootDirectory.Writable)
{
- Loggers.UpdateLogger.Warning("The application user has write permission to the application directory!");
+ Loggers.UpdateLogger?.Warning("The application user has write permission to the application directory!");
try
{
return ApplyFiles();
}
catch (Exception ex)
{
- Loggers.UpdateLogger.Error("Error applying update: {@Error}", ex);
+ Loggers.UpdateLogger?.Error("Error applying update: {@Error}", ex);
}
return false;
@@ -236,7 +236,7 @@ private async Task InitiateFileCopy(JobStep? step)
}
catch (Exception ex)
{
- Loggers.UpdateLogger.Error("Error applying update: {@Error}", ex);
+ Loggers.UpdateLogger?.Error("Error applying update: {@Error}", ex);
}
return false;
@@ -246,7 +246,7 @@ private async Task InitiateFileCopy(JobStep? step)
}
catch (ApplicationException ex)
{
- Loggers.UpdateLogger.Error("Unable to apply files {@Error}", ex);
+ Loggers.UpdateLogger?.Error("Unable to apply files {@Error}", ex);
return false;
}
@@ -259,8 +259,8 @@ private async Task InitiateFileCopy(JobStep? step)
private bool ApplyFiles()
{
- Loggers.UpdateLogger.Information("Running update as: " + WindowsIdentity.GetCurrent().Name);
- Loggers.UpdateLogger.Information("Updating updater");
+ Loggers.UpdateLogger?.Information("Running update as: " + WindowsIdentity.GetCurrent().Name);
+ Loggers.UpdateLogger?.Information("Updating updater");
@@ -268,13 +268,13 @@ private bool ApplyFiles()
SystemDirectory updaterDir = new SystemDirectory(_applicationRootDirectory.Path + "updater\\");
updaterDirFromStagedUpdate.CopyTo(updaterDir);
//File.Copy(UpdateStagingDirectory + "\\updater\\", _applicationRootDirectory + "updater\\", true);
- Loggers.UpdateLogger.Information("Updater updated");
+ Loggers.UpdateLogger?.Information("Updater updated");
//If the updater updated we can run the updater
var updaterRan = InvokeUpdateExecutable();
if (updaterRan)
{
- Loggers.UpdateLogger.Information("Update process started");
+ Loggers.UpdateLogger?.Information("Update process started");
return true;
}
@@ -313,18 +313,18 @@ private bool InvokeUpdateExecutable()
public async Task Backup(JobStep? step)
{
- Loggers.UpdateLogger.Information("Attempting backup of current version to: " + BackupPath);
+ Loggers.UpdateLogger?.Information("Attempting backup of current version to: " + BackupPath);
try
{
var result = await Task.Run(() => { return _applicationRootDirectory.CopyTo(BackupDirectory); });
- Loggers.UpdateLogger.Debug("Backup result: " + result.ToString());
+ Loggers.UpdateLogger?.Debug("Backup result: " + result.ToString());
return result;
}
catch (Exception ex)
{
- Loggers.UpdateLogger.Error("Backup of current version failed: " + ex.Message);
+ Loggers.UpdateLogger?.Error("Backup of current version failed: " + ex.Message);
return false;
}
}
@@ -334,7 +334,7 @@ public async Task CleanDownload(IJobStep? step)
{
return await Task.Run(() =>
{
- Loggers.UpdateLogger.Information("Attempting cleaning of download folder: " + UpdateFile);
+ Loggers.UpdateLogger?.Information("Attempting cleaning of download folder: " + UpdateFile);
try
{
@@ -345,7 +345,7 @@ public async Task CleanDownload(IJobStep? step)
}
catch (Exception ex)
{
- Loggers.UpdateLogger.Error("Error while cleaning of download folder: " + UpdateFile + " {@Error}", ex);
+ Loggers.UpdateLogger?.Error("Error while cleaning of download folder: " + UpdateFile + " {@Error}", ex);
return false;
}
@@ -363,7 +363,7 @@ public async Task CleanStaging(IJobStep? step)
}
catch (Exception ex)
{
- Loggers.UpdateLogger.Error("Error while cleaning staging directory. {@Error}", ex);
+ Loggers.UpdateLogger?.Error("Error while cleaning staging directory. {@Error}", ex);
return true;
}
});
@@ -375,7 +375,7 @@ public async Task ExtractFiles(JobStep? step)
if (!UpdateFile.Exists) return false;
- Loggers.UpdateLogger.Debug("Attempting unzip of " + UpdateFile);
+ Loggers.UpdateLogger?.Debug("Attempting unzip of " + UpdateFile);
UpdateStagingDirectory.EnsureCreated();
@@ -385,14 +385,13 @@ public async Task ExtractFiles(JobStep? step)
{
var zip = new ZipArchive(streamToReadFrom);
zip.ExtractToDirectory(UpdateStagingDirectory.Path, true);
-
- Loggers.UpdateLogger.Debug(UpdateFile + " unzipped successfully to " + UpdateStagingDirectory);
+ Loggers.UpdateLogger?.Debug(UpdateFile + " unzipped successfully to " + UpdateStagingDirectory);
return true;
}
catch (Exception ex)
{
- Loggers.UpdateLogger.Error("Error while extracting update zip {@Error}", ex);
+ Loggers.UpdateLogger?.Error("Error while extracting update zip {@Error}", ex);
return false;
}
diff --git a/BLAZAMUpdate/BLAZAMUpdate.csproj b/BLAZAMUpdate/BLAZAMUpdate.csproj
index d4754fb0..256054c5 100644
--- a/BLAZAMUpdate/BLAZAMUpdate.csproj
+++ b/BLAZAMUpdate/BLAZAMUpdate.csproj
@@ -10,7 +10,7 @@
-
+