Skip to content

Commit

Permalink
Fix bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
clovett committed Apr 16, 2024
1 parent 6021f19 commit 2cf651d
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions src/XmlNotepad/AsyncXslt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,10 @@ public void Cancel()

public override bool CanWrite => this.inner.CanWrite;

public override long Length
{
get
{
if (!disposed)
{
lastLength = this.inner.Length;
}
return lastLength;
}
}
public override long Length => lastLength;

public override long Position
{
get
{
if (!disposed)
{
lastPosition = this.inner.Position;
}
return lastPosition;
}
public override long Position {
get => lastPosition;
set => this.inner.Position = value;
}

Expand All @@ -156,17 +138,24 @@ public override int Read(byte[] buffer, int offset, int count)
{
throw new OperationCanceledException();
}
return this.inner.Read(buffer, offset, count);
int rc = this.inner.Read(buffer, offset, count);
lastPosition = this.inner.Position;
lastLength = this.inner.Length;
return rc;
}

public override long Seek(long offset, SeekOrigin origin)
{
return this.inner.Seek(offset, origin);
var pos = this.inner.Seek(offset, origin);
lastPosition = this.inner.Position;
lastLength = this.inner.Length;
return pos;
}

public override void SetLength(long value)
{
this.inner.SetLength(value);
lastLength = this.inner.Length;
}

public override void Write(byte[] buffer, int offset, int count)
Expand All @@ -176,6 +165,8 @@ public override void Write(byte[] buffer, int offset, int count)
{
this.EstimatedSize = this.Position * 2;
}
lastPosition = this.inner.Position;
lastLength = this.inner.Length;
if (cancelled)
{
disposed = true;
Expand Down

0 comments on commit 2cf651d

Please sign in to comment.