From 4065ebff15e228d7227500f3a2275025f5d16966 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 20 May 2009 13:50:33 +0000 Subject: Remove the pre-log4net, discrete output methods from the consoles --- OpenSim/Framework/Console/ConsoleBase.cs | 148 ---------------------- OpenSim/Framework/Console/ConsolePluginCommand.cs | 2 +- OpenSim/Framework/Console/LocalConsole.cs | 124 ------------------ 3 files changed, 1 insertion(+), 273 deletions(-) (limited to 'OpenSim/Framework/Console') diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index dd3c145..0747ae5 100644 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -58,154 +58,6 @@ namespace OpenSim.Framework.Console DefaultPrompt = defaultPrompt; } - /// - /// derive an ansi color from a string, ignoring the darker colors. - /// This is used to help automatically bin component tags with colors - /// in various print functions. - /// - /// arbitrary string for input - /// an ansii color - protected virtual ConsoleColor DeriveColor(string input) - { - return ConsoleColor.White; - } - - /// - /// Sends a warning to the current console output - /// - /// The message to send - /// WriteLine-style message arguments - public void Warn(string format, params object[] args) - { - WriteNewLine(ConsoleColor.Yellow, format, args); - } - - /// - /// Sends a warning to the current console output - /// - /// The module that sent this message - /// The message to send - /// WriteLine-style message arguments - public void Warn(string sender, string format, params object[] args) - { - WriteNewLine(DeriveColor(sender), sender, ConsoleColor.Yellow, format, args); - } - - /// - /// Sends a notice to the current console output - /// - /// The message to send - /// WriteLine-style message arguments - public void Notice(string format, params object[] args) - { - WriteNewLine(ConsoleColor.White, format, args); - } - - /// - /// Sends a notice to the current console output - /// - /// The module that sent this message - /// The message to send - /// WriteLine-style message arguments - public void Notice(string sender, string format, params object[] args) - { - WriteNewLine(DeriveColor(sender), sender, ConsoleColor.White, format, args); - } - /// - /// Sends an error to the current console output - /// - /// The message to send - /// WriteLine-style message arguments - public void Error(string format, params object[] args) - { - WriteNewLine(ConsoleColor.Red, format, args); - } - - /// - /// Sends an error to the current console output - /// - /// The module that sent this message - /// The message to send - /// WriteLine-style message arguments - public void Error(string sender, string format, params object[] args) - { - WriteNewLine(DeriveColor(sender), sender, ConsoleColor.Red, format, args); - } - - /// - /// Sends a status message to the current console output - /// - /// The message to send - /// WriteLine-style message arguments - public void Status(string format, params object[] args) - { - WriteNewLine(ConsoleColor.Blue, format, args); - } - - /// - /// Sends a status message to the current console output - /// - /// The module that sent this message - /// The message to send - /// WriteLine-style message arguments - public void Status(string sender, string format, params object[] args) - { - WriteNewLine(DeriveColor(sender), sender, ConsoleColor.Blue, format, args); - } - - [Conditional("DEBUG")] - public void Debug(string format, params object[] args) - { - WriteNewLine(ConsoleColor.Gray, format, args); - } - - [Conditional("DEBUG")] - public void Debug(string sender, string format, params object[] args) - { - WriteNewLine(DeriveColor(sender), sender, ConsoleColor.Gray, format, args); - } - - protected virtual void WriteNewLine(ConsoleColor senderColor, string sender, ConsoleColor color, string format, params object[] args) - { - WritePrefixLine(senderColor, sender); - WriteConsoleLine(color, format, args); - } - - protected virtual void WriteNewLine(ConsoleColor color, string format, params object[] args) - { - WriteConsoleLine(color, format, args); - } - - protected virtual void WriteConsoleLine(ConsoleColor color, string format, params object[] args) - { - try - { - System.Console.WriteLine(format, args); - } - catch (ObjectDisposedException) - { - } - } - - protected virtual void WritePrefixLine(ConsoleColor color, string sender) - { - try - { - sender = sender.ToUpper(); - - System.Console.WriteLine("[" + sender + "] "); - - System.Console.Write("["); - - System.Console.Write(sender); - - System.Console.Write("] \t"); - } - catch (ObjectDisposedException) - { - } - } - public virtual void LockOutput() { } diff --git a/OpenSim/Framework/Console/ConsolePluginCommand.cs b/OpenSim/Framework/Console/ConsolePluginCommand.cs index bf70645..8b87239 100644 --- a/OpenSim/Framework/Console/ConsolePluginCommand.cs +++ b/OpenSim/Framework/Console/ConsolePluginCommand.cs @@ -124,7 +124,7 @@ namespace OpenSim.Framework.Console /// public void ShowHelp(ConsoleBase console) { - console.Notice(String.Join(" ", m_cmdText) + " - " + m_helpText); + console.Output(String.Join(" ", m_cmdText) + " - " + m_helpText); } /// diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index 22f10fc..ca57bd6 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -62,19 +62,6 @@ namespace OpenSim.Framework.Console history.Add(text); } - /// - /// derive an ansi color from a string, ignoring the darker colors. - /// This is used to help automatically bin component tags with colors - /// in various print functions. - /// - /// arbitrary string for input - /// an ansii color - protected override ConsoleColor DeriveColor(string input) - { - int colIdx = (input.ToUpper().GetHashCode() % 6) + 9; - return (ConsoleColor) colIdx; - } - private int SetCursorTop(int top) { if (top >= 0 && top < System.Console.BufferHeight) @@ -101,117 +88,6 @@ namespace OpenSim.Framework.Console } } - protected override void WriteNewLine(ConsoleColor senderColor, string sender, ConsoleColor color, string format, params object[] args) - { - lock (cmdline) - { - if (y != -1) - { - y=SetCursorTop(y); - System.Console.CursorLeft = 0; - - int count = cmdline.Length; - - System.Console.Write(" "); - while (count-- > 0) - System.Console.Write(" "); - - y=SetCursorTop(y); - System.Console.CursorLeft = 0; - } - WritePrefixLine(senderColor, sender); - WriteConsoleLine(color, format, args); - if (y != -1) - y = System.Console.CursorTop; - } - } - - protected override void WriteNewLine(ConsoleColor color, string format, params object[] args) - { - lock (cmdline) - { - if (y != -1) - { - y=SetCursorTop(y); - System.Console.CursorLeft = 0; - - int count = cmdline.Length; - - System.Console.Write(" "); - while (count-- > 0) - System.Console.Write(" "); - - y=SetCursorTop(y); - System.Console.CursorLeft = 0; - } - WriteConsoleLine(color, format, args); - if (y != -1) - y = System.Console.CursorTop; - } - } - - protected override void WriteConsoleLine(ConsoleColor color, string format, params object[] args) - { - try - { - lock (m_syncRoot) - { - try - { - if (color != ConsoleColor.White) - System.Console.ForegroundColor = color; - - System.Console.WriteLine(format, args); - System.Console.ResetColor(); - } - catch (ArgumentNullException) - { - // Some older systems dont support coloured text. - System.Console.WriteLine(format, args); - } - catch (FormatException) - { - System.Console.WriteLine(args); - } - } - } - catch (ObjectDisposedException) - { - } - } - - protected override void WritePrefixLine(ConsoleColor color, string sender) - { - try - { - lock (m_syncRoot) - { - sender = sender.ToUpper(); - - System.Console.WriteLine("[" + sender + "] "); - - System.Console.Write("["); - - try - { - System.Console.ForegroundColor = color; - System.Console.Write(sender); - System.Console.ResetColor(); - } - catch (ArgumentNullException) - { - // Some older systems dont support coloured text. - System.Console.WriteLine(sender); - } - - System.Console.Write("] \t"); - } - } - catch (ObjectDisposedException) - { - } - } - private void Show() { lock (cmdline) -- cgit v1.1