Move classes into Program class.

This commit is contained in:
Anna Rose 2025-02-09 20:24:58 -05:00
parent 497f5887bd
commit eac331b4ee
2 changed files with 95 additions and 80 deletions

View File

@ -4,6 +4,8 @@ using System.Collections.Generic;
namespace IngameScript
{
partial class Program
{
public class ConfigParser
{
private Dictionary<string, string> _config;
@ -41,4 +43,5 @@ namespace IngameScript
}
}
}
}
}

View File

@ -8,7 +8,15 @@ using System.Text;
namespace IngameScript
{
public class Console
partial class Program
{
public interface IConsole
{
void Print(string text);
void PrintLower(string text);
}
public class Console : IConsole
{
private MyGridProgram _program;
private int _maxLines;
@ -58,12 +66,12 @@ namespace IngameScript
// This class is necessary because we need to keep a *single* buffer
// to write to. So we can ask the primary Console for a prefixer.
public class PrefixedConsole
public class PrefixedConsole : IConsole
{
private Console _console;
private IConsole _console;
private string _prefix;
public PrefixedConsole(Console console, string prefix)
public PrefixedConsole(IConsole console, string prefix)
{
_console = console;
_prefix = prefix + ": ";
@ -73,5 +81,9 @@ namespace IngameScript
{
_console.Print(_prefix + text);
}
// sub-consoles can't print to the ephemeral display
public void PrintLower(string text) { }
}
}
}