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.htmSee Also
- RemoveAllBreakpoints
- RemoveBreakpoint
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();
Forbids usage of namespace in a script.public void ForbidNamespace(string namespace_name)
Forbids usage of type in a script.public void ForbidType(System.Type t)
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();
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();
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();
Compiles script.public void Compile()
Discards scripter error.public void DiscardError()
Example
object v = paxScripter1.Eval("MyMath.a[3] + 1"); paxScripter1.DiscardError();
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())); }
Invokes a method from the compiled program.public object Invoke(RunMode rm, object target, string full_name, params object[] parameters)Arguments
rmRunMode.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.targetTarget object.full_nameName of method.parametersList of parameters.
Example
See demo_invoke_csharp.htm
Linkes compiled modules.public void Link()
Loads compiled module from a stream.public void LoadCompiledModule(string module_name, Stream s)
Loads compiled module from a file.public void LoadCompiledModuleFromFile(string module_name, string file_name)
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");
Loads assembly and registeres all types defined in the assembly.public void RegisterAssemblyWithPartialName(string path)
Example
paxScripter1.RegisterAssembly(@"System.Windows.Forms");
Registeres an instance of a host-defined class.public void RegisterInstance(string instance_name, object instance)
Removes all breakpoints.public void RemoveAllBreakpoints()
Removes breakpointpublic void RemoveBreakpoint(string module_name, int line_number) public void RemoveBreakpoint(Breakpoint bp)
Resets scripter.public void Reset()
Runs script.public void Run(RunMode rm, params object[] parameters)Arguments
rmRunMode.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.parametersThe command-line arguments you want to pass to your program when it starts.
Saves compiled module to a stream.public void SaveCompiledModule(string module_name, Stream s)
Saves compiled module to a file.public void SaveCompiledModuleToFile(string module_name, string file_name)