Allow accessor implementations to override Position property

This commit is contained in:
Michael Becker 2014-04-08 14:48:54 -04:00
parent 77bff918cc
commit a4df8fe080
2 changed files with 8 additions and 2 deletions

View File

@ -19,7 +19,8 @@ namespace UniversalEditor
public abstract long Length { get; set; }
private long mvarPosition = 0;
public long Position { get { return mvarPosition; } set { mvarPosition = value; Seek(mvarPosition, SeekOrigin.Begin); } }
public virtual long Position { get { return mvarPosition; } set { mvarPosition = value; Seek(mvarPosition, SeekOrigin.Begin); } }
public long Remaining { get { return Length - Position; } }
public void Seek(int length, SeekOrigin position)

View File

@ -9,6 +9,11 @@ namespace UniversalEditor.Accessors
{
public class FileAccessor : Accessor
{
public override long Position
{
get { return mvarFileStream.Position; }
set { mvarFileStream.Position = value; }
}
public override long Length
{
get { return mvarFileStream.Length; }
@ -47,7 +52,7 @@ namespace UniversalEditor.Accessors
internal override int WriteInternal(byte[] buffer, int offset, int count)
{
mvarFileStream.Write(buffer, offset, count);
mvarFileStream.Write(buffer, offset, count);
return count;
}