private string FormatLine(string line, CLogLevel level, CTag tag, string stackTrace) { StringBuilder lineBuffer = new StringBuilder(); string coloredLine = CEditorSkin.SetColors(line); string filename = CEditorStackTrace.ExtractFileName(stackTrace); if (level != null) { lineBuffer.Append("["); lineBuffer.Append(level.ShortName); lineBuffer.Append("]: "); } if (filename != null) { lineBuffer.Append(CStringUtils.C("[" + filename + "]: ", CEditorSkin.GetColor(CColorCode.Plain))); } if (tag != null) { lineBuffer.Append("["); lineBuffer.Append(tag.Name); lineBuffer.Append("]: "); } lineBuffer.Append(coloredLine); return(lineBuffer.ToString()); }
bool Execute(int index, string rgb) { uint value; try { value = Convert.ToUInt32(rgb, 16); } catch (Exception) { PrintError("Wrong color value"); return(false); } CColorCode[] values = (CColorCode[])Enum.GetValues(typeof(CColorCode)); if (index >= 0 && index < values.Length) { Color color = CColorUtils.FromRGB(value); CEditorSkin.SetColor(values[index], color); Print("{0}: {1}", index, CStringUtils.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] = CEditorSkin.SetColors(lines[i]); } return lines; }
private string[] FormatTable(string[] table, CLogLevel level, CTag tag, string stackTrace) { for (int i = 0; i < table.Length; ++i) { table[i] = CEditorSkin.SetColors(table[i]); } return(table); }
private static void ResolveSourceLink(CGUIStyleTextMeasure measure, ref CStackTraceLine stackLine) { Color color = CEditorSkin.GetColor(stackLine.sourcePathExists ? CColorCode.Link : CColorCode.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 = CStringUtils.C(stackLine.line, color, sourceStart, sourceEnd); }
////////////////////////////////////////////////////////////////////////////// private CTableViewCell CreateTableCell(CTableView table, ref CConsoleViewCellEntry entry) { if (entry.IsPlain || entry.IsTable) { CConsoleTextEntryView cell; if (entry.level == CLogLevel.Exception) { CConsoleTextEntryExceptionView exceptionCell = table.DequeueReusableCell <CConsoleTextEntryExceptionView>(); if (exceptionCell == null) { exceptionCell = new CConsoleTextEntryExceptionView(); } exceptionCell.StackTraceLines = entry.data as CStackTraceLine[]; cell = exceptionCell; } else { cell = table.DequeueReusableCell <CConsoleTextEntryView>(); if (cell == null) { cell = new CConsoleTextEntryView(); } } // set the size first to calculate individual lines height CColorCode colorCode = entry.level != null ? entry.level.Color : CColorCode.Plain; cell.TextColor = CEditorSkin.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 CEditorSkin.SetColors(line); }