示例#1
0
        private void HandleLog(string message, string stackTrace, LogType type)
        {
            if (type == LogType.Warning)
            {
                System.Console.ForegroundColor = ConsoleColor.Yellow;
            }
            else if (type == LogType.Error)
            {
                System.Console.ForegroundColor = ConsoleColor.Red;
            }
            else
            {
                System.Console.ForegroundColor = ConsoleColor.White;
            }

            // We're half way through typing something, so clear this line ..
            if (Console.CursorLeft != 0)
            {
                cInput.ClearLine();
            }

            System.Console.WriteLine(message);

            // If we were typing something re-add it.
            cInput.RedrawInputLine();
        }
示例#2
0
        public static void ThreadedLogRecieved(string condition, string stackTrace, LogType type)
        {
            if (input == null)
            {
                ServerConsole con = SingletonComponent <ServerConsole> .Instance;
                if (con == null)
                {
                    return;
                }

                input = (Windows.ConsoleInput) SingletonComponent <ServerConsole> .Instance.GetFieldValue("input");
            }
            if (!AlreadyLogged.Contains(condition))
            {
                switch (type)
                {
                case LogType.Log:
                    Console.ForegroundColor = ConsoleColor.Gray;
                    break;

                case LogType.Warning:
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    break;

                case LogType.Error:
                case LogType.Exception:
                case LogType.Assert:
                    Console.ForegroundColor = ConsoleColor.Red;
                    break;
                }
                input.ClearLine(input.statusText.Length);
                Console.WriteLine(condition);
                input.RedrawInputLine();
            }
            else
            {
                AlreadyLogged.Remove(condition);
            }
        }