/// <summary> /// Constructor /// </summary> public Console() { InitializeComponent(); textpen = new Pen(Settings.Simulator.ConsoleTextColor); //color of the init text this.BackColor = Settings.Simulator.ConsoleBackGroundColor; caretThread = new Thread(new ThreadStart(ShowCaret)); AllThreads.Add(caretThread); //add the caret thread to list for closing caretThread.Start(); m_Output = new dOutputFunction(this.Write); m_Exit = new dExitFunction(this.exitConsole); ScreenBuffer = new ArrayList(); InputBuffer = new CodeBlock(); ScreenBuffer.Insert(0, new CodeBlock()); bNowInInputFunction = false; eWaitForInput = new AutoResetEvent(false); PrevImage = new System.Drawing.Bitmap(_MaxX, _MaxY); NeedToRepaint = new System.Timers.Timer(); NeedToRepaint.Elapsed += new ElapsedEventHandler(ConsoleUpdateTime); NeedToRepaint.Interval = 100; NeedToRepaint.Enabled = false; }
/// <summary> /// Constructor /// </summary> public Console(string sInputFile, string sOutputFile) { _sInputFileName = sInputFile; _sOutputFileName = sOutputFile; InitializeComponent(); textpen = new Pen(Settings.Simulator.ConsoleTextColor); //color of the init text this.BackColor = Settings.Simulator.ConsoleBackGroundColor; caretThread = new Thread(new ThreadStart(ShowCaret)); caretThread.Name = "caret thread"; AllThreads.Add(caretThread); //add the caret thread to list for closing caretThread.Start(); m_Output = new dOutputFunction(this.Write); m_Exit = new dExitFunction(this.exitConsole); ScreenBuffer = new ArrayList(); ScreenBuffer.Insert(0, new CodeBlock()); InputBuffer = new CodeBlock(); //geting input from input file if (_sInputFileName != "") { fInputFile = new StreamReader(_sInputFileName); string sTempReadFromFile = fInputFile.ReadToEnd(); sTempReadFromFile = sTempReadFromFile.Replace("\r\n", "\n"); InputBuffer += (CodeBlock)sTempReadFromFile; InputBuffer += 0xff; fInputFile.Close(); } bNowInInputFunction = false; eWaitForInput = new AutoResetEvent(false); PrevImage = new System.Drawing.Bitmap(GraphicX, GraphicY); NeedToRepaint = new System.Timers.Timer(); NeedToRepaint.Elapsed += new ElapsedEventHandler(ConsoleUpdateTime); NeedToRepaint.Interval = 100; NeedToRepaint.Enabled = false; }