I visited pages like How to get all text from console to string?.
Is there a function to get all text in console and save it to string or array? I am thinking about getting text from console in function after writing the text. Is this possible? If not something that simulate the console functions like that I tried but including deleting text.
// I tried this. I do this for Write(),WriteLine(),ReadLine(),Read()
// It works for these functions. But when I remove something from console
// it don't save.
public static void Write(object value)
{
Console.Write(value);
AddToOutput(value.ToString());
}
public static void WriteLine(object value)
{
Console.WriteLine(value);
AddToOutput(value.ToString()+ "\n");
}
public static void WriteLine()
{
Console.WriteLine();
AddToOutput("\n");
}
public static string ReadLine()
{
string txt = Console.ReadLine();
AddToOutput(txt+"\n");
return txt;
}
public static void AddToOutput(string txt)
{
Log += txt;
}