Ejemplo n.º 1
0
    // Token: 0x060050C5 RID: 20677 RVA: 0x001B9D44 File Offset: 0x001B8144
    private void HandleLog(string condition, string stackTrace, LogType type)
    {
        string text = condition + "\n" + stackTrace;

        DebugLogGui.LogEntry logEntry = (this.debugLog.Count <= 0) ? null : this.debugLog[0];
        if (logEntry != null && logEntry.type == type && logEntry.text == text)
        {
            logEntry.count++;
        }
        else
        {
            this.debugLog.Insert(0, new DebugLogGui.LogEntry
            {
                type  = type,
                text  = text,
                count = 1
            });
            int count = this.debugLog.Count;
            if (count > this.MaxLines)
            {
                this.debugLog.RemoveRange(this.MaxLines, count - this.MaxLines);
            }
            if (this.autoScroll)
            {
                this.scrollPosition.y = float.MaxValue;
            }
        }
    }
Ejemplo n.º 2
0
    // Token: 0x060050C4 RID: 20676 RVA: 0x001B9BCC File Offset: 0x001B7FCC
    private DebugLogGui.DisplayInfo FormatEntry(DebugLogGui.LogEntry entry)
    {
        string  text = this.LogColor;
        LogType type = entry.type;

        if (type != LogType.Log)
        {
            if (type != LogType.Warning)
            {
                if (!this.showError)
                {
                    return(null);
                }
                text = this.ErrorColor;
            }
            else
            {
                if (!this.showWarning)
                {
                    return(null);
                }
                text = this.WarningColor;
            }
        }
        else
        {
            if (!this.showLog)
            {
                return(null);
            }
            text = this.LogColor;
        }
        string[] array = entry.text.Split(new char[]
        {
            '\n'
        });
        StringBuilder stringBuilder = new StringBuilder();
        int           num           = 0;

        foreach (string text2 in array)
        {
            string value;
            if (num == 0)
            {
                value = string.Format("<color={0}>{1}{2}</color>: {3}", new object[]
                {
                    text,
                    (entry.count <= 1) ? string.Empty : ("(" + entry.count.ToString() + ") "),
                    entry.type.ToString().ToUpper(),
                    text2
                });
            }
            else
            {
                value = text2;
            }
            stringBuilder.AppendLine(value);
            num++;
            if (!this.expand)
            {
                break;
            }
        }
        return(new DebugLogGui.DisplayInfo
        {
            text = stringBuilder.ToString(),
            lineCount = num
        });
    }