PaxScripter Methods


PaxScripter.AddBreakpoint

Adds a breakpoint.
public Breakpoint AddBreakpoint(string module_name, int line_number)

Example 1

private void ChangeState(PaxScripter sender, PaxScript.Net.ChangeStateEventArgs e)
{
    if (e.OldState == ScripterState.ReadyToRun)
    {
	sender.AddBreakpoint("1", 13);		
    }
..............................................

Example 2

demo_debug_csharp.htm

See Also

PaxScripter.AddCode

Adds source code to a module of scripter.
public void AddCode(string module_name, string text)

Example

paxScripter1.Reset();
paxScripter1.AddModule("one");
paxScripter1.AddCode("one", @"form1.button1.Text = ""hello"";");
paxScripter1.Run();

PaxScripter.ForbidNamespace

Forbids usage of namespace in a script.
public void ForbidNamespace(string namespace_name)

PaxScripter.ForbidType

Forbids usage of type in a script.
public void ForbidType(System.Type t)

PaxScripter.AddCodeLine

Adds a code line to a module and appends '\u000D' + '\u000A'.
public void AddCode(string module_name, string text)

Example

paxScripter1.Reset();
paxScripter1.AddModule("one", "VB");
paxScripter1.AddCodeLine("one", @"form1.button1.Text = ""hello""");
paxScripter1.Run();

PaxScripter.AddCodeFromFile

Adds source code from a text file to scripter.
public void AddCodeFromFile(string module_name, string path)

Example

paxScripter1.Reset();
paxScripter1.AddModule("1");
paxScripter1.AddCodeFromFile("1", "hello.cs");
paxScripter1.Run();

PaxScripter.AddModule

Adds new module to scripter.
public void AddModule(string module_name)
public void AddModule(string module_name, string laguage_name)

Example 1

paxScripter1.Reset();
paxScripter1.AddModule("1");
paxScripter1.AddCodeFromFile("1", "hello.cs");
paxScripter1.Run();

Example 2

paxScripter1.Reset();
paxScripter1.AddModule("1", "VB");
paxScripter1.AddCodeFromFile("1", "hello.vb");
paxScripter1.Run();

PaxScripter.Compile

Compiles script.
public void Compile()

PaxScripter.DiscardError

Discards scripter error.
public void DiscardError()

Example

object v = paxScripter1.Eval("MyMath.a[3] + 1");
paxScripter1.DiscardError();

PaxScripter.Eval

Evaluates an expression.
public object Eval(string expr)

Example

for (;;)
{
    paxScripter1.Run(RunMode.StepOver);
    if (paxScripter1.HasErrors || paxScripter1.State == ScripterState.Terminated)
	break;
    object v = paxScripter1.Eval("MyMath.a[3] + 1");
    paxScripter1.DiscardError();
    if (v == null)
       MessageBox.Show(String.Format("expr = null"));
    else
       MessageBox.Show(String.Format("expr = " + v.ToString()));
}

PaxScripter.Invoke

Invokes a method from the compiled program.
public object Invoke(RunMode rm, object target, string full_name, params object[] parameters)

Arguments

rm
RunMode.Run - run a program. RunMode.TraceInto - execute a program one line at a time, tracing into procedures. RunMode.StepOver - execute a program one line at a time, stepping over procedures. RunMode.NextLine - use this command to stop on the next source line in your application, regardless of the control flow. RunMode.UntilReturn - run the loaded program until execution returns from the current function.
target
Target object.
full_name
Name of method.
parameters
List of parameters.

Example

See demo_invoke_csharp.htm

PaxScripter.Link

Linkes compiled modules.
public void Link()

PaxScripter.LoadCompiledModule

Loads compiled module from a stream.
public void LoadCompiledModule(string module_name, Stream s)

PaxScripter.LoadCompiledModuleFromFile

Loads compiled module from a file.
public void LoadCompiledModuleFromFile(string module_name, string file_name)

PaxScripter.RegisterAssembly

Loads assembly and registeres all types defined in the assembly.
public void RegisterAssembly(string path)

Example

paxScripter1.RegisterAssembly(@"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll");

PaxScripter.RegisterAssemblyWithPartialName

Loads assembly and registeres all types defined in the assembly.
public void RegisterAssemblyWithPartialName(string path)

Example

paxScripter1.RegisterAssembly(@"System.Windows.Forms");

PaxScripter.RegisterInstance

Registeres an instance of a host-defined class.
public void RegisterInstance(string instance_name, object instance)

PaxScripter.RemoveAllBreakpoints

Removes all breakpoints.
public void RemoveAllBreakpoints()

PaxScripter.RemoveBreakpoint

Removes breakpoint
public void RemoveBreakpoint(string module_name, int line_number)
public void RemoveBreakpoint(Breakpoint bp)

PaxScripter.Reset

Resets scripter.
public void Reset()

PaxScripter.Run

Runs script.
public void Run(RunMode rm, params object[] parameters)

Arguments

rm
RunMode.Run - run a program. RunMode.TraceInto - execute a program one line at a time, tracing into procedures. RunMode.StepOver - execute a program one line at a time, stepping over procedures. RunMode.NextLine - use this command to stop on the next source line in your application, regardless of the control flow. RunMode.UntilReturn - run the loaded program until execution returns from the current function.
parameters
The command-line arguments you want to pass to your program when it starts.

PaxScripter.SaveCompiledModule

Saves compiled module to a stream.
public void SaveCompiledModule(string module_name, Stream s)

PaxScripter.SaveCompiledModuleToFile

Saves compiled module to a file.
public void SaveCompiledModuleToFile(string module_name, string file_name)


Copyright © 2005-2024 Alexander Baranovsky. All rights reserved.