From 6f20449e71d5589c2d1dc48b53e53214a4910bc3 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Tue, 15 Feb 2022 22:11:35 +1100 Subject: [PATCH] Add IReadWrite interface --- .../dotnet/Games.Common/IO/IReadWrite.cs | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 00_Common/dotnet/Games.Common/IO/IReadWrite.cs diff --git a/00_Common/dotnet/Games.Common/IO/IReadWrite.cs b/00_Common/dotnet/Games.Common/IO/IReadWrite.cs new file mode 100644 index 00000000..883e069d --- /dev/null +++ b/00_Common/dotnet/Games.Common/IO/IReadWrite.cs @@ -0,0 +1,69 @@ +namespace Games.Common.IO +{ + /// + /// Provides for input and output of strings and numbers. + /// + public interface IReadWrite + { + /// + /// Reads a value from input. + /// + /// The text to display to prompt for the value. + /// A , being the value entered. + float ReadNumber(string prompt); + + /// + /// Reads 2 values from input. + /// + /// The text to display to prompt for the values. + /// A , being the values entered. + (float, float) Read2Numbers(string prompt); + + /// + /// Reads 3 values from input. + /// + /// The text to display to prompt for the values. + /// A , being the values entered. + (float, float, float) Read3Numbers(string prompt); + + /// + /// Reads 4 values from input. + /// + /// The text to display to prompt for the values. + /// A , being the values entered. + (float, float, float, float) Read4Numbers(string prompt); + + /// + /// Read numbers from input to fill an array. + /// + /// The text to display to prompt for the values. + /// A to be filled with values from input. + void ReadNumbers(string prompt, float[] numbers); + + /// + /// Reads a value from input. + /// + /// The text to display to prompt for the value. + /// A , being the value entered. + string ReadString(string prompt); + + /// + /// Reads 2 values from input. + /// + /// The text to display to prompt for the values. + /// A , being the values entered. + (string, string) Read2Strings(string prompt); + + /// + /// Writes a to output. + /// + /// The to be written. + void Write(string message); + + /// + /// Writes a to output, followed by a new-line. + /// + /// The to be written. + void WriteLine(string message); + } +} \ No newline at end of file