EightBitNet/Fuse/Test.cs
Adrian Conlon 8dea5746c4 Tidy up stylecopy usage for the LR35902 set of libraries.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-07-21 13:11:00 +01:00

56 lines
1.4 KiB
C#

// <copyright file="Test.cs" company="Adrian Conlon">
// Copyright (c) Adrian Conlon. All rights reserved.
// </copyright>
namespace Fuse
{
using System;
using System.Collections.Generic;
public class Test
{
private readonly List<MemoryDatum> memoryData = new List<MemoryDatum>();
public string Description { get; private set; }
public RegisterState RegisterState { get; } = new RegisterState();
public IReadOnlyCollection<MemoryDatum> MemoryData => this.memoryData.AsReadOnly();
public bool TryParse(Lines lines)
{
if (lines == null)
{
throw new ArgumentNullException(nameof(lines));
}
while (!lines.EndOfFile && string.IsNullOrEmpty(this.Description))
{
this.Description = lines.ReadLine();
}
if (string.IsNullOrEmpty(this.Description))
{
return false;
}
this.RegisterState.Parse(lines);
var finished = false;
do
{
var line = lines.ReadLine();
finished = line == "-1";
if (!finished)
{
var datum = new MemoryDatum();
datum.Parse(line);
this.memoryData.Add(datum);
}
}
while (!finished);
return true;
}
}
}