private string FormatLine(string line, LogLevel level, Tag tag, string stackTrace) { RecyclableStringBuilder lineBuffer = StringBuilderPool.NextBuilder(); string coloredLine = EditorSkin.SetColors(line); string filename = EditorStackTrace.ExtractFileName(stackTrace); if (level != null) { lineBuffer.Append("["); lineBuffer.Append(level.ShortName); lineBuffer.Append("]: "); } if (filename != null) { lineBuffer.Append(StringUtils.C("[" + filename + "]: ", EditorSkin.GetColor(ColorCode.Plain))); } if (tag != null) { lineBuffer.Append("["); lineBuffer.Append(tag.Name); lineBuffer.Append("]: "); } lineBuffer.Append(coloredLine); string result = lineBuffer.ToString(); lineBuffer.Recycle(); // don't trash timer manager with this call return(result); }
bool Execute(int index, string rgb) { uint value; try { value = Convert.ToUInt32(rgb, 16); } catch (Exception) { PrintError("Wrong color value"); return(false); } ColorCode[] values = (ColorCode[])Enum.GetValues(typeof(ColorCode)); if (index >= 0 && index < values.Length) { Color color = ColorUtils.FromRGB(value); EditorSkin.SetColor(values[index], color); Print("{0}: {1}", index, StringUtils.C(values[index].ToString(), values[index])); } else { PrintError("Wrong index"); Execute(); } return(true); }
private string[] FormatLines(string[] lines) { for (int i = 0; i < lines.Length; ++i) { lines[i] = EditorSkin.SetColors(lines[i]); } return(lines); }
private string[] FormatTable(string[] table, LogLevel level, Tag tag, string stackTrace) { for (int i = 0; i < table.Length; ++i) { table[i] = EditorSkin.SetColors(table[i]); } return(table); }
private static void ResolveSourceLink(GUIStyleTextMeasure measure, ref StackTraceLine stackLine) { Color color = EditorSkin.GetColor(stackLine.sourcePathExists ? ColorCode.Link : ColorCode.LinkInnactive); int sourceStart = stackLine.sourcePathStart; int sourceEnd = stackLine.sourcePathEnd; GUIStyle style = measure.Style; GUIContent content = new GUIContent(stackLine.line); float startPosX = style.GetCursorPixelPosition(stackLine.frame, content, sourceStart).x - 1; float endPosX = style.GetCursorPixelPosition(stackLine.frame, content, sourceEnd).x + 1; stackLine.sourceFrame = new Rect(startPosX, stackLine.frame.y, endPosX - startPosX, stackLine.frame.height); stackLine.line = StringUtils.C(stackLine.line, color, sourceStart, sourceEnd); }
////////////////////////////////////////////////////////////////////////////// private TableViewCell CreateTableCell(TableView table, ref ConsoleViewCellEntry entry) { if (entry.IsPlain || entry.IsTable) { ConsoleTextEntryView cell; if (entry.level == LogLevel.Exception) { ConsoleTextEntryExceptionView exceptionCell = table.DequeueReusableCell <ConsoleTextEntryExceptionView>(); if (exceptionCell == null) { exceptionCell = new ConsoleTextEntryExceptionView(); } exceptionCell.StackTraceLines = entry.data as StackTraceLine[]; cell = exceptionCell; } else { cell = table.DequeueReusableCell <ConsoleTextEntryView>(); if (cell == null) { cell = new ConsoleTextEntryView(); } } // set the size first to calculate individual lines height ColorCode colorCode = entry.level != null ? entry.level.Color : ColorCode.Plain; cell.TextColor = EditorSkin.GetColor(colorCode); cell.Width = entry.width; cell.Height = entry.height; cell.Value = entry.value; cell.LogLevel = entry.level; cell.StackTrace = entry.stackTrace; return(cell); } else { throw new NotImplementedException("Unexpected entry type"); } }
private string FormatLine(string line) { return(EditorSkin.SetColors(line)); }