Browse Source

remove old code from DecompiledViewContent and NavigateToDecompiledEntityService

newNRILSpyDebugger
Siegfried Pammer 12 years ago
parent
commit
4d3786a080
  1. 5
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs
  2. 8
      src/AddIns/DisplayBindings/ILSpyAddIn/NavigateToDecompiledEntityService.cs
  3. 42
      src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs
  4. 33
      src/Main/Base/Project/Src/Services/NavigationService/NavigationService.cs

5
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs

@ -59,11 +59,12 @@ namespace ICSharpCode.ILSpyAddIn @@ -59,11 +59,12 @@ namespace ICSharpCode.ILSpyAddIn
public Debugger.SequencePoint GetSequencePoint(Module module, string filename, int line, int column)
{
var name = DecompiledTypeReference.FromFileName(filename);
if (name == null || !FileUtility.IsEqualFileName(module.FullPath, name.AssemblyFile))
return null;
var content = DecompiledViewContent.Get(name);
if (content == null)
return null;
if (!FileUtility.IsEqualFileName(module.FullPath, content.AssemblyFile))
return null;
TextLocation loc = new TextLocation(line, column);
foreach(var symbols in content.DebugSymbols.Values.Where(s => s.StartLocation <= loc && loc <= s.EndLocation)) {

8
src/AddIns/DisplayBindings/ILSpyAddIn/NavigateToDecompiledEntityService.cs

@ -44,14 +44,18 @@ namespace ICSharpCode.ILSpyAddIn @@ -44,14 +44,18 @@ namespace ICSharpCode.ILSpyAddIn
if (string.IsNullOrEmpty(typeName))
throw new ArgumentException("typeName is null or empty");
var type = new FullTypeName(typeName);
var target = new DecompiledTypeReference(assemblyFile, type);
foreach (var viewContent in SD.Workbench.ViewContentCollection.OfType<DecompiledViewContent>()) {
if (viewContent.AssemblyFile == assemblyFile && typeName == viewContent.FullTypeName) {
var viewContentName = viewContent.DecompiledTypeName;
if (viewContentName.AssemblyFile == assemblyFile && type == viewContentName.Type) {
viewContent.WorkbenchWindow.SelectWindow();
viewContent.JumpToEntity(entityIdString);
return;
}
}
SD.Workbench.ShowView(new DecompiledViewContent(assemblyFile, typeName, entityIdString));
SD.Workbench.ShowView(new DecompiledViewContent(target, entityIdString));
}
}
}

42
src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs

@ -26,14 +26,6 @@ namespace ICSharpCode.ILSpyAddIn @@ -26,14 +26,6 @@ namespace ICSharpCode.ILSpyAddIn
/// </summary>
class DecompiledViewContent : AbstractViewContentWithoutFile
{
readonly FileName assemblyFile;
readonly string fullTypeName;
public DecompiledTypeReference DecompiledTypeName { get; private set; }
public override FileName PrimaryFileName {
get { return this.DecompiledTypeName.ToFileName(); }
}
/// <summary>
/// Entity to jump to once decompilation has finished.
/// </summary>
@ -48,18 +40,13 @@ namespace ICSharpCode.ILSpyAddIn @@ -48,18 +40,13 @@ namespace ICSharpCode.ILSpyAddIn
public Dictionary<string, MethodDebugSymbols> DebugSymbols { get; private set; }
#region Constructor
public DecompiledViewContent(FileName assemblyFile, string fullTypeName, string entityTag)
public DecompiledViewContent(DecompiledTypeReference typeName, string entityTag)
{
this.DecompiledTypeName = new DecompiledTypeReference(assemblyFile, new FullTypeName(fullTypeName));
this.DecompiledTypeName = typeName;
this.Services = codeEditor.GetRequiredService<IServiceContainer>();
this.assemblyFile = assemblyFile;
this.fullTypeName = fullTypeName;
this.jumpToEntityIdStringWhenDecompilationFinished = entityTag;
string shortTypeName = fullTypeName.Substring(fullTypeName.LastIndexOf('.') + 1);
this.TitleName = "[" + ReflectionHelper.SplitTypeParameterCountFromReflectionName(shortTypeName) + "]";
this.TitleName = "[" + ReflectionHelper.SplitTypeParameterCountFromReflectionName(typeName.Type.Name) + "]";
DecompilationThread();
// Thread thread = new Thread(DecompilationThread);
@ -112,27 +99,25 @@ namespace ICSharpCode.ILSpyAddIn @@ -112,27 +99,25 @@ namespace ICSharpCode.ILSpyAddIn
if (string.IsNullOrEmpty(typeName))
throw new ArgumentException("typeName is null or empty");
var type = new FullTypeName(typeName);
foreach (var viewContent in SD.Workbench.ViewContentCollection.OfType<DecompiledViewContent>()) {
if (viewContent.AssemblyFile == assemblyFile && typeName == viewContent.FullTypeName) {
var viewContentName = viewContent.DecompiledTypeName;
if (viewContentName.AssemblyFile == assemblyFile && type == viewContentName.Type) {
return viewContent;
}
}
var newViewContent = new DecompiledViewContent(assemblyFile, typeName, null);
var newViewContent = new DecompiledViewContent(new DecompiledTypeReference(assemblyFile, new FullTypeName(typeName)), null);
SD.Workbench.ShowView(newViewContent);
return newViewContent;
}
#region Properties
public FileName AssemblyFile {
get { return assemblyFile; }
}
public DecompiledTypeReference DecompiledTypeName { get; private set; }
/// <summary>
/// The reflection name of the top-level type displayed in this view content.
/// </summary>
public string FullTypeName {
get { return fullTypeName; }
public override FileName PrimaryFileName {
get { return this.DecompiledTypeName.ToFileName(); }
}
public override object Control {
@ -142,7 +127,6 @@ namespace ICSharpCode.ILSpyAddIn @@ -142,7 +127,6 @@ namespace ICSharpCode.ILSpyAddIn
public override bool IsReadOnly {
get { return true; }
}
#endregion
#region Dispose
@ -152,8 +136,6 @@ namespace ICSharpCode.ILSpyAddIn @@ -152,8 +136,6 @@ namespace ICSharpCode.ILSpyAddIn
codeEditor.Dispose();
SD.BookmarkManager.BookmarkAdded -= BookmarkManager_Added;
SD.BookmarkManager.BookmarkRemoved -= BookmarkManager_Removed;
// DecompileInformation data;
// DebuggerDecompilerService.DebugInformation.TryRemove(decompiledType.MetadataToken.ToInt32(), out data);
base.Dispose();
}
#endregion
@ -208,7 +190,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -208,7 +190,7 @@ namespace ICSharpCode.ILSpyAddIn
SD.AnalyticsMonitor.TrackException(ex);
StringWriter writer = new StringWriter();
writer.WriteLine(string.Format("Exception while decompiling {0} ({1})", fullTypeName, assemblyFile));
writer.WriteLine(string.Format("Exception while decompiling {0} ({1})", DecompiledTypeName.Type, DecompiledTypeName.AssemblyFile));
writer.WriteLine();
writer.WriteLine(ex.ToString());
SD.MainThread.InvokeAsyncAndForget(() => OnDecompilationFinished(writer));

33
src/Main/Base/Project/Src/Services/NavigationService/NavigationService.cs

@ -432,29 +432,10 @@ namespace ICSharpCode.SharpDevelop @@ -432,29 +432,10 @@ namespace ICSharpCode.SharpDevelop
return true;
}
return false;
} else {
return FileService.JumpToFilePosition(region.FileName, region.BeginLine, region.BeginColumn) != null;
}
}
#endregion
#region Navigate to Member
/* Part of Eusebiu's debugger/decompiler implementation
public static bool NavigateTo(string assemblyFile, string typeName, string entityTag, int lineNumber = 0, bool updateMarker = true)
{
if (string.IsNullOrEmpty(assemblyFile))
throw new ArgumentException("assemblyFile is null or empty");
if (string.IsNullOrEmpty(typeName))
throw new ArgumentException("typeName is null or empty");
foreach (var item in AddInTree.BuildItems<INavigateToMemberService>("/SharpDevelop/Services/NavigateToEntityService", null, false)) {
if (item.NavigateToMember(assemblyFile, typeName, entityTag, lineNumber, updateMarker))
return true;
}
return false;
return FileService.JumpToFilePosition(region.FileName, region.BeginLine, region.BeginColumn) != null;
}
*/
#endregion
}
@ -468,16 +449,4 @@ namespace ICSharpCode.SharpDevelop @@ -468,16 +449,4 @@ namespace ICSharpCode.SharpDevelop
{
bool NavigateToEntity(IEntity entity);
}
/* Part of Eusebiu's debugger/decompiler implementation
/// <summary>
/// Called by <see cref="NavigationService.NavigateTo"/> when the member reference is not defined in source code.
/// </summary>
/// <remarks>
/// Loaded from addin tree path "/SharpDevelop/Services/NavigateToEntityService"
/// </remarks>
public interface INavigateToMemberService
{
bool NavigateToMember(string assemblyFile, string typeName, string entityTag, int lineNumber, bool updateMarker);
}
*/
}

Loading…
Cancel
Save