Track modification for single file edits

This commit is contained in:
Kurt
2018-11-26 17:05:42 -08:00
parent 507e1445bb
commit ea6c8d3158

View File

@@ -1,4 +1,5 @@
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -24,7 +25,16 @@ public void CancelEdits()
Data = (byte[]) Backup.Clone();
}
public byte[] this[int index] { get => Data; set => Data = value; }
public byte[] this[int index]
{
get => (byte[])Data.Clone();
set
{
Modified |= Data.SequenceEqual(value);
Data = value;
}
}
public Task<byte[][]> GetFiles() => Task.FromResult(new[] {Data});
public Task<byte[]> GetFile(int file, int subFile = 0) => Task.FromResult(Data);
public Task SetFile(int file, byte[] value, int subFile = 0) => Task.FromResult(Data = value);