Merge pull request 'add more hash logging' (#49) from waffle.lord/SPT-AKI-Installer:fix/correctly-log-hashes into master
Reviewed-on: CWX/SPT-AKI-Installer#49
This commit is contained in:
commit
148a8fd232
@ -14,7 +14,11 @@ public static class DownloadCacheHelper
|
||||
public static string GetCacheSizeText()
|
||||
{
|
||||
if (!Directory.Exists(CachePath))
|
||||
return "No cache folder";
|
||||
{
|
||||
var message = "No cache folder";
|
||||
Log.Information(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
var cacheDir = new DirectoryInfo(CachePath);
|
||||
|
||||
@ -22,7 +26,9 @@ public static class DownloadCacheHelper
|
||||
|
||||
if (cacheSize == -1)
|
||||
{
|
||||
return "An error occurred while getting the cache size :(";
|
||||
var message = "An error occurred while getting the cache size :(";
|
||||
Log.Error(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
if (cacheSize == 0)
|
||||
@ -51,7 +57,11 @@ public static class DownloadCacheHelper
|
||||
Directory.CreateDirectory(CachePath);
|
||||
|
||||
if (!cacheFile.Exists || expectedHash == null)
|
||||
{
|
||||
Log.Information($"{cacheFile.Name} {(cacheFile.Exists ? "is in cache" : "NOT in cache")}");
|
||||
Log.Information($"Expected hash: {(expectedHash == null ? "not provided" : expectedHash)}");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FileHashHelper.CheckHash(cacheFile, expectedHash))
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.RegularExpressions;
|
||||
using Gitea.Model;
|
||||
using Serilog;
|
||||
|
||||
namespace SPTInstaller.Helpers;
|
||||
|
||||
@ -26,6 +27,8 @@ public static class FileHashHelper
|
||||
|
||||
var sourceHash = md5Service.ComputeHash(sourceStream);
|
||||
var expectedHashBytes = Convert.FromBase64String(expectedHash);
|
||||
|
||||
Log.Information($"Comparing Hashes :: S: {Convert.ToBase64String(sourceHash)} - E: {expectedHash}");
|
||||
|
||||
var matched = Enumerable.SequenceEqual(sourceHash, expectedHashBytes);
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
<PackageIcon>icon.ico</PackageIcon>
|
||||
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
||||
<Configurations>Debug;Release;TEST</Configurations>
|
||||
<AssemblyVersion>2.27</AssemblyVersion>
|
||||
<FileVersion>2.27</FileVersion>
|
||||
<AssemblyVersion>2.28</AssemblyVersion>
|
||||
<FileVersion>2.28</FileVersion>
|
||||
<Company>SPT-AKI</Company>
|
||||
</PropertyGroup>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user