Refactor SetReleaseIdentifier()

This commit is contained in:
Michael Bucari-Tovo committed 2023-02-19 10:20:01 -07:00
1 parent 1e6e28cd57
commit 6ebbfb8e59
5 files changed
+66 -49

No files matched your search

+12 -1
View File
@@ -247,7 +247,15 @@ namespace AaxDecrypter
public override bool CanWrite => false;
[JsonIgnore]
public override long Length => ContentLength;
public override long Length
{
get
{
if (_backgroundDownloadTask is null)
throw new InvalidOperationException($"Background downloader must first be started by calling {nameof(BeginDownloadingAsync)}");
return ContentLength;
}
}
[JsonIgnore]
public override long Position { get => _readFile.Position; set => Seek(value, SeekOrigin.Begin); }
@@ -267,6 +275,9 @@ namespace AaxDecrypter
public override int Read(byte[] buffer, int offset, int count)
{
if (_backgroundDownloadTask is null)
throw new InvalidOperationException($"Background downloader must first be started by calling {nameof(BeginDownloadingAsync)}");
var toRead = Math.Min(count, Length - Position);
WaitToPosition(Position + toRead);
return IsCancelled ? 0 : _readFile.Read(buffer, offset, count);