void Language_DecompileFinished(object sender, DecompileEventArgs e) { if (e != null) { manager.UpdateClassMemberBookmarks(e.AstNodes); if (iconMargin.DecompiledMembers == null) { iconMargin.DecompiledMembers = new List <MemberReference>(); } iconMargin.DecompiledMembers.AddRange(e.DecompiledMemberReferences.Values.AsEnumerable()); // debugger info if (DebugInformation.CodeMappings == null) { DebugInformation.CodeMappings = e.CodeMappings; DebugInformation.LocalVariables = e.LocalVariables; DebugInformation.DecompiledMemberReferences = e.DecompiledMemberReferences; } else { DebugInformation.CodeMappings.AddRange(e.CodeMappings); DebugInformation.DecompiledMemberReferences.AddRange(e.DecompiledMemberReferences); if (e.LocalVariables != null) { DebugInformation.LocalVariables.AddRange(e.LocalVariables); } } } else { manager.UpdateClassMemberBookmarks(null); } }
/// <summary> /// Shows the given output in the text view. /// </summary> void ShowOutput(AvalonEditTextOutput textOutput, IHighlightingDefinition highlighting = null, DecompilerTextViewState state = null) { Debug.WriteLine("Showing {0} characters of output", textOutput.TextLength); Stopwatch w = Stopwatch.StartNew(); ClearLocalReferenceMarks(); textEditor.ScrollToHome(); if (foldingManager != null) { FoldingManager.Uninstall(foldingManager); foldingManager = null; } textEditor.Document = null; // clear old document while we're changing the highlighting uiElementGenerator.UIElements = textOutput.UIElements; referenceElementGenerator.References = textOutput.References; references = textOutput.References; definitionLookup = textOutput.DefinitionLookup; textEditor.SyntaxHighlighting = highlighting; // Change the set of active element generators: foreach (var elementGenerator in activeCustomElementGenerators) { textEditor.TextArea.TextView.ElementGenerators.Remove(elementGenerator); } activeCustomElementGenerators.Clear(); foreach (var elementGenerator in textOutput.elementGenerators) { textEditor.TextArea.TextView.ElementGenerators.Add(elementGenerator); activeCustomElementGenerators.Add(elementGenerator); } Debug.WriteLine(" Set-up: {0}", w.Elapsed); w.Restart(); textEditor.Document = textOutput.GetDocument(); Debug.WriteLine(" Assigning document: {0}", w.Elapsed); w.Restart(); if (textOutput.Foldings.Count > 0) { if (state != null) { state.RestoreFoldings(textOutput.Foldings); textEditor.ScrollToVerticalOffset(state.VerticalOffset); textEditor.ScrollToHorizontalOffset(state.HorizontalOffset); } foldingManager = FoldingManager.Install(textEditor.TextArea); foldingManager.UpdateFoldings(textOutput.Foldings.OrderBy(f => f.StartOffset), -1); Debug.WriteLine(" Updating folding: {0}", w.Elapsed); w.Restart(); } // update class bookmarks var document = textEditor.Document; manager.UpdateClassMemberBookmarks(textOutput.DefinitionLookup.ToDictionary(line => document.GetLineByOffset(line).LineNumber), typeof(TypeBookmark), typeof(MemberBookmark)); }