public void WriteOutput(string output, Color color)
{
try {
if(!this.IsHandleCreated || this.IsDisposed || this._isDisposed)
return;
Invoke((Action)(() => {
if(this.IsDisposed || !this.IsHandleCreated || this._isDisposed) {
return;
}
if(string.IsNullOrEmpty(lastInput) == false &&
(output == lastInput || output.Replace("\r\n", "") == lastInput)) {
return;
}
// Write the output.
richTextBoxConsole.SelectionColor = color;
richTextBoxConsole.SelectedText += output.REReplace("[\r]{1,}\n?", Environment.NewLine);
InputStart = richTextBoxConsole.SelectionStart;
Imports.SendMessage(richTextBoxConsole.Handle, Imports.WmVscroll, Imports.SbBottom, 0x0);
}));
} catch(ObjectDisposedException odex) {
// I don't know why it keeps throwing this but it does.
}
}