diff --git a/Compression.BSA/BSAReader.cs b/Compression.BSA/BSAReader.cs index e600c6e4..aa1a39cb 100644 --- a/Compression.BSA/BSAReader.cs +++ b/Compression.BSA/BSAReader.cs @@ -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); } diff --git a/Wabbajack.Common/StatusFileStream.cs b/Wabbajack.Common/StatusFileStream.cs index 723c0b43..b477ab15 100644 --- a/Wabbajack.Common/StatusFileStream.cs +++ b/Wabbajack.Common/StatusFileStream.cs @@ -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;