public static string FormatAsRtf(string buffer, ConsoleColorTheme theme) { StringBuilder builder = new StringBuilder(); Stack <ConsoleColorExt> stack = new Stack <ConsoleColorExt>(); foreach (Match match in FormatRegex.Matches(buffer)) { if (match.Groups["Tag"].Success) { ConsoleColorExt item = ParseColour(match.Groups["Inner"].Value, theme); stack.Push(item); builder.Append(@"\cf" + ((((int)item) + 1)).ToString() + @"\ulnone "); } else if (match.Groups["EndTag"].Success) { if (stack.Count < 0) { throw new Exception(string.Format(Strings.ConsoleInterpreter_UnexpectedEndTag, match.Index)); } builder.Append(@"\cf" + ((int)(((ConsoleColorExt)stack.Pop()) + (int)ConsoleColorExt.DarkBlue)).ToString() + @"\ulnone "); } else if (match.Groups["Text"].Success) { string str = UnescapeString(match.Value); builder.Append(ReplaceLineEnds(str)); } } return(builder.ToString()); }
public static string Format(ConsoleColorExt color, string message) { if (color != ConsoleColorExt.Inhreit) { return string.Format("<c:{0}>{1}</c>", (int) color, EscapeString(message)); } return string.Format("{0}", EscapeString(message)); }
public static string Format(ConsoleColorExt color, string format, params object[] args) { if (color != ConsoleColorExt.Inhreit) { return(string.Format("<c:{0}>{1}</c>{2}", (int)color, EscapeString(string.Format(format, args)), Environment.NewLine)); } return(EscapeString(string.Format(format, args))); }
public static string Format(ConsoleColorExt color, string message) { if (color != ConsoleColorExt.Inhreit) { return(string.Format("<c:{0}>{1}</c>", (int)color, EscapeString(message))); } return(string.Format("{0}", EscapeString(message))); }
public static string FormatLine(ConsoleColorExt color, string message) { if (color != ConsoleColorExt.Inhreit) { return(string.Format("<c:{0}>{1}</c>{2}", (int)color, EscapeString(message), Environment.NewLine)); } return(string.Format("{0}{1}", EscapeString(message), Environment.NewLine)); }
public static string Format(ConsoleColorExt color, string format, params object[] args) { if (color != ConsoleColorExt.Inhreit) { return string.Format("<c:{0}>{1}</c>{2}", (int) color, EscapeString(string.Format(format, args)), Environment.NewLine); } return EscapeString(string.Format(format, args)); }
private ConsoleColor GetConsoleColor(ConsoleColor current, ConsoleThemeColor color) { ConsoleColorExt ext = this.GetColor(color); if (ext != ConsoleColorExt.Inhreit) { return((ConsoleColor)ext); } return(current); }
public void WriteLine(ConsoleColorExt color, string message) { if (color != ConsoleColorExt.Inhreit) { this.m_Result.AppendFormat("<c:{0}>{1}</c>{2}", (int)color, EscapeString(message), Environment.NewLine); } else { this.m_Result.AppendFormat("{0}{1}", EscapeString(message), Environment.NewLine); } }
public static void WriteInterpreted(IConsole console, ConsoleColorExt colour, string buffer, int paddingLeft, int paddingRight) { ConsoleColorExt foregroundColor = console.ForegroundColor; if (colour != ConsoleColorExt.Inhreit) { console.ForegroundColor = colour; } WriteInterpreted(console, buffer, paddingLeft, paddingRight); console.ForegroundColor = foregroundColor; }
public void Write(ConsoleColorExt color, string format, params object[] args) { if (color != ConsoleColorExt.Inhreit) { this.m_Result.AppendFormat("<c:{0}>{1}</c>{2}", (int)color, EscapeString(string.Format(format, args)), Environment.NewLine); } else { this.m_Result.Append(EscapeString(string.Format(format, args))); } }
public void Write(ConsoleColorExt color, string message) { if (color != ConsoleColorExt.Inhreit) { this.m_Result.AppendFormat("<c:{0}>{1}</c>", (int)color, EscapeString(message)); } else { this.m_Result.AppendFormat("{0}", EscapeString(message)); } }
public static void WriteInfoToConsole(string label, string value, ConsoleColorExt valueColor, bool extended) { RugConsole.Write(ConsoleThemeColor.TitleText, " " + label.PadRight(0x12) + ":"); if (extended) { RugConsole.WriteLine(valueColor, value); } else if (value.Length < 0x16) { RugConsole.Write(ConsoleThemeColor.SubText, new string('.', 0x16 - value.Length)); RugConsole.WriteLine(valueColor, value); } else { RugConsole.WriteLine(valueColor, value.Substring(value.Length - 0x16)); } }
public static void WriteLine(ConsoleVerbosity level, ConsoleColorExt colour, string str) { if (level <= m_Verbosity) { if (colour != ConsoleColorExt.Inhreit) { ConsoleColor foregroundColor = Console.ForegroundColor; if (colour != ConsoleColorExt.Inhreit) { Console.ForegroundColor = (ConsoleColor)colour; } Console.WriteLine(str); Console.ForegroundColor = foregroundColor; } else { Console.WriteLine(str); } } }
public static void WriteMessage(IConsole console, MessageDirection dir, ConsoleColorExt messageColor, string message) { lock (m_Lock) { switch (dir) { case MessageDirection.Transmit: console.Write(ConsoleVerbosity.Normal, TransmitColor, "TX "); break; case MessageDirection.Receive: console.Write(ConsoleVerbosity.Normal, ReceiveColor, "RX "); break; default: break; } console.WriteLine(ConsoleVerbosity.Normal, messageColor, message); } }
public static void WriteWrapped(ConsoleColorExt colour, string message, int paddingLeft, int paddingRight) { ConsoleColor foregroundColor = Console.ForegroundColor; if (colour != ConsoleColorExt.Inhreit) { Console.ForegroundColor = (ConsoleColor)colour; } int length = BufferWidth - (paddingLeft + paddingRight); List <string> list = new List <string>(message.Split(new string[] { Environment.NewLine, "\n" }, StringSplitOptions.None)); string str = new string(' ', paddingLeft); foreach (string str2 in list) { string str3 = str2; if (str3.Length != 0) { goto Label_00B2; } Console.WriteLine(); continue; Label_0074: if (str3.Length > length) { Console.WriteLine(str + str3.Substring(0, length)); str3 = str3.Substring(length); } else { Console.WriteLine(str + str3); str3 = ""; } Label_00B2: if (str3.Length > 0) { goto Label_0074; } } Console.ForegroundColor = foregroundColor; }
public void WriteMessage(ConsoleMessage type, ConsoleColorExt colour, int errorId, string sourceFile, int line, int character, string str) { ConsoleExt.WriteMessage(type, colour, errorId, sourceFile, line, character, str); }
public void WriteWarning(ConsoleColorExt colour, int id, string sourceFile, int line, int character, string str) { ConsoleExt.WriteWarning(colour, id, sourceFile, line, character, str); }
public static void Write(ConsoleColorExt colour, string str) { App.Write(colour, str); }
public static void WriteError(ConsoleColorExt colour, int id, string str) { App.WriteError(colour, id, str); }
public static void WriteWarning(ConsoleColorExt colour, int id, string sourceFile, int line, int character, string str) { WriteMessage(ConsoleMessage.Warning, colour, id, sourceFile, line, character, str); }
public static void WriteWarning(ConsoleColorExt colour, int id, string sourceFile, int line, int character, string str) { App.WriteWarning(colour, id, sourceFile, line, character, str); }
public void WriteLine(ConsoleColorExt colour, string str) { ConsoleExt.WriteLine(colour, str); }
public static void WriteMessage(ConsoleMessage type, ConsoleColorExt colour, int errorId, string str) { WriteMessage(type, colour, errorId, null, 0, 0, str); }
public static void WriteWrapped(ConsoleColorExt colour, string message, int paddingLeft, int paddingRight) { ConsoleColor foregroundColor = Console.ForegroundColor; if (colour != ConsoleColorExt.Inhreit) { Console.ForegroundColor = (ConsoleColor) colour; } int length = BufferWidth - (paddingLeft + paddingRight); List<string> list = new List<string>(message.Split(new string[] { Environment.NewLine, "\n" }, StringSplitOptions.None)); string str = new string(' ', paddingLeft); foreach (string str2 in list) { string str3 = str2; if (str3.Length != 0) { goto Label_00B2; } Console.WriteLine(); continue; Label_0074: if (str3.Length > length) { Console.WriteLine(str + str3.Substring(0, length)); str3 = str3.Substring(length); } else { Console.WriteLine(str + str3); str3 = ""; } Label_00B2: if (str3.Length > 0) { goto Label_0074; } } Console.ForegroundColor = foregroundColor; }
public void WriteError(ConsoleColorExt colour, int id, string str) { ConsoleExt.WriteError(colour, id, str); }
public static void WriteWarning(ConsoleColorExt colour, int id, string str) { WriteMessage(ConsoleMessage.Warning, colour, id, str); }
public static void WritePrompt(ConsoleColorExt colour, string str) { WriteMessage(ConsoleMessage.Prompt, colour, str); }
public static void WriteError(ConsoleColorExt colour, int id, string str) { WriteMessage(ConsoleMessage.Error, colour, id, str); }
public static void WriteLine(ConsoleVerbosity level, ConsoleColorExt colour, string str) { if (level <= m_Verbosity) { if (colour != ConsoleColorExt.Inhreit) { ConsoleColor foregroundColor = Console.ForegroundColor; if (colour != ConsoleColorExt.Inhreit) { Console.ForegroundColor = (ConsoleColor) colour; } Console.WriteLine(str); Console.ForegroundColor = foregroundColor; } else { Console.WriteLine(str); } } }
public void WriteWarning(ConsoleColorExt colour, int id, string str) { ConsoleExt.WriteWarning(colour, id, str); }
public ConsoleColorState(ConsoleColorExt ForegroundColor, ConsoleColorExt BackgroundColor) { this.ForegroundColor = ForegroundColor; this.BackgroundColor = BackgroundColor; }
public static void WriteMessage(ConsoleMessage type, ConsoleColorExt colour, int errorId, string sourceFile, int line, int character, string str) { string str2 = str; if (IsBuildMode) { string str3 = ""; if (type == ConsoleMessage.Warning) { if (WarningsAsErrors) { str3 = "error"; } else { str3 = "warning"; } } else if (type == ConsoleMessage.Prompt) { if (WarningsAsErrors) { str3 = "error"; } else { str3 = "warning"; } } else { str3 = "error"; } string executablePath = null; if (sourceFile == null) { executablePath = Application.ExecutablePath; } else { executablePath = string.Concat(new object[] { sourceFile, "(", line, ",", character, ")" }); } if ((str3 != "warning") || ((str3 == "warning") && ReportWarnings)) { str2 = executablePath + ": " + str3 + " " + ApplicationBuildReportPrefix + errorId.ToString().PadLeft(4, '0') + ": " + str.Replace("\n", " "); } } ConsoleColor foregroundColor = Console.ForegroundColor; if (colour != ConsoleColorExt.Inhreit) { Console.ForegroundColor = (ConsoleColor) colour; } if (CanManipulateBuffer) { if (Console.CursorLeft > 0) { Console.WriteLine(); } Console.WriteLine(str2); } else { Console.WriteLine(Environment.NewLine + str2); } Console.ForegroundColor = foregroundColor; }
public static void WriteInfoToConsole(ConsoleVerbosity verbose, string label, string value, ConsoleColorExt valueColor, bool extended) { if (RugConsole.Verbosity >= verbose) { WriteInfoToConsole(label, value, valueColor, extended); } }
public static void WriteWrapped(ConsoleColorExt colour, string message, int paddingLeft, int paddingRight) { App.WriteWrapped(colour, message, paddingLeft, paddingRight); }
public static void WriteSimpleBanner(string str, char fill, ConsoleColorExt ForeColour, ConsoleColorExt BackColour) { WriteSimpleBanner(str, fill, 0, ForeColour, BackColour); }
public static void Write(ConsoleVerbosity level, ConsoleColorExt colour, string str) { App.Write(level, colour, str); }
public void Write(ConsoleColorExt colour, string str) { ConsoleExt.Write(colour, str); }
public void WriteMessage(ConsoleMessage type, ConsoleColorExt colour, int errorId, string str) { ConsoleExt.WriteMessage(type, colour, errorId, str); }
public static void WriteInterpreted(ConsoleColorExt colour, string buffer, int paddingLeft, int paddingRight) { ConsoleFormatter.WriteInterpreted(m_SystemConsole, colour, buffer, paddingLeft, paddingRight); }
public void WriteWrapped(ConsoleColorExt colour, string message, int paddingLeft, int paddingRight) { ConsoleExt.WriteWrapped(colour, message, paddingLeft, paddingRight); }
public static void WriteInterpreted(ConsoleColorExt colour, string buffer, int paddingLeft, int paddingRight) { App.WriteInterpreted(colour, buffer, paddingLeft, paddingRight); }
public static void WriteMessage(ConsoleMessage type, ConsoleColorExt colour, string str) { WriteMessage(type, colour, 0, str); }
public static void WriteMessage(ConsoleMessage type, ConsoleColorExt colour, int errorId, string str) { App.WriteMessage(type, colour, errorId, str); }
public static void WriteMessage(ConsoleMessage type, ConsoleColorExt colour, int errorId, string sourceFile, int line, int character, string str) { string str2 = str; if (IsBuildMode) { string str3 = ""; if (type == ConsoleMessage.Warning) { if (WarningsAsErrors) { str3 = "error"; } else { str3 = "warning"; } } else if (type == ConsoleMessage.Prompt) { if (WarningsAsErrors) { str3 = "error"; } else { str3 = "warning"; } } else { str3 = "error"; } string executablePath = null; if (sourceFile == null) { executablePath = Application.ExecutablePath; } else { executablePath = string.Concat(new object[] { sourceFile, "(", line, ",", character, ")" }); } if ((str3 != "warning") || ((str3 == "warning") && ReportWarnings)) { str2 = executablePath + ": " + str3 + " " + ApplicationBuildReportPrefix + errorId.ToString().PadLeft(4, '0') + ": " + str.Replace("\n", " "); } } ConsoleColor foregroundColor = Console.ForegroundColor; if (colour != ConsoleColorExt.Inhreit) { Console.ForegroundColor = (ConsoleColor)colour; } if (CanManipulateBuffer) { if (Console.CursorLeft > 0) { Console.WriteLine(); } Console.WriteLine(str2); } else { Console.WriteLine(Environment.NewLine + str2); } Console.ForegroundColor = foregroundColor; }
public static void WriteMessage(ConsoleMessage type, ConsoleColorExt colour, int errorId, string sourceFile, int line, int character, string str) { App.WriteMessage(type, colour, errorId, sourceFile, line, character, str); }
public static void WriteWarning(ConsoleColorExt colour, int id, string str) { App.WriteWarning(colour, id, str); }
public static void WriteSimpleBanner(string str, char fill, int paddingRight, ConsoleColorExt ForeColour, ConsoleColorExt BackColour) { ConsoleColorState colorState = RugConsole.ColorState; int num = RugConsole.BufferWidth - paddingRight; int count = (num - str.Length) / 2; if (ForeColour != ConsoleColorExt.Inhreit) { RugConsole.ForegroundColor = ForeColour; } if (BackColour != ConsoleColorExt.Inhreit) { RugConsole.BackgroundColor = BackColour; } if (paddingRight > 0) { RugConsole.Write(ConsoleVerbosity.Silent, new string(fill, count) + str + new string(fill, num - (count + str.Length))); RugConsole.ColorState = colorState; RugConsole.WriteLine(ConsoleVerbosity.Silent); } else { RugConsole.Write(ConsoleVerbosity.Silent, new string(fill, count) + str + new string(fill, num - (count + str.Length))); RugConsole.ColorState = colorState; RugConsole.Write(ConsoleVerbosity.Silent, new string(' ', RugConsole.BufferWidth)); if (RugConsole.CanManipulateBuffer) { RugConsole.CursorTop--; } } }
public void Write(ConsoleVerbosity level, ConsoleColorExt colour, string str) { ConsoleExt.Write(level, colour, str); }
public static void WriteInfoToConsole(string label, string value, ConsoleColorExt valueColor) { RugConsole.Write(ConsoleThemeColor.TitleText, " " + label.PadRight(0x12) + ":"); RugConsole.Write(ConsoleThemeColor.SubText, new string('.', 0x16 - value.Length)); RugConsole.WriteLine(valueColor, value); }
public void WriteInterpreted(ConsoleColorExt colour, string buffer, int paddingLeft, int paddingRight) { ConsoleExt.WriteInterpreted(colour, buffer, paddingLeft, paddingRight); }
public static void WriteInterpreted(View3D view, RectangleF RemainingBounds, SizeF lineSize, int maxWidth, string buffer, FontType fontType, Vector3 start, float scale, ConsoleColorExt foregroundColor, Color4[] colorLookup, SlimDX.DataStream TriangleVerts, ref int TriangleVertsCount, SlimDX.DataStream TriangleIndices, ref int TriangleIndicesCount) { string prefix = ""; int lastIndex = 0; Stack<ConsoleColorExt> stack = new Stack<ConsoleColorExt>(); ConsoleColorExt activeForegroundColor = foregroundColor; float x = start.X, y = start.Y; foreach (Match match in ConsoleFormatter.FormatRegex.Matches(buffer)) { if (match.Groups["Tag"].Success) { // start tag // parse the tags inner value // e.g. c:# (where # is the name or ID of the colour to use (From ConsoleColourExt) // add the parsed colour to the stack ConsoleColorExt col = ConsoleFormatter.ParseColour(match.Groups["Inner"].Value, RC.Theme); stack.Push(activeForegroundColor); activeForegroundColor = col; } else if (match.Groups["EndTag"].Success) { // end tag // handle stack changes if (stack.Count >= 0) { activeForegroundColor = stack.Pop(); } else { throw new Exception(string.Format("Unexpected end tag at index {0}", match.Index)); } } else if (match.Groups["Text"].Success) { string wholeMessage = ConsoleFormatter.UnescapeString(match.Value); List<string> lines = ConsoleFormatter.SplitLinebreaks(wholeMessage); foreach (string line in lines) { string str = line; if (str == "\n" || str == Environment.NewLine) { //BufferWriteLine(""); x = start.X; y += lineSize.Height; lastIndex = 0; } else { while (str.Length > 0) { if (lastIndex + str.Length > maxWidth) { int lastWord = str.LastIndexOf(' ', maxWidth - lastIndex, maxWidth - lastIndex); if (lastWord <= 0) { lastWord = maxWidth - lastIndex; } string toRender; if (lastIndex > 0) { toRender = str.Substring(0, lastWord); } else { toRender = prefix + str.Substring(0, lastWord); } if (maxWidth == lastIndex + toRender.Length) { WriteString(view, RemainingBounds, toRender, fontType, ref x, ref y, start.Z, scale, colorLookup[(int)activeForegroundColor], TriangleVerts, ref TriangleVertsCount, TriangleIndices, ref TriangleIndicesCount); //BufferWrite(toRender); } else { WriteString(view, RemainingBounds, toRender, fontType, ref x, ref y, start.Z, scale, colorLookup[(int)activeForegroundColor], TriangleVerts, ref TriangleVertsCount, TriangleIndices, ref TriangleIndicesCount); // BufferWriteLine(toRender); x = start.X; y += lineSize.Height; } str = str.Substring(lastWord + 1); lastIndex = 0; } else { string toRender = str; if (lastIndex <= 0) { toRender = prefix + str; } //BufferWrite(toRender); WriteString(view, RemainingBounds, toRender, fontType, ref x, ref y, start.Z, scale, colorLookup[(int)activeForegroundColor], TriangleVerts, ref TriangleVertsCount, TriangleIndices, ref TriangleIndicesCount); lastIndex += str.Length; str = ""; } } } } } } }