mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #756 from wabbajack-tools/less-rapid-hashing-messages
Update the UI less often while hashing files
This commit is contained in:
commit
69cca90a56
@ -316,7 +316,7 @@ namespace Compression.BSA
|
||||
{
|
||||
if (Compressed)
|
||||
{
|
||||
var r = LZ4Stream.Decode(rdr.BaseStream);
|
||||
using var r = LZ4Stream.Decode(rdr.BaseStream);
|
||||
r.CopyToLimit(output, (int) _originalSize);
|
||||
}
|
||||
else
|
||||
@ -327,10 +327,10 @@ namespace Compression.BSA
|
||||
else
|
||||
{
|
||||
if (Compressed)
|
||||
using (var z = new InflaterInputStream(rdr.BaseStream))
|
||||
{
|
||||
z.CopyToLimit(output, (int) _originalSize);
|
||||
}
|
||||
{
|
||||
using var z = new InflaterInputStream(rdr.BaseStream);
|
||||
z.CopyToLimit(output, (int) _originalSize);
|
||||
}
|
||||
else
|
||||
rdr.BaseStream.CopyToLimit(output, (int) _onDiskSize);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Wabbajack.Common
|
||||
{
|
||||
@ -7,12 +8,14 @@ namespace Wabbajack.Common
|
||||
private string _message;
|
||||
private Stream _inner;
|
||||
private WorkQueue? _queue;
|
||||
private DateTime _lastUpdate;
|
||||
|
||||
public StatusFileStream(Stream fs, string message, WorkQueue? queue = null)
|
||||
{
|
||||
_queue = queue;
|
||||
_inner = fs;
|
||||
_message = message;
|
||||
_lastUpdate = DateTime.UnixEpoch;
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
@ -38,6 +41,13 @@ namespace Wabbajack.Common
|
||||
|
||||
private void UpdateStatus()
|
||||
{
|
||||
if (DateTime.Now - _lastUpdate < TimeSpan.FromMilliseconds(500))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_lastUpdate = DateTime.Now;
|
||||
|
||||
if (_inner.Length == 0)
|
||||
{
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user