fixed backups being case sensitive

This commit is contained in:
Asval 2025-02-15 23:47:33 +01:00
parent b5c1fdccc6
commit c92103857e
4 changed files with 18 additions and 12 deletions

@ -1 +1 @@
Subproject commit 7c76fdc0d3053170121bd5b6f0bb3b5fa28afbf6
Subproject commit c36748f206d19eea45a6f2ea4cc82e56617d87c9

View File

@ -66,7 +66,7 @@ public class BackupManagerViewModel : ViewModel
var backupFolder = Path.Combine(UserSettings.Default.OutputDirectory, "Backups");
var fileName = $"{_gameName}_{DateTime.Now:MM'_'dd'_'yyyy}.fbkp";
var fullPath = Path.Combine(backupFolder, fileName);
var func = new Func<GameFile, bool>(x => !x.Path.EndsWith(".uexp") && !x.Path.EndsWith(".ubulk") && !x.Path.EndsWith(".uptnl"));
var func = new Func<GameFile, bool>(x => !x.IsUePackagePayload);
using var fileStream = new FileStream(fullPath, FileMode.Create);
using var compressedStream = LZ4Stream.Encode(fileStream, LZ4Level.L00_FAST);
@ -80,7 +80,7 @@ public class BackupManagerViewModel : ViewModel
if (!func(asset)) continue;
writer.Write(asset.Size);
writer.Write(asset.IsEncrypted);
writer.Write($"/{asset.Path.ToLower()}");
writer.Write(asset.Path);
}
SaveCheck(fullPath, fileName, "created", "create");
@ -121,6 +121,7 @@ public enum EBackupVersion : byte
{
BeforeVersionWasAdded = 0,
Initial,
PerfectPath, // no more leading slash and ToLower
LatestPlusOne,
Latest = LatestPlusOne - 1

View File

@ -182,7 +182,7 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
{
case ELoadingMode.AllButNew:
{
var paths = new HashSet<string>();
var paths = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var magic = archive.Read<uint>();
if (magic != BackupManagerViewModel.FBKP_MAGIC)
{
@ -192,7 +192,7 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
cancellationToken.ThrowIfCancellationRequested();
archive.Position += 29;
paths.Add(archive.ReadString().ToLower()[1..]);
paths.Add(archive.ReadString()[1..]);
archive.Position += 4;
}
}
@ -205,7 +205,10 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
cancellationToken.ThrowIfCancellationRequested();
archive.Position += sizeof(long) + sizeof(byte);
paths.Add(archive.ReadString().ToLower()[1..]);
var fullPath = archive.ReadString();
if (version < EBackupVersion.PerfectPath) fullPath = fullPath[1..];
paths.Add(fullPath);
}
}
@ -233,7 +236,7 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
var uncompressedSize = archive.Read<long>();
var isEncrypted = archive.ReadFlag();
archive.Position += 4;
var fullPath = archive.ReadString().ToLower()[1..];
var fullPath = archive.ReadString()[1..];
archive.Position += 4;
AddEntry(fullPath, uncompressedSize, isEncrypted, entries);
@ -249,7 +252,8 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
var uncompressedSize = archive.Read<long>();
var isEncrypted = archive.ReadFlag();
var fullPath = archive.ReadString().ToLower()[1..];
var fullPath = archive.ReadString();
if (version < EBackupVersion.PerfectPath) fullPath = fullPath[1..];
AddEntry(fullPath, uncompressedSize, isEncrypted, entries);
}

View File

@ -122,14 +122,15 @@ public class Renderer : IDisposable
public void Animate(Lazy<UObject> anim) => Animate(anim.Value, Options.SelectedModel);
private void Animate(UObject anim, FGuid guid)
{
if (anim is not UAnimSequenceBase animBase || !Options.TryGetModel(guid, out var m) || m is not SkeletalModel model)
if (anim is not UAnimSequenceBase animBase || !animBase.Skeleton.TryLoad(out USkeleton skeleton) ||
!Options.TryGetModel(guid, out var m) || m is not SkeletalModel model)
return;
var animSet = animBase switch
{
UAnimSequence animSequence when animSequence.Skeleton.TryLoad(out USkeleton skeleton) => skeleton.ConvertAnims(animSequence),
UAnimMontage animMontage when animMontage.Skeleton.TryLoad(out USkeleton skeleton) => skeleton.ConvertAnims(animMontage),
UAnimComposite animComposite when animComposite.Skeleton.TryLoad(out USkeleton skeleton) => skeleton.ConvertAnims(animComposite),
UAnimSequence animSequence => skeleton.ConvertAnims(animSequence),
UAnimMontage animMontage => skeleton.ConvertAnims(animMontage),
UAnimComposite animComposite => skeleton.ConvertAnims(animComposite),
_ => throw new ArgumentException("Unknown animation type")
};