2015-02-17 22:58:25 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using Jellyfish.Library;
|
|
|
|
|
|
|
|
|
|
namespace Jellyfish.Virtu
|
|
|
|
|
{
|
|
|
|
|
public sealed class DiskNib : Disk525
|
|
|
|
|
{
|
2015-05-18 00:14:00 +00:00
|
|
|
|
public DiskNib() { }
|
2015-02-17 22:58:25 +00:00
|
|
|
|
public DiskNib(string name, byte[] data, bool isWriteProtected) :
|
|
|
|
|
base(name, data, isWriteProtected)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DiskNib(string name, Stream stream, bool isWriteProtected) :
|
|
|
|
|
base(name, new byte[TrackCount * TrackSize], isWriteProtected)
|
|
|
|
|
{
|
|
|
|
|
if (stream == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException("stream");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stream.ReadBlock(Data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ReadTrack(int number, int fraction, byte[] buffer)
|
|
|
|
|
{
|
|
|
|
|
Buffer.BlockCopy(Data, (number / 2) * TrackSize, buffer, 0, TrackSize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void WriteTrack(int number, int fraction, byte[] buffer)
|
|
|
|
|
{
|
|
|
|
|
Buffer.BlockCopy(buffer, 0, Data, (number / 2) * TrackSize, TrackSize);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|