Convert Hexapawn to common library

This commit is contained in:
Andrew Cooper
2022-03-18 07:05:27 +11:00
parent 455fea9609
commit 1a8ea5aabd
18 changed files with 527 additions and 603 deletions

View File

@@ -95,13 +95,19 @@ public class TextIO : IReadWrite
public void WriteLine(float value) => _output.WriteLine(GetString(value));
public void Write(Stream stream)
public void Write(object value) => _output.Write(value.ToString());
public void WriteLine(object value) => _output.WriteLine(value.ToString());
public void Write(Stream stream, bool keepOpen = false)
{
using var reader = new StreamReader(stream);
while (!reader.EndOfStream)
{
_output.WriteLine(reader.ReadLine());
}
if (!keepOpen) { stream?.Dispose(); }
}
private string GetString(float value) => value < 0 ? $"{value} " : $" {value} ";