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