private void ConsolePromptReplied(ref ConsoleActionArgs e) { if (string.IsNullOrEmpty(e.Message)) { return; } string strCode = PreProcess(e.Message, consoleScriptContext); string strDisp = "\r\n"; Task <object> Eval = null; try { Eval = CSharpScript.EvaluateAsync(strCode, GenericScriptOptions, consoleScriptContext); } catch (CompilationErrorException err) { strDisp = err.Diagnostics.Aggregate("", (strRet, errItm) => strRet += errItm + "\r\n"); } if (Eval != null) { if (Eval.Exception == null) { if (Eval.Result != null) { strDisp = ExpandedObjectString(Eval.Result, TypesExpandExempt, true) + "\r\n"; } else { strDisp = (strCode.EndsWith(";"))?$"{Eval.Status}":"<NULL>\r\n"; } } else { strDisp = ExceptionFullString(Eval.Exception); } Eval.Dispose(); } Invoke(new Action(() => { Console.Write(strDisp, ">", strCode, true); })); }
private void ConsolePromptReady(ref ConsoleActionArgs e) { e.Message = ">"; }