public void Run(String fileName) { // Set the source code String sourceCode = GetSourceCode(fileName); // Find reference String reference = GetReference(); ScriptCompiler compiler = new ScriptCompiler(); CompilerResults results; results = compiler.CompileScript(sourceCode, reference); if (results.Errors.Count == 0) { IScript _compiledScript = (IScript)compiler.FindInterface(results.CompiledAssembly, "IScript"); _compiledScript.Main(); // Run the transcript } else { MessageBox.Show("Compile failed with " + results.Errors.Count.ToString() + " errors.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
private void btnRun_Click(object sender, EventArgs e) { // Find reference String reference = GetReference(); ScriptCompiler compiler = new ScriptCompiler(); CompilerResults results; results = compiler.CompileScript(ScriptSource, reference); if (results.Errors.Count == 0) { IScript _compiledScript = (IScript)compiler.FindInterface(results.CompiledAssembly, "IScript"); if (_compiledScript != null) _compiledScript.Main(); // Run the transcript else MessageBox.Show("No script"); } else { MessageBox.Show("Compile failed with " + results.Errors.Count.ToString() + " errors.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Stop); } }