/// <summary> /// Helper method for /// <see cref="MainEmbedded(string)">MainEmbedded(string)</see> /// , etc. /// </summary> private static Program MainEmbeddedImpl(ContextFactory factory, object scopeProvider, string title) { if (title == null) { title = "Rhino JavaScript Debugger (embedded usage)"; } Program main = new Program(title); main.DoBreak(); main.SetExitAction(new Main.IProxy(Main.IProxy.EXIT_ACTION)); main.AttachTo(factory); if (scopeProvider is ScopeProvider) { main.SetScopeProvider((ScopeProvider)scopeProvider); } else { Scriptable scope = (Scriptable)scopeProvider; if (scope is Global) { Global global = (Global)scope; global.SetIn(main.GetIn()); global.SetOut(main.GetOut()); global.SetErr(main.GetErr()); } main.SetScope(scope); } main.Pack(); main.SetSize(600, 460); main.SetVisible(true); return main; }
/// <summary>Main entry point.</summary> /// <remarks> /// Main entry point. Creates a debugger attached to a Rhino /// <see cref="Rhino.Tools.Shell.Program">Rhino.Tools.Shell.Program</see> /// shell session. /// </remarks> public static void Main(string[] args) { Program main = new Program("Rhino JavaScript Debugger"); main.DoBreak(); main.SetExitAction(new Main.IProxy(Main.IProxy.EXIT_ACTION)); Runtime.SetIn(main.GetIn()); Runtime.SetOut(main.GetOut()); Runtime.SetErr(main.GetErr()); Global global = Program.GetGlobal(); global.SetIn(main.GetIn()); global.SetOut(main.GetOut()); global.SetErr(main.GetErr()); main.AttachTo(Program.shellContextFactory); main.SetScope(global); main.Pack(); main.SetSize(600, 460); main.SetVisible(true); Program.Exec(args); }