mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
few fixes and improvements
This commit is contained in:
parent
6c7d1759bc
commit
1a7dec86c1
@ -14,6 +14,7 @@
|
||||
* Ignore some files Wabbajack creates
|
||||
* Improve compilation times by reworking file indexing algorithm
|
||||
* Store patch files in byte format instead of base64 strings
|
||||
* Verify SHA of patched files after install
|
||||
|
||||
#### Version 0.9.1 - 9/5/2019
|
||||
* Fixed a bug where having only one profile selected would result in no profiles being selected
|
||||
|
@ -45,41 +45,34 @@ namespace VFS
|
||||
Directory.CreateDirectory(_stagedRoot);
|
||||
}
|
||||
|
||||
private static void DeleteDirectory(string path)
|
||||
private static void DeleteDirectory(string path, bool recursive = true)
|
||||
{
|
||||
Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories)
|
||||
.DoProgress("Cleaning VFS Files", file =>
|
||||
if (recursive)
|
||||
{
|
||||
var subfolders = Directory.GetDirectories(path);
|
||||
foreach (var s in subfolders)
|
||||
{
|
||||
try
|
||||
DeleteDirectory(s, recursive);
|
||||
}
|
||||
}
|
||||
var files = Directory.GetFiles(path);
|
||||
foreach (var f in files)
|
||||
{
|
||||
try
|
||||
{
|
||||
var attr = File.GetAttributes(f);
|
||||
if ((attr & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
|
||||
{
|
||||
var fi = new FileInfo(file);
|
||||
fi.Attributes &= ~FileAttributes.ReadOnly;
|
||||
File.Delete(file);
|
||||
File.SetAttributes(f, attr ^ FileAttributes.ReadOnly);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.Log(ex.ToString());
|
||||
}
|
||||
});
|
||||
File.Delete(f);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
}
|
||||
Directory.Delete(path, true);
|
||||
|
||||
Directory.EnumerateDirectories(path, DirectoryEnumerationOptions.Recursive)
|
||||
.OrderByDescending(d => d.Length)
|
||||
.DoProgress("Cleaning VFS Folders", folder =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(folder))
|
||||
return;
|
||||
var di = new DirectoryInfo(folder);
|
||||
di.Attributes &= ~FileAttributes.ReadOnly;
|
||||
Directory.Delete(path, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.Log(ex.ToString());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,6 @@
|
||||
<Compile Include="Consts.cs" />
|
||||
<Compile Include="DynamicIniData.cs" />
|
||||
<Compile Include="FileExtractor.cs" />
|
||||
<Compile Include="MarkdownBuilder.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SplittingStream.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
|
@ -903,6 +903,7 @@ namespace Wabbajack
|
||||
var e = source.EvolveTo<PatchedFromArchive>();
|
||||
e.ArchiveHashPath = found.MakeRelativePaths();
|
||||
e.To = source.Path;
|
||||
e.Hash = source.File.Hash;
|
||||
Utils.TryGetPatch(found.Hash, source.File.Hash, out e.Patch);
|
||||
return e;
|
||||
|
||||
|
@ -157,6 +157,7 @@ namespace Wabbajack
|
||||
/// The file to apply to the source file to patch it
|
||||
/// </summary>
|
||||
public byte[] Patch;
|
||||
public string Hash;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
@ -411,6 +411,11 @@ namespace Wabbajack
|
||||
{
|
||||
BSDiff.Apply(old_data, () => new MemoryStream(patch_data), out_stream);
|
||||
}
|
||||
|
||||
Status($"Verifying Patch {Path.GetFileName(to_patch.To)}");
|
||||
var result_sha = Utils.FileSHA256(to_file);
|
||||
if (result_sha != to_patch.Hash)
|
||||
throw new InvalidDataException($"Invalid Hash for {to_patch.To} after patching");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user