Example #1
0
        protected static string CreateMessage(object info)
        {
            // Not the most efficient solution possible, but it looks pretty good on the
            // console.
            string  message;
            RCBlock block = info as RCBlock;

            if (block != null)
            {
                if (block.Count == 1 && block.Evaluator == RCEvaluator.Yield)
                {
                    message = block.Format(RCFormat.Default, _colmap);
                }
                else
                {
                    message = block.Format(RCFormat.Pretty, _colmap);
                }
            }
            else if (info is RCCube)
            {
                message = ((RCValue)info).Format(RCFormat.Pretty, _colmap);
            }
            else if (info is RCException && (_level == RCOutput.Test || _level == RCOutput.Single))
            {
                message = ((RCException)info).ToTestString();
            }
            else if (info is Exception && (_level == RCOutput.Test || _level == RCOutput.Single))
            {
                if (RCSystem.Args.FullStack)
                {
                    message = string.Format("<<Reported, {0}>>", info.ToString());
                }
                else
                {
                    message = "<<Reported>>";
                }
            }
            else if (info is RCString)
            {
                RCString      strings = (RCString)info;
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < strings.Count; ++i)
                {
                    builder.AppendLine(strings[i]);
                }
                if (builder.Length > 0)
                {
                    builder.Remove(builder.Length - 1, 1);
                }
                message = builder.ToString();
            }
            else
            {
                message = info.ToString();
            }
            return(message);
        }
Example #2
0
        public void PrintStartup(string appDomainVersionString)
        {
            bool copyright = !Batch && OutputEnum != RCOutput.Clean && OutputEnum != RCOutput.Test;
            bool options   = !Batch && OutputEnum != RCOutput.Clean && OutputEnum != RCOutput.Test;
            bool version   = Version || (!Batch &&
                                         OutputEnum != RCOutput.Clean &&
                                         OutputEnum != RCOutput.Test);

            if (version)
            {
                PrintVersion(appDomainVersionString);
            }
            if (copyright)
            {
                PrintCopyright();
            }
            if (options)
            {
                Console.WriteLine();
                if (Arguments.Count > 0)
                {
                    for (int i = 0; i < Arguments.Count; ++i)
                    {
                        Console.Write(Arguments[i]);
                        if (i < Arguments.Count - 1)
                        {
                            Console.Write(" ");
                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine(Options.Format(RCFormat.Pretty));
            }
            if (options || copyright)
            {
                Console.WriteLine();
            }
        }