StartServer() public static method

public static StartServer ( int port = 13337, bool allowRemoteConnections = false ) : string
port int
allowRemoteConnections bool
return string
Beispiel #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
            {
                Console.WriteLine();
                Console.WriteLine("Goodbye! ¡Adiós! Ciao! Adieu! Adeus! Tschüss! Пока! 再见 さようなら הֱיה שלום وداعا");
            };

            ClearLine();

            // Subscribe to the printing events from the interpreter.
            // A printing event will be triggered after each successful statement
            // execution. On error an exception will be thrown.
            Interpreter.Instance.OnOutput += Print;

            string scriptFilename = "scripts/test.cscs";

            scriptFilename = "";
            string script = Utils.GetFileContents(scriptFilename);

            Environment.SetEnvironmentVariable("MONO_REGISTRY_PATH",
                                               "/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/registry/");

            DebuggerServer.BaseDirectory = "";
            if (string.IsNullOrWhiteSpace(script) && (args.Length < 1 || args[1] == "debugger"))
            {
                DebuggerServer.StartServer(13337, true);
            }

            if (args.Length >= 3)
            {
                Translation.TranslateScript(args);
                return;
            }
            if (args.Length > 0)
            {
                if (args[0].EndsWith(EXT))
                {
                    scriptFilename = args[0];
                    Console.WriteLine("Reading script from " + scriptFilename);
                    script = Utils.GetFileContents(scriptFilename);
                }
                else
                {
                    script = args[0];
                }
            }

            if (!string.IsNullOrWhiteSpace(script))
            {
                ProcessScript(script, scriptFilename);
                return;
            }

            RunLoop();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
            {
                Console.WriteLine();
                Console.WriteLine("Goodbye! ¡Adiós! Ciao! Adieu! Adeus! Tschüss! Пока! 再见 さようなら הֱיה שלום وداعا");
            };

            ClearLine();

            // Subscribe to the printing events from the interpreter.
            // A printing event will be triggered after each successful statement
            // execution. On error an exception will be thrown.
            Interpreter.Instance.GetOutput += Print;

            //ProcessScript("include(\"scripts/functions.cscs\");");
            string scriptFilename = "scripts/temp.cscs";
            string script         = "";

            script = Utils.GetFileContents(scriptFilename);

            if (string.IsNullOrWhiteSpace(script) && (args.Length < 1 || args[1] == "debugger"))
            {
                DebuggerServer.StartServer(13337, true);
                //return;
            }

            if (args.Length >= 3)
            {
                Translation.TranslateScript(args);
                return;
            }
            if (args.Length > 0)
            {
                if (args[0].EndsWith(EXT))
                {
                    scriptFilename = args[0];
                    Console.WriteLine("Reading script from " + scriptFilename);
                    script = Utils.GetFileContents(scriptFilename);
                }
                else
                {
                    script = args[0];
                }
            }

            if (!string.IsNullOrWhiteSpace(script))
            {
                ProcessScript(script, scriptFilename);
                return;
            }

            RunLoop();
        }
Beispiel #3
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();
            int             port = Utils.GetSafeInt(args, 0, 13337);

            DebuggerServer.StartServer(port);

            DebuggerServer.OnRequest += ProcessRequest;
            return(Variable.EmptyInstance);
        }
Beispiel #4
0
        protected override Variable Evaluate(ParsingScript script)
        {
            string          res  = "OK";
            List <Variable> args = script.GetFunctionArgs();

            if (m_start)
            {
                int port = Utils.GetSafeInt(args, 0, 13337);
                res = DebuggerServer.StartServer(port);
            }
            else
            {
                DebuggerServer.StopServer();
            }

            return(new Variable(res));
        }
        protected override Variable Evaluate(ParsingScript script)
        {
            string res = "OK";
            List<Variable> args = script.GetFunctionArgs();
            if (m_start)
            {
                int port = Utils.GetSafeInt(args, 0, 13337);
                bool allowRemote = Utils.GetSafeInt(args, 1, 0) == 1;
                DebuggerServer.AllowedClients = Utils.GetSafeString(args, 2);

                res = DebuggerServer.StartServer(port, allowRemote);
            }
            else
            {
                DebuggerServer.StopServer();
            }

            return new Variable(res);
        }