public ConnectionAssessmentRunner(ICodeRunner runner, IUserServices userServices, ICodingTrainerRepository rep, int chapter, int exercise) { this.runner = runner; this.userServices = userServices; this.rep = rep; this.chapter = chapter; this.exercise = exercise; }
/// <summary> /// Evals the specified language. /// </summary> /// <param name="language">The language.</param> /// <param name="code">The code.</param> /// <param name="isSnippet">if set to <c>true</c> [is snippet].</param> /// <param name="arguments">The arguments.</param> /// <returns></returns> /// <exception cref="Utilities.Code.CodeUtilities.CompileException"/> /// <exception cref="Utilities.Code.CodeUtilities.NativeCompileException"/> public static string Eval(Language language, string code, bool isSnippet, params string[] arguments) { CompilerResults compilerResults = Compile(language, code, isSnippet, true); // Now, run the code ICodeRunner codeRunner = GetCodeRunner(language); return(codeRunner.RunToString(compilerResults, string.Format("{0}.{1}.{2}", DefaultNamespace, DefaultClassName, GetDefaultMainMethodName(language)), arguments)); }
public QuestionValidatorWithProgram( IMapper mapper, IContext context, IHashComputer hashComputer, IRepository <DatabaseQuestion> repositoryQuestion, ICodeRunner codeRunner) : base( mapper, context, hashComputer, repositoryQuestion) { _codeRunner = codeRunner; }
protected abstract bool Run <T>(T compiled, ExecOptions options, ICodeRunner <T> runner, params ExtendedOption[] extOptions) where T : ICompiledAssembly;
public TamerCode(ICodeRunner codeRunner, ICodeExecutor codeExecutor, ICodeAnalyzer codeAnalyzer) { _codeRunner = codeRunner; _codeExecutor = codeExecutor; _codeAnalyzer = codeAnalyzer; }
// Constructors public CodeRunnerHub(ICodeRunner runner, IUserServices userServices, ICodingTrainerRepository dbRepository) { this.userServices = userServices; sqlRep = dbRepository; this.runner = runner; }
public IdeServices(ICodeRunner runner) { this.runner = runner; }
public AssessmentManager(ICodeRunner runner, ICodingTrainerRepository repository) { codeRunner = runner; rep = repository; }
public ConnectionCodeRunner(ICodeRunner runner) { this.runner = runner; }
internal bool Execute <T>(T compiled, ExecOptions options, ICodeRunner <T> runner, params ExtendedOption[] extOptions) where T : ICompiledAssembly { var output = App.GetService <IOutputService>(); var con = App.GetService <IConsoleService>(); var sci = App.Editor().Control as ScintillaControl; if (options.Set(ExecOptions.Console)) { App.OpenView("Console"); var sess = new ConsoleSessionInfo { SessionName = compiled.MainUnit.Name, Banner = String.Format("Running module {0}", compiled.MainUnit.Name) }; con.StartSession(sess); } var ah = new ManualResetEvent(false); var success = false; var th = new Thread(() => { var res = default(Object); try { res = runner.Execute(compiled, extOptions); success = true; ah.Set(); WriteExecutionResult(sci, options, res); } catch (CodeException ex) { ah.Set(); sci.Invoke(() => { output.WriteLine(OutputFormat.Header, "Unhandled run-time error:"); output.WriteLine(OutputFormat.Error, ex.ToString()); var nav = App.GetService <IDocumentNavigatorService>(); if (options.Set(ExecOptions.TipError) && sci != null) { sci.ShowCallTip(ex.Message); } if (options.Set(ExecOptions.Annotation) && sci != null && ex.Document != null && nav.SetActive(ex.Document)) { sci.Styles.Annotation1.Font = "Segoe UI"; sci.SetAnnotation(ex.Line - 1, ex.Message, TextStyle.Annotation1); sci.CaretPosition = sci.GetPositionFromLine(ex.Line); sci.ScrollToCaret(); } if (options.Set(ExecOptions.Console) && con != null) { con.EndSession("Session terminated because of an unhandled run-time error."); } if (options.Set(ExecOptions.ShowOutput)) { App.OpenView("Output"); } }); return; } finally { abortCallBack = null; } if (options.Set(ExecOptions.Console)) { con.EndSession(res); } }); abortCallBack = () => { ah.Set(); th.Abort(); if (options.Set(ExecOptions.Console) && con != null) { con.EndSession("Session terminated."); } }; if (options.Set(ExecOptions.LimitTime)) { try { th.Start(); if (!ah.WaitOne(500)) { var s = success; if (!s) { try { th.Abort(); abortCallBack = null; } catch { } } return(s); } return(true); } catch { return(false); } } else { th.Start(); return(true); } }
protected override bool Run <T>(T compiled, ExecOptions options, ICodeRunner <T> runner, params ExtendedOption[] extOptions) { return(Execute(compiled, options, runner, extOptions)); }
public AssessmentRunner(ICodeRunner runner, string code) { _runner = runner; _code = code; }