ScriptSource Property
ScriptSource
Gets source of the script to execute.
Declaration
[Browsable(false)]
public IScriptSource ScriptSource { get; }
Property Value
Type | Description |
---|---|
IScriptSource |
Implements
Remarks
ScriptSource specifies that the script to be executed is a simple code, list of files or a TypeScript project.
Use ScriptSource to specify additional information related to the script compilation, such as search directories to look for the source files and referenced assemblies.
Examples
Here is how to use a ScriptSource in the C# code:
using System.IO;
using Alternet.Scripter.TypeScript;
public partial class Form1 : Form
{
private ScriptRun scriptRun;
private void Form1_Load(object sender, EventArgs e)
{
scriptRun = new ScriptRun();
scriptRun.ScriptSource.SearchPaths.Add(Path.GetDirectoryName(scriptRun.ScriptHost.ModulesDirectoryPath));
scriptRun.ScriptSource.FromScriptCode(edit.Text);
}
}
Here is how to use a ScriptSource in the Visual Basic code:
Imports System.IO
Imports Alternet.Scripter.TypeScript
Partial Public Class Form1
Inherits Form
Private scriptRun As ScriptRun
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
scriptRun = New ScriptRun()
scriptRun.ScriptSource.SearchPaths.Add(Path.GetDirectoryName(scriptRun.ScriptHost.ModulesDirectoryPath))
scriptRun.ScriptSource.FromScriptCode(edit.Text)
End Sub
End Class