public MainForm() { InitializeComponent(); defineLuaGlobals(); this.ResizeChoiceButtons(); remoteDebugger = new RemoteDebuggerService(); #if DEBUG //luaScript.Options.DebugPrint = s => this.richTextBox1.AppendText(s + "\n"); this.tToolStripMenuItem.Visible = true; if (MessageBox.Show("Do you want to start the debugger?\nA browser window will be opened", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { remoteDebugger.Attach(luaScript, "Main game script"); Process.Start(remoteDebugger.HttpUrlStringLocalHost); } #endif //AddItem("Test", "Test Item", null); //initSkill("survival", "SKL_SURVIVAL",10); //initSkill("speech", "SKL_SPEECH"); if (LoadGame(Program.GameName)) { } else { MessageBox.Show("The game failed to load it's files!", "Error loading game!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Execute(ShellContext context, string arguments) { if (m_Debugger == null) { m_Debugger = new RemoteDebuggerService(); m_Debugger.Attach(context.Script, "MoonSharp REPL interpreter", false); Process.Start(m_Debugger.HttpUrlStringLocalHost); } }
public static void StartDebugger(Script script, bool willstart = true) { if (remoteDebugger == null) { remoteDebugger = new RemoteDebuggerService(); // the last boolean is to specify if the script is free to run // after attachment, defaults to false remoteDebugger.Attach(script, "Description of the script", willstart); // start the web-browser at the correct url. Replace this or just // pass the url to the user in some way. Process.Start(remoteDebugger.HttpUrlStringLocalHost); } }
private void ActivateRemoteDebugger(Script script) { if (remoteDebugger == null) { remoteDebugger = new RemoteDebuggerService(new RemoteDebuggerOptions() { NetworkOptions = Utf8TcpServerOptions.LocalHostOnly | Utf8TcpServerOptions.SingleClientOnly, // SingleScriptMode = true, HttpPort = 2705, RpcPortBase = 2006, }); remoteDebugger.Attach(script, "FurnitureActions", true); } Process.Start(remoteDebugger.HttpUrlStringLocalHost); }
private static void ParseCommand(Script S, string p) { if (p == "help") { Console.WriteLine("Type Lua code to execute Lua code, multilines are accepted, "); Console.WriteLine("or type one of the following commands to execute them."); Console.WriteLine(""); Console.WriteLine("Commands:"); Console.WriteLine(""); Console.WriteLine(" !exit - Exits the interpreter"); Console.WriteLine(" !debug - Starts the debugger"); Console.WriteLine(" !run <filename> - Executes the specified Lua script"); Console.WriteLine(" !compile <filename> - Compiles the file in a binary format"); Console.WriteLine(""); } else if (p == "exit") { Environment.Exit(0); } else if (p == "debug" && m_Debugger == null) { m_Debugger = new RemoteDebuggerService(); m_Debugger.Attach(S, "MoonSharp REPL interpreter", false); Process.Start(m_Debugger.HttpUrlStringLocalHost); } else if (p.StartsWith("run")) { p = p.Substring(3).Trim(); S.DoFile(p); } else if (p == "!") { ParseCommand(S, "debug"); ParseCommand(S, @"run c:\temp\test.lua"); } else if (p.StartsWith("compile")) { p = p.Substring("compile".Length).Trim(); string targetFileName = p + "-compiled"; DynValue chunk = S.LoadFile(p); using (Stream stream = new FileStream(targetFileName, FileMode.Create, FileAccess.Write)) S.Dump(chunk, stream); } }
protected virtual void ActivateRemoteDebugger(Script script) { #if UNITY_STANDALONE if (remoteDebuggerService == null) { remoteDebuggerService = new RemoteDebuggerService(); // the last boolean is to specify if the script is free to run // after attachment, defaults to false remoteDebuggerService.Attach(script, gameObject.name, false); } // start the web-browser at the correct url. Replace this or just // pass the url to the user in some way. Process.Start(remoteDebuggerService.HttpUrlStringLocalHost); #endif }
private static void ParseCommand(Script S, string p) { if (p == "debug" && m_Debugger == null) { m_Debugger = new RemoteDebuggerService(); m_Debugger.Attach(S, "MoonSharp REPL interpreter", false); Process.Start(m_Debugger.HttpUrlStringLocalHost); } if (p.StartsWith("run")) { p = p.Substring(3).Trim(); S.DoFile(p); } if (p == "!") { ParseCommand(S, "debug"); ParseCommand(S, @"run c:\temp\test.lua"); } }
private void ActivateRemoteDebugger(Script script) { if (remoteDebugger == null) { remoteDebugger = new RemoteDebuggerService(new RemoteDebuggerOptions() { NetworkOptions = Utf8TcpServerOptions.LocalHostOnly | Utf8TcpServerOptions.SingleClientOnly, SingleScriptMode = true, HttpPort = 2705, RpcPortBase = 2006, }); // the last boolean is to specify if the script is free to run // after attachment, defaults to false remoteDebugger.Attach(script, "My Awesome Debugger", true); // start the web-browser at the correct url. Replace this or just // pass the url to the user in some way. System.Diagnostics.Process.Start(remoteDebugger.HttpUrlStringLocalHost); } }
public void RunScript(bool debug) { CheckImportMenu(); Log("-"); Script script = new Script(); IEnumerable <Type> extTypes = null; foreach (var _item in importToolStripMenuItem.DropDownItems) { var item = _item as ToolStripMenuItem; if (item.Checked && item.Enabled) { if (extTypes == null) { extTypes = (_EnumTypes(extTypesList[item.Text])); } else { extTypes = extTypes.Concat(_EnumTypes(extTypesList[item.Text])); } } } if (extTypes != null) { foreach (var t in extTypes) { if (!ignoreList.Contains(t.Name)) { UserData.RegisterType(t); Log("Ext Revit class '" + t.Name + "' registered."); } } GlobalTypesList = PrimaryTypesList.Concat(extTypes).Distinct(); } else { GlobalTypesList = PrimaryTypesList; } foreach (var t in GlobalTypesList.ToList()) { if (!ignoreList.Contains(t.Name)) { script.Globals.Set(t.Name, UserData.Create(t)); } } var helper = new Helper(); helper.UIApp = UIApp; helper.MoonScript = script; var maker = new Maker(); maker.TypeList = GlobalTypesList; script.Globals.Set("helper", UserData.Create(helper)); script.Globals.Set("make", UserData.Create(maker)); script.Globals.Set("utils", UserData.Create(new Utils())); script.Globals["log"] = (Func <object, int>)(s => Log(s, curScriptName)); script.Globals["descr"] = (Func <object, int>)(o => Log(new Helper().Describe(o, fulldescrOutputToolStripMenuItem.Checked), curScriptName)); script.Globals["uiapp"] = UIApp; script.Globals["uidoc"] = UIApp.ActiveUIDocument; script.Globals["doc"] = UIApp.ActiveUIDocument.Document; ((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { TypeForm.mainDirectory + "/?.lua" }; var ctls = mainTab.SelectedTab.Controls; foreach (var c in ctls) { if (c is FastColoredTextBox) { curScriptName = mainTab.SelectedTab.Text.Replace("*", ""); if (debug) { if (remoteDebugger == null) { remoteDebugger = new RemoteDebuggerService(); remoteDebugger.Attach(script, curScriptName, false); } Process.Start(remoteDebugger.HttpUrlStringLocalHost); } script.DoString(AutoPrepend + (c as FastColoredTextBox).Text + AutoAppend); AutoResizeLogColumn(); break; } } }