mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2025-02-03 03:30:58 +00:00
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
|
namespace Fuse
|
|||
|
{
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.IO;
|
|||
|
|
|||
|
public class Test
|
|||
|
{
|
|||
|
public bool Valid => !string.IsNullOrEmpty(this.Description);
|
|||
|
|
|||
|
public string Description { get; private set; }
|
|||
|
|
|||
|
public RegisterState RegisterState { get; } = new RegisterState();
|
|||
|
|
|||
|
public List<MemoryDatum> MemoryData { get; } = new List<MemoryDatum>();
|
|||
|
|
|||
|
public void Read(StreamReader file)
|
|||
|
{
|
|||
|
while ((string.IsNullOrWhiteSpace(this.Description) || this.Description.StartsWith(";")) && !file.EndOfStream)
|
|||
|
{
|
|||
|
this.Description = file.ReadLine();
|
|||
|
}
|
|||
|
|
|||
|
if (!this.Valid)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
this.RegisterState.Read(file);
|
|||
|
|
|||
|
var finished = false;
|
|||
|
do
|
|||
|
{
|
|||
|
var line = file.ReadLine();
|
|||
|
finished = line == "-1";
|
|||
|
if (!finished)
|
|||
|
{
|
|||
|
var datum = new MemoryDatum();
|
|||
|
datum.Parse(line);
|
|||
|
this.MemoryData.Add(datum);
|
|||
|
}
|
|||
|
}
|
|||
|
while (!finished);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|