diff --git a/ICSharpCode.Decompiler/Output/TextTokenWriter.cs b/ICSharpCode.Decompiler/Output/TextTokenWriter.cs index 5263c4639..5b671076a 100644 --- a/ICSharpCode.Decompiler/Output/TextTokenWriter.cs +++ b/ICSharpCode.Decompiler/Output/TextTokenWriter.cs @@ -191,7 +191,8 @@ namespace ICSharpCode.Decompiler public override void WriteKeyword(Role role, string keyword) { - if (keyword == "this" || keyword == "base") { + //To make reference for 'this' and 'base' keywords in the ClassName():this() expression + if (role == ConstructorInitializer.ThisKeywordRole || role == ConstructorInitializer.BaseKeywordRole) { if (nodeStack.Peek() is ConstructorInitializer initializer && initializer.GetSymbol() is IMember member) { var cecil = typeSystem.GetCecil(member); if (cecil != null) { diff --git a/ILSpy.AddIn/license.txt b/ILSpy.AddIn/license.txt index d7af541b0..ca82a7f57 100644 --- a/ILSpy.AddIn/license.txt +++ b/ILSpy.AddIn/license.txt @@ -3,7 +3,7 @@ The following MIT license applies to ILSpy, NRefactory and ICSharpCode.Decompile MIT license: -Copyright (c) 2011-2016 AlphaSierraPapa for the SharpDevelop team +Copyright (c) 2011-2017 AlphaSierraPapa for the SharpDevelop team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/ILSpy/ContextMenuEntry.cs b/ILSpy/ContextMenuEntry.cs index b217441ef..fc2bdce88 100644 --- a/ILSpy/ContextMenuEntry.cs +++ b/ILSpy/ContextMenuEntry.cs @@ -109,6 +109,8 @@ namespace ICSharpCode.ILSpy public ExportContextMenuEntryAttribute() : base(typeof(IContextMenuEntry)) { + // entries default to end of menu unless given specific order position + Order = double.MaxValue; } public string Icon { get; set; } diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index 0f8ddb13e..4dba3080d 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -191,6 +191,7 @@ + @@ -348,6 +349,8 @@ + + diff --git a/ILSpy/Images/Copy.png b/ILSpy/Images/Copy.png new file mode 100644 index 000000000..d131f3636 Binary files /dev/null and b/ILSpy/Images/Copy.png differ diff --git a/ILSpy/Images/Library.png b/ILSpy/Images/Library.png index d366971ff..7524cadf5 100644 Binary files a/ILSpy/Images/Library.png and b/ILSpy/Images/Library.png differ diff --git a/ILSpy/Images/OverlayStatic.png b/ILSpy/Images/OverlayStatic.png index d079a1107..1a0e5e9d4 100644 Binary files a/ILSpy/Images/OverlayStatic.png and b/ILSpy/Images/OverlayStatic.png differ diff --git a/ILSpy/Images/SearchMsdn.png b/ILSpy/Images/SearchMsdn.png new file mode 100644 index 000000000..42cefecdf Binary files /dev/null and b/ILSpy/Images/SearchMsdn.png differ diff --git a/ILSpy/Languages/CSharpLanguage.cs b/ILSpy/Languages/CSharpLanguage.cs index 6c3cc02f1..56ffeaae5 100644 --- a/ILSpy/Languages/CSharpLanguage.cs +++ b/ILSpy/Languages/CSharpLanguage.cs @@ -377,7 +377,7 @@ namespace ICSharpCode.ILSpy return base.WriteResourceToFile(fileName, resourceName, entryStream); } } - + /* AstBuilder CreateAstBuilder(DecompilationOptions options, ModuleDefinition currentModule = null, TypeDefinition currentType = null, bool isSingleMember = false) { @@ -421,10 +421,12 @@ namespace ICSharpCode.ILSpy ((ComposedType)astType).PointerRank--; } - astType.AcceptVisitor(new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateAllman())); + astType.AcceptVisitor(new CSharpOutputVisitor(w, TypeToStringFormattingOptions)); return w.ToString(); } - */ + static readonly CSharpFormattingOptions TypeToStringFormattingOptions = FormattingOptionsFactory.CreateEmpty(); + */ + public override string FormatPropertyName(PropertyDefinition property, bool? isIndexer) { if (property == null) @@ -455,6 +457,15 @@ namespace ICSharpCode.ILSpy } else return property.Name; } + + public override string FormatMethodName(MethodDefinition method) + { + if (method == null) + throw new ArgumentNullException("method"); + + return (method.IsConstructor) ? method.DeclaringType.Name : method.Name; + } + /* public override string FormatTypeName(TypeDefinition type) { diff --git a/ILSpy/Languages/Language.cs b/ILSpy/Languages/Language.cs index 1f14bb188..83b986f23 100644 --- a/ILSpy/Languages/Language.cs +++ b/ILSpy/Languages/Language.cs @@ -133,7 +133,14 @@ namespace ICSharpCode.ILSpy throw new ArgumentNullException(nameof(property)); return property.Name; } - + + public virtual string FormatMethodName(MethodDefinition method) + { + if (method == null) + throw new ArgumentNullException("method"); + return method.Name; + } + public virtual string FormatTypeName(TypeDefinition type) { if (type == null) diff --git a/ILSpy/LoadedAssembly.cs b/ILSpy/LoadedAssembly.cs index e99e3159a..d4c2c81a6 100644 --- a/ILSpy/LoadedAssembly.cs +++ b/ILSpy/LoadedAssembly.cs @@ -143,6 +143,20 @@ namespace ICSharpCode.ILSpy private void LoadSymbols(ModuleDefinition module) { + if (!module.HasDebugHeader) { + return; + } + byte[] headerBytes; + var debugHeader = module.GetDebugHeader(out headerBytes); + if (debugHeader.Type != 2) { + // the debug type is not IMAGE_DEBUG_TYPE_CODEVIEW + return; + } + if (debugHeader.MajorVersion != 0 || debugHeader.MinorVersion != 0) { + // the PDB type is not compatible with PdbReaderProvider. It is probably a Portable PDB + return; + } + // search for pdb in same directory as dll string pdbName = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".pdb"); if (File.Exists(pdbName)) { diff --git a/ILSpy/MainWindow.xaml b/ILSpy/MainWindow.xaml index 2c12afc6c..23788f68a 100644 --- a/ILSpy/MainWindow.xaml +++ b/ILSpy/MainWindow.xaml @@ -44,7 +44,7 @@ - + @@ -57,7 +57,7 @@ + DockPanel.Dock="Top" ToolBarTray.IsLocked="True" KeyboardNavigation.TabNavigation="None">