private void DrawStackBox(LogStackData stack, int index, ref Vector2 drawPos) { if (string.IsNullOrEmpty(stack.sourceContent)) { stack.sourceContent = UnityDebugViewerEditorUtility.GetSourceContent(stack.filePath, stack.lineNumber); } var stackBoxGUIContent = new GUIContent(string.Format("\n{0}\n{1}", stack.fullStackMessage, stack.sourceContent)); if (this.selectedStackIndex == index) { stackBoxStyle = UnityDebugViewerWindowUtility.activeControlID == this.stackBoxControlID ? stackBoxStyle = UnityDebugViewerWindowStyleUtility.selectedStackBoxStyle : UnityDebugViewerWindowStyleUtility.inactiveStackBoxStyle; } else { stackBoxStyle = index % 2 == 0 ? UnityDebugViewerWindowStyleUtility.oddStackBoxStyle : UnityDebugViewerWindowStyleUtility.evenStackBoxStyle; } var height = stackBoxStyle.CalcHeight(stackBoxGUIContent, this.lowerPanelRect.width); var stackBoxRect = new Rect(drawPos.x, drawPos.y, this.lowerPanelRect.width, height); EditorGUI.LabelField(stackBoxRect, stackBoxGUIContent, stackBoxStyle); EditorGUILayout.GetControlRect(false, height); this.stackRectList[index] = stackBoxRect; drawPos.y += height; if (stackBoxRect.Contains(Event.current.mousePosition)) { EventType eventType = Event.current.GetTypeForControl(this.stackBoxControlID); #if UNITY_5 || UNITY_5_3_OR_NEWER if (eventType == EventType.MouseDown) #else if (eventType == EventType.mouseDown) #endif { if (Event.current.button == 0 && Event.current.clickCount == 2) { UnityDebugViewerWindowUtility.JumpToSource(stack); } this.selectedStackIndex = index; UnityDebugViewerWindowUtility.activeControlID = this.stackBoxControlID; Event.current.Use(); } #if UNITY_5 || UNITY_5_3_OR_NEWER if (eventType == EventType.MouseUp && Event.current.button == 1) #else if (eventType == EventType.mouseUp && Event.current.button == 1) #endif { ShowCopyMenu(stack.fullStackMessage); UnityDebugViewerWindowUtility.activeControlID = this.stackBoxControlID; Event.current.Use(); } } }
public bool Equals(LogStackData data) { if (data == null) { return(false); } return(fullStackMessage.Equals(data.fullStackMessage)); }
public static bool JumpToSource(LogStackData stack) { if (stack == null) { return(false); } else { return(JumpToSource(stack.filePath, stack.lineNumber)); } }
public LogData(string info, string extraInfo, List <StackFrame> stackFrameList, string time, LogType logType) { this.info = info ?? string.Empty; this.type = logType; this.extraInfo = extraInfo ?? string.Empty; this.time = time ?? string.Empty; this.stackMessage = extraInfo ?? string.Empty; if (stackFrameList == null) { return; } for (int i = 0; i < stackFrameList.Count; i++) { var logStackData = new LogStackData(stackFrameList[i]); this.stackMessage = string.Format("{0}\n{1}", this.stackMessage, logStackData.fullStackMessage); this.stackList.Add(logStackData); } }
public UnityDebugViewerAnalysisData(LogStackData stackData, LogType type, bool isExpanded) { if (stackData == null) { this.className = "UnknowClass"; this.methodName = "UnknowMethod"; } else { this.className = stackData.className; this.methodName = stackData.methodName; } this.fullStackMessage = string.Format("{0}:{1}", this.className, this.methodName); this.errorCount = 0; this.warningCount = 0; this.errorCount = 0; AddLogCount(type); this.isExpanded = isExpanded; this.isSearchedStatus = false; this.isVisible = true; }
public LogData(string info, string stack, string time, LogType type) { this.info = info ?? string.Empty; this.type = type; this.stackMessage = stack ?? string.Empty; this.time = time ?? string.Empty; /// stack message is null means that it is generated by compilation if (string.IsNullOrEmpty(stack)) { if (string.IsNullOrEmpty(info) == false) { Match compileMatch = Regex.Match(info, UNITY_COMPILE_LOG_REGEX); if (compileMatch.Success) { var logStack = new LogStackData(compileMatch); this.stackList.Add(logStack); this.info = Regex.Replace(info, UNITY_COMPILE_LOG_REGEX, "").Trim(); this.stackMessage = logStack.fullStackMessage; } } return; } try { string[] stackArray = stack.Split('\n'); if (stackArray != null) { for (int i = 0; i < stackArray.Length; i++) { var match = Regex.Match(stackArray[i], UNITY_STACK_REGEX); if (match.Success) { this.stackList.Add(new LogStackData(match)); match = match.NextMatch(); continue; } match = Regex.Match(stackArray[i], ANDROID_STACK_REGEX); if (match.Success) { this.stackList.Add(new LogStackData(match)); match = match.NextMatch(); continue; } match = Regex.Match(stackArray[i], ANDROID_STACK_REGEX_WITH_PARAM); if (match.Success) { this.stackList.Add(new LogStackData(match)); match = match.NextMatch(); continue; } this.extraInfo = string.Format("{0}{1}\n", this.extraInfo, stackArray[i]); } } this.extraInfo = this.extraInfo.Trim(); if (string.IsNullOrEmpty(extraInfo)) { if (stackList.Count > 0 && stackList[0].lineNumber == -1) { var stackData = stackList[0]; stackList.RemoveAt(0); this.extraInfo = stackData.ToString(); } } } catch { /// get the extraInfo of log this.extraInfo = stack.Trim(); } }