-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNullSector.cs
22 lines (21 loc) · 971 Bytes
/
NullSector.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using ItzWarty;
namespace Dargon.VirtualFileMaps
{
[Guid("35544913-46AE-4118-930D-6A4A89FD087C")]
public class NullSector : ISector
{
private long size;
public NullSector() { }
public NullSector(long size) { this.size = size; }
public long Size { get { return size; } }
public IEnumerable<KeyValuePair<SectorRange, ISector>> Segment(SectorRange currentRange, IEnumerable<SectorRange> newRanges) { return newRanges.Select(range => range.PairValue((ISector)new NullSector(range.Size))); }
public void Read(long readOffset, long readLength, byte[] buffer, long bufferOffset) { Array.Clear(buffer, (int)bufferOffset, (int)readLength); }
public void Serialize(BinaryWriter writer) { writer.Write((long)size);}
public void Deserialize(BinaryReader reader) { size = reader.ReadInt64(); }
}
}