public string Execute(string code) { EventLog.WriteEntry("RoslynCodeService", "Running code execution", EventLogEntryType.Information); var engine = new ScriptExecuter(); var result = engine.Execute(code); EventLog.WriteEntry("RoslynCodeService", "Running code execution - Finished", EventLogEntryType.Information); return result.ToString(); }
public string Execute(string code) { Thread.CurrentThread.CurrentCulture = new CultureInfo("en"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en"); EventLog.WriteEntry("RoslynCodeService", "Initializing code execution", EventLogEntryType.Information); var engine = new ScriptExecuter(); try { EventLog.WriteEntry("RoslynCodeService", "Running code execution", EventLogEntryType.Information); var unformatted = engine.Execute(code); EventLog.WriteEntry("RoslynCodeService", "Running code execution - Finished", EventLogEntryType.Information); return FormatResult(unformatted); } catch (Exception ex) { EventLog.WriteEntry("RoslynCodeService", ex.ToString(), EventLogEntryType.Error); } return string.Empty; }