/// <inheritdoc /> public async Task <IScript> CompileCodeAsync(string code, ScriptLanguage language) { if (string.IsNullOrEmpty(code)) { return(null); } switch (language) { case ScriptLanguage.NCScript: return(await parser.ParseAsync(code)); case ScriptLanguage.JavaScript: case ScriptLanguage.TypeScript: return(new Dto.Scripts.JavaScript(code, importservice, language)); case ScriptLanguage.Python: return(new PythonScript(pythonservice, code)); case ScriptLanguage.Lua: return(new LuaScript(code, luaservice)); default: throw new ArgumentException($"Unsupported script language '{language}'"); } }
public async Task <IScript> CompileCodeAsync(string code, ScriptLanguage language) { if (string.IsNullOrEmpty(code)) { return(null); } switch (language) { case ScriptLanguage.NCScript: return(await parser.ParseAsync(code)); case ScriptLanguage.JavaScript: return(new JavaScript(code, new ScriptImportService(null))); default: throw new ArgumentException($"Unsupported script language '{language}'"); } }