Exemplo n.º 1
0
        private bool PreProcess(string input)
        {
            // Idea here was to allow execution of arbitrary commands in the current context.
            // This is a wonderfully stupid idea for security reasons, but still.
            // In any case, I've removed it for now.
            //
            // if (!string.IsNullOrEmpty(input))
            // {
            //    if (input.StartsWith("."))
            //    {
            //        //var cmd = input.Substring(1);
            //        var bash = @"C:\Program Files\Git\git-bash.exe";
            //        var proc = new System.Diagnostics.Process();
            //        proc.OutputDataReceived += (sender, args) => WriteLine(args.Data);
            //        ProcessStartInfo si = new ProcessStartInfo();
            //        si.RedirectStandardOutput = true;
            //        si.UseShellExecute = false;
            //        si.CreateNoWindow = true;
            //        si.RedirectStandardOutput = true;
            //        si.FileName = bash;
            //        //si.Arguments = cmd;
            //        proc.StartInfo = si;
            //        var sr =
            //        proc.StandardOutput =
            //        return true;
            //    }
            // }

            switch (input)
            {
            case "?":
            case "help":
                return(ShowHelp());

            case "rho":
                _context.Language = ELanguage.Rho;
                return(true);

            case "pi":
                _context.Language = ELanguage.Pi;
                return(true);

            case "leave":
                _peer.Leave();
                return(true);
            }

            return(false);
        }