private static void WriteOnlyToMemoryWithoutReplacing_UNSAFE(char c, int x, int y) { CodePageEnsurer.EnsureLegitCP850(c); //Write to memory memory.Add(new PositionedChar(new Point(x, y), c)); }
public static void Write(string s, int startLeft, int startTop, ConsoleColor color = ConsoleColor.White) { CodePageEnsurer.EnsureLegitCP850(s); foreach (char c in s) { IEnumerable <PositionedChar> toReplace = memory.Where(ch => ch.Position.X == startLeft && ch.Position.Y == startTop); if (toReplace != null && toReplace.Count() == 1) { memory.Remove(toReplace.First()); } //Write to memory memory.Add(new PositionedChar(new Point(startLeft, startTop), c)); //Write to screen ConsoleColor before = Console.ForegroundColor; Console.ForegroundColor = color; Console.SetCursorPosition(startLeft, startTop); Console.Write(c); Console.ForegroundColor = before; startLeft++; } }
public PositionedChar(Point position, char inputChar) { if (position == null) { throw new ArgumentNullException(); } Position = position; CodePageEnsurer.EnsureLegitCP850(inputChar); Char = inputChar; }
private static void WriteOnlyToMemory(char c, int x, int y) { CodePageEnsurer.EnsureLegitCP850(c); IEnumerable <PositionedChar> toReplace = memory.Where(ch => ch.Position.X == x && ch.Position.Y == y); if (toReplace != null && toReplace.Count() == 1) { memory.Remove(toReplace.First()); } //Write to memory memory.Add(new PositionedChar(new Point(x, y), c)); }
public static void Write(char c, int x, int y, ConsoleColor color = ConsoleColor.White) { CodePageEnsurer.EnsureLegitCP850(c); IEnumerable <PositionedChar> toReplace = memory.Where(ch => ch.Position.X == x && ch.Position.Y == y); if (toReplace != null && toReplace.Count() == 1) { memory.Remove(toReplace.First()); } //Write to memory memory.Add(new PositionedChar(new Point(x, y), c)); //Write to screen ConsoleColor before = Console.ForegroundColor; Console.ForegroundColor = color; Console.SetCursorPosition(x, y); Console.Write(c); Console.ForegroundColor = before; }