public void WriteConsole(string output, int length, ConsoleOutputType outputType) { using (var file = File.Open(FileName, FileMode.OpenOrCreate)) { file.Seek(0, SeekOrigin.End); using (var stream = new StreamWriter(file)) stream.WriteLine(output); } }
public void WriteConsole(string output, int length, ConsoleOutputType outputType) { _pending += output; if (output.IndexOfAny(new[] { '\r', '\n' }) == 0) { _output.Add(_pending); _pending = string.Empty; } }
/// <summary> /// Prints provided message. /// </summary> /// <param name="consoleOutputType">What is the type of the response and what color should be it in? /// Details in enum file.</param> /// <param name="messagePrefix">Prefix input before the main message. Will take the color accordingly to consoleOutputType.</param> /// <param name="message">Main message to display. Will take the color accordingly to consoleOutputType.</param> public void PrintMessage(ConsoleOutputType consoleOutputType, string messagePrefix, string message) { var messageToShow = messagePrefix + message; var newResponse = Instantiate(_consoleOutputTextPrefab, _responseContainerTransform); var textControlConfigurator = newResponse.GetComponentInChildren <ConsoleOutputConfigurator>(); var responseColor = _consoleColors.GetConsoleColor(consoleOutputType); textControlConfigurator.SetTextControl(messageToShow, responseColor); _onPrintMessage?.Invoke(); }
//[Tooltip("Console text color for regular response.")] //[SerializeField] //private Color _regularResponseColor; //[Tooltip("Console text color for error response.")] //[SerializeField] //private Color _errorResponseColor; /// <summary> /// Retrieves proper color for the response type. If no color found, returns /// regular color. /// </summary> /// <param name="consoleConsoleOutputType"></param> /// <returns></returns> public Color GetConsoleColor(ConsoleOutputType consoleConsoleOutputType) { var consoleColors = _consoleColorsData.dictionary; if (consoleColors.TryGetValue(consoleConsoleOutputType, out var color)) { return(color); } return(consoleColors[ConsoleOutputType.Regular]); }
/// <summary> /// Outputs a message to the console with the given color. /// </summary> /// <param name="message"></param> /// <param name="outType"></param> /// <param name="color"></param> public static void Output(string message, ConsoleOutputType outType, ConsoleColor color = ConsoleColor.White) { // Store the original foreground color.. var c = Console.ForegroundColor; // Prepare the new message build.. var msg = "[!] "; // Set the color based on our message type.. switch (outType) { case ConsoleOutputType.Info: Console.ForegroundColor = ConsoleColor.White; msg += "Info: " + message; break; case ConsoleOutputType.Warning: Console.ForegroundColor = ConsoleColor.Yellow; msg += "Warn: " + message; break; case ConsoleOutputType.Error: Console.ForegroundColor = ConsoleColor.Red; msg += "Error: " + message; break; case ConsoleOutputType.Success: Console.ForegroundColor = ConsoleColor.Green; msg += "Success: " + message; break; case ConsoleOutputType.Custom: Console.ForegroundColor = color; msg += message; break; } // Print the message.. Console.WriteLine(msg); // Restore the foreground color.. Console.ForegroundColor = c; }
/// <summary> /// Write output on console. /// </summary> /// <param name="output">The output message</param> /// <param name="length">Parameter is ignored</param> /// <param name="outputType">Parameter is ignored</param> public void WriteConsole(string output, int length, ConsoleOutputType outputType) { Console.Write(output); }
public void WriteConsole(string output, int length, ConsoleOutputType outputType) { if (saveStream) savedStream.Append(output); }
public void WriteConsole(string output, int length, ConsoleOutputType outputType) { this.builder.Append(output); }
private void WriteConsoleEx(string buffer, int length, ConsoleOutputType outputType) { Device.WriteConsole(buffer, length, outputType); }
public void WriteConsole(string output, int length, ConsoleOutputType outputType) { SqlContext.Pipe.Send(output); }
public ConsoleOutput(string output, ConsoleOutputType type) { Output = output; Type = type; }
/// <summary> /// Write output on console. /// </summary> /// <param name="output">The output message</param> /// <param name="length">Parameter is ignored</param> /// <param name="outputType">Parameter is ignored</param> public void WriteConsole(string output, int length, ConsoleOutputType outputType) { output = output.Trim(' '); Console.Write(output); }
/// <summary> /// This implementation has no effect /// </summary> /// <param name="output">The output message</param> /// <param name="length">The output's length in byte.</param> /// <param name="outputType">The output type.</param> public void WriteConsole(string output, int length, ConsoleOutputType outputType) { }
public OutputEventArgs(string output, ConsoleOutputType type) { Output = output; Type = type; }