public SKMScript(SKMScriptOptions options, string scriptContent) { _options = options; _scriptContent = scriptContent; _script = CSharpScript.Create(scriptContent, ScriptOptions.Default.WithFilePath(options.ScriptPath).AddReferences(typeof(LightingConsole).Assembly, typeof(LightingConsoleExtensions).Assembly) .AddImports("SKMNET", "SKMNET.Client", "SKMScripting.LightingConsoleExtensions"), globalsType: typeof(SKMScriptGlobals)); }
private static async Task StartExecuteScript(SKMScriptOptions options) { try { //string extension = Path.GetExtension(options.ScriptPath); string fileContent = await File.ReadAllTextAsync(options.ScriptPath); //Debug.Assert(extension == "cs", "Extension has to be cs"); await new SKMScript(options, fileContent).ExecuteAsync(); Logger.Log("a"); } catch (SKMConnectException connectException) { Logger.Log($"Could not connect to {options.IpAddress}"); } catch (Exception exception) { Logger.Log(exception); } }