mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #895 from wabbajack-tools/auto-heal-fixes-2
Several small tweaks for auto healing
This commit is contained in:
commit
da7c1e6584
@ -26,5 +26,16 @@ namespace Wabbajack.Common.Test
|
|||||||
Assert.True(Utils.TryGetHashCache(testFile, out var fileHash));
|
Assert.True(Utils.TryGetHashCache(testFile, out var fileHash));
|
||||||
Assert.Equal(Hash.FromBase64("eSIyd+KOG3s="), fileHash);
|
Assert.Equal(Hash.FromBase64("eSIyd+KOG3s="), fileHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestHashHex()
|
||||||
|
{
|
||||||
|
|
||||||
|
var hash = Hash.FromULong((ulong)Utils.NextRandom(0, int.MaxValue));
|
||||||
|
Assert.Equal(hash, Hash.FromHex(hash.ToHex()));
|
||||||
|
|
||||||
|
hash = Hash.FromLong(4085310893299329733);
|
||||||
|
Assert.Equal(hash, Hash.FromHex(hash.ToHex()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,10 +66,7 @@ namespace Wabbajack.Common
|
|||||||
return BitConverter.ToInt64(BitConverter.GetBytes(a._code));
|
return BitConverter.ToInt64(BitConverter.GetBytes(a._code));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToHex()
|
|
||||||
{
|
|
||||||
return BitConverter.GetBytes(_code).ToHex();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ToBase64()
|
public string ToBase64()
|
||||||
{
|
{
|
||||||
@ -97,6 +94,10 @@ namespace Wabbajack.Common
|
|||||||
{
|
{
|
||||||
return new Hash(BitConverter.ToUInt64(xxHashAsHex.FromHex()));
|
return new Hash(BitConverter.ToUInt64(xxHashAsHex.FromHex()));
|
||||||
}
|
}
|
||||||
|
public string ToHex()
|
||||||
|
{
|
||||||
|
return BitConverter.GetBytes(_code).ToHex();
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] ToArray()
|
public byte[] ToArray()
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.Log($"Looking for patch for {archive.Name}");
|
Utils.Log($"Looking for patch for {archive.Name} ({(long)archive.Hash} {archive.Hash.ToHex()} -> {(long)result.Archive!.Hash} {result.Archive!.Hash.ToHex()})");
|
||||||
var patchResult = await ClientAPI.GetModUpgrade(archive, result.Archive!);
|
var patchResult = await ClientAPI.GetModUpgrade(archive, result.Archive!);
|
||||||
|
|
||||||
Utils.Log($"Downloading patch for {archive.Name}");
|
Utils.Log($"Downloading patch for {archive.Name}");
|
||||||
|
@ -131,14 +131,14 @@ namespace Wabbajack.Server.DataLayer
|
|||||||
"SELECT SrcId, DestId, PatchSize, Finished, IsFailed, FailMessage FROM dbo.Patches WHERE SrcId = @SrcId", new {SrcId = sourceDownload});
|
"SELECT SrcId, DestId, PatchSize, Finished, IsFailed, FailMessage FROM dbo.Patches WHERE SrcId = @SrcId", new {SrcId = sourceDownload});
|
||||||
|
|
||||||
List<Patch> results = new List<Patch>();
|
List<Patch> results = new List<Patch>();
|
||||||
foreach (var (srcId, destId, patchSize, finished, isFinished, failMessage) in patches)
|
foreach (var (srcId, destId, patchSize, finished, isFailed, failMessage) in patches)
|
||||||
{
|
{
|
||||||
results.Add( new Patch {
|
results.Add( new Patch {
|
||||||
Src = await GetArchiveDownload(srcId),
|
Src = await GetArchiveDownload(srcId),
|
||||||
Dest = await GetArchiveDownload(destId),
|
Dest = await GetArchiveDownload(destId),
|
||||||
PatchSize = patchSize,
|
PatchSize = patchSize,
|
||||||
Finished = finished,
|
Finished = finished,
|
||||||
IsFailed = isFinished,
|
IsFailed = isFailed,
|
||||||
FailMessage = failMessage
|
FailMessage = failMessage
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ namespace Wabbajack.Server.Services
|
|||||||
return (archive, ArchiveStatus.Updating);
|
return (archive, ArchiveStatus.Updating);
|
||||||
|
|
||||||
if (patch.IsFailed == true)
|
if (patch.IsFailed == true)
|
||||||
continue;
|
return (archive, ArchiveStatus.InValid);
|
||||||
|
|
||||||
var (_, status) = await ValidateArchive(data, patch.Dest.Archive);
|
var (_, status) = await ValidateArchive(data, patch.Dest.Archive);
|
||||||
if (status == ArchiveStatus.Valid)
|
if (status == ArchiveStatus.Valid)
|
||||||
|
Loading…
Reference in New Issue
Block a user